@@ -347,7 +347,7 @@ |
||
347 | 347 | $total_ticket_count++; |
348 | 348 | $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
349 | 349 | $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
350 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
350 | + && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
351 | 351 | ? $tickets[ $ticket->ID() ]['count'] + 1 |
352 | 352 | : 1; |
353 | 353 | $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
@@ -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 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @param mixed $data incoming data object|array. Suggested that child classes use type hinting for expected |
267 | 267 | * data object. But here parent will be generic because we don't know what's coming in. |
268 | 268 | */ |
269 | - public function __construct( $data ) { |
|
269 | + public function __construct($data) { |
|
270 | 270 | $this->_data = $data; |
271 | 271 | $this->_setup_data(); |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return mixed The prepped data for db |
290 | 290 | */ |
291 | - static public function convert_data_for_persistent_storage( $data ) { |
|
291 | + static public function convert_data_for_persistent_storage($data) { |
|
292 | 292 | return $data; |
293 | 293 | } |
294 | 294 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return mixed |
306 | 306 | */ |
307 | - static public function convert_data_from_persistent_storage( $data ) { |
|
307 | + static public function convert_data_from_persistent_storage($data) { |
|
308 | 308 | return $data; |
309 | 309 | } |
310 | 310 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | protected function _assemble_data() { |
332 | 332 | //verify that reg_objs is set |
333 | 333 | if ( |
334 | - ! is_array( $this->reg_objs ) |
|
335 | - && ! reset( $this->reg_objs ) instanceof EE_Registration |
|
334 | + ! is_array($this->reg_objs) |
|
335 | + && ! reset($this->reg_objs) instanceof EE_Registration |
|
336 | 336 | ) { |
337 | 337 | throw new EE_Error( |
338 | 338 | __( |
@@ -347,84 +347,84 @@ discard block |
||
347 | 347 | $answers = $questions = $attendees = $line_items = $registrations = array(); |
348 | 348 | $total_ticket_count = 0; |
349 | 349 | |
350 | - if ( ! empty( $this->reg_objs ) ) { |
|
350 | + if ( ! empty($this->reg_objs)) { |
|
351 | 351 | $event_attendee_count = array(); |
352 | - foreach ( $this->reg_objs as $reg ) { |
|
352 | + foreach ($this->reg_objs as $reg) { |
|
353 | 353 | |
354 | 354 | if ( |
355 | - $this->_skip_registration_for_processing( $reg ) |
|
355 | + $this->_skip_registration_for_processing($reg) |
|
356 | 356 | ) { |
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $evt_id = $reg->event_ID(); |
361 | 361 | /** @type EE_Ticket $ticket */ |
362 | - $ticket = $reg->get_first_related( 'Ticket' ); |
|
362 | + $ticket = $reg->get_first_related('Ticket'); |
|
363 | 363 | $relateddatetime = $ticket->datetimes(); |
364 | 364 | $total_ticket_count++; |
365 | - $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
|
366 | - $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
|
367 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
368 | - ? $tickets[ $ticket->ID() ]['count'] + 1 |
|
365 | + $tickets[$ticket->ID()]['ticket'] = $ticket; |
|
366 | + $tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()]) |
|
367 | + && isset($tickets[$ticket->ID()]['count']) |
|
368 | + ? $tickets[$ticket->ID()]['count'] + 1 |
|
369 | 369 | : 1; |
370 | - $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
371 | - $tickets[ $ticket->ID() ]['dtt_objs'] = $relateddatetime; |
|
372 | - $tickets[ $ticket->ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
370 | + $tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
371 | + $tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime; |
|
372 | + $tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg; |
|
373 | 373 | $event = $reg->event(); |
374 | - $tickets[ $ticket->ID() ]['EE_Event'] = $event; |
|
375 | - $evtcache[ $evt_id ] = $event; |
|
376 | - $eventsetup[ $evt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
377 | - $eventsetup[ $evt_id ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
378 | - $eventsetup[ $evt_id ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
379 | - $event_attendee_count[ $evt_id ] = isset( $event_attendee_count[ $evt_id ] ) |
|
380 | - ? $event_attendee_count[ $evt_id ] + 1 |
|
374 | + $tickets[$ticket->ID()]['EE_Event'] = $event; |
|
375 | + $evtcache[$evt_id] = $event; |
|
376 | + $eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg; |
|
377 | + $eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket; |
|
378 | + $eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
379 | + $event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id]) |
|
380 | + ? $event_attendee_count[$evt_id] + 1 |
|
381 | 381 | : 0; |
382 | - $attendees[ $reg->attendee_ID() ]['line_ref'][] = $evt_id; |
|
383 | - $attendees[ $reg->attendee_ID() ]['att_obj'] = $reg->attendee(); |
|
384 | - $attendees[ $reg->attendee_ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
382 | + $attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id; |
|
383 | + $attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee(); |
|
384 | + $attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg; |
|
385 | 385 | //$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID(); |
386 | - $attendees[ $reg->attendee_ID() ]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
386 | + $attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
387 | 387 | ? $reg->attendee()->email() |
388 | 388 | : ''; |
389 | - $attendees[ $reg->attendee_ID() ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
390 | - $attendees[ $reg->attendee_ID() ]['evt_objs'][ $evt_id ] = $event; |
|
389 | + $attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket; |
|
390 | + $attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event; |
|
391 | 391 | |
392 | 392 | //registrations |
393 | - $registrations[ $reg->ID() ]['tkt_obj'] = $ticket; |
|
394 | - $registrations[ $reg->ID() ]['evt_obj'] = $event; |
|
395 | - $registrations[ $reg->ID() ]['reg_obj'] = $reg; |
|
396 | - $registrations[ $reg->ID() ]['att_obj'] = $reg->attendee(); |
|
393 | + $registrations[$reg->ID()]['tkt_obj'] = $ticket; |
|
394 | + $registrations[$reg->ID()]['evt_obj'] = $event; |
|
395 | + $registrations[$reg->ID()]['reg_obj'] = $reg; |
|
396 | + $registrations[$reg->ID()]['att_obj'] = $reg->attendee(); |
|
397 | 397 | |
398 | 398 | //set up answer objects |
399 | - $rel_ans = $reg->get_many_related( 'Answer' ); |
|
400 | - foreach ( $rel_ans as $ansid => $answer ) { |
|
401 | - if ( ! isset( $questions[ $ansid ] ) ) { |
|
402 | - $questions[ $ansid ] = $answer->get_first_related( 'Question' ); |
|
399 | + $rel_ans = $reg->get_many_related('Answer'); |
|
400 | + foreach ($rel_ans as $ansid => $answer) { |
|
401 | + if ( ! isset($questions[$ansid])) { |
|
402 | + $questions[$ansid] = $answer->get_first_related('Question'); |
|
403 | 403 | } |
404 | - $answers[ $ansid ] = $answer; |
|
405 | - $registrations[ $reg->ID() ]['ans_objs'][ $ansid ] = $answer; |
|
404 | + $answers[$ansid] = $answer; |
|
405 | + $registrations[$reg->ID()]['ans_objs'][$ansid] = $answer; |
|
406 | 406 | } |
407 | 407 | |
408 | - foreach ( $relateddatetime as $dtt_id => $datetime ) { |
|
409 | - $eventsetup[ $evt_id ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
410 | - $registrations[ $reg->ID() ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
408 | + foreach ($relateddatetime as $dtt_id => $datetime) { |
|
409 | + $eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime; |
|
410 | + $registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime; |
|
411 | 411 | |
412 | - if ( isset( $datetimes[ $dtt_id ] ) ) { |
|
412 | + if (isset($datetimes[$dtt_id])) { |
|
413 | 413 | continue; //already have this info in the datetimes array. |
414 | 414 | } |
415 | 415 | |
416 | - $datetimes[ $dtt_id ]['tkt_objs'][] = $ticket; |
|
417 | - $datetimes[ $dtt_id ]['datetime'] = $datetime; |
|
418 | - $datetimes[ $dtt_id ]['evt_objs'][ $evt_id ] = $event; |
|
419 | - $datetimes[ $dtt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
416 | + $datetimes[$dtt_id]['tkt_objs'][] = $ticket; |
|
417 | + $datetimes[$dtt_id]['datetime'] = $datetime; |
|
418 | + $datetimes[$dtt_id]['evt_objs'][$evt_id] = $event; |
|
419 | + $datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg; |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
423 | 423 | //let's loop through the unique event=>reg items and setup data on them |
424 | 424 | |
425 | - if ( ! empty( $eventsetup ) ) { |
|
426 | - foreach ( $eventsetup as $evt_id => $items ) { |
|
427 | - if ( $this->txn instanceof EE_Transaction ) { |
|
425 | + if ( ! empty($eventsetup)) { |
|
426 | + foreach ($eventsetup as $evt_id => $items) { |
|
427 | + if ($this->txn instanceof EE_Transaction) { |
|
428 | 428 | $ticket_line_items_for_event = EEM_Line_Item::instance()->get_all( |
429 | 429 | array( |
430 | 430 | array( |
@@ -437,25 +437,25 @@ discard block |
||
437 | 437 | } else { |
438 | 438 | $ticket_line_items_for_event = array(); |
439 | 439 | } |
440 | - $events[ $evt_id ] = array( |
|
440 | + $events[$evt_id] = array( |
|
441 | 441 | 'ID' => $evt_id, |
442 | - 'event' => $evtcache[ $evt_id ], |
|
443 | - 'name' => $evtcache[ $evt_id ] instanceof EE_Event ? $evtcache[ $evt_id ]->name() : '', |
|
444 | - 'total_attendees' => $event_attendee_count[ $evt_id ], |
|
442 | + 'event' => $evtcache[$evt_id], |
|
443 | + 'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '', |
|
444 | + 'total_attendees' => $event_attendee_count[$evt_id], |
|
445 | 445 | 'reg_objs' => $items['reg_objs'], |
446 | 446 | 'tkt_objs' => $items['tkt_objs'], |
447 | 447 | 'att_objs' => $items['att_objs'], |
448 | - 'dtt_objs' => isset( $items['dtt_objs'] ) ? $items['dtt_objs'] : array(), |
|
448 | + 'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(), |
|
449 | 449 | 'line_items' => $ticket_line_items_for_event, |
450 | 450 | ); |
451 | 451 | |
452 | 452 | //make sure the tickets have the line items setup for them. |
453 | - foreach ( $ticket_line_items_for_event as $line_id => $line_item ) { |
|
454 | - if ( $line_item instanceof EE_Line_Item ) { |
|
455 | - $tickets[ $line_item->ticket()->ID() ]['line_item'] = $line_item; |
|
456 | - $tickets[ $line_item->ticket()->ID() ]['sub_line_items'] = $line_item->children(); |
|
457 | - $line_items[ $line_item->ID() ]['children'] = $line_item->children(); |
|
458 | - $line_items[ $line_item->ID() ]['EE_Ticket'] = $line_item->ticket(); |
|
453 | + foreach ($ticket_line_items_for_event as $line_id => $line_item) { |
|
454 | + if ($line_item instanceof EE_Line_Item) { |
|
455 | + $tickets[$line_item->ticket()->ID()]['line_item'] = $line_item; |
|
456 | + $tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children(); |
|
457 | + $line_items[$line_item->ID()]['children'] = $line_item->children(); |
|
458 | + $line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket(); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $this->total_ticket_count = $total_ticket_count; |
478 | 478 | $this->registrations = $registrations; |
479 | 479 | |
480 | - if ( $this->txn instanceof EE_Transaction ) { |
|
480 | + if ($this->txn instanceof EE_Transaction) { |
|
481 | 481 | $this->tax_line_items = $this->txn->tax_items(); |
482 | 482 | $this->additional_line_items = $this->txn->non_ticket_line_items(); |
483 | 483 | $this->payments = $this->txn->payments(); |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | //let's get just the primary_attendee_data! First we get the primary registration object. |
488 | 488 | $primary_reg = $this->txn->primary_registration(); |
489 | 489 | // verify |
490 | - if ( $primary_reg instanceof EE_Registration ) { |
|
490 | + if ($primary_reg instanceof EE_Registration) { |
|
491 | 491 | |
492 | 492 | // get attendee object |
493 | - if ( $primary_reg->attendee() instanceof EE_Attendee ) { |
|
493 | + if ($primary_reg->attendee() instanceof EE_Attendee) { |
|
494 | 494 | |
495 | 495 | //now we can setup the primary_attendee_data array |
496 | 496 | $this->primary_attendee_data = array( |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | * @return bool returning true means we DO want to skip processing. returning false means we DON'T want to skip |
535 | 535 | * processing |
536 | 536 | */ |
537 | - protected function _skip_registration_for_processing( EE_Registration $registration ) { |
|
538 | - if ( empty( $this->filtered_reg_status ) ) { |
|
537 | + protected function _skip_registration_for_processing(EE_Registration $registration) { |
|
538 | + if (empty($this->filtered_reg_status)) { |
|
539 | 539 | return false; |
540 | 540 | } |
541 | 541 |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -50,79 +50,79 @@ discard block |
||
50 | 50 | * @throws \EE_Error |
51 | 51 | * } |
52 | 52 | */ |
53 | - public static function register( $mt_name = NULL, $setup_args = array() ) { |
|
53 | + public static function register($mt_name = NULL, $setup_args = array()) { |
|
54 | 54 | //required fields MUST be present, so let's make sure they are. |
55 | 55 | if ( |
56 | - ! isset( $mt_name ) |
|
57 | - || ! is_array( $setup_args ) |
|
58 | - || empty( $setup_args['mtfilename'] ) || empty( $setup_args['autoloadpaths'] ) |
|
59 | - ){ |
|
56 | + ! isset($mt_name) |
|
57 | + || ! is_array($setup_args) |
|
58 | + || empty($setup_args['mtfilename']) || empty($setup_args['autoloadpaths']) |
|
59 | + ) { |
|
60 | 60 | throw new EE_Error( |
61 | - __( 'In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso' ) |
|
61 | + __('In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | //make sure we don't register twice |
66 | - if( isset( self::$_ee_message_type_registry[ $mt_name ] ) ){ |
|
66 | + if (isset(self::$_ee_message_type_registry[$mt_name])) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | //make sure this was called in the right place! |
71 | 71 | if ( |
72 | - ! did_action( 'EE_Brewing_Regular___messages_caf' ) |
|
73 | - || did_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ) |
|
72 | + ! did_action('EE_Brewing_Regular___messages_caf') |
|
73 | + || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations') |
|
74 | 74 | ) { |
75 | 75 | EE_Error::doing_it_wrong( |
76 | 76 | __METHOD__, |
77 | 77 | sprintf( |
78 | - __('A message type named "%s" has been attempted to be registered with the EE Messages System. It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.','event_espresso'), |
|
78 | + __('A message type named "%s" has been attempted to be registered with the EE Messages System. It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.', 'event_espresso'), |
|
79 | 79 | $mt_name |
80 | 80 | ), |
81 | 81 | '4.3.0' |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | //setup $__ee_message_type_registry array from incoming values. |
85 | - self::$_ee_message_type_registry[ $mt_name ] = array( |
|
85 | + self::$_ee_message_type_registry[$mt_name] = array( |
|
86 | 86 | 'mtfilename' => (string) $setup_args['mtfilename'], |
87 | 87 | 'autoloadpaths' => (array) $setup_args['autoloadpaths'], |
88 | - 'messengers_to_activate_with' => ! empty( $setup_args['messengers_to_activate_with'] ) |
|
88 | + 'messengers_to_activate_with' => ! empty($setup_args['messengers_to_activate_with']) |
|
89 | 89 | ? (array) $setup_args['messengers_to_activate_with'] |
90 | 90 | : array(), |
91 | - 'messengers_to_validate_with' => ! empty( $setup_args['messengers_to_validate_with'] ) |
|
91 | + 'messengers_to_validate_with' => ! empty($setup_args['messengers_to_validate_with']) |
|
92 | 92 | ? (array) $setup_args['messengers_to_validate_with'] |
93 | 93 | : array(), |
94 | - 'force_activation' => ! empty( $setup_args['force_activation'] ) |
|
94 | + 'force_activation' => ! empty($setup_args['force_activation']) |
|
95 | 95 | ? (bool) $setup_args['force_activation'] |
96 | 96 | : array() |
97 | 97 | ); |
98 | 98 | //add filters |
99 | 99 | add_filter( |
100 | 100 | 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', |
101 | - array( 'EE_Register_Message_Type', 'register_msgs_autoload_paths' ), |
|
101 | + array('EE_Register_Message_Type', 'register_msgs_autoload_paths'), |
|
102 | 102 | 10 |
103 | 103 | ); |
104 | 104 | add_filter( |
105 | 105 | 'FHEE__EE_messages__get_installed__messagetype_files', |
106 | - array( 'EE_Register_Message_Type', 'register_messagetype_files' ), |
|
106 | + array('EE_Register_Message_Type', 'register_messagetype_files'), |
|
107 | 107 | 10, |
108 | 108 | 1 |
109 | 109 | ); |
110 | 110 | add_filter( |
111 | 111 | 'FHEE__EE_messenger__get_default_message_types__default_types', |
112 | - array( 'EE_Register_Message_Type', 'register_messengers_to_activate_mt_with' ), |
|
112 | + array('EE_Register_Message_Type', 'register_messengers_to_activate_mt_with'), |
|
113 | 113 | 10, |
114 | 114 | 2 |
115 | 115 | ); |
116 | 116 | add_filter( |
117 | 117 | 'FHEE__EE_messenger__get_valid_message_types__valid_types', |
118 | - array( 'EE_Register_Message_Type', 'register_messengers_to_validate_mt_with' ), |
|
118 | + array('EE_Register_Message_Type', 'register_messengers_to_validate_mt_with'), |
|
119 | 119 | 10, |
120 | 120 | 2 |
121 | 121 | ); |
122 | 122 | //actions |
123 | 123 | add_action( |
124 | 124 | 'AHEE__EE_Addon__initialize_default_data__begin', |
125 | - array( 'EE_Register_Message_Type', 'set_defaults' ) |
|
125 | + array('EE_Register_Message_Type', 'set_defaults') |
|
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function set_defaults() { |
135 | 135 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
136 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
136 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
137 | 137 | |
138 | 138 | //for any message types with force activation, let's ensure they are activated |
139 | - foreach ( self::$_ee_message_type_registry as $message_type_name => $settings ) { |
|
140 | - if ( $settings['force_activation'] ) { |
|
141 | - foreach ( $settings['messengers_to_activate_with'] as $messenger ) { |
|
139 | + foreach (self::$_ee_message_type_registry as $message_type_name => $settings) { |
|
140 | + if ($settings['force_activation']) { |
|
141 | + foreach ($settings['messengers_to_activate_with'] as $messenger) { |
|
142 | 142 | //DO not force activation if this message type has already been activated in the system |
143 | - if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger( $message_type_name, $messenger ) ) { |
|
144 | - $message_resource_manager->ensure_message_type_is_active( $message_type_name, $messenger ); |
|
143 | + if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger($message_type_name, $messenger)) { |
|
144 | + $message_resource_manager->ensure_message_type_is_active($message_type_name, $messenger); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
@@ -158,13 +158,13 @@ discard block |
||
158 | 158 | * @param string $message_type_name the name for the message type that was previously registered |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - public static function deregister( $message_type_name = null ) { |
|
162 | - if ( ! empty( self::$_ee_message_type_registry[ $message_type_name ] ) ) { |
|
161 | + public static function deregister($message_type_name = null) { |
|
162 | + if ( ! empty(self::$_ee_message_type_registry[$message_type_name])) { |
|
163 | 163 | //let's make sure that we remove any place this message type was made active |
164 | 164 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
165 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
166 | - $Message_Resource_Manager->deactivate_message_type( $message_type_name ); |
|
167 | - unset( self::$_ee_message_type_registry[ $message_type_name ] ); |
|
165 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
166 | + $Message_Resource_Manager->deactivate_message_type($message_type_name); |
|
167 | + unset(self::$_ee_message_type_registry[$message_type_name]); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | * @param array $messagetype_files The current array of message type file names |
179 | 179 | * @return array Array of message type file names |
180 | 180 | */ |
181 | - public static function register_messagetype_files( $messagetype_files ) { |
|
182 | - if ( empty( self::$_ee_message_type_registry ) ) { |
|
181 | + public static function register_messagetype_files($messagetype_files) { |
|
182 | + if (empty(self::$_ee_message_type_registry)) { |
|
183 | 183 | return $messagetype_files; |
184 | 184 | } |
185 | - foreach ( self::$_ee_message_type_registry as $mt_reg ) { |
|
186 | - if ( empty( $mt_reg['mtfilename' ] ) ) { |
|
185 | + foreach (self::$_ee_message_type_registry as $mt_reg) { |
|
186 | + if (empty($mt_reg['mtfilename'])) { |
|
187 | 187 | continue; |
188 | 188 | } |
189 | 189 | $messagetype_files[] = $mt_reg['mtfilename']; |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | * @param array $paths array of paths to be checked by EE_messages autoloader. |
204 | 204 | * @return array |
205 | 205 | */ |
206 | - public static function register_msgs_autoload_paths( $paths ) { |
|
207 | - if ( ! empty( self::$_ee_message_type_registry ) ) { |
|
208 | - foreach ( self::$_ee_message_type_registry as $mt_reg ) { |
|
209 | - if ( empty( $mt_reg['autoloadpaths'] ) ) { |
|
206 | + public static function register_msgs_autoload_paths($paths) { |
|
207 | + if ( ! empty(self::$_ee_message_type_registry)) { |
|
208 | + foreach (self::$_ee_message_type_registry as $mt_reg) { |
|
209 | + if (empty($mt_reg['autoloadpaths'])) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | - $paths = array_merge( $paths, $mt_reg['autoloadpaths'] ); |
|
212 | + $paths = array_merge($paths, $mt_reg['autoloadpaths']); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | return $paths; |
@@ -228,18 +228,18 @@ discard block |
||
228 | 228 | * @param EE_messenger $messenger The EE_messenger the filter is called from. |
229 | 229 | * @return array |
230 | 230 | */ |
231 | - public static function register_messengers_to_activate_mt_with( $default_types, EE_messenger $messenger ) { |
|
232 | - if ( empty( self::$_ee_message_type_registry ) ) { |
|
231 | + public static function register_messengers_to_activate_mt_with($default_types, EE_messenger $messenger) { |
|
232 | + if (empty(self::$_ee_message_type_registry)) { |
|
233 | 233 | return $default_types; |
234 | 234 | } |
235 | - foreach ( self::$_ee_message_type_registry as $message_type_name => $mt_reg ) { |
|
236 | - if ( empty( $mt_reg['messengers_to_activate_with'] ) || empty( $mt_reg['mtfilename'] ) ) { |
|
235 | + foreach (self::$_ee_message_type_registry as $message_type_name => $mt_reg) { |
|
236 | + if (empty($mt_reg['messengers_to_activate_with']) || empty($mt_reg['mtfilename'])) { |
|
237 | 237 | continue; |
238 | 238 | } |
239 | 239 | // loop through each of the messengers and if it matches the loaded class |
240 | 240 | // then we add this message type to the |
241 | - foreach ( $mt_reg['messengers_to_activate_with'] as $msgr ) { |
|
242 | - if ( $messenger->name == $msgr ) { |
|
241 | + foreach ($mt_reg['messengers_to_activate_with'] as $msgr) { |
|
242 | + if ($messenger->name == $msgr) { |
|
243 | 243 | $default_types[] = $message_type_name; |
244 | 244 | } |
245 | 245 | } |
@@ -259,18 +259,18 @@ discard block |
||
259 | 259 | * @param EE_messenger $messenger The EE_messenger the filter is called from. |
260 | 260 | * @return array |
261 | 261 | */ |
262 | - public static function register_messengers_to_validate_mt_with( $valid_types, EE_messenger $messenger ) { |
|
263 | - if ( empty( self::$_ee_message_type_registry ) ) { |
|
262 | + public static function register_messengers_to_validate_mt_with($valid_types, EE_messenger $messenger) { |
|
263 | + if (empty(self::$_ee_message_type_registry)) { |
|
264 | 264 | return $valid_types; |
265 | 265 | } |
266 | - foreach ( self::$_ee_message_type_registry as $message_type_name => $mt_reg ) { |
|
267 | - if ( empty( $mt_reg['messengers_to_validate_with'] ) || empty( $mt_reg['mtfilename'] ) ) { |
|
266 | + foreach (self::$_ee_message_type_registry as $message_type_name => $mt_reg) { |
|
267 | + if (empty($mt_reg['messengers_to_validate_with']) || empty($mt_reg['mtfilename'])) { |
|
268 | 268 | continue; |
269 | 269 | } |
270 | 270 | // loop through each of the messengers and if it matches the loaded class |
271 | 271 | // then we add this message type to the |
272 | - foreach ( $mt_reg['messengers_to_validate_with'] as $msgr ) { |
|
273 | - if ( $messenger->name == $msgr ) { |
|
272 | + foreach ($mt_reg['messengers_to_validate_with'] as $msgr) { |
|
273 | + if ($messenger->name == $msgr) { |
|
274 | 274 | $valid_types[] = $message_type_name; |
275 | 275 | } |
276 | 276 | } |
@@ -251,14 +251,14 @@ |
||
251 | 251 | |
252 | 252 | |
253 | 253 | /** |
254 | - * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter. |
|
255 | - * |
|
256 | - * @since 4.3.0 |
|
257 | - * @param array $valid_types array of message types valid with messenger ( |
|
258 | - * corresponds to the $name property of message type) |
|
259 | - * @param EE_messenger $messenger The EE_messenger the filter is called from. |
|
260 | - * @return array |
|
261 | - */ |
|
254 | + * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter. |
|
255 | + * |
|
256 | + * @since 4.3.0 |
|
257 | + * @param array $valid_types array of message types valid with messenger ( |
|
258 | + * corresponds to the $name property of message type) |
|
259 | + * @param EE_messenger $messenger The EE_messenger the filter is called from. |
|
260 | + * @return array |
|
261 | + */ |
|
262 | 262 | public static function register_messengers_to_validate_mt_with( $valid_types, EE_messenger $messenger ) { |
263 | 263 | if ( empty( self::$_ee_message_type_registry ) ) { |
264 | 264 | return $valid_types; |
@@ -5,7 +5,9 @@ |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Use this to register or deregister a new message type for the EE messages system. |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | * @since $VID:$ |
14 | 14 | * |
15 | 15 | */ |
16 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
17 | - exit( 'No direct script access allowed' ); |
|
16 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
17 | + exit('No direct script access allowed'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | class Rest_Exception extends \EE_Error { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $_wp_error_data = array(); |
26 | 26 | protected $_wp_error_code = ''; |
27 | - public function __construct( $string_code, $message, $wp_error_data = array(), $previous = null ) { |
|
27 | + public function __construct($string_code, $message, $wp_error_data = array(), $previous = null) { |
|
28 | 28 | parent::__construct( |
29 | 29 | $message, |
30 | 30 | 500, |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct() { |
44 | 44 | // construct request stack and run middleware apps as soon as all WP plugins are loaded |
45 | - add_action( 'plugins_loaded', array( $this, 'run_request_stack' ), 0 ); |
|
45 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
46 | 46 | // set framework for the rest of EE to hook into when loading |
47 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_espresso_addons' ), 1 ); |
|
48 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'detect_activations_or_upgrades' ), 3 ); |
|
49 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_core_configuration' ), 5 ); |
|
50 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
51 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'brew_espresso' ), 9 ); |
|
47 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
48 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
49 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
50 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
51 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | new EE_Load_Espresso_Core() |
66 | 66 | ); |
67 | 67 | $this->_request_stack->handle_request( |
68 | - new EE_Request( $_GET, $_POST, $_COOKIE ), |
|
68 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
69 | 69 | new EE_Response() |
70 | 70 | ); |
71 | 71 | $this->_request_stack->handle_response(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function load_autoloader() { |
80 | 80 | // load interfaces |
81 | - espresso_load_required( 'EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' ); |
|
81 | + espresso_load_required('EEH_Autoloader', EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php'); |
|
82 | 82 | EEH_Autoloader::instance(); |
83 | 83 | } |
84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function set_autoloaders_for_required_files() { |
91 | 91 | // load interfaces |
92 | - espresso_load_required( 'EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php' ); |
|
92 | + espresso_load_required('EEI_Interfaces', EE_CORE.'interfaces'.DS.'EEI_Interfaces.php'); |
|
93 | 93 | // load helpers |
94 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS ); |
|
94 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
95 | 95 | // load request stack |
96 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'request_stack' . DS ); |
|
96 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
97 | 97 | // load middleware |
98 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'middleware' . DS ); |
|
98 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | // load middleware onto stack : FILO (First In Last Out) |
121 | - foreach ( (array)$stack_apps as $stack_app ) { |
|
121 | + foreach ((array) $stack_apps as $stack_app) { |
|
122 | 122 | //$request_stack_builder->push( $stack_app ); |
123 | - $request_stack_builder->unshift( $stack_app ); |
|
123 | + $request_stack_builder->unshift($stack_app); |
|
124 | 124 | } |
125 | 125 | return apply_filters( |
126 | 126 | 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * no other logic should be performed at this point |
138 | 138 | */ |
139 | 139 | public static function load_espresso_addons() { |
140 | - do_action( 'AHEE__EE_Bootstrap__load_espresso_addons' ); |
|
140 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * we can determine if anything needs activating or upgrading |
150 | 150 | */ |
151 | 151 | public static function detect_activations_or_upgrades() { |
152 | - do_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' ); |
|
152 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * we can load and set all of the system configurations |
162 | 162 | */ |
163 | 163 | public static function load_core_configuration() { |
164 | - do_action( 'AHEE__EE_Bootstrap__load_core_configuration' ); |
|
164 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * so that they are ready to be used throughout the system |
174 | 174 | */ |
175 | 175 | public static function register_shortcodes_modules_and_widgets() { |
176 | - do_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' ); |
|
176 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * so let the fun begin... |
186 | 186 | */ |
187 | 187 | public static function brew_espresso() { |
188 | - do_action( 'AHEE__EE_Bootstrap__brew_espresso' ); |
|
188 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 |
@@ -217,8 +217,7 @@ discard block |
||
217 | 217 | //ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID) |
218 | 218 | try { |
219 | 219 | return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db ); |
220 | - } |
|
221 | - catch ( EE_Error $e ) { |
|
220 | + } catch ( EE_Error $e ) { |
|
222 | 221 | //handle it outside the catch |
223 | 222 | } |
224 | 223 | throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) ); |
@@ -283,8 +282,7 @@ discard block |
||
283 | 282 | break; |
284 | 283 | } |
285 | 284 | } |
286 | - } |
|
287 | - catch ( EE_Error $e ) { |
|
285 | + } catch ( EE_Error $e ) { |
|
288 | 286 | $payment_method->set_active( FALSE ); |
289 | 287 | } |
290 | 288 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * |
@@ -37,33 +37,33 @@ discard block |
||
37 | 37 | * @access protected |
38 | 38 | * @return EEM_Payment_Method |
39 | 39 | */ |
40 | - protected function __construct( $timezone = NULL ) { |
|
41 | - $this->singlular_item = __( 'Payment Method', 'event_espresso' ); |
|
42 | - $this->plural_item = __( 'Payment Methods', 'event_espresso' ); |
|
43 | - $this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) ); |
|
40 | + protected function __construct($timezone = NULL) { |
|
41 | + $this->singlular_item = __('Payment Method', 'event_espresso'); |
|
42 | + $this->plural_item = __('Payment Methods', 'event_espresso'); |
|
43 | + $this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID')); |
|
44 | 44 | $this->_fields = array( |
45 | 45 | 'Payment_Method' => array( |
46 | - 'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ), |
|
47 | - 'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ), |
|
48 | - 'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ), |
|
49 | - 'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ), |
|
50 | - 'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ), |
|
51 | - 'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ), |
|
52 | - 'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ), |
|
53 | - 'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ), |
|
54 | - 'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ), |
|
55 | - 'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ), |
|
56 | - 'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ), |
|
57 | - 'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API' |
|
46 | + 'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')), |
|
47 | + 'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'), |
|
48 | + 'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE), |
|
49 | + 'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''), |
|
50 | + 'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE), |
|
51 | + 'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE), |
|
52 | + 'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE), |
|
53 | + 'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0), |
|
54 | + 'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE), |
|
55 | + 'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE), |
|
56 | + 'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''), |
|
57 | + 'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API' |
|
58 | 58 | ) ); |
59 | 59 | $this->_model_relations = array( |
60 | 60 | // 'Event'=>new EE_HABTM_Relation('Event_Payment_Method'), |
61 | 61 | 'Payment' => new EE_Has_Many_Relation(), |
62 | - 'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ), |
|
62 | + 'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'), |
|
63 | 63 | 'Transaction' => new EE_Has_Many_Relation(), |
64 | 64 | 'WP_User' => new EE_Belongs_To_Relation(), |
65 | 65 | ); |
66 | - parent::__construct( $timezone ); |
|
66 | + parent::__construct($timezone); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param string $slug |
74 | 74 | * @return EE_Payment_Method |
75 | 75 | */ |
76 | - public function get_one_by_slug( $slug ) { |
|
77 | - return $this->get_one( array( array( 'PMD_slug' => $slug ) ) ); |
|
76 | + public function get_one_by_slug($slug) { |
|
77 | + return $this->get_one(array(array('PMD_slug' => $slug))); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | return apply_filters( |
89 | 89 | 'FHEE__EEM_Payment_Method__scopes', |
90 | 90 | array( |
91 | - self::scope_cart => __( "Front-end Registration Page", 'event_espresso' ), |
|
92 | - self::scope_admin => __( "Admin Registration Page (no online processing)", 'event_espresso' ) |
|
91 | + self::scope_cart => __("Front-end Registration Page", 'event_espresso'), |
|
92 | + self::scope_admin => __("Admin Registration Page (no online processing)", 'event_espresso') |
|
93 | 93 | ) |
94 | 94 | ); |
95 | 95 | } |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string $scope like one of EEM_Payment_Method::instance()->scopes() |
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | - public function is_valid_scope( $scope ) { |
|
104 | + public function is_valid_scope($scope) { |
|
105 | 105 | $scopes = $this->scopes(); |
106 | - if ( isset( $scopes[ $scope ] ) ) { |
|
106 | + if (isset($scopes[$scope])) { |
|
107 | 107 | return TRUE; |
108 | 108 | } else { |
109 | 109 | return FALSE; |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | * @throws EE_Error |
120 | 120 | * @return EE_Payment_Method[] |
121 | 121 | */ |
122 | - public function get_all_active( $scope = NULL, $query_params = array() ) { |
|
123 | - if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) { |
|
124 | - $query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) ); |
|
122 | + public function get_all_active($scope = NULL, $query_params = array()) { |
|
123 | + if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) { |
|
124 | + $query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC')); |
|
125 | 125 | } |
126 | - return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
126 | + return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param array $query_params |
133 | 133 | * @return int |
134 | 134 | */ |
135 | - public function count_active( $scope = NULL, $query_params = array() ){ |
|
136 | - return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
135 | + public function count_active($scope = NULL, $query_params = array()) { |
|
136 | + return $this->count($this->_get_query_params_for_all_active($scope, $query_params)); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | * @return array like param of EEM_Base::get_all() |
145 | 145 | * @throws EE_Error |
146 | 146 | */ |
147 | - protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){ |
|
148 | - if ( $scope ) { |
|
149 | - if ( $this->is_valid_scope( $scope ) ) { |
|
150 | - return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params ); |
|
147 | + protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) { |
|
148 | + if ($scope) { |
|
149 | + if ($this->is_valid_scope($scope)) { |
|
150 | + return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params); |
|
151 | 151 | } else { |
152 | - throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) ); |
|
152 | + throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope)); |
|
153 | 153 | } |
154 | 154 | } else { |
155 | 155 | $acceptable_scopes = array(); |
156 | 156 | $count = 0; |
157 | - foreach ( $this->scopes() as $scope_name => $desc ) { |
|
157 | + foreach ($this->scopes() as $scope_name => $desc) { |
|
158 | 158 | $count++; |
159 | - $acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' ); |
|
159 | + $acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%'); |
|
160 | 160 | } |
161 | - return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params ); |
|
161 | + return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * @return array like param of EEM_Base::get_all() |
171 | 171 | * @throws EE_Error |
172 | 172 | */ |
173 | - public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) { |
|
174 | - return $this->_get_query_params_for_all_active( $scope, $query_params ); |
|
173 | + public function get_query_params_for_all_active($scope = NULL, $query_params = array()) { |
|
174 | + return $this->_get_query_params_for_all_active($scope, $query_params); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @param array $query_params |
182 | 182 | * @return EE_Payment_Method |
183 | 183 | */ |
184 | - public function get_one_active( $scope = NULL, $query_params = array() ) { |
|
185 | - return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
184 | + public function get_one_active($scope = NULL, $query_params = array()) { |
|
185 | + return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * @param string $type |
193 | 193 | * @return EE_Payment_Method |
194 | 194 | */ |
195 | - public function get_one_of_type( $type ) { |
|
196 | - return $this->get_one( array( array( 'PMD_type' => $type ) ) ); |
|
195 | + public function get_one_of_type($type) { |
|
196 | + return $this->get_one(array(array('PMD_type' => $type))); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -206,22 +206,22 @@ discard block |
||
206 | 206 | * @return EE_Payment_Method |
207 | 207 | * @throws EE_Error |
208 | 208 | */ |
209 | - public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) { |
|
209 | + public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) { |
|
210 | 210 | //first: check if it's a slug |
211 | - if( is_string( $base_class_obj_or_id ) ) { |
|
212 | - $obj = $this->get_one_by_slug( $base_class_obj_or_id ); |
|
213 | - if( $obj ) { |
|
211 | + if (is_string($base_class_obj_or_id)) { |
|
212 | + $obj = $this->get_one_by_slug($base_class_obj_or_id); |
|
213 | + if ($obj) { |
|
214 | 214 | return $obj; |
215 | 215 | } |
216 | 216 | } |
217 | 217 | //ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID) |
218 | 218 | try { |
219 | - return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db ); |
|
219 | + return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db); |
|
220 | 220 | } |
221 | - catch ( EE_Error $e ) { |
|
221 | + catch (EE_Error $e) { |
|
222 | 222 | //handle it outside the catch |
223 | 223 | } |
224 | - throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) ); |
|
224 | + throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id)); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | * @param mixed $base_obj_or_id_or_slug |
233 | 233 | * @return int |
234 | 234 | */ |
235 | - function ensure_is_ID( $base_obj_or_id_or_slug ) { |
|
236 | - if ( is_string( $base_obj_or_id_or_slug ) ) { |
|
235 | + function ensure_is_ID($base_obj_or_id_or_slug) { |
|
236 | + if (is_string($base_obj_or_id_or_slug)) { |
|
237 | 237 | //assume it's a slug |
238 | - $base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug ); |
|
238 | + $base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug); |
|
239 | 239 | } |
240 | - return parent::ensure_is_ID( $base_obj_or_id_or_slug ); |
|
240 | + return parent::ensure_is_ID($base_obj_or_id_or_slug); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -246,36 +246,36 @@ discard block |
||
246 | 246 | * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default. |
247 | 247 | * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart |
248 | 248 | */ |
249 | - function verify_button_urls( $payment_methods = NULL ) { |
|
250 | - $payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
251 | - foreach ( $payment_methods as $payment_method ) { |
|
249 | + function verify_button_urls($payment_methods = NULL) { |
|
250 | + $payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
251 | + foreach ($payment_methods as $payment_method) { |
|
252 | 252 | try { |
253 | 253 | $current_button_url = $payment_method->button_url(); |
254 | - $buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array( |
|
255 | - 'current_ssl' => str_replace( "http://", "https://", $current_button_url ), |
|
256 | - 'current' => str_replace( "https://", "http://", $current_button_url ), |
|
257 | - 'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ), |
|
258 | - 'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ), |
|
259 | - ) ); |
|
260 | - foreach( $buttons_urls_to_try as $button_url_to_try ) { |
|
261 | - if( |
|
254 | + $buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array( |
|
255 | + 'current_ssl' => str_replace("http://", "https://", $current_button_url), |
|
256 | + 'current' => str_replace("https://", "http://", $current_button_url), |
|
257 | + 'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()), |
|
258 | + 'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()), |
|
259 | + )); |
|
260 | + foreach ($buttons_urls_to_try as $button_url_to_try) { |
|
261 | + if ( |
|
262 | 262 | (//this is the current url and it exists, regardless of SSL issues |
263 | 263 | $button_url_to_try == $current_button_url && |
264 | 264 | EEH_URL::remote_file_exists( |
265 | 265 | $button_url_to_try, |
266 | 266 | array( |
267 | 267 | 'sslverify' => false, |
268 | - 'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
268 | + 'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
269 | 269 | ) ) |
270 | 270 | ) |
271 | 271 | || |
272 | 272 | (//this is NOT the current url and it exists with a working SSL cert |
273 | 273 | $button_url_to_try != $current_button_url && |
274 | - EEH_URL::remote_file_exists( $button_url_to_try ) |
|
274 | + EEH_URL::remote_file_exists($button_url_to_try) |
|
275 | 275 | ) ) { |
276 | - if( $current_button_url != $button_url_to_try ){ |
|
277 | - $payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) ); |
|
278 | - EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) ); |
|
276 | + if ($current_button_url != $button_url_to_try) { |
|
277 | + $payment_method->save(array('PMD_button_url' => $button_url_to_try)); |
|
278 | + EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try)); |
|
279 | 279 | } |
280 | 280 | //this image exists. So if wasn't set before, now it is; |
281 | 281 | //or if it was already set, we have nothing to do |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
286 | - catch ( EE_Error $e ) { |
|
287 | - $payment_method->set_active( FALSE ); |
|
286 | + catch (EE_Error $e) { |
|
287 | + $payment_method->set_active(FALSE); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | } |
@@ -298,29 +298,29 @@ discard block |
||
298 | 298 | * @param array $rows |
299 | 299 | * @return EE_Payment_Method[] |
300 | 300 | */ |
301 | - protected function _create_objects( $rows = array() ) { |
|
302 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
303 | - $payment_methods = parent::_create_objects( $rows ); |
|
301 | + protected function _create_objects($rows = array()) { |
|
302 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
303 | + $payment_methods = parent::_create_objects($rows); |
|
304 | 304 | /* @var $payment_methods EE_Payment_Method[] */ |
305 | 305 | $usable_payment_methods = array(); |
306 | - foreach ( $payment_methods as $key => $payment_method ) { |
|
307 | - if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $payment_method->type() ) ) { |
|
308 | - $usable_payment_methods[ $key ] = $payment_method; |
|
306 | + foreach ($payment_methods as $key => $payment_method) { |
|
307 | + if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) { |
|
308 | + $usable_payment_methods[$key] = $payment_method; |
|
309 | 309 | //some payment methods enqueue their scripts in EE_PMT_*::__construct |
310 | 310 | //which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue |
311 | 311 | //its scripts). but for backwards-compat we should continue to do that |
312 | 312 | $payment_method->type_obj(); |
313 | - } elseif( $payment_method->active() ) { |
|
313 | + } elseif ($payment_method->active()) { |
|
314 | 314 | //only deactivate and notify the admin if the payment is active somewhere |
315 | 315 | $payment_method->deactivate(); |
316 | 316 | $payment_method->save(); |
317 | 317 | EE_Error::add_persistent_admin_notice( |
318 | - 'auto-deactivated-' . $payment_method->type(), |
|
318 | + 'auto-deactivated-'.$payment_method->type(), |
|
319 | 319 | sprintf( |
320 | - __( 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso' ), |
|
320 | + __('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'), |
|
321 | 321 | $payment_method->admin_name(), |
322 | 322 | '<br />', |
323 | - '<a href="' . admin_url('plugins.php') . '">', |
|
323 | + '<a href="'.admin_url('plugins.php').'">', |
|
324 | 324 | '</a>' |
325 | 325 | ), |
326 | 326 | true |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | * @param string $scope @see EEM_Payment_Method::get_all_for_events |
341 | 341 | * @return EE_Payment_Method[] |
342 | 342 | */ |
343 | - public function get_all_for_transaction( $transaction, $scope ) { |
|
343 | + public function get_all_for_transaction($transaction, $scope) { |
|
344 | 344 | //@todo take relations between events and payment methods into account, once that relation exists |
345 | - if ( $transaction instanceof EE_Transaction ) { |
|
345 | + if ($transaction instanceof EE_Transaction) { |
|
346 | 346 | //@todo take the relation between transaction and currencies into account |
347 | 347 | } |
348 | - $currencies_for_events = array( EE_Config::instance()->currency->code ); |
|
348 | + $currencies_for_events = array(EE_Config::instance()->currency->code); |
|
349 | 349 | //give addons a chance to override what payment methods are chosen based on the transaction |
350 | 350 | return apply_filters( |
351 | 351 | 'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods', |
352 | - $this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ), |
|
352 | + $this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))), |
|
353 | 353 | $transaction, |
354 | 354 | $scope |
355 | 355 | ); |
@@ -365,16 +365,16 @@ discard block |
||
365 | 365 | * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
366 | 366 | * @return EE_Payment|null |
367 | 367 | */ |
368 | - public function get_last_used_for_registration( $registration_or_reg_id ) { |
|
369 | - $registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id ); |
|
368 | + public function get_last_used_for_registration($registration_or_reg_id) { |
|
369 | + $registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id); |
|
370 | 370 | |
371 | 371 | $query_params = array( |
372 | 372 | 0 => array( |
373 | 373 | 'Payment.Registration.REG_ID' => $registration_id, |
374 | 374 | ), |
375 | - 'order_by' => array( 'Payment.PAY_ID' => 'DESC' ) |
|
375 | + 'order_by' => array('Payment.PAY_ID' => 'DESC') |
|
376 | 376 | ); |
377 | - return $this->get_one( $query_params ); |
|
377 | + return $this->get_one($query_params); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | /** |
202 | 202 | * Overrides parent ot also check by the slug |
203 | 203 | * @see EEM_Base::ensure_is_obj() |
204 | - * @param string|int|EE_Payment_Method $base_class_obj_or_id |
|
204 | + * @param EE_Payment_Method $base_class_obj_or_id |
|
205 | 205 | * @param boolean $ensure_is_in_db |
206 | 206 | * @return EE_Payment_Method |
207 | 207 | * @throws EE_Error |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | * Note: if an offline payment method was selected on the related transaction then this will have no payment methods returned. |
363 | 363 | * It will ONLY return a payment method for a PAYMENT recorded against the registration. |
364 | 364 | * |
365 | - * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
|
366 | - * @return EE_Payment|null |
|
365 | + * @param EE_Registration $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
|
366 | + * @return null|EE_Base_Class |
|
367 | 367 | */ |
368 | 368 | public function get_last_used_for_registration( $registration_or_reg_id ) { |
369 | 369 | $registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id ); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @since $VID:$ |
16 | 16 | * |
17 | 17 | */ |
18 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
19 | - exit( 'No direct script access allowed' ); |
|
18 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | + exit('No direct script access allowed'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Datetime extends Calculations_Base { |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @return int |
33 | 33 | * @throws \EE_Error |
34 | 34 | */ |
35 | - public static function spaces_remaining_considering_tickets( $wpdb_row, $request, $controller ){ |
|
36 | - if( is_array( $wpdb_row ) && isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
37 | - $dtt_obj = \EEM_Datetime::instance()->get_one_by_ID( $wpdb_row[ 'Datetime.DTT_ID' ] ); |
|
35 | + public static function spaces_remaining_considering_tickets($wpdb_row, $request, $controller) { |
|
36 | + if (is_array($wpdb_row) && isset($wpdb_row['Datetime.DTT_ID'])) { |
|
37 | + $dtt_obj = \EEM_Datetime::instance()->get_one_by_ID($wpdb_row['Datetime.DTT_ID']); |
|
38 | 38 | } else { |
39 | 39 | $dtt_obj = null; |
40 | 40 | } |
41 | - if( $dtt_obj instanceof \EE_Datetime ) { |
|
42 | - return $dtt_obj->spaces_remaining( true ); |
|
41 | + if ($dtt_obj instanceof \EE_Datetime) { |
|
42 | + return $dtt_obj->spaces_remaining(true); |
|
43 | 43 | } else { |
44 | 44 | throw new \EE_Error( |
45 | 45 | sprintf( |
46 | - __( 'Cannot calculate spaces_remaining_considering_tickets because the datetime with ID %1$s (from database row %2$s) was not found', 'event_espresso' ), |
|
47 | - $wpdb_row[ 'Datetime.DTT_ID' ], |
|
48 | - print_r( $wpdb_row, true ) |
|
46 | + __('Cannot calculate spaces_remaining_considering_tickets because the datetime with ID %1$s (from database row %2$s) was not found', 'event_espresso'), |
|
47 | + $wpdb_row['Datetime.DTT_ID'], |
|
48 | + print_r($wpdb_row, true) |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | } |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | * @throws \EE_Error |
64 | 64 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
65 | 65 | */ |
66 | - public static function registrations_checked_in_count( $wpdb_row, $request, $controller ){ |
|
67 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
66 | + public static function registrations_checked_in_count($wpdb_row, $request, $controller) { |
|
67 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
68 | 68 | throw new \EE_Error( |
69 | 69 | sprintf( |
70 | - __( 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
71 | - print_r( $wpdb_row, true ) |
|
70 | + __('Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso'), |
|
71 | + print_r($wpdb_row, true) |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | } |
75 | - self::_verify_current_user_can( 'ee_read_checkins', 'registrations_checked_in_count' ); |
|
76 | - return \EEM_Registration::instance()->count_registrations_checked_into_datetime( $wpdb_row[ 'Datetime.DTT_ID' ], true ); |
|
75 | + self::_verify_current_user_can('ee_read_checkins', 'registrations_checked_in_count'); |
|
76 | + return \EEM_Registration::instance()->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], true); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | * @throws \EE_Error |
89 | 89 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
90 | 90 | */ |
91 | - public static function registrations_checked_out_count( $wpdb_row, $request, $controller ){ |
|
92 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
91 | + public static function registrations_checked_out_count($wpdb_row, $request, $controller) { |
|
92 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
93 | 93 | throw new \EE_Error( |
94 | 94 | sprintf( |
95 | - __( 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
96 | - print_r( $wpdb_row, true ) |
|
95 | + __('Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso'), |
|
96 | + print_r($wpdb_row, true) |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | - self::_verify_current_user_can( 'ee_read_checkins', 'registrations_checked_out_count' ); |
|
101 | - return \EEM_Registration::instance()->count_registrations_checked_into_datetime( $wpdb_row[ 'Datetime.DTT_ID' ], false ); |
|
100 | + self::_verify_current_user_can('ee_read_checkins', 'registrations_checked_out_count'); |
|
101 | + return \EEM_Registration::instance()->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], false); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -114,20 +114,20 @@ discard block |
||
114 | 114 | * @throws \EE_Error |
115 | 115 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
116 | 116 | */ |
117 | - public static function spots_taken_pending_payment( $wpdb_row, $request, $controller ){ |
|
118 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
117 | + public static function spots_taken_pending_payment($wpdb_row, $request, $controller) { |
|
118 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
119 | 119 | throw new \EE_Error( |
120 | 120 | sprintf( |
121 | - __( 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
122 | - print_r( $wpdb_row, true ) |
|
121 | + __('Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso'), |
|
122 | + print_r($wpdb_row, true) |
|
123 | 123 | ) |
124 | 124 | ); |
125 | 125 | } |
126 | - self::_verify_current_user_can( 'ee_read_registrations', 'spots_taken_pending_payment' ); |
|
126 | + self::_verify_current_user_can('ee_read_registrations', 'spots_taken_pending_payment'); |
|
127 | 127 | return \EEM_Registration::instance()->count( |
128 | 128 | array( |
129 | 129 | array( |
130 | - 'Ticket.Datetime.DTT_ID' => $wpdb_row[ 'Datetime.DTT_ID' ], |
|
130 | + 'Ticket.Datetime.DTT_ID' => $wpdb_row['Datetime.DTT_ID'], |
|
131 | 131 | 'STS_ID' => \EEM_Registration::status_id_pending_payment |
132 | 132 | ) |
133 | 133 | ), |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param mixed $info |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function add( $object, $info = null ) { |
|
43 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | - return parent::add( $object, $info ); |
|
42 | + public function add($object, $info = null) { |
|
43 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | + return parent::add($object, $info); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param mixed $info |
58 | 58 | * @return bool |
59 | 59 | */ |
60 | - public function set_info( $object, $info = null ) { |
|
61 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | - return parent::set_info( $object, $info ); |
|
60 | + public function set_info($object, $info = null) { |
|
61 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | + return parent::set_info($object, $info); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @param mixed |
75 | 75 | * @return null | object |
76 | 76 | */ |
77 | - public function get_by_info( $info ) { |
|
78 | - return parent::get_by_info( str_replace( ' ', '_', strtolower( $info ) ) ); |
|
77 | + public function get_by_info($info) { |
|
78 | + return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param object $object |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public function has( $object ) { |
|
93 | - return parent::has( $object ); |
|
92 | + public function has($object) { |
|
93 | + return parent::has($object); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $message_type_name |
105 | 105 | * @return bool |
106 | 106 | */ |
107 | - public function has_by_name( $message_type_name ) { |
|
108 | - return $this->get_by_info( $message_type_name ) instanceof $this->interface ? true : false; |
|
107 | + public function has_by_name($message_type_name) { |
|
108 | + return $this->get_by_info($message_type_name) instanceof $this->interface ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param $object |
120 | 120 | * @return bool |
121 | 121 | */ |
122 | - public function remove( $object ) { |
|
123 | - return parent::remove( $object ); |
|
122 | + public function remove($object) { |
|
123 | + return parent::remove($object); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @param $object |
135 | 135 | * @return void |
136 | 136 | */ |
137 | - public function set_current( $object ) { |
|
138 | - parent::set_current( $object ); |
|
137 | + public function set_current($object) { |
|
138 | + parent::set_current($object); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param $info |
150 | 150 | * @return void |
151 | 151 | */ |
152 | - public function set_current_by_info( $info ) { |
|
153 | - parent::set_current_by_info( $info ); |
|
152 | + public function set_current_by_info($info) { |
|
153 | + parent::set_current_by_info($info); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | * @return void |
165 | 165 | */ |
166 | 166 | public function show_collection_classes() { |
167 | - if ( WP_DEBUG ) { |
|
167 | + if (WP_DEBUG) { |
|
168 | 168 | $this->rewind(); |
169 | - while ( $this->valid() ) { |
|
170 | - echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
169 | + while ($this->valid()) { |
|
170 | + echo '<h5 style="color:#2EA2CC;">'.__CLASS__.' class : <span style="color:#E76700">'.$this->getInfo().'</span></h5>'; |
|
171 | 171 | $this->next(); |
172 | 172 | } |
173 | 173 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param mixed $info |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function add( $object, $info = null ) { |
|
43 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | - return parent::add( $object, $info ); |
|
42 | + public function add($object, $info = null) { |
|
43 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | + return parent::add($object, $info); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param mixed $info |
58 | 58 | * @return bool |
59 | 59 | */ |
60 | - public function set_info( $object, $info = null ) { |
|
61 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | - return parent::set_info( $object, $info ); |
|
60 | + public function set_info($object, $info = null) { |
|
61 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | + return parent::set_info($object, $info); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @param mixed |
75 | 75 | * @return null | object |
76 | 76 | */ |
77 | - public function get_by_info( $info ) { |
|
78 | - return parent::get_by_info( str_replace( ' ', '_', strtolower( $info ) ) ); |
|
77 | + public function get_by_info($info) { |
|
78 | + return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param object $object |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public function has( $object ) { |
|
93 | - return parent::has( $object ); |
|
92 | + public function has($object) { |
|
93 | + return parent::has($object); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $messenger_name |
105 | 105 | * @return bool |
106 | 106 | */ |
107 | - public function has_by_name( $messenger_name ) { |
|
108 | - return $this->get_by_info( $messenger_name ) instanceof $this->interface ? true : false; |
|
107 | + public function has_by_name($messenger_name) { |
|
108 | + return $this->get_by_info($messenger_name) instanceof $this->interface ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param $object |
120 | 120 | * @return bool |
121 | 121 | */ |
122 | - public function remove( $object ) { |
|
123 | - return parent::remove( $object ); |
|
122 | + public function remove($object) { |
|
123 | + return parent::remove($object); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | * @param $object |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public function set_current( $object ) { |
|
152 | - parent::set_current( $object ); |
|
151 | + public function set_current($object) { |
|
152 | + parent::set_current($object); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @param $info |
164 | 164 | * @return void |
165 | 165 | */ |
166 | - public function set_current_by_info( $info ) { |
|
167 | - parent::set_current_by_info( $info ); |
|
166 | + public function set_current_by_info($info) { |
|
167 | + parent::set_current_by_info($info); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @return void |
179 | 179 | */ |
180 | 180 | public function show_collection_classes() { |
181 | - if ( WP_DEBUG ) { |
|
181 | + if (WP_DEBUG) { |
|
182 | 182 | $this->rewind(); |
183 | - while ( $this->valid() ) { |
|
184 | - echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : . <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
183 | + while ($this->valid()) { |
|
184 | + echo '<h5 style="color:#2EA2CC;">'.__CLASS__.' class : . <span style="color:#E76700">'.$this->getInfo().'</span></h5>'; |
|
185 | 185 | $this->next(); |
186 | 186 | } |
187 | 187 | } |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @ link http://www.eventespresso.com |
10 | 10 | * @ version 4+ |
11 | 11 | */ |
12 | -define( 'EE_THEME_FUNCTIONS_LOADED', TRUE ); |
|
12 | +define('EE_THEME_FUNCTIONS_LOADED', TRUE); |
|
13 | 13 | |
14 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
14 | +if ( ! function_exists('espresso_pagination')) { |
|
15 | 15 | /** |
16 | 16 | * espresso_pagination |
17 | 17 | * |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | $big = 999999999; // need an unlikely integer |
24 | 24 | $pagination = paginate_links( |
25 | 25 | array( |
26 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
26 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
27 | 27 | 'format' => '?paged=%#%', |
28 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
28 | + 'current' => max(1, get_query_var('paged')), |
|
29 | 29 | 'total' => $wp_query->max_num_pages, |
30 | 30 | 'show_all' => true, |
31 | 31 | 'end_size' => 10, |
32 | 32 | 'mid_size' => 6, |
33 | 33 | 'prev_next' => true, |
34 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
35 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
34 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
35 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
36 | 36 | 'type' => 'plain', |
37 | 37 | 'add_args' => false, |
38 | 38 | 'add_fragment' => '' |
39 | 39 | ) |
40 | 40 | ); |
41 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
41 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |