@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
144 | 144 | * } |
145 | 145 | */ |
146 | - public function __construct( $input_args = array() ){ |
|
147 | - $input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
146 | + public function __construct($input_args = array()) { |
|
147 | + $input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
148 | 148 | // the following properties must be cast as arrays |
149 | - if ( isset( $input_args['validation_strategies'] ) ) { |
|
150 | - foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) { |
|
151 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
152 | - $this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy; |
|
149 | + if (isset($input_args['validation_strategies'])) { |
|
150 | + foreach ((array) $input_args['validation_strategies'] as $validation_strategy) { |
|
151 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
152 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
153 | 153 | } |
154 | 154 | } |
155 | - unset( $input_args['validation_strategies'] ); |
|
155 | + unset($input_args['validation_strategies']); |
|
156 | 156 | } |
157 | 157 | // loop thru incoming options |
158 | - foreach( $input_args as $key => $value ) { |
|
158 | + foreach ($input_args as $key => $value) { |
|
159 | 159 | // add underscore to $key to match property names |
160 | - $_key = '_' . $key; |
|
161 | - if ( property_exists( $this, $_key )) { |
|
160 | + $_key = '_'.$key; |
|
161 | + if (property_exists($this, $_key)) { |
|
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // ensure that "required" is set correctly |
166 | 166 | $this->set_required( |
167 | - $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) |
|
168 | - ? $input_args[ 'required_validation_error_message' ] |
|
167 | + $this->_required, isset($input_args['required_validation_error_message']) |
|
168 | + ? $input_args['required_validation_error_message'] |
|
169 | 169 | : null |
170 | 170 | ); |
171 | 171 | |
172 | 172 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
173 | 173 | |
174 | 174 | $this->_display_strategy->_construct_finalize($this); |
175 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
175 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
176 | 176 | $validation_strategy->_construct_finalize($this); |
177 | 177 | } |
178 | 178 | |
179 | - if( ! $this->_normalization_strategy){ |
|
179 | + if ( ! $this->_normalization_strategy) { |
|
180 | 180 | $this->_normalization_strategy = new EE_Text_Normalization(); |
181 | 181 | } |
182 | 182 | $this->_normalization_strategy->_construct_finalize($this); |
183 | 183 | |
184 | 184 | //at least we can use the normalization strategy to populate the default |
185 | - if( isset( $input_args[ 'default' ] ) ) { |
|
186 | - $this->set_default( $input_args[ 'default' ] ); |
|
185 | + if (isset($input_args['default'])) { |
|
186 | + $this->set_default($input_args['default']); |
|
187 | 187 | } |
188 | 188 | |
189 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
189 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
190 | 190 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
191 | 191 | } |
192 | 192 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
193 | - parent::__construct( $input_args ); |
|
193 | + parent::__construct($input_args); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | - protected function _set_default_html_name_if_empty(){ |
|
205 | - if( ! $this->_html_name){ |
|
204 | + protected function _set_default_html_name_if_empty() { |
|
205 | + if ( ! $this->_html_name) { |
|
206 | 206 | $this->_html_name = $this->name(); |
207 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
208 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
207 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
208 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | 222 | $this->_set_default_html_name_if_empty(); |
223 | - if( ! $this->_html_label && ! $this->_html_label_text){ |
|
224 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
223 | + if ( ! $this->_html_label && ! $this->_html_label_text) { |
|
224 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
225 | 225 | } |
226 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
226 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @return EE_Display_Strategy_Base |
232 | 232 | * @throws EE_Error |
233 | 233 | */ |
234 | - protected function _get_display_strategy(){ |
|
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
234 | + protected function _get_display_strategy() { |
|
235 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
236 | 236 | throw new EE_Error( |
237 | 237 | sprintf( |
238 | 238 | __( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * Sets the display strategy. |
252 | 252 | * @param EE_Display_Strategy_Base $strategy |
253 | 253 | */ |
254 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
254 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
255 | 255 | $this->_display_strategy = $strategy; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Sets the sanitization strategy |
260 | 260 | * @param EE_Normalization_Strategy_Base $strategy |
261 | 261 | */ |
262 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
262 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
263 | 263 | $this->_normalization_strategy = $strategy; |
264 | 264 | } |
265 | 265 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * Gets the display strategy for this input |
286 | 286 | * @return EE_Display_Strategy_Base |
287 | 287 | */ |
288 | - public function get_display_strategy(){ |
|
288 | + public function get_display_strategy() { |
|
289 | 289 | return $this->_display_strategy; |
290 | 290 | } |
291 | 291 | /** |
292 | 292 | * Overwrites the display strategy |
293 | 293 | * @param EE_Display_Strategy_Base $display_strategy |
294 | 294 | */ |
295 | - public function set_display_strategy($display_strategy){ |
|
295 | + public function set_display_strategy($display_strategy) { |
|
296 | 296 | $this->_display_strategy = $display_strategy; |
297 | 297 | $this->_display_strategy->_construct_finalize($this); |
298 | 298 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * Gets the normalization strategy set on this input |
301 | 301 | * @return EE_Normalization_Strategy_Base |
302 | 302 | */ |
303 | - public function get_normalization_strategy(){ |
|
303 | + public function get_normalization_strategy() { |
|
304 | 304 | return $this->_normalization_strategy; |
305 | 305 | } |
306 | 306 | /** |
307 | 307 | * Overwrites the normalization strategy |
308 | 308 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
309 | 309 | */ |
310 | - public function set_normalization_strategy($normalization_strategy){ |
|
310 | + public function set_normalization_strategy($normalization_strategy) { |
|
311 | 311 | $this->_normalization_strategy = $normalization_strategy; |
312 | 312 | $this->_normalization_strategy->_construct_finalize($this); |
313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * Returns all teh validation strategies which apply to this field, numerically indexed |
317 | 317 | * @return EE_Validation_Strategy_Base[] |
318 | 318 | */ |
319 | - public function get_validation_strategies(){ |
|
319 | + public function get_validation_strategies() { |
|
320 | 320 | return $this->_validation_strategies; |
321 | 321 | } |
322 | 322 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
331 | - $validation_strategy->_construct_finalize( $this ); |
|
330 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $validation_strategy->_construct_finalize($this); |
|
332 | 332 | $this->_validation_strategies[] = $validation_strategy; |
333 | 333 | } |
334 | 334 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Validation_Strategy_Base $validation_strategy |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
343 | - $this->_add_validation_strategy( $validation_strategy ); |
|
342 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
343 | + $this->_add_validation_strategy($validation_strategy); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string $validation_strategy_classname |
352 | 352 | */ |
353 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
354 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
355 | - if( |
|
353 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
354 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
355 | + if ( |
|
356 | 356 | $validation_strategy instanceof $validation_strategy_classname |
357 | - || is_subclass_of( $validation_strategy, $validation_strategy_classname ) |
|
357 | + || is_subclass_of($validation_strategy, $validation_strategy_classname) |
|
358 | 358 | ) { |
359 | - unset( $this->_validation_strategies[ $key ] ); |
|
359 | + unset($this->_validation_strategies[$key]); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | } |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @param array $validation_strategy_classnames |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function has_validation_strategy( $validation_strategy_classnames ) { |
|
373 | - $validation_strategy_classnames = is_array( $validation_strategy_classnames ) |
|
372 | + public function has_validation_strategy($validation_strategy_classnames) { |
|
373 | + $validation_strategy_classnames = is_array($validation_strategy_classnames) |
|
374 | 374 | ? $validation_strategy_classnames |
375 | - : array( $validation_strategy_classnames ); |
|
376 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
377 | - if( in_array( $key, $validation_strategy_classnames ) ) { |
|
375 | + : array($validation_strategy_classnames); |
|
376 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
377 | + if (in_array($key, $validation_strategy_classnames)) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * Gets the HTML |
388 | 388 | * @return string |
389 | 389 | */ |
390 | - public function get_html(){ |
|
390 | + public function get_html() { |
|
391 | 391 | return $this->_parent_section->get_html_for_input($this); |
392 | 392 | } |
393 | 393 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return string |
402 | 402 | * @throws \EE_Error |
403 | 403 | */ |
404 | - public function get_html_for_input(){ |
|
404 | + public function get_html_for_input() { |
|
405 | 405 | return $this->_get_display_strategy()->display(); |
406 | 406 | } |
407 | 407 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @return string |
412 | 412 | */ |
413 | 413 | public function html_other_attributes() { |
414 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
414 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | /** |
420 | 420 | * @param string $html_other_attributes |
421 | 421 | */ |
422 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
422 | + public function set_html_other_attributes($html_other_attributes) { |
|
423 | 423 | $this->_html_other_attributes = $html_other_attributes; |
424 | 424 | } |
425 | 425 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * according to the form section's layout strategy |
429 | 429 | * @return string |
430 | 430 | */ |
431 | - public function get_html_for_label(){ |
|
431 | + public function get_html_for_label() { |
|
432 | 432 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
433 | 433 | } |
434 | 434 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * according to the form section's layout strategy |
437 | 437 | * @return string |
438 | 438 | */ |
439 | - public function get_html_for_errors(){ |
|
439 | + public function get_html_for_errors() { |
|
440 | 440 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
441 | 441 | } |
442 | 442 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * according to the form section's layout strategy |
445 | 445 | * @return string |
446 | 446 | */ |
447 | - public function get_html_for_help(){ |
|
447 | + public function get_html_for_help() { |
|
448 | 448 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
449 | 449 | } |
450 | 450 | /** |
@@ -453,18 +453,18 @@ discard block |
||
453 | 453 | * @return boolean |
454 | 454 | */ |
455 | 455 | protected function _validate() { |
456 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
457 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
458 | - try{ |
|
456 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
457 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
458 | + try { |
|
459 | 459 | $validation_strategy->validate($this->normalized_value()); |
460 | - }catch(EE_Validation_Error $e){ |
|
460 | + } catch (EE_Validation_Error $e) { |
|
461 | 461 | $this->add_validation_error($e); |
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | - if( $this->get_validation_errors()){ |
|
465 | + if ($this->get_validation_errors()) { |
|
466 | 466 | return false; |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | return true; |
469 | 469 | } |
470 | 470 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param string $value |
479 | 479 | * @return null|string |
480 | 480 | */ |
481 | - private function _sanitize( $value ) { |
|
482 | - return $value !== null ? stripslashes( html_entity_decode( trim( $value ) ) ) : null; |
|
481 | + private function _sanitize($value) { |
|
482 | + return $value !== null ? stripslashes(html_entity_decode(trim($value))) : null; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -493,24 +493,24 @@ discard block |
||
493 | 493 | * @return boolean whether or not there was an error |
494 | 494 | * @throws \EE_Error |
495 | 495 | */ |
496 | - protected function _normalize( $req_data ) { |
|
496 | + protected function _normalize($req_data) { |
|
497 | 497 | //any existing validation errors don't apply so clear them |
498 | 498 | $this->_validation_errors = array(); |
499 | 499 | try { |
500 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
500 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
501 | 501 | //super simple sanitization for now |
502 | - if ( is_array( $raw_input )) { |
|
502 | + if (is_array($raw_input)) { |
|
503 | 503 | $this->_raw_value = array(); |
504 | - foreach( $raw_input as $key => $value ) { |
|
505 | - $this->_raw_value[ $key ] = $this->_sanitize( $value ); |
|
504 | + foreach ($raw_input as $key => $value) { |
|
505 | + $this->_raw_value[$key] = $this->_sanitize($value); |
|
506 | 506 | } |
507 | 507 | } else { |
508 | - $this->_raw_value = $this->_sanitize( $raw_input ); |
|
508 | + $this->_raw_value = $this->_sanitize($raw_input); |
|
509 | 509 | } |
510 | 510 | //we want ot mostly leave the input alone in case we need to re-display it to the user |
511 | - $this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() ); |
|
512 | - } catch ( EE_Validation_Error $e ) { |
|
513 | - $this->add_validation_error( $e ); |
|
511 | + $this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value()); |
|
512 | + } catch (EE_Validation_Error $e) { |
|
513 | + $this->add_validation_error($e); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | /** |
520 | 520 | * @return string |
521 | 521 | */ |
522 | - public function html_name(){ |
|
522 | + public function html_name() { |
|
523 | 523 | return $this->_html_name; |
524 | 524 | } |
525 | 525 | |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | /** |
529 | 529 | * @return string |
530 | 530 | */ |
531 | - public function html_label_id(){ |
|
532 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
531 | + public function html_label_id() { |
|
532 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * @return string |
539 | 539 | */ |
540 | - public function html_label_class(){ |
|
540 | + public function html_label_class() { |
|
541 | 541 | return $this->_html_label_class; |
542 | 542 | } |
543 | 543 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | /** |
547 | 547 | * @return string |
548 | 548 | */ |
549 | - public function html_label_style(){ |
|
549 | + public function html_label_style() { |
|
550 | 550 | return $this->_html_label_style; |
551 | 551 | } |
552 | 552 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | /** |
556 | 556 | * @return string |
557 | 557 | */ |
558 | - public function html_label_text(){ |
|
558 | + public function html_label_text() { |
|
559 | 559 | return $this->_html_label_text; |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | /** |
565 | 565 | * @return string |
566 | 566 | */ |
567 | - public function html_help_text(){ |
|
567 | + public function html_help_text() { |
|
568 | 568 | return $this->_html_help_text; |
569 | 569 | } |
570 | 570 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * @return string |
575 | 575 | */ |
576 | - public function html_help_class(){ |
|
576 | + public function html_help_class() { |
|
577 | 577 | return $this->_html_help_class; |
578 | 578 | } |
579 | 579 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @return string |
584 | 584 | */ |
585 | - public function html_help_style(){ |
|
585 | + public function html_help_style() { |
|
586 | 586 | return $this->_html_style; |
587 | 587 | } |
588 | 588 | /** |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * in which case, we would have stored the malicious content to our database. |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - public function raw_value(){ |
|
598 | + public function raw_value() { |
|
599 | 599 | return $this->_raw_value; |
600 | 600 | } |
601 | 601 | /** |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | * it escapes all html entities |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - public function raw_value_in_form(){ |
|
607 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
606 | + public function raw_value_in_form() { |
|
607 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
608 | 608 | } |
609 | 609 | /** |
610 | 610 | * returns the value after it's been sanitized, and then converted into it's proper type |
611 | 611 | * in PHP. Eg, a string, an int, an array, |
612 | 612 | * @return mixed |
613 | 613 | */ |
614 | - public function normalized_value(){ |
|
614 | + public function normalized_value() { |
|
615 | 615 | return $this->_normalized_value; |
616 | 616 | } |
617 | 617 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * the best thing to display |
622 | 622 | * @return string |
623 | 623 | */ |
624 | - public function pretty_value(){ |
|
624 | + public function pretty_value() { |
|
625 | 625 | return $this->_normalized_value; |
626 | 626 | } |
627 | 627 | /** |
@@ -640,19 +640,19 @@ discard block |
||
640 | 640 | }</code> |
641 | 641 | * @return array |
642 | 642 | */ |
643 | - public function get_jquery_validation_rules(){ |
|
643 | + public function get_jquery_validation_rules() { |
|
644 | 644 | $jquery_validation_js = array(); |
645 | 645 | $jquery_validation_rules = array(); |
646 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
646 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
647 | 647 | $jquery_validation_rules = array_replace_recursive( |
648 | 648 | $jquery_validation_rules, |
649 | 649 | $validation_strategy->get_jquery_validation_rule_array() |
650 | 650 | ); |
651 | 651 | } |
652 | 652 | |
653 | - if(! empty($jquery_validation_rules)){ |
|
654 | - foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) { |
|
655 | - $jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules; |
|
653 | + if ( ! empty($jquery_validation_rules)) { |
|
654 | + foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) { |
|
655 | + $jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | return $jquery_validation_js; |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | * @param mixed $value |
665 | 665 | * @return void |
666 | 666 | */ |
667 | - public function set_default($value){ |
|
667 | + public function set_default($value) { |
|
668 | 668 | $this->_normalized_value = $value; |
669 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
669 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @param string $label |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function set_html_label_text($label){ |
|
677 | + public function set_html_label_text($label) { |
|
678 | 678 | $this->_html_label_text = $label; |
679 | 679 | } |
680 | 680 | |
@@ -688,13 +688,13 @@ discard block |
||
688 | 688 | * @param boolean $required boolean |
689 | 689 | * @param null $required_text |
690 | 690 | */ |
691 | - public function set_required($required = true, $required_text = NULL ){ |
|
692 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
691 | + public function set_required($required = true, $required_text = NULL) { |
|
692 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
693 | 693 | //whether $required is a string or a boolean, we want to add a required validation strategy |
694 | - if ( $required ) { |
|
695 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
694 | + if ($required) { |
|
695 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
696 | 696 | } else { |
697 | - unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] ); |
|
697 | + unset($this->_validation_strategies['EE_Required_Validation_Strategy']); |
|
698 | 698 | } |
699 | 699 | $this->_required = $required; |
700 | 700 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * Returns whether or not this field is required |
703 | 703 | * @return boolean |
704 | 704 | */ |
705 | - public function required(){ |
|
705 | + public function required() { |
|
706 | 706 | return $this->_required; |
707 | 707 | } |
708 | 708 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | /** |
712 | 712 | * @param string $required_css_class |
713 | 713 | */ |
714 | - public function set_required_css_class( $required_css_class ) { |
|
714 | + public function set_required_css_class($required_css_class) { |
|
715 | 715 | $this->_required_css_class = $required_css_class; |
716 | 716 | } |
717 | 717 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | * Sets the help text, in case |
731 | 731 | * @param string $text |
732 | 732 | */ |
733 | - public function set_html_help_text($text){ |
|
733 | + public function set_html_help_text($text) { |
|
734 | 734 | $this->_html_help_text = $text; |
735 | 735 | } |
736 | 736 | /** |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | public function clean_sensitive_data() { |
743 | 743 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
744 | 744 | //if we need more logic than this we'll make a strategy for it |
745 | - if( $this->_sensitive_data_removal_strategy && |
|
746 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
745 | + if ($this->_sensitive_data_removal_strategy && |
|
746 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
747 | 747 | $this->_raw_value = NULL; |
748 | 748 | } |
749 | 749 | //and clean the normalized value according to the appropriate strategy |
@@ -759,10 +759,10 @@ discard block |
||
759 | 759 | * @param string $button_size |
760 | 760 | * @param string $other_attributes |
761 | 761 | */ |
762 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
762 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
763 | 763 | $button_css_attributes = 'button'; |
764 | 764 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
765 | - switch ( $button_size ) { |
|
765 | + switch ($button_size) { |
|
766 | 766 | case 'xs' : |
767 | 767 | case 'extra-small' : |
768 | 768 | $button_css_attributes .= ' button-xs'; |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | default : |
784 | 784 | $button_css_attributes .= ''; |
785 | 785 | } |
786 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
787 | - ? $button_css_attributes . ' ' . $other_attributes |
|
786 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
787 | + ? $button_css_attributes.' '.$other_attributes |
|
788 | 788 | : $button_css_attributes; |
789 | 789 | } |
790 | 790 | |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * @return string |
795 | 795 | */ |
796 | 796 | public function button_css_attributes() { |
797 | - if ( empty( $this->_button_css_attributes )) { |
|
797 | + if (empty($this->_button_css_attributes)) { |
|
798 | 798 | $this->set_button_css_attributes(); |
799 | 799 | } |
800 | 800 | return $this->_button_css_attributes; |
@@ -816,26 +816,26 @@ discard block |
||
816 | 816 | * @return mixed whatever the raw value of this form section is in the request data |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - public function find_form_data_for_this_section( $req_data ){ |
|
819 | + public function find_form_data_for_this_section($req_data) { |
|
820 | 820 | // break up the html name by "[]" |
821 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
822 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
821 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
822 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
823 | 823 | } else { |
824 | 824 | $before_any_brackets = $this->html_name(); |
825 | 825 | } |
826 | 826 | // grab all of the segments |
827 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
828 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
829 | - $name_parts = $matches[ 1 ]; |
|
827 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
828 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
829 | + $name_parts = $matches[1]; |
|
830 | 830 | array_unshift($name_parts, $before_any_brackets); |
831 | - }else{ |
|
832 | - $name_parts = array( $before_any_brackets ); |
|
831 | + } else { |
|
832 | + $name_parts = array($before_any_brackets); |
|
833 | 833 | } |
834 | 834 | // now get the value for the input |
835 | 835 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
836 | 836 | // check if this thing's name is at the TOP level of the request data |
837 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
838 | - $value = $req_data[ $this->name() ]; |
|
837 | + if ($value === null && isset($req_data[$this->name()])) { |
|
838 | + $value = $req_data[$this->name()]; |
|
839 | 839 | } |
840 | 840 | return $value; |
841 | 841 | } |
@@ -848,18 +848,18 @@ discard block |
||
848 | 848 | * @param array $req_data |
849 | 849 | * @return array | NULL |
850 | 850 | */ |
851 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
852 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
853 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
854 | - if( empty($html_name_parts ) ){ |
|
855 | - return $req_data[ $first_part_to_consider ]; |
|
856 | - }else{ |
|
851 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
852 | + $first_part_to_consider = array_shift($html_name_parts); |
|
853 | + if (isset($req_data[$first_part_to_consider])) { |
|
854 | + if (empty($html_name_parts)) { |
|
855 | + return $req_data[$first_part_to_consider]; |
|
856 | + } else { |
|
857 | 857 | return $this->_find_form_data_for_this_section_using_name_parts( |
858 | 858 | $html_name_parts, |
859 | - $req_data[ $first_part_to_consider ] |
|
859 | + $req_data[$first_part_to_consider] |
|
860 | 860 | ); |
861 | 861 | } |
862 | - }else{ |
|
862 | + } else { |
|
863 | 863 | return NULL; |
864 | 864 | } |
865 | 865 | } |
@@ -873,14 +873,14 @@ discard block |
||
873 | 873 | * @return boolean |
874 | 874 | * @throws \EE_Error |
875 | 875 | */ |
876 | - public function form_data_present_in($req_data = NULL){ |
|
877 | - if( $req_data === NULL ){ |
|
876 | + public function form_data_present_in($req_data = NULL) { |
|
877 | + if ($req_data === NULL) { |
|
878 | 878 | $req_data = $_POST; |
879 | 879 | } |
880 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
881 | - if( $checked_value !== null ){ |
|
880 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
881 | + if ($checked_value !== null) { |
|
882 | 882 | return TRUE; |
883 | - }else{ |
|
883 | + } else { |
|
884 | 884 | return FALSE; |
885 | 885 | } |
886 | 886 | } |
@@ -891,8 +891,8 @@ discard block |
||
891 | 891 | * @param array $form_other_js_data |
892 | 892 | * @return array |
893 | 893 | */ |
894 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
895 | - $form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data ); |
|
894 | + public function get_other_js_data($form_other_js_data = array()) { |
|
895 | + $form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data); |
|
896 | 896 | return $form_other_js_data; |
897 | 897 | } |
898 | 898 | |
@@ -905,10 +905,10 @@ discard block |
||
905 | 905 | * @param array $form_other_js_data |
906 | 906 | * @return array |
907 | 907 | */ |
908 | - public function get_other_js_data_from_strategies( $form_other_js_data = array() ) { |
|
909 | - $form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data ); |
|
910 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
911 | - $form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data ); |
|
908 | + public function get_other_js_data_from_strategies($form_other_js_data = array()) { |
|
909 | + $form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data); |
|
910 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
911 | + $form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data); |
|
912 | 912 | } |
913 | 913 | return $form_other_js_data; |
914 | 914 | } |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | * Override parent because we want to give our strategies an opportunity to enqueue some js and css |
918 | 918 | * @return void |
919 | 919 | */ |
920 | - public function enqueue_js(){ |
|
920 | + public function enqueue_js() { |
|
921 | 921 | //ask our display strategy and validation strategies if they have js to enqueue |
922 | 922 | $this->enqueue_js_from_strategies(); |
923 | 923 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | */ |
929 | 929 | public function enqueue_js_from_strategies() { |
930 | 930 | $this->get_display_strategy()->enqueue_js(); |
931 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
931 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
932 | 932 | $validation_strategy->enqueue_js(); |
933 | 933 | } |
934 | 934 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | /** |
6 | 6 | * Event Espresso |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | <li><?php printf( |
40 | 40 | __('To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.', 'event_espresso'), |
41 | 41 | '<a href="http://developer.paypal.com">developer.paypal.com</a>'); ?></li> |
42 | - <li><?php printf(__('CVV2 should be 115 (see %s PayPal\'s documentation for other special codes %s)', 'event_espresso'),'<a href="https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions#id108HH0RJ0TS" target="_blank">','</a>'); ?></li> |
|
42 | + <li><?php printf(__('CVV2 should be 115 (see %s PayPal\'s documentation for other special codes %s)', 'event_espresso'), '<a href="https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions#id108HH0RJ0TS" target="_blank">', '</a>'); ?></li> |
|
43 | 43 | </ul> |
44 | 44 | |
45 | 45 | <p class="test-credit-cards-info-pg"> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | <p class="test-credit-cards-info-pg"> |
68 | 68 | <strong><?php _e('Testing Result Code Responses', 'event_espresso'); ?></strong><br/> |
69 | - <span class="small-text"><?php printf(__('You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s', 'event_espresso'),"<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>","</a>", "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>","</a>","<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>","</a>"); ?></span> |
|
69 | + <span class="small-text"><?php printf(__('You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s', 'event_espresso'), "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>", "</a>", "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>", "</a>", "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>", "</a>"); ?></span> |
|
70 | 70 | </p> |
71 | 71 | |
72 | 72 | <div class="tbl-wrap"> |
@@ -18,43 +18,43 @@ |
||
18 | 18 | * @throws EE_Error |
19 | 19 | * @return string of html to display the field |
20 | 20 | */ |
21 | - public function display(){ |
|
21 | + public function display() { |
|
22 | 22 | $input = $this->get_input(); |
23 | 23 | //d( $input ); |
24 | - $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
24 | + $multi = count($input->options()) > 1 ? TRUE : FALSE; |
|
25 | 25 | $input->set_label_sizes(); |
26 | 26 | $label_size_class = $input->get_label_size_class(); |
27 | 27 | $html = ''; |
28 | - if ( ! is_array( $input->raw_value() ) && $input->raw_value() !== NULL ) { |
|
28 | + if ( ! is_array($input->raw_value()) && $input->raw_value() !== NULL) { |
|
29 | 29 | EE_Error::doing_it_wrong( |
30 | 30 | 'EE_Checkbox_Display_Strategy::display()', |
31 | 31 | sprintf( |
32 | - __( 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), |
|
32 | + __('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), |
|
33 | 33 | $input->html_id(), |
34 | - var_export( $input->raw_value(), true), |
|
35 | - $input->html_name() . '[]' |
|
34 | + var_export($input->raw_value(), true), |
|
35 | + $input->html_name().'[]' |
|
36 | 36 | ), |
37 | 37 | '4.8.1' |
38 | 38 | ); |
39 | 39 | } |
40 | - $input_raw_value = (array)$input->raw_value(); |
|
41 | - foreach( $input->options() as $value => $display_text ){ |
|
42 | - $value = $input->get_normalization_strategy()->unnormalize_one( $value ); |
|
43 | - $html_id = $this->get_sub_input_id( $value ); |
|
44 | - $html .= EEH_HTML::nl( 0, 'checkbox' ); |
|
45 | - $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">'; |
|
46 | - $html .= EEH_HTML::nl( 1, 'checkbox' ); |
|
40 | + $input_raw_value = (array) $input->raw_value(); |
|
41 | + foreach ($input->options() as $value => $display_text) { |
|
42 | + $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
43 | + $html_id = $this->get_sub_input_id($value); |
|
44 | + $html .= EEH_HTML::nl(0, 'checkbox'); |
|
45 | + $html .= '<label for="'.$html_id.'" id="'.$html_id.'-lbl" class="ee-checkbox-label-after'.$label_size_class.'">'; |
|
46 | + $html .= EEH_HTML::nl(1, 'checkbox'); |
|
47 | 47 | $html .= '<input type="checkbox"'; |
48 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
49 | - $html .= ' id="' . $html_id . '"'; |
|
50 | - $html .= ' class="' . $input->html_class() . '"'; |
|
51 | - $html .= ' style="' . $input->html_style() . '"'; |
|
52 | - $html .= ' value="' . esc_attr( $value ) . '"'; |
|
53 | - $html .= ! empty( $input_raw_value ) && in_array( $value, $input_raw_value ) ? ' checked="checked"' : ''; |
|
54 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
48 | + $html .= ' name="'.$input->html_name().'[]"'; |
|
49 | + $html .= ' id="'.$html_id.'"'; |
|
50 | + $html .= ' class="'.$input->html_class().'"'; |
|
51 | + $html .= ' style="'.$input->html_style().'"'; |
|
52 | + $html .= ' value="'.esc_attr($value).'"'; |
|
53 | + $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : ''; |
|
54 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
55 | 55 | $html .= '> '; |
56 | 56 | $html .= $display_text; |
57 | - $html .= EEH_HTML::nl( -1, 'checkbox' ) . '</label>'; |
|
57 | + $html .= EEH_HTML::nl( -1, 'checkbox' ).'</label>'; |
|
58 | 58 | } |
59 | 59 | return $html; |
60 | 60 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Specialized form for payment methods, allowing for easy setting and retrieving of meta fields. |
5 | 5 | * Uses EEM_Payment_Method as the model |
6 | 6 | */ |
7 | -class EE_Payment_Method_Form extends EE_Model_Form_Section{ |
|
7 | +class EE_Payment_Method_Form extends EE_Model_Form_Section { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * All the subsection inputs that correspond ot extra meta rows |
@@ -39,37 +39,37 @@ discard block |
||
39 | 39 | * @see EE_Model_Form_Section::__construct() for more |
40 | 40 | * } |
41 | 41 | */ |
42 | - public function __construct($options_array = array()){ |
|
42 | + public function __construct($options_array = array()) { |
|
43 | 43 | $this->_model = EEM_Payment_Method::instance(); |
44 | 44 | $this->_options_array = $options_array; |
45 | - if(isset($options_array['payment_method_type'])){ |
|
45 | + if (isset($options_array['payment_method_type'])) { |
|
46 | 46 | $this->_payment_method_type = $options_array['payment_method_type']; |
47 | 47 | } |
48 | 48 | $options_array = $this->_options_array; |
49 | - if(isset($options_array['extra_meta_inputs'])){ |
|
50 | - $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs,$options_array['extra_meta_inputs']); |
|
49 | + if (isset($options_array['extra_meta_inputs'])) { |
|
50 | + $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs, $options_array['extra_meta_inputs']); |
|
51 | 51 | } |
52 | - if($this->_extra_meta_inputs){ |
|
53 | - $this->_subsections = array_merge($this->_subsections,$this->_extra_meta_inputs); |
|
52 | + if ($this->_extra_meta_inputs) { |
|
53 | + $this->_subsections = array_merge($this->_subsections, $this->_extra_meta_inputs); |
|
54 | 54 | } |
55 | 55 | $this->_subsections['PMD_button_url'] = new EE_Admin_File_Uploader_Input( |
56 | - array( 'html_label_text'=> __( 'Button URL', 'event_espresso' )) |
|
56 | + array('html_label_text'=> __('Button URL', 'event_espresso')) |
|
57 | 57 | ); |
58 | 58 | $this->_subsections['PMD_scope'] = new EE_Checkbox_Multi_Input( |
59 | 59 | EEM_Payment_Method::instance()->scopes(), |
60 | - array( 'html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename() . EEH_Template::get_help_tab_link( 'payment_methods_overview' )) |
|
60 | + array('html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename().EEH_Template::get_help_tab_link('payment_methods_overview')) |
|
61 | 61 | ); |
62 | 62 | //setup the currency options |
63 | 63 | $this->_subsections['Currency'] = new EE_Select_Multi_Model_Input( |
64 | - EEM_Currency::instance()->get_all_currencies_usable_by( $this->_payment_method_type ), |
|
64 | + EEM_Currency::instance()->get_all_currencies_usable_by($this->_payment_method_type), |
|
65 | 65 | array( |
66 | - 'html_label_text'=> __( 'Currencies Supported', 'event_espresso' ), |
|
66 | + 'html_label_text'=> __('Currencies Supported', 'event_espresso'), |
|
67 | 67 | 'required'=>TRUE |
68 | 68 | ) |
69 | 69 | ); |
70 | - $this->_subsections['PMD_order'] = new EE_Text_Input( array( |
|
71 | - 'html_label_text' => __( 'Order', 'event_espresso' ), |
|
72 | - 'html_help_text' => __( 'Lowest numbers will be shown first', 'event_espresso' ), |
|
70 | + $this->_subsections['PMD_order'] = new EE_Text_Input(array( |
|
71 | + 'html_label_text' => __('Order', 'event_espresso'), |
|
72 | + 'html_help_text' => __('Lowest numbers will be shown first', 'event_espresso'), |
|
73 | 73 | 'normalization_strategy' => new EE_Int_Normalization(), |
74 | 74 | 'validation_strategies' => array( |
75 | 75 | new EE_Int_Validation_Strategy() |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | )); |
79 | 79 | $this->_layout_strategy = new EE_Admin_Two_Column_Layout(); |
80 | 80 | parent::__construct($options_array); |
81 | - $debug_mode = isset( $this->_subsections[ 'PMD_debug_mode' ] ) ? $this->_subsections[ 'PMD_debug_mode' ] : null; |
|
82 | - if( $debug_mode instanceof EE_Form_Input_Base ) { |
|
83 | - $debug_mode->set_html_help_text( __( 'This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.', 'event_espresso' ) ); |
|
81 | + $debug_mode = isset($this->_subsections['PMD_debug_mode']) ? $this->_subsections['PMD_debug_mode'] : null; |
|
82 | + if ($debug_mode instanceof EE_Form_Input_Base) { |
|
83 | + $debug_mode->set_html_help_text(__('This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.', 'event_espresso')); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | * @param string $name |
93 | 93 | * @throws EE_Error |
94 | 94 | */ |
95 | - public function _construct_finalize( $parent_form_section, $name ) { |
|
96 | - if( ! $this->_payment_method_type instanceof EE_PMT_Base ){ |
|
97 | - throw new EE_Error( sprintf( __( 'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso' ))); |
|
95 | + public function _construct_finalize($parent_form_section, $name) { |
|
96 | + if ( ! $this->_payment_method_type instanceof EE_PMT_Base) { |
|
97 | + throw new EE_Error(sprintf(__('Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso'))); |
|
98 | 98 | } |
99 | 99 | //set the name of this form based on the payment method type |
100 | - if( ! $this->_name && ! $name ){ |
|
101 | - $name = str_replace(" ","_",ucwords(str_replace("_"," ",($this->_payment_method_type->system_name()))))."_Settings_Form"; |
|
100 | + if ( ! $this->_name && ! $name) { |
|
101 | + $name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))."_Settings_Form"; |
|
102 | 102 | } |
103 | - parent::_construct_finalize( $parent_form_section, $name ); |
|
103 | + parent::_construct_finalize($parent_form_section, $name); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param $payment_method_type |
110 | 110 | * @throws EE_Error |
111 | 111 | */ |
112 | - public function set_payment_method_type( $payment_method_type ){ |
|
113 | - if( ! $payment_method_type instanceof EE_PMT_Base){ |
|
112 | + public function set_payment_method_type($payment_method_type) { |
|
113 | + if ( ! $payment_method_type instanceof EE_PMT_Base) { |
|
114 | 114 | throw new EE_Error(sprintf(__("Payment Method forms MUST set a payment method type by using _set_payment_method_type", "event_espresso"))); |
115 | 115 | } |
116 | 116 | $this->_payment_method_type = $payment_method_type; |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | * extends the model form section's save method to also save the extra meta field values |
123 | 123 | * @return int ID of the payment method inserted, or true on update |
124 | 124 | */ |
125 | - public function save(){ |
|
125 | + public function save() { |
|
126 | 126 | $parent_save_val = parent::save(); |
127 | - if( $this->_model_object && $this->_model_object->ID()){ |
|
128 | - foreach($this->_extra_meta_inputs as $input_name => $input){ |
|
127 | + if ($this->_model_object && $this->_model_object->ID()) { |
|
128 | + foreach ($this->_extra_meta_inputs as $input_name => $input) { |
|
129 | 129 | $this->_model_object->update_extra_meta($input_name, $input->normalized_value()); |
130 | 130 | } |
131 | 131 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $model_obj = $this->_model->ensure_is_obj($model_obj); |
143 | 143 | parent::populate_model_obj($model_obj); |
144 | 144 | $extra_meta = $model_obj->all_extra_meta_array(); |
145 | - foreach($this->_extra_meta_inputs as $input_name => $extra_meta_input){ |
|
146 | - if(isset($extra_meta[$input_name])){ |
|
145 | + foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) { |
|
146 | + if (isset($extra_meta[$input_name])) { |
|
147 | 147 | $extra_meta_input->set_default($extra_meta[$input_name]); |
148 | 148 | } |
149 | 149 | } |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * gets the default name of this form section if none is specified |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - protected function _set_default_name_if_empty(){ |
|
159 | - if( ! $this->_name ){ |
|
160 | - $default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form"; |
|
161 | - $this->_name = $default_name; |
|
158 | + protected function _set_default_name_if_empty() { |
|
159 | + if ( ! $this->_name) { |
|
160 | + $default_name = str_replace("EEM_", "", get_class($this->_model))."_Model_Form"; |
|
161 | + $this->_name = $default_name; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * Gets all the extra meta inputs in this form |
169 | 169 | * @return EE_Form_Input_Base[] |
170 | 170 | */ |
171 | - public function extra_meta_inputs(){ |
|
171 | + public function extra_meta_inputs() { |
|
172 | 172 | return $this->_extra_meta_inputs; |
173 | 173 | } |
174 | 174 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </td> |
16 | 16 | </tr> |
17 | 17 | <?php |
18 | - if( apply_filters( 'FHEE__google_map__show_api_key_input', true ) ) { ?> |
|
18 | + if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
19 | 19 | <tr> |
20 | 20 | <th> |
21 | 21 | <label for="ee-google-map-api-key"> |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | <td> |
111 | 111 | <label for="event_details_control_type-default" class="ee-admin-radio-lbl"> |
112 | 112 | <?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?> |
113 | - <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/> |
|
113 | + <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/> |
|
114 | 114 | <?php _e(' Default', 'event_espresso') ?> |
115 | 115 | </label> |
116 | 116 | |
117 | 117 | <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl"> |
118 | 118 | <?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
119 | - <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/> |
|
119 | + <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
120 | 120 | <?php _e(' Horizontal', 'event_espresso') ?> |
121 | 121 | </label> |
122 | 122 | |
123 | 123 | <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl"> |
124 | 124 | <?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
125 | - <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/> |
|
125 | + <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
126 | 126 | <?php _e(' Dropdown', 'event_espresso') ?> |
127 | 127 | </label> |
128 | 128 | </td> |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | <td> |
136 | 136 | <label for="event_details_map_align-none" class="ee-admin-radio-lbl"> |
137 | 137 | <?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?> |
138 | - <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/> |
|
138 | + <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/> |
|
139 | 139 | <?php _e(' None', 'event_espresso') ?> |
140 | 140 | </label> |
141 | 141 | |
142 | 142 | <label for="event_details_map_align-left" class="ee-admin-radio-lbl"> |
143 | 143 | <?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?> |
144 | - <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/> |
|
144 | + <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/> |
|
145 | 145 | <?php _e(' Align Left', 'event_espresso') ?> |
146 | 146 | </label> |
147 | 147 | |
148 | 148 | <label for="event_details_map_align-center" class="ee-admin-radio-lbl"> |
149 | 149 | <?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?> |
150 | - <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/> |
|
150 | + <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/> |
|
151 | 151 | <?php _e(' Align Center', 'event_espresso') ?> |
152 | 152 | </label> |
153 | 153 | |
154 | 154 | <label for="event_details_map_align-right" class="ee-admin-radio-lbl"> |
155 | 155 | <?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?> |
156 | - <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/> |
|
156 | + <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/> |
|
157 | 157 | <?php _e(' Align Right', 'event_espresso') ?> |
158 | 158 | </label> |
159 | 159 | </td> |
@@ -228,19 +228,19 @@ discard block |
||
228 | 228 | <td> |
229 | 229 | <label for="event_list_control_type-default" class="ee-admin-radio-lbl"> |
230 | 230 | <?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?> |
231 | - <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/> |
|
231 | + <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/> |
|
232 | 232 | <?php _e(' Default', 'event_espresso') ?> |
233 | 233 | </label> |
234 | 234 | |
235 | 235 | <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl"> |
236 | 236 | <?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
237 | - <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/> |
|
237 | + <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
238 | 238 | <?php _e(' Horizontal', 'event_espresso') ?> |
239 | 239 | </label> |
240 | 240 | |
241 | 241 | <label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl"> |
242 | 242 | <?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
243 | - <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/> |
|
243 | + <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
244 | 244 | <?php _e(' Dropdown', 'event_espresso') ?> |
245 | 245 | </label> |
246 | 246 | |
@@ -254,25 +254,25 @@ discard block |
||
254 | 254 | <td> |
255 | 255 | <label for="event_list_map_align-none" class="ee-admin-radio-lbl"> |
256 | 256 | <?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?> |
257 | - <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/> |
|
257 | + <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/> |
|
258 | 258 | <?php _e(' None', 'event_espresso') ?> |
259 | 259 | </label> |
260 | 260 | |
261 | 261 | <label for="event_list_map_align-left" class="ee-admin-radio-lbl"> |
262 | 262 | <?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?> |
263 | - <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/> |
|
263 | + <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/> |
|
264 | 264 | <?php _e(' Align Left', 'event_espresso') ?> |
265 | 265 | </label> |
266 | 266 | |
267 | 267 | <label for="event_list_map_align-center" class="ee-admin-radio-lbl"> |
268 | 268 | <?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?> |
269 | - <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/> |
|
269 | + <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/> |
|
270 | 270 | <?php _e(' Align Center', 'event_espresso') ?> |
271 | 271 | </label> |
272 | 272 | |
273 | 273 | <label for="event_list_map_align-right" class="ee-admin-radio-lbl"> |
274 | 274 | <?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?> |
275 | - <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/> |
|
275 | + <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/> |
|
276 | 276 | <?php _e(' Align Right', 'event_espresso') ?> |
277 | 277 | </label> |
278 | 278 |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | 'nav' => array( |
449 | 449 | 'label' => __('REG Details', 'event_espresso'), |
450 | 450 | 'order' => 15, |
451 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
451 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
452 | 452 | 'persistent' => FALSE |
453 | 453 | ), |
454 | 454 | 'help_tabs' => array( |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | 'filename' => 'registrations_details_registrant_details' |
470 | 470 | ) |
471 | 471 | ), |
472 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
473 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
472 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
473 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
474 | 474 | 'require_nonce' => FALSE |
475 | 475 | ), |
476 | 476 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | 'order' => 15, |
495 | 495 | 'persistent' => FALSE |
496 | 496 | ), |
497 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
497 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
498 | 498 | 'require_nonce' => FALSE |
499 | 499 | ), |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | 'label' => __('Edit Contact', 'event_espresso'), |
504 | 504 | 'order' => 15, |
505 | 505 | 'persistent' => FALSE, |
506 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
506 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
507 | 507 | ), |
508 | 508 | 'metaboxes' => array('attendee_editor_metaboxes'), |
509 | 509 | 'require_nonce' => FALSE |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'filename' => 'registrations_contact_list_other' |
534 | 534 | ) |
535 | 535 | ), |
536 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
536 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
537 | 537 | 'metaboxes' => array(), |
538 | 538 | 'require_nonce' => FALSE |
539 | 539 | ), |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | protected function _add_screen_options() {} |
553 | 553 | protected function _add_feature_pointers() {} |
554 | 554 | public function admin_init() { |
555 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
555 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
556 | 556 | } |
557 | 557 | public function admin_notices() {} |
558 | 558 | public function admin_footer_scripts() {} |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return void |
571 | 571 | */ |
572 | 572 | private function _get_registration_status_array() { |
573 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
573 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | public function load_scripts_styles() { |
594 | 594 | //style |
595 | 595 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
596 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
596 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
597 | 597 | wp_enqueue_style('espresso_reg'); |
598 | 598 | |
599 | 599 | //script |
600 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
601 | 601 | wp_enqueue_script('espresso_reg'); |
602 | 602 | } |
603 | 603 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | public function load_scripts_styles_edit_attendee() { |
607 | 607 | //stuff to only show up on our attendee edit details page. |
608 | 608 | $attendee_details_translations = array( |
609 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
609 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
610 | 610 | ); |
611 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
611 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
612 | 612 | wp_enqueue_script('jquery-validate'); |
613 | 613 | } |
614 | 614 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | //styles |
618 | 618 | wp_enqueue_style('espresso-ui-theme'); |
619 | 619 | //scripts |
620 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
621 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
620 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
621 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public function load_scripts_styles_contact_list() { |
630 | 630 | wp_deregister_style('espresso_reg'); |
631 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
631 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
632 | 632 | wp_enqueue_style('espresso_att'); |
633 | 633 | } |
634 | 634 | |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | |
638 | 638 | |
639 | 639 | public function load_scripts_styles_new_registration() { |
640 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
640 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
641 | 641 | wp_enqueue_script('ee-spco-for-admin'); |
642 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
642 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
643 | 643 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
644 | 644 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
645 | 645 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | //for notification related bulk actions we need to make sure only active messengers have an option. |
667 | 667 | EED_Messages::set_autoloaders(); |
668 | 668 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
669 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
669 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
670 | 670 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
671 | 671 | //key= bulk_action_slug, value= message type. |
672 | 672 | $match_array = array( |
@@ -679,23 +679,23 @@ discard block |
||
679 | 679 | |
680 | 680 | /** setup reg status bulk actions **/ |
681 | 681 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
682 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
682 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
683 | 683 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
684 | 684 | } |
685 | 685 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
686 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
686 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
687 | 687 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
688 | 688 | } |
689 | 689 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
690 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
690 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
691 | 691 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
692 | 692 | } |
693 | 693 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
694 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
694 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
695 | 695 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
696 | 696 | } |
697 | 697 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
698 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
698 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
699 | 699 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
700 | 700 | } |
701 | 701 | |
@@ -704,29 +704,29 @@ discard block |
||
704 | 704 | 'slug' => 'all', |
705 | 705 | 'label' => __('View All Registrations', 'event_espresso'), |
706 | 706 | 'count' => 0, |
707 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
707 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
708 | 708 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
709 | - ) ) |
|
709 | + )) |
|
710 | 710 | ), |
711 | 711 | 'month' => array( |
712 | 712 | 'slug' => 'month', |
713 | 713 | 'label' => __('This Month', 'event_espresso'), |
714 | 714 | 'count' => 0, |
715 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
715 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
716 | 716 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
717 | 717 | )) |
718 | 718 | ), |
719 | 719 | 'today' => array( |
720 | 720 | 'slug' => 'today', |
721 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
721 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
722 | 722 | 'count' => 0, |
723 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
723 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
724 | 724 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
725 | 725 | )) |
726 | 726 | ) |
727 | 727 | ); |
728 | 728 | |
729 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
729 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
730 | 730 | $this->_views['incomplete'] = array( |
731 | 731 | 'slug' => 'incomplete', |
732 | 732 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | ) |
763 | 763 | ); |
764 | 764 | |
765 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
765 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
766 | 766 | $this->_views['trash'] = array( |
767 | 767 | 'slug' => 'trash', |
768 | 768 | 'label' => __('Trash', 'event_espresso'), |
@@ -801,18 +801,18 @@ discard block |
||
801 | 801 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
802 | 802 | ), |
803 | 803 | ); |
804 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
804 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
805 | 805 | $fc_items['resend_registration'] = array( |
806 | 806 | 'class' => 'dashicons dashicons-email-alt', |
807 | 807 | 'desc' => __('Resend Registration Details', 'event_espresso') |
808 | 808 | ); |
809 | 809 | } else { |
810 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
810 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
811 | 811 | } |
812 | 812 | |
813 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
814 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
815 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
813 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
814 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
815 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
816 | 816 | $fc_items['view_related_messages'] = array( |
817 | 817 | 'class' => $related_for_icon['css_class'], |
818 | 818 | 'desc' => $related_for_icon['label'], |
@@ -822,31 +822,31 @@ discard block |
||
822 | 822 | |
823 | 823 | $sc_items = array( |
824 | 824 | 'approved_status' => array( |
825 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
826 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
825 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
826 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
827 | 827 | ), |
828 | 828 | 'pending_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'incomplete_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
835 | 835 | ), |
836 | 836 | 'not_approved' => array( |
837 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
838 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
837 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
838 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
839 | 839 | ), |
840 | 840 | 'declined_status' => array( |
841 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
842 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
841 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
842 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
843 | 843 | ), |
844 | 844 | 'cancelled_status' => array( |
845 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
846 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
845 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
846 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
847 | 847 | ) |
848 | 848 | ); |
849 | - return array_merge( $fc_items, $sc_items ); |
|
849 | + return array_merge($fc_items, $sc_items); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | |
@@ -859,15 +859,15 @@ discard block |
||
859 | 859 | |
860 | 860 | |
861 | 861 | protected function _registrations_overview_list_table() { |
862 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
863 | - if ( $EVT_ID ) { |
|
864 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
865 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
862 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
863 | + if ($EVT_ID) { |
|
864 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
865 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
866 | 866 | } |
867 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
868 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
867 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
868 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
869 | 869 | } |
870 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
870 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
871 | 871 | $this->display_admin_list_table_page_with_no_sidebar(); |
872 | 872 | } |
873 | 873 | |
@@ -882,19 +882,19 @@ discard block |
||
882 | 882 | */ |
883 | 883 | private function _set_registration_object() { |
884 | 884 | //get out if we've already set the object |
885 | - if ( is_object( $this->_registration )) { |
|
885 | + if (is_object($this->_registration)) { |
|
886 | 886 | return TRUE; |
887 | 887 | } |
888 | 888 | |
889 | 889 | $REG = EEM_Registration::instance(); |
890 | 890 | |
891 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
891 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
892 | 892 | |
893 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
893 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
894 | 894 | return TRUE; |
895 | 895 | else { |
896 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
897 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
896 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
897 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
898 | 898 | $this->_registration = NULL; |
899 | 899 | return FALSE; |
900 | 900 | } |
@@ -912,24 +912,24 @@ discard block |
||
912 | 912 | * @throws \EE_Error |
913 | 913 | * @return mixed (int|array) int = count || array of registration objects |
914 | 914 | */ |
915 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
916 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
917 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
918 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
919 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
920 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
921 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
915 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
916 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
917 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
918 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
919 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
920 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
921 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
922 | 922 | $start_date = FALSE; |
923 | 923 | $end_date = FALSE; |
924 | 924 | $_where = array(); |
925 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
926 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
925 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
926 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
927 | 927 | |
928 | 928 | //set orderby |
929 | 929 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
930 | 930 | |
931 | 931 | |
932 | - switch ( $this->_req_data['orderby'] ) { |
|
932 | + switch ($this->_req_data['orderby']) { |
|
933 | 933 | case '_REG_ID': |
934 | 934 | $orderby = 'REG_ID'; |
935 | 935 | break; |
@@ -949,26 +949,26 @@ discard block |
||
949 | 949 | $orderby = 'REG_date'; |
950 | 950 | } |
951 | 951 | |
952 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
953 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
954 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
952 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
953 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
954 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
955 | 955 | |
956 | 956 | |
957 | - $offset = ($current_page-1)*$per_page; |
|
958 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
957 | + $offset = ($current_page - 1) * $per_page; |
|
958 | + $limit = $count ? NULL : array($offset, $per_page); |
|
959 | 959 | |
960 | - if($EVT_ID){ |
|
961 | - $_where['EVT_ID']=$EVT_ID; |
|
960 | + if ($EVT_ID) { |
|
961 | + $_where['EVT_ID'] = $EVT_ID; |
|
962 | 962 | } |
963 | - if($CAT_ID){ |
|
963 | + if ($CAT_ID) { |
|
964 | 964 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
965 | 965 | } |
966 | - if ( $incomplete ) { |
|
966 | + if ($incomplete) { |
|
967 | 967 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
968 | 968 | } else if ( ! $trash) { |
969 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
969 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
970 | 970 | } |
971 | - if($reg_status){ |
|
971 | + if ($reg_status) { |
|
972 | 972 | $_where['STS_ID'] = $reg_status; |
973 | 973 | } |
974 | 974 | |
@@ -980,105 +980,105 @@ discard block |
||
980 | 980 | $time_start = ' 00:00:00'; |
981 | 981 | $time_end = ' 23:59:59'; |
982 | 982 | |
983 | - if($today_a || $today ){ |
|
983 | + if ($today_a || $today) { |
|
984 | 984 | $curdate = date('Y-m-d', current_time('timestamp')); |
985 | - $_where['REG_date']= array('BETWEEN', |
|
985 | + $_where['REG_date'] = array('BETWEEN', |
|
986 | 986 | array( |
987 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
988 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
987 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
988 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
989 | 989 | )); |
990 | - }elseif($this_month_a || $this_month){ |
|
990 | + }elseif ($this_month_a || $this_month) { |
|
991 | 991 | $this_month_r = date('m', current_time('timestamp')); |
992 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
993 | - $_where['REG_date']= array('BETWEEN', |
|
992 | + $days_this_month = date('t', current_time('timestamp')); |
|
993 | + $_where['REG_date'] = array('BETWEEN', |
|
994 | 994 | array( |
995 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
996 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
995 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
996 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
997 | 997 | )); |
998 | - }elseif($month_range){ |
|
998 | + }elseif ($month_range) { |
|
999 | 999 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1000 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1001 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1002 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1003 | - $_where['REG_date']= array('BETWEEN', |
|
1004 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
1005 | - }elseif($start_date && $end_date){ |
|
1000 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1001 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1002 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1003 | + $_where['REG_date'] = array('BETWEEN', |
|
1004 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
1005 | + }elseif ($start_date && $end_date) { |
|
1006 | 1006 | throw new EE_Error("not yet supported"); |
1007 | - }elseif($start_date){ |
|
1007 | + }elseif ($start_date) { |
|
1008 | 1008 | throw new EE_Error("not yet supported"); |
1009 | - }elseif($end_date){ |
|
1009 | + }elseif ($end_date) { |
|
1010 | 1010 | throw new EE_Error("not yet supported"); |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1014 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1013 | + if ( ! empty($this->_req_data['s'])) { |
|
1014 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1015 | 1015 | $_where['OR'] = array( |
1016 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1017 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1018 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1019 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1020 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1021 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1022 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1023 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1024 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1025 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1026 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1027 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1028 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1029 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1030 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1031 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1032 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1033 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1016 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1017 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1018 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1019 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1020 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1021 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1022 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1023 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1024 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1025 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1026 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1027 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1028 | + 'REG_code' => array('LIKE', $sstr), |
|
1029 | + 'REG_count' => array('LIKE', $sstr), |
|
1030 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1031 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1032 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1033 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1034 | 1034 | ); |
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | //capability checks |
1038 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1038 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1039 | 1039 | $_where['AND'] = array( |
1040 | 1040 | 'Event.EVT_wp_user' => get_current_user_id() |
1041 | 1041 | ); |
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
1045 | - if( $count ){ |
|
1046 | - if ( $trash ) { |
|
1047 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1048 | - } else if ( $incomplete ) { |
|
1049 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1045 | + if ($count) { |
|
1046 | + if ($trash) { |
|
1047 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1048 | + } else if ($incomplete) { |
|
1049 | + return EEM_Registration::instance()->count(array($_where)); |
|
1050 | 1050 | } else { |
1051 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1051 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1052 | 1052 | } |
1053 | 1053 | } else { |
1054 | 1054 | //make sure we remove default where conditions cause all registrations matching query are returned |
1055 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1056 | - if ( $per_page !== -1 ) { |
|
1055 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1056 | + if ($per_page !== -1) { |
|
1057 | 1057 | $query_params['limit'] = $limit; |
1058 | 1058 | } |
1059 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1059 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1060 | 1060 | |
1061 | 1061 | |
1062 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1062 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1063 | 1063 | $first_registration = $registrations[0]; |
1064 | 1064 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1065 | 1065 | $event_name = $first_registration->event_obj()->name(); |
1066 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1066 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1067 | 1067 | // edit event link |
1068 | - if ( $event_name != '' ) { |
|
1069 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1070 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1071 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1068 | + if ($event_name != '') { |
|
1069 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1070 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1071 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1075 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1074 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1075 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1076 | 1076 | |
1077 | 1077 | $this->_template_args['before_admin_page_content'] = ' |
1078 | 1078 | <div id="admin-page-header"> |
1079 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1080 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1081 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1079 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1080 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1081 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1082 | 1082 | </div> |
1083 | 1083 | '; |
1084 | 1084 | |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | $this->_set_registration_object(); |
1118 | 1118 | |
1119 | - if ( is_object( $this->_registration )) { |
|
1119 | + if (is_object($this->_registration)) { |
|
1120 | 1120 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1121 | 1121 | $this->_session = $transaction->session_data(); |
1122 | 1122 | |
@@ -1124,10 +1124,10 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | |
1126 | 1126 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1127 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1127 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1128 | 1128 | |
1129 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1130 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1129 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1130 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1131 | 1131 | |
1132 | 1132 | $this->_template_args['grand_total'] = $transaction->total(); |
1133 | 1133 | |
@@ -1135,19 +1135,19 @@ discard block |
||
1135 | 1135 | // link back to overview |
1136 | 1136 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1137 | 1137 | $this->_template_args['registration'] = $this->_registration; |
1138 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1139 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1140 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1138 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1139 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1140 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1141 | 1141 | |
1142 | 1142 | //next and previous links |
1143 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1144 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1145 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1146 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1143 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1144 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1145 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1146 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1147 | 1147 | |
1148 | 1148 | // grab header |
1149 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1150 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1149 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1150 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1151 | 1151 | |
1152 | 1152 | } else { |
1153 | 1153 | |
@@ -1166,17 +1166,17 @@ discard block |
||
1166 | 1166 | |
1167 | 1167 | |
1168 | 1168 | protected function _registration_details_metaboxes() { |
1169 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1169 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1170 | 1170 | $this->_set_registration_object(); |
1171 | 1171 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1172 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1173 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1174 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1175 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1172 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1173 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1174 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1175 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1176 | 1176 | } |
1177 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1178 | - if ( $this->_registration->group_size() > 1 ) { |
|
1179 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1177 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1178 | + if ($this->_registration->group_size() > 1) { |
|
1179 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1180 | 1180 | } |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1197,23 +1197,23 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | //let's get an array of all possible buttons that we can just reference |
1199 | 1199 | $status_buttons = $this->_get_reg_status_buttons(); |
1200 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1201 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1200 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1201 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1202 | 1202 | $template_args['attendee'] = $this->_registration->attendee(); |
1203 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1204 | - if ( $this->_set_registration_object() ) { |
|
1203 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1204 | + if ($this->_set_registration_object()) { |
|
1205 | 1205 | $current_status = $this->_registration->status_ID(); |
1206 | - unset( $status_buttons[$current_status] ); |
|
1207 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1208 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1206 | + unset($status_buttons[$current_status]); |
|
1207 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1208 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1209 | 1209 | } |
1210 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1210 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1211 | 1211 | } |
1212 | 1212 | $template_args['form_url'] = REG_ADMIN_URL; |
1213 | 1213 | $template_args['REG_ID'] = $this->_registration->ID(); |
1214 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1214 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1215 | 1215 | |
1216 | - EEH_Template::display_template( $template, $template_args ); |
|
1216 | + EEH_Template::display_template($template, $template_args); |
|
1217 | 1217 | |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1227,11 +1227,11 @@ discard block |
||
1227 | 1227 | private function _get_reg_status_buttons() { |
1228 | 1228 | |
1229 | 1229 | $buttons = array( |
1230 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1231 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1232 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1233 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1234 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1230 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1231 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1232 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1233 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1234 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1235 | 1235 | ); |
1236 | 1236 | return $buttons; |
1237 | 1237 | } |
@@ -1245,13 +1245,13 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @return array (array with reg_id(s) updated and whether update was successful. |
1247 | 1247 | */ |
1248 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1249 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1248 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1249 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1250 | 1250 | |
1251 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1251 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1252 | 1252 | |
1253 | 1253 | //notify? |
1254 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1254 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1255 | 1255 | $this->_process_resend_registration(); |
1256 | 1256 | } |
1257 | 1257 | |
@@ -1269,19 +1269,19 @@ discard block |
||
1269 | 1269 | * @param bool $status |
1270 | 1270 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1271 | 1271 | */ |
1272 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1272 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1273 | 1273 | $success = true; |
1274 | 1274 | // set default status if none is passed |
1275 | 1275 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1276 | 1276 | |
1277 | 1277 | //typecast and sanitize reg_id |
1278 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1278 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1279 | 1279 | |
1280 | 1280 | //loop through REG_ID's and change status |
1281 | - foreach ( $reg_ids as $r_id ) { |
|
1282 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1283 | - if ( $registration instanceof EE_Registration ) { |
|
1284 | - $registration->set_status( $status ); |
|
1281 | + foreach ($reg_ids as $r_id) { |
|
1282 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1283 | + if ($registration instanceof EE_Registration) { |
|
1284 | + $registration->set_status($status); |
|
1285 | 1285 | $result = $registration->save(); |
1286 | 1286 | |
1287 | 1287 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $this->_req_data['_REG_ID'] = $reg_ids; |
1294 | 1294 | |
1295 | 1295 | //return $success and processed registrations |
1296 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1296 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | |
@@ -1305,37 +1305,37 @@ discard block |
||
1305 | 1305 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1306 | 1306 | * @return void |
1307 | 1307 | */ |
1308 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1308 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1309 | 1309 | |
1310 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1310 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1311 | 1311 | |
1312 | 1312 | |
1313 | - $success = isset( $result['success'] ) && $result['success']; |
|
1313 | + $success = isset($result['success']) && $result['success']; |
|
1314 | 1314 | |
1315 | 1315 | //setup success message |
1316 | - if ( $success ) { |
|
1317 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1318 | - EE_Error::add_success( $msg ); |
|
1316 | + if ($success) { |
|
1317 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1318 | + EE_Error::add_success($msg); |
|
1319 | 1319 | } else { |
1320 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1320 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1323 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1324 | 1324 | //unset nonces |
1325 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1326 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1327 | - unset( $this->_req_data[$ref] ); |
|
1325 | + foreach ($this->_req_data as $ref => $value) { |
|
1326 | + if (strpos($ref, 'nonce') !== false) { |
|
1327 | + unset($this->_req_data[$ref]); |
|
1328 | 1328 | continue; |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1331 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1332 | 1332 | $this->_req_data[$ref] = $value; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | //merge request vars so that the reloaded list table contains any existing filter query params |
1336 | - $route = array_merge( $this->_req_data, $route ); |
|
1336 | + $route = array_merge($this->_req_data, $route); |
|
1337 | 1337 | |
1338 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1338 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | |
@@ -1347,29 +1347,29 @@ discard block |
||
1347 | 1347 | protected function _change_reg_status() { |
1348 | 1348 | $this->_req_data['return'] = 'view_registration'; |
1349 | 1349 | //set notify based on whether the send notifications toggle is set or not |
1350 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1351 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1350 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1351 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1352 | 1352 | |
1353 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1354 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1355 | - $this->approve_registration( $notify ); |
|
1353 | + switch ($this->_req_data['_reg_status_id']) { |
|
1354 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1355 | + $this->approve_registration($notify); |
|
1356 | 1356 | break; |
1357 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1358 | - $this->pending_registration( $notify ); |
|
1357 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1358 | + $this->pending_registration($notify); |
|
1359 | 1359 | break; |
1360 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1361 | - $this->not_approve_registration( $notify ); |
|
1360 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1361 | + $this->not_approve_registration($notify); |
|
1362 | 1362 | break; |
1363 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1364 | - $this->decline_registration( $notify ); |
|
1363 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1364 | + $this->decline_registration($notify); |
|
1365 | 1365 | break; |
1366 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1367 | - $this->cancel_registration( $notify ); |
|
1366 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1367 | + $this->cancel_registration($notify); |
|
1368 | 1368 | break; |
1369 | 1369 | default : |
1370 | 1370 | $result['success'] = false; |
1371 | - unset( $this->_req_data['return'] ); |
|
1372 | - $this->_reg_status_change_return( '', false ); |
|
1371 | + unset($this->_req_data['return']); |
|
1372 | + $this->_reg_status_change_return('', false); |
|
1373 | 1373 | break; |
1374 | 1374 | } |
1375 | 1375 | } |
@@ -1382,8 +1382,8 @@ discard block |
||
1382 | 1382 | * @param bool $notify whether or not to notify the registrant about their approval. |
1383 | 1383 | * @return void |
1384 | 1384 | */ |
1385 | - protected function approve_registration( $notify = false ) { |
|
1386 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1385 | + protected function approve_registration($notify = false) { |
|
1386 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | * @param bool $notify whether or not to notify the registrant about their approval. |
1396 | 1396 | * @return void |
1397 | 1397 | */ |
1398 | - protected function decline_registration( $notify = false ) { |
|
1399 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1398 | + protected function decline_registration($notify = false) { |
|
1399 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | |
@@ -1408,8 +1408,8 @@ discard block |
||
1408 | 1408 | * @param bool $notify whether or not to notify the registrant about their approval. |
1409 | 1409 | * @return void |
1410 | 1410 | */ |
1411 | - protected function cancel_registration( $notify = false ) { |
|
1412 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1411 | + protected function cancel_registration($notify = false) { |
|
1412 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | |
@@ -1422,8 +1422,8 @@ discard block |
||
1422 | 1422 | * @param bool $notify whether or not to notify the registrant about their approval. |
1423 | 1423 | * @return void |
1424 | 1424 | */ |
1425 | - protected function not_approve_registration( $notify = false ) { |
|
1426 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1425 | + protected function not_approve_registration($notify = false) { |
|
1426 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | * @param bool $notify whether or not to notify the registrant about their approval. |
1435 | 1435 | * @return void |
1436 | 1436 | */ |
1437 | - protected function pending_registration( $notify = false ) { |
|
1438 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1437 | + protected function pending_registration($notify = false) { |
|
1438 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | |
@@ -1449,75 +1449,75 @@ discard block |
||
1449 | 1449 | public function _reg_details_meta_box() { |
1450 | 1450 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1451 | 1451 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1452 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1452 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1453 | 1453 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1454 | 1454 | $this->_session = $transaction->session_data(); |
1455 | 1455 | |
1456 | 1456 | $filters = new EE_Line_Item_Filter_Collection(); |
1457 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1458 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1459 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1457 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1458 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1459 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1460 | 1460 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1461 | 1461 | |
1462 | 1462 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1463 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1464 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1463 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1464 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1465 | 1465 | |
1466 | 1466 | |
1467 | 1467 | $attendee = $this->_registration->attendee(); |
1468 | 1468 | |
1469 | 1469 | |
1470 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1471 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1470 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1471 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1472 | 1472 | |
1473 | 1473 | |
1474 | 1474 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1475 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1475 | + $payment = $transaction->get_first_related('Payment'); |
|
1476 | 1476 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1477 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1477 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1478 | 1478 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1479 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1479 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1480 | 1480 | $reg_details = array( |
1481 | 1481 | 'payment_method' => $payment_method->name(), |
1482 | 1482 | 'response_msg' => $payment->gateway_response(), |
1483 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1483 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1484 | 1484 | 'registration_session' => $this->_registration->session_ID(), |
1485 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1486 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1485 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1486 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1487 | 1487 | ); |
1488 | 1488 | |
1489 | 1489 | |
1490 | - if ( isset( $reg_details['registration_id'] )) { |
|
1490 | + if (isset($reg_details['registration_id'])) { |
|
1491 | 1491 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1492 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1492 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1493 | 1493 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1494 | 1494 | } |
1495 | 1495 | |
1496 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1496 | + if (isset($reg_details['payment_method'])) { |
|
1497 | 1497 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1498 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1498 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1499 | 1499 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1500 | 1500 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1501 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1501 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1502 | 1502 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1506 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1506 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1507 | 1507 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1508 | 1508 | |
1509 | 1509 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1510 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1510 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1511 | 1511 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1512 | 1512 | |
1513 | 1513 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1514 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1514 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1515 | 1515 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1516 | 1516 | |
1517 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1517 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1518 | 1518 | |
1519 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1520 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1519 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1520 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1521 | 1521 | |
1522 | 1522 | } |
1523 | 1523 | |
@@ -1531,14 +1531,14 @@ discard block |
||
1531 | 1531 | */ |
1532 | 1532 | public function _reg_questions_meta_box() { |
1533 | 1533 | //allow someone to override this method entirely |
1534 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1535 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1536 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1534 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1535 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1536 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1537 | 1537 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1538 | 1538 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1539 | 1539 | |
1540 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1541 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1540 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1541 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1542 | 1542 | } |
1543 | 1543 | } |
1544 | 1544 | |
@@ -1552,12 +1552,12 @@ discard block |
||
1552 | 1552 | * @param string $output |
1553 | 1553 | * @return string |
1554 | 1554 | */ |
1555 | - public function form_before_question_group( $output ) { |
|
1555 | + public function form_before_question_group($output) { |
|
1556 | 1556 | EE_Error::doing_it_wrong( |
1557 | - __CLASS__ . '::' . __FUNCTION__, |
|
1558 | - __( 'This method would have been protected but was used on a filter callback' |
|
1557 | + __CLASS__.'::'.__FUNCTION__, |
|
1558 | + __('This method would have been protected but was used on a filter callback' |
|
1559 | 1559 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1560 | - 'event_espresso' ), |
|
1560 | + 'event_espresso'), |
|
1561 | 1561 | '4.8.32.rc.000' |
1562 | 1562 | ); |
1563 | 1563 | return ' |
@@ -1576,20 +1576,20 @@ discard block |
||
1576 | 1576 | * @param string $output |
1577 | 1577 | * @return string |
1578 | 1578 | */ |
1579 | - public function form_after_question_group( $output ) { |
|
1579 | + public function form_after_question_group($output) { |
|
1580 | 1580 | EE_Error::doing_it_wrong( |
1581 | - __CLASS__ . '::' . __FUNCTION__, |
|
1582 | - __( 'This method would have been protected but was used on a filter callback' |
|
1581 | + __CLASS__.'::'.__FUNCTION__, |
|
1582 | + __('This method would have been protected but was used on a filter callback' |
|
1583 | 1583 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1584 | - 'event_espresso' ), |
|
1584 | + 'event_espresso'), |
|
1585 | 1585 | '4.8.32.rc.000' |
1586 | 1586 | ); |
1587 | 1587 | return ' |
1588 | 1588 | <tr class="hide-if-no-js"> |
1589 | 1589 | <th> </th> |
1590 | 1590 | <td class="reg-admin-edit-attendee-question-td"> |
1591 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1592 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1591 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1592 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1593 | 1593 | <div class="dashicons dashicons-edit"></div> |
1594 | 1594 | </a> |
1595 | 1595 | </td> |
@@ -1609,18 +1609,18 @@ discard block |
||
1609 | 1609 | * @param string $label |
1610 | 1610 | * @return string |
1611 | 1611 | */ |
1612 | - public function form_form_field_label_wrap( $label ) { |
|
1612 | + public function form_form_field_label_wrap($label) { |
|
1613 | 1613 | EE_Error::doing_it_wrong( |
1614 | - __CLASS__ . '::' . __FUNCTION__, |
|
1615 | - __( 'This method would have been protected but was used on a filter callback' |
|
1614 | + __CLASS__.'::'.__FUNCTION__, |
|
1615 | + __('This method would have been protected but was used on a filter callback' |
|
1616 | 1616 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1617 | - 'event_espresso' ), |
|
1617 | + 'event_espresso'), |
|
1618 | 1618 | '4.8.32.rc.000' |
1619 | 1619 | ); |
1620 | 1620 | return ' |
1621 | 1621 | <tr> |
1622 | 1622 | <th> |
1623 | - ' . $label . ' |
|
1623 | + ' . $label.' |
|
1624 | 1624 | </th>'; |
1625 | 1625 | } |
1626 | 1626 | |
@@ -1634,17 +1634,17 @@ discard block |
||
1634 | 1634 | * @param string $input |
1635 | 1635 | * @return string |
1636 | 1636 | */ |
1637 | - public function form_form_field_input__wrap( $input ) { |
|
1637 | + public function form_form_field_input__wrap($input) { |
|
1638 | 1638 | EE_Error::doing_it_wrong( |
1639 | - __CLASS__ . '::' . __FUNCTION__, |
|
1640 | - __( 'This method would have been protected but was used on a filter callback' |
|
1639 | + __CLASS__.'::'.__FUNCTION__, |
|
1640 | + __('This method would have been protected but was used on a filter callback' |
|
1641 | 1641 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1642 | - 'event_espresso' ), |
|
1642 | + 'event_espresso'), |
|
1643 | 1643 | '4.8.32.rc.000' |
1644 | 1644 | ); |
1645 | 1645 | return ' |
1646 | 1646 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1647 | - ' . $input . ' |
|
1647 | + ' . $input.' |
|
1648 | 1648 | </td> |
1649 | 1649 | </tr>'; |
1650 | 1650 | } |
@@ -1658,14 +1658,14 @@ discard block |
||
1658 | 1658 | * @return void |
1659 | 1659 | */ |
1660 | 1660 | protected function _update_attendee_registration_form() { |
1661 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1662 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1663 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1664 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1665 | - if( $success ) { |
|
1661 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1662 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1663 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1664 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1665 | + if ($success) { |
|
1666 | 1666 | $what = __('Registration Form', 'event_espresso'); |
1667 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1668 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1667 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1668 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1669 | 1669 | } |
1670 | 1670 | } |
1671 | 1671 | } |
@@ -1676,11 +1676,11 @@ discard block |
||
1676 | 1676 | * @param int $REG_ID |
1677 | 1677 | * @return EE_Registration_Custom_Questions_Form |
1678 | 1678 | */ |
1679 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1680 | - if( ! $this->_reg_custom_questions_form ) { |
|
1681 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1682 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1683 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1679 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1680 | + if ( ! $this->_reg_custom_questions_form) { |
|
1681 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1682 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1683 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1684 | 1684 | } |
1685 | 1685 | return $this->_reg_custom_questions_form; |
1686 | 1686 | } |
@@ -1693,17 +1693,17 @@ discard block |
||
1693 | 1693 | * @param bool $REG_ID |
1694 | 1694 | * @return bool |
1695 | 1695 | */ |
1696 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1696 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1697 | 1697 | |
1698 | 1698 | if ( ! $REG_ID) { |
1699 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1699 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1700 | 1700 | } |
1701 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1702 | - $form->receive_form_submission( $this->_req_data ); |
|
1701 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1702 | + $form->receive_form_submission($this->_req_data); |
|
1703 | 1703 | $success = false; |
1704 | - if( $form->is_valid() ) { |
|
1705 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1706 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1704 | + if ($form->is_valid()) { |
|
1705 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1706 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1707 | 1707 | $where_conditions = array( |
1708 | 1708 | 'QST_ID' => $question_id, |
1709 | 1709 | 'REG_ID' => $REG_ID |
@@ -1711,19 +1711,19 @@ discard block |
||
1711 | 1711 | $possibly_new_values = array( |
1712 | 1712 | 'ANS_value' => $input->normalized_value() |
1713 | 1713 | ); |
1714 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1715 | - if( $answer instanceof EE_Answer ) { |
|
1716 | - $success = $answer->save( $possibly_new_values ); |
|
1714 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1715 | + if ($answer instanceof EE_Answer) { |
|
1716 | + $success = $answer->save($possibly_new_values); |
|
1717 | 1717 | } else { |
1718 | 1718 | //insert it then |
1719 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1720 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1719 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1720 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1721 | 1721 | $success = $answer->save(); |
1722 | 1722 | } |
1723 | 1723 | } |
1724 | 1724 | } |
1725 | 1725 | } else { |
1726 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1726 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1727 | 1727 | } |
1728 | 1728 | return $success; |
1729 | 1729 | } |
@@ -1741,29 +1741,29 @@ discard block |
||
1741 | 1741 | $registrations = $REG->get_all(array( |
1742 | 1742 | array( |
1743 | 1743 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1744 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1744 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1745 | 1745 | ), |
1746 | 1746 | 'force_join'=>array('Attendee'))); |
1747 | 1747 | |
1748 | 1748 | $this->_template_args['attendees'] = array(); |
1749 | 1749 | $this->_template_args['attendee_notice'] = ''; |
1750 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1751 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1750 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1751 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1752 | 1752 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1753 | 1753 | } else { |
1754 | 1754 | |
1755 | 1755 | $att_nmbr = 1; |
1756 | - foreach ( $registrations as $registration ) { |
|
1756 | + foreach ($registrations as $registration) { |
|
1757 | 1757 | /* @var $registration EE_Registration */ |
1758 | 1758 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1759 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1760 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1761 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1762 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1759 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1760 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1761 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1762 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1763 | 1763 | |
1764 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1764 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1765 | 1765 | |
1766 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1766 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1767 | 1767 | |
1768 | 1768 | $att_nmbr++; |
1769 | 1769 | } |
@@ -1775,8 +1775,8 @@ discard block |
||
1775 | 1775 | |
1776 | 1776 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1777 | 1777 | } |
1778 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1779 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1778 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1779 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1780 | 1780 | |
1781 | 1781 | } |
1782 | 1782 | |
@@ -1797,11 +1797,11 @@ discard block |
||
1797 | 1797 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1798 | 1798 | |
1799 | 1799 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1800 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1800 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1801 | 1801 | $primary_registration = $this->_registration->get_primary_registration(); |
1802 | 1802 | $primary_attendee = $primary_registration->attendee(); |
1803 | 1803 | |
1804 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1804 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1805 | 1805 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1806 | 1806 | $primary_registration = NULL; |
1807 | 1807 | } |
@@ -1810,27 +1810,27 @@ discard block |
||
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1813 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1814 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1815 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1813 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1814 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1815 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1816 | 1816 | $this->_template_args['phone'] = $attendee->phone(); |
1817 | 1817 | |
1818 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1818 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1819 | 1819 | |
1820 | 1820 | |
1821 | 1821 | //edit link |
1822 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1822 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1823 | 1823 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
1824 | 1824 | |
1825 | 1825 | //create link |
1826 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1826 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1827 | 1827 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1828 | 1828 | |
1829 | 1829 | $this->_template_args['att_check'] = $att_check; |
1830 | 1830 | |
1831 | 1831 | |
1832 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1833 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1832 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1833 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1834 | 1834 | } |
1835 | 1835 | |
1836 | 1836 | |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | * @access protected |
1844 | 1844 | * @return void |
1845 | 1845 | */ |
1846 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1846 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1847 | 1847 | $REGM = EEM_Registration::instance(); |
1848 | 1848 | |
1849 | 1849 | $success = 1; |
@@ -1853,26 +1853,26 @@ discard block |
||
1853 | 1853 | $dtts = array(); |
1854 | 1854 | |
1855 | 1855 | //if empty _REG_ID then get out because there's nothing to do |
1856 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1856 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1857 | 1857 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1858 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1859 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1858 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1859 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1860 | 1860 | } |
1861 | 1861 | |
1862 | 1862 | //Checkboxes |
1863 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1863 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1864 | 1864 | // if array has more than one element than success message should be plural |
1865 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1865 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1866 | 1866 | // cycle thru checkboxes |
1867 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1867 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1868 | 1868 | |
1869 | 1869 | $REG = $REGM->get_one_by_ID($REG_ID); |
1870 | 1870 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1871 | - if ( $payment_count > 0 ) { |
|
1872 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1871 | + if ($payment_count > 0) { |
|
1872 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1873 | 1873 | $error = 1; |
1874 | 1874 | $success = 0; |
1875 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1875 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1876 | 1876 | continue; //can't trash this registration because it has payments. |
1877 | 1877 | } |
1878 | 1878 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1881,7 +1881,7 @@ discard block |
||
1881 | 1881 | $dtts = array_merge($dtts, $dtt); |
1882 | 1882 | |
1883 | 1883 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1884 | - if ( !$updated ) { |
|
1884 | + if ( ! $updated) { |
|
1885 | 1885 | $success = 0; |
1886 | 1886 | } else { |
1887 | 1887 | $success = 2; |
@@ -1896,7 +1896,7 @@ discard block |
||
1896 | 1896 | $tickets[$ticket->ID()] = $ticket; |
1897 | 1897 | $dtts = $ticket->get_many_related('Datetime'); |
1898 | 1898 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1899 | - if ( ! $updated ) { |
|
1899 | + if ( ! $updated) { |
|
1900 | 1900 | $success = 0; |
1901 | 1901 | } |
1902 | 1902 | |
@@ -1906,10 +1906,10 @@ discard block |
||
1906 | 1906 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1907 | 1907 | EEM_Datetime::instance()->update_sold($dtts); |
1908 | 1908 | |
1909 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1910 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1909 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1910 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1911 | 1911 | $overwrite_msgs = $error ? TRUE : FALSE; |
1912 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1912 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1933,16 +1933,16 @@ discard block |
||
1933 | 1933 | $success = 1; |
1934 | 1934 | |
1935 | 1935 | //Checkboxes |
1936 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1936 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1937 | 1937 | // if array has more than one element than success message should be plural |
1938 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1938 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1939 | 1939 | // cycle thru checkboxes |
1940 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1940 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1941 | 1941 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1942 | - if ( ! $REG instanceof EE_Registration ) |
|
1942 | + if ( ! $REG instanceof EE_Registration) |
|
1943 | 1943 | continue; |
1944 | 1944 | $deleted = $this->_delete_registration($REG); |
1945 | - if ( !$deleted ) { |
|
1945 | + if ( ! $deleted) { |
|
1946 | 1946 | $success = 0; |
1947 | 1947 | } |
1948 | 1948 | } |
@@ -1952,15 +1952,15 @@ discard block |
||
1952 | 1952 | $REG_ID = $this->_req_data['_REG_ID']; |
1953 | 1953 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1954 | 1954 | $deleted = $this->_delete_registration($REG); |
1955 | - if ( ! $deleted ) { |
|
1955 | + if ( ! $deleted) { |
|
1956 | 1956 | $success = 0; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | 1959 | } |
1960 | 1960 | |
1961 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1962 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1963 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1961 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1962 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1963 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | |
@@ -1972,31 +1972,31 @@ discard block |
||
1972 | 1972 | * @param EE_Registration $REG registration to be deleted permenantly |
1973 | 1973 | * @return boolean true = successful deletion, false = fail. |
1974 | 1974 | */ |
1975 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1975 | + protected function _delete_registration(EE_Registration $REG) { |
|
1976 | 1976 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1977 | 1977 | $TXN = $REG->get_first_related('Transaction'); |
1978 | 1978 | $REGS = $TXN->get_many_related('Registration'); |
1979 | 1979 | |
1980 | 1980 | $all_trashed = TRUE; |
1981 | - foreach ( $REGS as $registration ) { |
|
1982 | - if ( ! $registration->get('REG_deleted') ) |
|
1981 | + foreach ($REGS as $registration) { |
|
1982 | + if ( ! $registration->get('REG_deleted')) |
|
1983 | 1983 | $all_trashed = FALSE; |
1984 | 1984 | } |
1985 | 1985 | |
1986 | - if ( ! $all_trashed ) { |
|
1987 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1986 | + if ( ! $all_trashed) { |
|
1987 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1988 | 1988 | return false; |
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1992 | - foreach ( $REGS as $registration ) { |
|
1992 | + foreach ($REGS as $registration) { |
|
1993 | 1993 | |
1994 | 1994 | //delete related answers |
1995 | 1995 | $registration->delete_related_permanently('Answer'); |
1996 | 1996 | |
1997 | 1997 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1998 | 1998 | $attendee = $registration->get_first_related('Attendee'); |
1999 | - if ( $attendee instanceof EE_Attendee ) { |
|
1999 | + if ($attendee instanceof EE_Attendee) { |
|
2000 | 2000 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2001 | 2001 | } |
2002 | 2002 | |
@@ -2006,7 +2006,7 @@ discard block |
||
2006 | 2006 | //now delete permanently the checkins related to this registration. |
2007 | 2007 | $registration->delete_related_permanently('Checkin'); |
2008 | 2008 | |
2009 | - if ( $registration->ID() === $REG->ID() ) |
|
2009 | + if ($registration->ID() === $REG->ID()) |
|
2010 | 2010 | continue; //we don't want to delete permanently the existing registration just yet. |
2011 | 2011 | |
2012 | 2012 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2039,35 +2039,35 @@ discard block |
||
2039 | 2039 | * @return void |
2040 | 2040 | */ |
2041 | 2041 | public function new_registration() { |
2042 | - if ( ! $this->_set_reg_event() ) { |
|
2043 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2042 | + if ( ! $this->_set_reg_event()) { |
|
2043 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2044 | 2044 | } |
2045 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2045 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2046 | 2046 | // gotta start with a clean slate if we're not coming here via ajax |
2047 | 2047 | if ( |
2048 | - ! defined('DOING_AJAX' ) |
|
2049 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2048 | + ! defined('DOING_AJAX') |
|
2049 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2050 | 2050 | ) { |
2051 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2051 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2052 | 2052 | } |
2053 | 2053 | |
2054 | - $this->_template_args['event_name'] = '' ; |
|
2054 | + $this->_template_args['event_name'] = ''; |
|
2055 | 2055 | // event name |
2056 | - if ( $this->_reg_event ) { |
|
2056 | + if ($this->_reg_event) { |
|
2057 | 2057 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2058 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2059 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2060 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2058 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2059 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2060 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2061 | 2061 | } |
2062 | 2062 | |
2063 | 2063 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2064 | 2064 | |
2065 | - if ( defined('DOING_AJAX' ) ) { |
|
2065 | + if (defined('DOING_AJAX')) { |
|
2066 | 2066 | $this->_return_json(); |
2067 | 2067 | } |
2068 | 2068 | // grab header |
2069 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2070 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2069 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2070 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2071 | 2071 | |
2072 | 2072 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2073 | 2073 | // the details template wrapper |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | * @return string html |
2085 | 2085 | */ |
2086 | 2086 | protected function _get_registration_step_content() { |
2087 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2087 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2088 | 2088 | $warning_msg = sprintf( |
2089 | 2089 | __( |
2090 | 2090 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2100,7 +2100,7 @@ discard block |
||
2100 | 2100 | '</b>' |
2101 | 2101 | ); |
2102 | 2102 | return ' |
2103 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2103 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2104 | 2104 | <script > |
2105 | 2105 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2106 | 2106 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2135,16 +2135,16 @@ discard block |
||
2135 | 2135 | $cart = EE_Registry::instance()->SSN->cart(); |
2136 | 2136 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2137 | 2137 | |
2138 | - switch ( $step ) { |
|
2138 | + switch ($step) { |
|
2139 | 2139 | case 'ticket' : |
2140 | 2140 | $hidden_fields['processing_registration']['value'] = 1; |
2141 | 2141 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2142 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2142 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2143 | 2143 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2144 | 2144 | $template_args['show_notification_toggle'] = FALSE; |
2145 | 2145 | break; |
2146 | 2146 | case 'questions' : |
2147 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2147 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2148 | 2148 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2149 | 2149 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2150 | 2150 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2153,10 +2153,10 @@ discard block |
||
2153 | 2153 | break; |
2154 | 2154 | } |
2155 | 2155 | |
2156 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2156 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2157 | 2157 | |
2158 | 2158 | return EEH_Template::display_template( |
2159 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2159 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2160 | 2160 | ); |
2161 | 2161 | } |
2162 | 2162 | |
@@ -2171,11 +2171,11 @@ discard block |
||
2171 | 2171 | * @return boolean |
2172 | 2172 | */ |
2173 | 2173 | private function _set_reg_event() { |
2174 | - if ( is_object( $this->_reg_event )) { |
|
2174 | + if (is_object($this->_reg_event)) { |
|
2175 | 2175 | return TRUE; |
2176 | 2176 | } |
2177 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2178 | - if ( ! $EVT_ID ) { |
|
2177 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2178 | + if ( ! $EVT_ID) { |
|
2179 | 2179 | return FALSE; |
2180 | 2180 | } |
2181 | 2181 | |
@@ -2196,82 +2196,82 @@ discard block |
||
2196 | 2196 | public function process_reg_step() { |
2197 | 2197 | EE_System::do_not_cache(); |
2198 | 2198 | $this->_set_reg_event(); |
2199 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2199 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2200 | 2200 | |
2201 | 2201 | //what step are we on? |
2202 | 2202 | $cart = EE_Registry::instance()->SSN->cart(); |
2203 | 2203 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2204 | 2204 | |
2205 | 2205 | //if doing ajax then we need to verify the nonce |
2206 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2207 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2208 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2206 | + if (defined('DOING_AJAX')) { |
|
2207 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2208 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2209 | 2209 | } |
2210 | 2210 | |
2211 | - switch ( $step ) { |
|
2211 | + switch ($step) { |
|
2212 | 2212 | |
2213 | 2213 | case 'ticket' : |
2214 | 2214 | //process ticket selection |
2215 | 2215 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2216 | - if ( $success ) { |
|
2217 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2216 | + if ($success) { |
|
2217 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2218 | 2218 | } else { |
2219 | 2219 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2220 | 2220 | } |
2221 | - if ( defined('DOING_AJAX') ) { |
|
2221 | + if (defined('DOING_AJAX')) { |
|
2222 | 2222 | $this->new_registration(); //display next step |
2223 | 2223 | } else { |
2224 | 2224 | $query_args['action'] = 'new_registration'; |
2225 | 2225 | $query_args['processing_registration'] = 1; |
2226 | 2226 | $query_args['event_id'] = $this->_reg_event->ID(); |
2227 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2227 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2228 | 2228 | } |
2229 | 2229 | break; |
2230 | 2230 | |
2231 | 2231 | case 'questions' : |
2232 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2233 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2232 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2233 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2234 | 2234 | } |
2235 | 2235 | //process registration |
2236 | 2236 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2237 | - if ( $cart instanceof EE_Cart ) { |
|
2237 | + if ($cart instanceof EE_Cart) { |
|
2238 | 2238 | $grand_total = $cart->get_cart_grand_total(); |
2239 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2239 | + if ($grand_total instanceof EE_Line_Item) { |
|
2240 | 2240 | $grand_total->save_this_and_descendants_to_txn(); |
2241 | 2241 | } |
2242 | 2242 | } |
2243 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2243 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2244 | 2244 | $query_args = array( |
2245 | 2245 | 'action' => 'new_registration', |
2246 | 2246 | 'processing_registration' => 2, |
2247 | 2247 | 'event_id' => $this->_reg_event->ID() |
2248 | 2248 | ); |
2249 | 2249 | |
2250 | - if ( defined('DOING_AJAX' )) { |
|
2250 | + if (defined('DOING_AJAX')) { |
|
2251 | 2251 | //display registration form again because there are errors (maybe validation?) |
2252 | 2252 | $this->new_registration(); |
2253 | 2253 | return; |
2254 | 2254 | } else { |
2255 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2255 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2256 | 2256 | return; |
2257 | 2257 | } |
2258 | 2258 | } |
2259 | 2259 | /** @type EE_Transaction_Payments $transaction_payments */ |
2260 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2260 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2261 | 2261 | // maybe update status, and make sure to save transaction if not done already |
2262 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2262 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2263 | 2263 | $transaction->save(); |
2264 | 2264 | } |
2265 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2265 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2266 | 2266 | $this->_req_data = array(); |
2267 | 2267 | $query_args = array( |
2268 | 2268 | 'action' => 'redirect_to_txn', |
2269 | 2269 | 'TXN_ID' => $transaction->ID(), |
2270 | 2270 | 'EVT_ID' => $this->_reg_event->ID(), |
2271 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2271 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2272 | 2272 | 'redirect_from' => 'new_registration' |
2273 | 2273 | ); |
2274 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2274 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2275 | 2275 | break; |
2276 | 2276 | } |
2277 | 2277 | |
@@ -2288,21 +2288,21 @@ discard block |
||
2288 | 2288 | */ |
2289 | 2289 | public function redirect_to_txn() { |
2290 | 2290 | EE_System::do_not_cache(); |
2291 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2291 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2292 | 2292 | $query_args = array( |
2293 | 2293 | 'action' => 'view_transaction', |
2294 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2294 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2295 | 2295 | 'page' => 'espresso_transactions' |
2296 | 2296 | ); |
2297 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2298 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2299 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2300 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2297 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2298 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2299 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2300 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2301 | 2301 | } |
2302 | 2302 | EE_Error::add_success( |
2303 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2303 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2304 | 2304 | ); |
2305 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2305 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2306 | 2306 | } |
2307 | 2307 | |
2308 | 2308 | |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | * @return void |
2314 | 2314 | */ |
2315 | 2315 | protected function _attendee_contact_list_table() { |
2316 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2316 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2317 | 2317 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2318 | 2318 | $this->display_admin_list_table_page_with_no_sidebar(); |
2319 | 2319 | } |
@@ -2328,10 +2328,10 @@ discard block |
||
2328 | 2328 | * @access public |
2329 | 2329 | * @return array |
2330 | 2330 | */ |
2331 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2331 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2332 | 2332 | |
2333 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2334 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2333 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2334 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2335 | 2335 | $ATT_MDL = EEM_Attendee::instance(); |
2336 | 2336 | |
2337 | 2337 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2359,47 +2359,47 @@ discard block |
||
2359 | 2359 | $orderby = 'ATT_lname'; |
2360 | 2360 | } |
2361 | 2361 | |
2362 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2362 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2363 | 2363 | |
2364 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2365 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2366 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2364 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2365 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2366 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2367 | 2367 | |
2368 | 2368 | $_where = array(); |
2369 | 2369 | |
2370 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2371 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2370 | + if (isset($this->_req_data['s'])) { |
|
2371 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2372 | 2372 | $_where['OR'] = array( |
2373 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2374 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2375 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2376 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2377 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2378 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2379 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2380 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2381 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2382 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2383 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2384 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2385 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2386 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2387 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2388 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2389 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2373 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2374 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2375 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2376 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2377 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2378 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2379 | + 'ATT_email' => array('LIKE', $sstr), |
|
2380 | + 'ATT_address' => array('LIKE', $sstr), |
|
2381 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2382 | + 'ATT_city' => array('LIKE', $sstr), |
|
2383 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2384 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2385 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2386 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2387 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2388 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2389 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2390 | 2390 | ); |
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | |
2394 | - $offset = ($current_page-1)*$per_page; |
|
2395 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2394 | + $offset = ($current_page - 1) * $per_page; |
|
2395 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2396 | 2396 | |
2397 | - if ( $trash ) { |
|
2398 | - $_where['status'] = array( '!=', 'publish' ); |
|
2399 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2397 | + if ($trash) { |
|
2398 | + $_where['status'] = array('!=', 'publish'); |
|
2399 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2400 | 2400 | } else { |
2401 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2402 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2401 | + $_where['status'] = array('IN', array('publish')); |
|
2402 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | return $all_attendees; |
@@ -2416,10 +2416,10 @@ discard block |
||
2416 | 2416 | */ |
2417 | 2417 | protected function _resend_registration() { |
2418 | 2418 | $this->_process_resend_registration(); |
2419 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2419 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2420 | 2420 | 'action' => 'default' |
2421 | 2421 | ); |
2422 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2422 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | |
@@ -2427,26 +2427,26 @@ discard block |
||
2427 | 2427 | |
2428 | 2428 | |
2429 | 2429 | |
2430 | - public function _registrations_report(){ |
|
2431 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2432 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2430 | + public function _registrations_report() { |
|
2431 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2432 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2433 | 2433 | array( |
2434 | 2434 | 'page' => 'espresso_batch', |
2435 | 2435 | 'batch' => 'file', |
2436 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2437 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2438 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2439 | - )) ); |
|
2436 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2437 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2438 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2439 | + ))); |
|
2440 | 2440 | } else { |
2441 | 2441 | $new_request_args = array( |
2442 | 2442 | 'export' => 'report', |
2443 | 2443 | 'action' => 'registrations_report_for_event', |
2444 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2444 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2445 | 2445 | ); |
2446 | 2446 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2447 | 2447 | |
2448 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2449 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2448 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2449 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2450 | 2450 | $EE_Export = EE_Export::instance($this->_req_data); |
2451 | 2451 | $EE_Export->export(); |
2452 | 2452 | } |
@@ -2455,26 +2455,26 @@ discard block |
||
2455 | 2455 | |
2456 | 2456 | |
2457 | 2457 | |
2458 | - public function _contact_list_export(){ |
|
2459 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2460 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2458 | + public function _contact_list_export() { |
|
2459 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2460 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2461 | 2461 | $EE_Export = EE_Export::instance($this->_req_data); |
2462 | 2462 | $EE_Export->export_attendees(); |
2463 | 2463 | } |
2464 | 2464 | } |
2465 | 2465 | |
2466 | - public function _contact_list_report(){ |
|
2467 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2468 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2466 | + public function _contact_list_report() { |
|
2467 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2468 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2469 | 2469 | array( |
2470 | 2470 | 'page' => 'espresso_batch', |
2471 | 2471 | 'batch' => 'file', |
2472 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2473 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2474 | - )) ); |
|
2472 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2473 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2474 | + ))); |
|
2475 | 2475 | } else { |
2476 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2477 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2476 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2477 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2478 | 2478 | $EE_Export = EE_Export::instance($this->_req_data); |
2479 | 2479 | $EE_Export->report_attendees(); |
2480 | 2480 | } |
@@ -2494,73 +2494,73 @@ discard block |
||
2494 | 2494 | * @return void |
2495 | 2495 | */ |
2496 | 2496 | protected function _duplicate_attendee() { |
2497 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2497 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2498 | 2498 | //verify we have necessary info |
2499 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2500 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2501 | - $query_args = array( 'action' => $action ); |
|
2499 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2500 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2501 | + $query_args = array('action' => $action); |
|
2502 | 2502 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2506 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2506 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2507 | 2507 | $attendee = $registration->attendee(); |
2508 | 2508 | |
2509 | 2509 | //remove relation of existing attendee on registration |
2510 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2510 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2511 | 2511 | //new attendee |
2512 | 2512 | $new_attendee = clone $attendee; |
2513 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2513 | + $new_attendee->set('ATT_ID', 0); |
|
2514 | 2514 | $new_attendee->save(); |
2515 | 2515 | |
2516 | 2516 | //add new attendee to reg |
2517 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2517 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2518 | 2518 | |
2519 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2519 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2520 | 2520 | |
2521 | 2521 | //redirect to edit page for attendee |
2522 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2522 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2523 | 2523 | |
2524 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2524 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2525 | 2525 | } |
2526 | 2526 | |
2527 | 2527 | |
2528 | 2528 | //related to cpt routes |
2529 | 2529 | protected function _insert_update_cpt_item($post_id, $post) { |
2530 | 2530 | $success = true; |
2531 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2531 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2532 | 2532 | //for attendee updates |
2533 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2533 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2534 | 2534 | //note we should only be UPDATING attendees at this point. |
2535 | 2535 | $updated_fields = array( |
2536 | 2536 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2537 | 2537 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2538 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2538 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2539 | 2539 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2540 | 2540 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2541 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2542 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2543 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2544 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2545 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2546 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2541 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2542 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2543 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2544 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2545 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2546 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2547 | 2547 | ); |
2548 | - foreach ( $updated_fields as $field => $value ) { |
|
2548 | + foreach ($updated_fields as $field => $value) { |
|
2549 | 2549 | $attendee->set($field, $value); |
2550 | 2550 | } |
2551 | 2551 | |
2552 | 2552 | $success = $attendee->save(); |
2553 | 2553 | |
2554 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2555 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2556 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2557 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2554 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2555 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2556 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2557 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2558 | 2558 | } |
2559 | 2559 | } |
2560 | 2560 | } |
2561 | 2561 | |
2562 | - if ( $success === FALSE ) |
|
2563 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2562 | + if ($success === FALSE) |
|
2563 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2564 | 2564 | |
2565 | 2565 | } |
2566 | 2566 | |
@@ -2580,17 +2580,17 @@ discard block |
||
2580 | 2580 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2581 | 2581 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2582 | 2582 | |
2583 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2584 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2583 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2584 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2585 | 2585 | } |
2586 | 2586 | |
2587 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2587 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2588 | 2588 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2589 | 2589 | } |
2590 | 2590 | |
2591 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2592 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2593 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2591 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2592 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2593 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2594 | 2594 | } |
2595 | 2595 | |
2596 | 2596 | |
@@ -2599,10 +2599,10 @@ discard block |
||
2599 | 2599 | * @param WP_Post $post wp post object |
2600 | 2600 | * @return string attendee contact info ( and form ) |
2601 | 2601 | */ |
2602 | - public function attendee_contact_info( $post ) { |
|
2602 | + public function attendee_contact_info($post) { |
|
2603 | 2603 | //get attendee object ( should already have it ) |
2604 | 2604 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2605 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2605 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2606 | 2606 | EEH_Template::display_template($template, $this->_template_args); |
2607 | 2607 | } |
2608 | 2608 | |
@@ -2618,12 +2618,12 @@ discard block |
||
2618 | 2618 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2619 | 2619 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2620 | 2620 | new EE_Question_Form_Input( |
2621 | - EE_Question::new_instance( array( |
|
2621 | + EE_Question::new_instance(array( |
|
2622 | 2622 | 'QST_ID' => 0, |
2623 | 2623 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2624 | 2624 | 'QST_system' => 'admin-state' |
2625 | 2625 | )), |
2626 | - EE_Answer::new_instance( array( |
|
2626 | + EE_Answer::new_instance(array( |
|
2627 | 2627 | 'ANS_ID' => 0, |
2628 | 2628 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2629 | 2629 | )), |
@@ -2636,12 +2636,12 @@ discard block |
||
2636 | 2636 | )); |
2637 | 2637 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2638 | 2638 | new EE_Question_Form_Input( |
2639 | - EE_Question::new_instance( array( |
|
2639 | + EE_Question::new_instance(array( |
|
2640 | 2640 | 'QST_ID' => 0, |
2641 | 2641 | 'QST_display_text' => __('Country', 'event_espresso'), |
2642 | 2642 | 'QST_system' => 'admin-country' |
2643 | 2643 | )), |
2644 | - EE_Answer::new_instance( array( |
|
2644 | + EE_Answer::new_instance(array( |
|
2645 | 2645 | 'ANS_ID' => 0, |
2646 | 2646 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2647 | 2647 | )), |
@@ -2652,8 +2652,8 @@ discard block |
||
2652 | 2652 | 'append_qstn_id' => FALSE |
2653 | 2653 | ) |
2654 | 2654 | )); |
2655 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2656 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2655 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2656 | + EEH_Template::display_template($template, $this->_template_args); |
|
2657 | 2657 | |
2658 | 2658 | } |
2659 | 2659 | |
@@ -2663,11 +2663,11 @@ discard block |
||
2663 | 2663 | * @access protected |
2664 | 2664 | * @return void |
2665 | 2665 | */ |
2666 | - public function attendee_registrations_meta_box( $post ) { |
|
2666 | + public function attendee_registrations_meta_box($post) { |
|
2667 | 2667 | |
2668 | 2668 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2669 | 2669 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2670 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2670 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2671 | 2671 | EEH_Template::display_template($template, $this->_template_args); |
2672 | 2672 | |
2673 | 2673 | } |
@@ -2681,8 +2681,8 @@ discard block |
||
2681 | 2681 | * @return string html for new form. |
2682 | 2682 | */ |
2683 | 2683 | public function after_title_form_fields($post) { |
2684 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2685 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2684 | + if ($post->post_type == 'espresso_attendees') { |
|
2685 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2686 | 2686 | $template_args['attendee'] = $this->_cpt_model_obj; |
2687 | 2687 | EEH_Template::display_template($template, $template_args); |
2688 | 2688 | } |
@@ -2699,21 +2699,21 @@ discard block |
||
2699 | 2699 | * @access protected |
2700 | 2700 | * @return void |
2701 | 2701 | */ |
2702 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2702 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2703 | 2703 | |
2704 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2704 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2705 | 2705 | |
2706 | 2706 | $ATT_MDL = EEM_Attendee::instance(); |
2707 | 2707 | |
2708 | 2708 | $success = 1; |
2709 | 2709 | //Checkboxes |
2710 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2710 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2711 | 2711 | // if array has more than one element than success message should be plural |
2712 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2712 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2713 | 2713 | // cycle thru checkboxes |
2714 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2715 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2716 | - if ( !$updated ) { |
|
2714 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2715 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2716 | + if ( ! $updated) { |
|
2717 | 2717 | $success = 0; |
2718 | 2718 | } |
2719 | 2719 | } |
@@ -2722,18 +2722,18 @@ discard block |
||
2722 | 2722 | // grab single id and delete |
2723 | 2723 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2724 | 2724 | //get attendee |
2725 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2725 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2726 | 2726 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2727 | 2727 | $updated = $att->save(); |
2728 | - if ( ! $updated ) { |
|
2728 | + if ( ! $updated) { |
|
2729 | 2729 | $success = 0; |
2730 | 2730 | } |
2731 | 2731 | |
2732 | 2732 | } |
2733 | 2733 | |
2734 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2735 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2736 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2734 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2735 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2736 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2737 | 2737 | |
2738 | 2738 | } |
2739 | 2739 |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | parent::__construct( |
32 | 32 | 'ee-upcoming-events-widget', |
33 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
34 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )), |
|
33 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
34 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')), |
|
35 | 35 | array( |
36 | 36 | 'width' => 300, |
37 | 37 | 'height' => 350, |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param array $instance Previously saved values from database. |
50 | 50 | * @return string|void |
51 | 51 | */ |
52 | - public function form( $instance ) { |
|
52 | + public function form($instance) { |
|
53 | 53 | |
54 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
54 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
55 | 55 | // Set up some default widget settings. |
56 | 56 | $defaults = array( |
57 | 57 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | 'image_size' => 'medium' |
67 | 67 | ); |
68 | 68 | |
69 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
69 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
70 | 70 | // don't add HTML labels for EE_Form_Fields generated inputs |
71 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
71 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
72 | 72 | $yes_no_values = array( |
73 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
73 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | ?> |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
83 | 83 | <?php _e('Title:', 'event_espresso'); ?> |
84 | 84 | </label> |
85 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
85 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
86 | 86 | </p> |
87 | 87 | <p> |
88 | 88 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | <?php |
92 | 92 | $event_categories = array(); |
93 | 93 | /** @type EEM_Term $EEM_Term */ |
94 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
95 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
96 | - if ( $categories ) { |
|
97 | - foreach ( $categories as $category ) { |
|
98 | - if ( $category instanceof EE_Term ) { |
|
99 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
94 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
95 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
96 | + if ($categories) { |
|
97 | + foreach ($categories as $category) { |
|
98 | + if ($category instanceof EE_Term) { |
|
99 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
103 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
104 | 104 | echo EEH_Form_Fields::select( |
105 | 105 | __('Event Category:', 'event_espresso'), |
106 | 106 | $instance['category_name'], |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | <?php |
138 | 138 | $image_sizes = array(); |
139 | 139 | $sizes = get_intermediate_image_sizes(); |
140 | - if ( $sizes ) { |
|
140 | + if ($sizes) { |
|
141 | 141 | // loop thru images and create option objects out of them |
142 | - foreach ( $sizes as $image_size ) { |
|
143 | - $image_size = trim( $image_size ); |
|
142 | + foreach ($sizes as $image_size) { |
|
143 | + $image_size = trim($image_size); |
|
144 | 144 | // no big images plz |
145 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
146 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
145 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
146 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
147 | 147 | } |
148 | 148 | } |
149 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
149 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
150 | 150 | } |
151 | 151 | echo EEH_Form_Fields::select( |
152 | 152 | __('Image Size:', 'event_espresso'), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
205 | 205 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
206 | 206 | </label> |
207 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
207 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return array Updated safe values to be saved. |
238 | 238 | */ |
239 | - public function update( $new_instance, $old_instance ) { |
|
239 | + public function update($new_instance, $old_instance) { |
|
240 | 240 | $instance = $old_instance; |
241 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
241 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
242 | 242 | $instance['category_name'] = $new_instance['category_name']; |
243 | 243 | $instance['show_expired'] = $new_instance['show_expired']; |
244 | 244 | $instance['limit'] = $new_instance['limit']; |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | * @param array $args Widget arguments. |
262 | 262 | * @param array $instance Saved values from database. |
263 | 263 | */ |
264 | - public function widget( $args, $instance ) { |
|
264 | + public function widget($args, $instance) { |
|
265 | 265 | |
266 | 266 | global $post; |
267 | 267 | // make sure there is some kinda post object |
268 | - if ( $post instanceof WP_Post ) { |
|
268 | + if ($post instanceof WP_Post) { |
|
269 | 269 | $before_widget = ''; |
270 | 270 | $before_title = ''; |
271 | 271 | $after_title = ''; |
272 | 272 | $after_widget = ''; |
273 | 273 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
274 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
275 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
274 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
275 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
276 | 276 | // let's use some of the event helper functions' |
277 | 277 | // make separate vars out of attributes |
278 | 278 | |
@@ -291,81 +291,81 @@ discard block |
||
291 | 291 | // Before widget (defined by themes). |
292 | 292 | echo $before_widget; |
293 | 293 | // Display the widget title if one was input (before and after defined by themes). |
294 | - if ( ! empty( $title )) { |
|
295 | - echo $before_title . $title . $after_title; |
|
294 | + if ( ! empty($title)) { |
|
295 | + echo $before_title.$title.$after_title; |
|
296 | 296 | } |
297 | 297 | // grab widget settings |
298 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
299 | - $show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; |
|
300 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
301 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
302 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
303 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
304 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
298 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
299 | + $show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE; |
|
300 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
301 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
302 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
303 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
304 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
305 | 305 | // start to build our where clause |
306 | 306 | $where = array( |
307 | 307 | // 'Datetime.DTT_is_primary' => 1, |
308 | 308 | 'status' => 'publish' |
309 | 309 | ); |
310 | 310 | // add category |
311 | - if ( $category ) { |
|
311 | + if ($category) { |
|
312 | 312 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
313 | 313 | $where['Term_Taxonomy.Term.slug'] = $category; |
314 | 314 | } |
315 | 315 | // if NOT expired then we want events that start today or in the future |
316 | - if ( ! $show_expired ) { |
|
317 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
316 | + if ( ! $show_expired) { |
|
317 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
318 | 318 | } |
319 | 319 | // run the query |
320 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
320 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
321 | 321 | $where, |
322 | - 'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', |
|
322 | + 'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10', |
|
323 | 323 | 'order_by' => 'Datetime.DTT_EVT_start', |
324 | 324 | 'order' => 'ASC', |
325 | 325 | 'group_by' => 'EVT_ID' |
326 | 326 | )); |
327 | 327 | |
328 | - if ( ! empty( $events )) { |
|
328 | + if ( ! empty($events)) { |
|
329 | 329 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
330 | - foreach ( $events as $event ) { |
|
331 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
330 | + foreach ($events as $event) { |
|
331 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
332 | 332 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
333 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
333 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
334 | 334 | // how big is the event name ? |
335 | - $name_length = strlen( $event->name() ); |
|
336 | - switch( $name_length ) { |
|
335 | + $name_length = strlen($event->name()); |
|
336 | + switch ($name_length) { |
|
337 | 337 | case $name_length > 70 : |
338 | - $len_class = ' three-line'; |
|
338 | + $len_class = ' three-line'; |
|
339 | 339 | break; |
340 | 340 | case $name_length > 35 : |
341 | - $len_class = ' two-line'; |
|
341 | + $len_class = ' two-line'; |
|
342 | 342 | break; |
343 | 343 | default : |
344 | - $len_class = ' one-line'; |
|
344 | + $len_class = ' one-line'; |
|
345 | 345 | } |
346 | - $event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event ); |
|
347 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>'; |
|
348 | - if ( post_password_required( $event->ID() ) ) { |
|
349 | - $pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event ); |
|
346 | + $event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event); |
|
347 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>'; |
|
348 | + if (post_password_required($event->ID())) { |
|
349 | + $pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event); |
|
350 | 350 | echo $pswd_form; |
351 | 351 | } else { |
352 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
353 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
352 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
353 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
354 | 354 | } |
355 | - $desc = $event->short_description( 25 ); |
|
356 | - if ( $show_dates ) { |
|
357 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
358 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
359 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
360 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
361 | - if ( $date_range == TRUE ) { |
|
362 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
363 | - }else{ |
|
364 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
355 | + $desc = $event->short_description(25); |
|
356 | + if ($show_dates) { |
|
357 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
358 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
359 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
360 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
361 | + if ($date_range == TRUE) { |
|
362 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
363 | + } else { |
|
364 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
365 | 365 | } |
366 | 366 | } |
367 | - if ( $show_desc && $desc ) { |
|
368 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
367 | + if ($show_desc && $desc) { |
|
368 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | echo '</li>'; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @return string |
390 | 390 | */ |
391 | 391 | public function make_the_title_a_link($title) { |
392 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
392 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -360,7 +362,7 @@ discard block |
||
360 | 362 | $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
361 | 363 | if ( $date_range == TRUE ) { |
362 | 364 | echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
363 | - }else{ |
|
365 | + } else{ |
|
364 | 366 | echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
365 | 367 | } |
366 | 368 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Paypal_Pro extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Paypal_Pro extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param EE_Payment_Method $pm_instance |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | require_once($this->file_folder().'EEG_Paypal_Pro.gateway.php'); |
36 | 36 | $this->_gateway = new EEG_Paypal_Pro(); |
37 | 37 | $this->_pretty_name = __("Paypal Pro", 'event_espresso'); |
38 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
38 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
39 | 39 | $this->_requires_https = true; |
40 | 40 | parent::__construct($pm_instance); |
41 | 41 | } |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | 'extra_meta_inputs'=>array( |
52 | 52 | // 'paypal_email'=>new EE_Email_Input(), not actually used |
53 | 53 | 'username'=>new EE_Text_Input(array( |
54 | - 'html_label_text'=> sprintf(__("Paypal API Username %s", "event_espresso"),$this->get_help_tab_link()), |
|
54 | + 'html_label_text'=> sprintf(__("Paypal API Username %s", "event_espresso"), $this->get_help_tab_link()), |
|
55 | 55 | 'required' => true |
56 | 56 | )), |
57 | 57 | 'password'=>new EE_Text_Input(array( |
58 | - 'html_label_text'=> sprintf(__("Paypal API Password %s", "event_espresso"),$this->get_help_tab_link()), |
|
58 | + 'html_label_text'=> sprintf(__("Paypal API Password %s", "event_espresso"), $this->get_help_tab_link()), |
|
59 | 59 | 'required' => true |
60 | 60 | )), |
61 | 61 | 'signature'=>new EE_Text_Input(array( |
62 | - 'html_label_text'=> sprintf(__("Paypal API Signature %s", "event_espresso"),$this->get_help_tab_link()), |
|
62 | + 'html_label_text'=> sprintf(__("Paypal API Signature %s", "event_espresso"), $this->get_help_tab_link()), |
|
63 | 63 | 'required' => true |
64 | 64 | )), |
65 | 65 | 'credit_card_types'=>new EE_Checkbox_Multi_Input( |
66 | 66 | $this->card_types_supported(), |
67 | 67 | array( |
68 | - 'html_label_text' => __( 'Card Types Supported', 'event_espresso' ), |
|
68 | + 'html_label_text' => __('Card Types Supported', 'event_espresso'), |
|
69 | 69 | 'required' => true )), |
70 | 70 | ) |
71 | 71 | ) |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | * @throws \EE_Error |
80 | 80 | * @return EE_Billing_Info_Form |
81 | 81 | */ |
82 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
83 | - $allowed_types = $this->_pm_instance->get_extra_meta( 'credit_card_types', TRUE ); |
|
82 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
83 | + $allowed_types = $this->_pm_instance->get_extra_meta('credit_card_types', TRUE); |
|
84 | 84 | //if allowed types is a string or empty array or null... |
85 | - if( empty( $allowed_types )) { |
|
85 | + if (empty($allowed_types)) { |
|
86 | 86 | $allowed_types = array(); |
87 | 87 | } |
88 | 88 | |
@@ -93,26 +93,26 @@ discard block |
||
93 | 93 | // 'html_id'=> 'ee-Paypal_Pro-billing-form', |
94 | 94 | 'subsections'=>array( |
95 | 95 | 'credit_card'=>new EE_Credit_Card_Input( |
96 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Number', 'event_espresso' )) |
|
96 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Number', 'event_espresso')) |
|
97 | 97 | ), |
98 | 98 | 'credit_card_type'=>new EE_Select_Input( |
99 | 99 | //the options are set dynamically |
100 | - array_intersect_key( EE_PMT_Paypal_Pro::card_types_supported(), array_flip( $allowed_types )), |
|
101 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Type', 'event_espresso' )) |
|
100 | + array_intersect_key(EE_PMT_Paypal_Pro::card_types_supported(), array_flip($allowed_types)), |
|
101 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Type', 'event_espresso')) |
|
102 | 102 | ), |
103 | 103 | 'exp_month'=>new EE_Credit_Card_Month_Input( |
104 | - TRUE, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) ) |
|
104 | + TRUE, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Month', 'event_espresso')) |
|
105 | 105 | ), |
106 | 106 | 'exp_year'=>new EE_Credit_Card_Year_Input( |
107 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) ) |
|
107 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Year', 'event_espresso')) |
|
108 | 108 | ), |
109 | 109 | 'cvv'=>new EE_CVV_Input( |
110 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'CVV', 'event_espresso' ) ) |
|
110 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('CVV', 'event_espresso')) |
|
111 | 111 | ), |
112 | 112 | ) |
113 | 113 | ) |
114 | 114 | ); |
115 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
115 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | * @param \EE_Billing_Info_Form $billing_form |
125 | 125 | * @return \EE_Billing_Info_Form |
126 | 126 | */ |
127 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
128 | - if ( $this->_pm_instance->debug_mode() ) { |
|
127 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
128 | + if ($this->_pm_instance->debug_mode()) { |
|
129 | 129 | $billing_form->add_subsections( |
130 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
130 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
131 | 131 | 'credit_card' |
132 | 132 | ); |
133 | 133 | $billing_form->add_subsections( |
134 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php' )), |
|
134 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php')), |
|
135 | 135 | 'first_name' |
136 | 136 | ); |
137 | - $billing_form->get_input( 'credit_card_type' )->set_default( 'Visa' ); |
|
138 | - $billing_form->get_input( 'exp_year' )->set_default( 2018); |
|
139 | - $billing_form->get_input( 'cvv' )->set_default( '115' ); |
|
137 | + $billing_form->get_input('credit_card_type')->set_default('Visa'); |
|
138 | + $billing_form->get_input('exp_year')->set_default(2018); |
|
139 | + $billing_form->get_input('cvv')->set_default('115'); |
|
140 | 140 | } |
141 | 141 | return $billing_form; |
142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * Keys are their values, values are their pretty names. |
149 | 149 | * @return array |
150 | 150 | */ |
151 | - public static function card_types_supported(){ |
|
151 | + public static function card_types_supported() { |
|
152 | 152 | return array( |
153 | 153 | 'Visa'=> __("Visa", 'event_espresso'), |
154 | 154 | 'MasterCard'=> __("MasterCard", 'event_espresso'), |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @see EE_PMT_Base::help_tabs_config() |
165 | 165 | * @return array |
166 | 166 | */ |
167 | - public function help_tabs_config(){ |
|
167 | + public function help_tabs_config() { |
|
168 | 168 | return array( |
169 | 169 | $this->get_help_tab_name() => array( |
170 | 170 | 'title' => __('PayPal Pro Settings', 'event_espresso'), |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * @param EE_Billing_Info_Form $billing_form |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
183 | - $billing_values = parent::_get_billing_values_from_form( $billing_form ); |
|
184 | - $billing_values[ 'country' ] = $billing_form->get_input_value( 'country' ); |
|
185 | - $billing_values[ 'credit_card_type' ] = $billing_form->get_input_value( 'credit_card_type' ); |
|
182 | + protected function _get_billing_values_from_form($billing_form) { |
|
183 | + $billing_values = parent::_get_billing_values_from_form($billing_form); |
|
184 | + $billing_values['country'] = $billing_form->get_input_value('country'); |
|
185 | + $billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type'); |
|
186 | 186 | return $billing_values; |
187 | 187 | } |
188 | 188 |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | * @param array $ee_gmaps_opts array of attributes required for the map link generation |
22 | 22 | * @return string (link to map!) |
23 | 23 | */ |
24 | - public static function google_map( $ee_gmaps_opts ){ |
|
25 | - |
|
26 | - $ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300'; |
|
27 | - $ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185'; |
|
28 | - $ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12'; |
|
29 | - $ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false'; |
|
30 | - $ee_map_nav_size = isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default'; |
|
31 | - $ee_map_type_control = isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default'; |
|
32 | - $static_url = isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE; |
|
33 | - |
|
34 | - if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){ |
|
35 | - switch( $ee_gmaps_opts['ee_map_align'] ){ |
|
24 | + public static function google_map($ee_gmaps_opts) { |
|
25 | + |
|
26 | + $ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300'; |
|
27 | + $ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185'; |
|
28 | + $ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12'; |
|
29 | + $ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false'; |
|
30 | + $ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default'; |
|
31 | + $ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default'; |
|
32 | + $static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE; |
|
33 | + |
|
34 | + if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) { |
|
35 | + switch ($ee_gmaps_opts['ee_map_align']) { |
|
36 | 36 | case "left": |
37 | 37 | $map_align = 'ee-gmap-align-left left'; |
38 | 38 | break; |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | |
54 | 54 | // Determine whether user has set a hardoded url to use and |
55 | 55 | // if so display a Google static iframe map else run V3 api |
56 | - if( $static_url ) { |
|
56 | + if ($static_url) { |
|
57 | 57 | |
58 | - $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">'; |
|
59 | - $html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">'; |
|
58 | + $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">'; |
|
59 | + $html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">'; |
|
60 | 60 | $html .= '</iframe>'; |
61 | - $html .= '<a href="' . $static_url . '">View Large map</a>'; |
|
61 | + $html .= '<a href="'.$static_url.'">View Large map</a>'; |
|
62 | 62 | $html .= '</div>'; |
63 | 63 | return $html; |
64 | 64 | |
65 | 65 | } else { |
66 | 66 | |
67 | - EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array( |
|
67 | + EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array( |
|
68 | 68 | 'map_ID' => $ee_gmaps_opts['map_ID'], |
69 | 69 | 'ee_map_zoom' => $ee_map_zoom, |
70 | 70 | 'ee_map_nav_display' => $ee_map_nav_display, |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | ); |
75 | 75 | |
76 | 76 | $html = '<div class="ee-gmap-wrapper '.$map_align.';">'; |
77 | - $html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; // |
|
77 | + $html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; // |
|
78 | 78 | $html .= '</div>'; |
79 | 79 | |
80 | - wp_enqueue_script( 'gmap_api' ); |
|
81 | - wp_enqueue_script( 'ee_gmap' ); |
|
82 | - add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' )); |
|
80 | + wp_enqueue_script('gmap_api'); |
|
81 | + wp_enqueue_script('ee_gmap'); |
|
82 | + add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script')); |
|
83 | 83 | |
84 | 84 | return $html; |
85 | 85 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | public static function footer_enqueue_script() { |
97 | - wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars ); |
|
97 | + wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | public static function espresso_google_map_js() { |
106 | 106 | $api_url = sprintf( |
107 | 107 | "https://maps.googleapis.com/maps/api/js?key=%s", |
108 | - apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key ) |
|
108 | + apply_filters('FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key) |
|
109 | 109 | ); |
110 | - wp_register_script( 'gmap_api', $api_url, array('jquery'), NULL, TRUE ); |
|
111 | - wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE ); |
|
110 | + wp_register_script('gmap_api', $api_url, array('jquery'), NULL, TRUE); |
|
111 | + wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return string (link to map!) |
118 | 118 | */ |
119 | 119 | public static function google_map_link($atts) { |
120 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
120 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
121 | 121 | extract($atts); |
122 | 122 | /** @var string $address */ |
123 | 123 | /** @var string $city */ |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | $id = isset($id) ? $id : 'not_set'; |
137 | 137 | $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view'; |
138 | 138 | |
139 | - $address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : ''); |
|
139 | + $address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : ''); |
|
140 | 140 | |
141 | - $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string )); |
|
141 | + $google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string)); |
|
142 | 142 | |
143 | 143 | switch ($type) { |
144 | 144 | case 'text': |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | |
153 | 153 | case 'map': |
154 | 154 | $scheme = is_ssl() ? 'https://' : 'http://'; |
155 | - return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode( $address_string ) . '&sensor=false' ) . '" /></a>'; |
|
155 | + return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&zoom=14&size='.$map_w.'x'.$map_h.'&markers=color:green|label:|'.urlencode($address_string).'&sensor=false').'" /></a>'; |
|
156 | 156 | } |
157 | 157 | |
158 | - return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>'; |
|
158 | + return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 |