@@ -47,7 +47,7 @@ |
||
| 47 | 47 | public function handle(CommandInterface $command) |
| 48 | 48 | { |
| 49 | 49 | /** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */ |
| 50 | - if (! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) { |
|
| 50 | + if ( ! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) { |
|
| 51 | 51 | throw new InvalidEntityException( |
| 52 | 52 | get_class($command), |
| 53 | 53 | 'UpdateRegistrationAndTransactionAfterChangeCommand' |
@@ -17,39 +17,39 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class UpdateRegistrationAndTransactionAfterChangeCommandHandler extends CommandHandler |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * @var UpdateRegistrationService $update_registration_service |
|
| 22 | - */ |
|
| 23 | - private $update_registration_service; |
|
| 20 | + /** |
|
| 21 | + * @var UpdateRegistrationService $update_registration_service |
|
| 22 | + */ |
|
| 23 | + private $update_registration_service; |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Command constructor |
|
| 28 | - * |
|
| 29 | - * @param UpdateRegistrationService $update_registration_service |
|
| 30 | - */ |
|
| 31 | - public function __construct( |
|
| 32 | - UpdateRegistrationService $update_registration_service |
|
| 33 | - ) { |
|
| 34 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 35 | - $this->update_registration_service = $update_registration_service; |
|
| 36 | - } |
|
| 26 | + /** |
|
| 27 | + * Command constructor |
|
| 28 | + * |
|
| 29 | + * @param UpdateRegistrationService $update_registration_service |
|
| 30 | + */ |
|
| 31 | + public function __construct( |
|
| 32 | + UpdateRegistrationService $update_registration_service |
|
| 33 | + ) { |
|
| 34 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 35 | + $this->update_registration_service = $update_registration_service; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command |
|
| 41 | - * @return boolean |
|
| 42 | - * @throws InvalidEntityException |
|
| 43 | - */ |
|
| 44 | - public function handle(CommandInterface $command) |
|
| 45 | - { |
|
| 46 | - /** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */ |
|
| 47 | - if (! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) { |
|
| 48 | - throw new InvalidEntityException( |
|
| 49 | - get_class($command), |
|
| 50 | - 'UpdateRegistrationAndTransactionAfterChangeCommand' |
|
| 51 | - ); |
|
| 52 | - } |
|
| 53 | - return $this->update_registration_service->updateRegistrationAndTransaction($command->registration()); |
|
| 54 | - } |
|
| 39 | + /** |
|
| 40 | + * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command |
|
| 41 | + * @return boolean |
|
| 42 | + * @throws InvalidEntityException |
|
| 43 | + */ |
|
| 44 | + public function handle(CommandInterface $command) |
|
| 45 | + { |
|
| 46 | + /** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */ |
|
| 47 | + if (! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) { |
|
| 48 | + throw new InvalidEntityException( |
|
| 49 | + get_class($command), |
|
| 50 | + 'UpdateRegistrationAndTransactionAfterChangeCommand' |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | + return $this->update_registration_service->updateRegistrationAndTransaction($command->registration()); |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $this->reg_status = $reg_status; |
| 93 | 93 | // grab the related ticket object for this line_item if one wasn't already supplied |
| 94 | 94 | $this->ticket = $ticket instanceof EE_Ticket ? $ticket : $this->ticket_line_item->ticket(); |
| 95 | - if (! $this->ticket instanceof EE_Ticket) { |
|
| 95 | + if ( ! $this->ticket instanceof EE_Ticket) { |
|
| 96 | 96 | throw new InvalidEntityException( |
| 97 | 97 | is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
| 98 | 98 | 'EE_Ticket', |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getCapCheck() |
| 113 | 113 | { |
| 114 | - if (! $this->cap_check instanceof CapCheckInterface) { |
|
| 114 | + if ( ! $this->cap_check instanceof CapCheckInterface) { |
|
| 115 | 115 | return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
| 116 | 116 | } |
| 117 | 117 | return $this->cap_check; |
@@ -25,155 +25,155 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class CreateRegistrationCommand extends Command implements CommandRequiresCapCheckInterface |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * @var EE_Transaction $transaction |
|
| 30 | - */ |
|
| 31 | - private $transaction; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var EE_Ticket $ticket |
|
| 35 | - */ |
|
| 36 | - private $ticket; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var EE_Line_Item $ticket_line_item |
|
| 40 | - */ |
|
| 41 | - private $ticket_line_item; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @var int $reg_count |
|
| 45 | - */ |
|
| 46 | - private $reg_count; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @var int $reg_group_size |
|
| 50 | - */ |
|
| 51 | - private $reg_group_size; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @var string $reg_status |
|
| 55 | - */ |
|
| 56 | - private $reg_status; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @var EE_Registration $registration |
|
| 60 | - */ |
|
| 61 | - protected $registration; |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * CreateRegistrationCommand constructor. |
|
| 66 | - * |
|
| 67 | - * @param EE_Transaction $transaction |
|
| 68 | - * @param EE_Line_Item $ticket_line_item |
|
| 69 | - * @param int $reg_count |
|
| 70 | - * @param int $reg_group_size |
|
| 71 | - * @param string $reg_status |
|
| 72 | - * @param EE_Ticket|null $ticket |
|
| 73 | - * @throws InvalidEntityException |
|
| 74 | - * @throws EE_Error |
|
| 75 | - */ |
|
| 76 | - public function __construct( |
|
| 77 | - EE_Transaction $transaction, |
|
| 78 | - EE_Line_Item $ticket_line_item, |
|
| 79 | - $reg_count = 1, |
|
| 80 | - $reg_group_size = 0, |
|
| 81 | - $reg_status = EEM_Registration::status_id_incomplete, |
|
| 82 | - EE_Ticket $ticket = null |
|
| 83 | - ) { |
|
| 84 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 85 | - $this->transaction = $transaction; |
|
| 86 | - $this->ticket_line_item = $ticket_line_item; |
|
| 87 | - $this->reg_count = absint($reg_count); |
|
| 88 | - $this->reg_group_size = absint($reg_group_size); |
|
| 89 | - $this->reg_status = $reg_status; |
|
| 90 | - // grab the related ticket object for this line_item if one wasn't already supplied |
|
| 91 | - $this->ticket = $ticket instanceof EE_Ticket ? $ticket : $this->ticket_line_item->ticket(); |
|
| 92 | - if (! $this->ticket instanceof EE_Ticket) { |
|
| 93 | - throw new InvalidEntityException( |
|
| 94 | - is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
|
| 95 | - 'EE_Ticket', |
|
| 96 | - sprintf( |
|
| 97 | - esc_html__('Line item %s did not contain a valid ticket', 'event_espresso'), |
|
| 98 | - $ticket_line_item->ID() |
|
| 99 | - ) |
|
| 100 | - ); |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @return CapCheckInterface |
|
| 107 | - * @throws InvalidDataTypeException |
|
| 108 | - */ |
|
| 109 | - public function getCapCheck() |
|
| 110 | - { |
|
| 111 | - if (! $this->cap_check instanceof CapCheckInterface) { |
|
| 112 | - return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
|
| 113 | - } |
|
| 114 | - return $this->cap_check; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @return EE_Transaction |
|
| 120 | - */ |
|
| 121 | - public function transaction() |
|
| 122 | - { |
|
| 123 | - return $this->transaction; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @return EE_Ticket |
|
| 129 | - */ |
|
| 130 | - public function ticket() |
|
| 131 | - { |
|
| 132 | - return $this->ticket; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * @return EE_Line_Item |
|
| 138 | - */ |
|
| 139 | - public function ticketLineItem() |
|
| 140 | - { |
|
| 141 | - return $this->ticket_line_item; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @return int |
|
| 147 | - */ |
|
| 148 | - public function regCount() |
|
| 149 | - { |
|
| 150 | - return $this->reg_count; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * @return int |
|
| 156 | - */ |
|
| 157 | - public function regGroupSize() |
|
| 158 | - { |
|
| 159 | - return $this->reg_group_size; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * @return string |
|
| 165 | - */ |
|
| 166 | - public function regStatus() |
|
| 167 | - { |
|
| 168 | - return $this->reg_status; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * @return EE_Registration |
|
| 174 | - */ |
|
| 175 | - public function registration() |
|
| 176 | - { |
|
| 177 | - return $this->registration; |
|
| 178 | - } |
|
| 28 | + /** |
|
| 29 | + * @var EE_Transaction $transaction |
|
| 30 | + */ |
|
| 31 | + private $transaction; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var EE_Ticket $ticket |
|
| 35 | + */ |
|
| 36 | + private $ticket; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var EE_Line_Item $ticket_line_item |
|
| 40 | + */ |
|
| 41 | + private $ticket_line_item; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @var int $reg_count |
|
| 45 | + */ |
|
| 46 | + private $reg_count; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @var int $reg_group_size |
|
| 50 | + */ |
|
| 51 | + private $reg_group_size; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @var string $reg_status |
|
| 55 | + */ |
|
| 56 | + private $reg_status; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @var EE_Registration $registration |
|
| 60 | + */ |
|
| 61 | + protected $registration; |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * CreateRegistrationCommand constructor. |
|
| 66 | + * |
|
| 67 | + * @param EE_Transaction $transaction |
|
| 68 | + * @param EE_Line_Item $ticket_line_item |
|
| 69 | + * @param int $reg_count |
|
| 70 | + * @param int $reg_group_size |
|
| 71 | + * @param string $reg_status |
|
| 72 | + * @param EE_Ticket|null $ticket |
|
| 73 | + * @throws InvalidEntityException |
|
| 74 | + * @throws EE_Error |
|
| 75 | + */ |
|
| 76 | + public function __construct( |
|
| 77 | + EE_Transaction $transaction, |
|
| 78 | + EE_Line_Item $ticket_line_item, |
|
| 79 | + $reg_count = 1, |
|
| 80 | + $reg_group_size = 0, |
|
| 81 | + $reg_status = EEM_Registration::status_id_incomplete, |
|
| 82 | + EE_Ticket $ticket = null |
|
| 83 | + ) { |
|
| 84 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 85 | + $this->transaction = $transaction; |
|
| 86 | + $this->ticket_line_item = $ticket_line_item; |
|
| 87 | + $this->reg_count = absint($reg_count); |
|
| 88 | + $this->reg_group_size = absint($reg_group_size); |
|
| 89 | + $this->reg_status = $reg_status; |
|
| 90 | + // grab the related ticket object for this line_item if one wasn't already supplied |
|
| 91 | + $this->ticket = $ticket instanceof EE_Ticket ? $ticket : $this->ticket_line_item->ticket(); |
|
| 92 | + if (! $this->ticket instanceof EE_Ticket) { |
|
| 93 | + throw new InvalidEntityException( |
|
| 94 | + is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
|
| 95 | + 'EE_Ticket', |
|
| 96 | + sprintf( |
|
| 97 | + esc_html__('Line item %s did not contain a valid ticket', 'event_espresso'), |
|
| 98 | + $ticket_line_item->ID() |
|
| 99 | + ) |
|
| 100 | + ); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @return CapCheckInterface |
|
| 107 | + * @throws InvalidDataTypeException |
|
| 108 | + */ |
|
| 109 | + public function getCapCheck() |
|
| 110 | + { |
|
| 111 | + if (! $this->cap_check instanceof CapCheckInterface) { |
|
| 112 | + return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
|
| 113 | + } |
|
| 114 | + return $this->cap_check; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @return EE_Transaction |
|
| 120 | + */ |
|
| 121 | + public function transaction() |
|
| 122 | + { |
|
| 123 | + return $this->transaction; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @return EE_Ticket |
|
| 129 | + */ |
|
| 130 | + public function ticket() |
|
| 131 | + { |
|
| 132 | + return $this->ticket; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @return EE_Line_Item |
|
| 138 | + */ |
|
| 139 | + public function ticketLineItem() |
|
| 140 | + { |
|
| 141 | + return $this->ticket_line_item; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @return int |
|
| 147 | + */ |
|
| 148 | + public function regCount() |
|
| 149 | + { |
|
| 150 | + return $this->reg_count; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * @return int |
|
| 156 | + */ |
|
| 157 | + public function regGroupSize() |
|
| 158 | + { |
|
| 159 | + return $this->reg_group_size; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * @return string |
|
| 165 | + */ |
|
| 166 | + public function regStatus() |
|
| 167 | + { |
|
| 168 | + return $this->reg_status; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * @return EE_Registration |
|
| 174 | + */ |
|
| 175 | + public function registration() |
|
| 176 | + { |
|
| 177 | + return $this->registration; |
|
| 178 | + } |
|
| 179 | 179 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | public function handle(CommandInterface $command) |
| 53 | 53 | { |
| 54 | 54 | /** @var CreateRegistrationCommand $command */ |
| 55 | - if (! $command instanceof CreateRegistrationCommand) { |
|
| 55 | + if ( ! $command instanceof CreateRegistrationCommand) { |
|
| 56 | 56 | throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand'); |
| 57 | 57 | } |
| 58 | 58 | // now create a new registration for the ticket |
@@ -21,47 +21,47 @@ |
||
| 21 | 21 | class CreateRegistrationCommandHandler extends CommandHandler |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var CreateRegistrationService $registration_service |
|
| 26 | - */ |
|
| 27 | - private $registration_service; |
|
| 24 | + /** |
|
| 25 | + * @var CreateRegistrationService $registration_service |
|
| 26 | + */ |
|
| 27 | + private $registration_service; |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Command constructor |
|
| 32 | - * |
|
| 33 | - * @param CreateRegistrationService $registration_service |
|
| 34 | - */ |
|
| 35 | - public function __construct(CreateRegistrationService $registration_service) |
|
| 36 | - { |
|
| 37 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 38 | - $this->registration_service = $registration_service; |
|
| 39 | - } |
|
| 30 | + /** |
|
| 31 | + * Command constructor |
|
| 32 | + * |
|
| 33 | + * @param CreateRegistrationService $registration_service |
|
| 34 | + */ |
|
| 35 | + public function __construct(CreateRegistrationService $registration_service) |
|
| 36 | + { |
|
| 37 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 38 | + $this->registration_service = $registration_service; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @param CommandInterface|CreateRegistrationCommand $command |
|
| 44 | - * @return mixed |
|
| 45 | - * @throws OutOfRangeException |
|
| 46 | - * @throws UnexpectedEntityException |
|
| 47 | - * @throws EE_Error |
|
| 48 | - * @throws InvalidEntityException |
|
| 49 | - */ |
|
| 50 | - public function handle(CommandInterface $command) |
|
| 51 | - { |
|
| 52 | - /** @var CreateRegistrationCommand $command */ |
|
| 53 | - if (! $command instanceof CreateRegistrationCommand) { |
|
| 54 | - throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand'); |
|
| 55 | - } |
|
| 56 | - // now create a new registration for the ticket |
|
| 57 | - return $this->registration_service->create( |
|
| 58 | - $command->ticket()->get_related_event(), |
|
| 59 | - $command->transaction(), |
|
| 60 | - $command->ticket(), |
|
| 61 | - $command->ticketLineItem(), |
|
| 62 | - $command->regCount(), |
|
| 63 | - $command->regGroupSize(), |
|
| 64 | - $command->regStatus() |
|
| 65 | - ); |
|
| 66 | - } |
|
| 42 | + /** |
|
| 43 | + * @param CommandInterface|CreateRegistrationCommand $command |
|
| 44 | + * @return mixed |
|
| 45 | + * @throws OutOfRangeException |
|
| 46 | + * @throws UnexpectedEntityException |
|
| 47 | + * @throws EE_Error |
|
| 48 | + * @throws InvalidEntityException |
|
| 49 | + */ |
|
| 50 | + public function handle(CommandInterface $command) |
|
| 51 | + { |
|
| 52 | + /** @var CreateRegistrationCommand $command */ |
|
| 53 | + if (! $command instanceof CreateRegistrationCommand) { |
|
| 54 | + throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand'); |
|
| 55 | + } |
|
| 56 | + // now create a new registration for the ticket |
|
| 57 | + return $this->registration_service->create( |
|
| 58 | + $command->ticket()->get_related_event(), |
|
| 59 | + $command->transaction(), |
|
| 60 | + $command->ticket(), |
|
| 61 | + $command->ticketLineItem(), |
|
| 62 | + $command->regCount(), |
|
| 63 | + $command->regGroupSize(), |
|
| 64 | + $command->regStatus() |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | public function handle(CommandInterface $command) |
| 61 | 61 | { |
| 62 | 62 | /** @var CancelRegistrationAndTicketLineItemCommand $command */ |
| 63 | - if (! $command instanceof CancelRegistrationAndTicketLineItemCommand) { |
|
| 63 | + if ( ! $command instanceof CancelRegistrationAndTicketLineItemCommand) { |
|
| 64 | 64 | throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand'); |
| 65 | 65 | } |
| 66 | 66 | $registration = $command->registration(); |
@@ -27,48 +27,48 @@ |
||
| 27 | 27 | class CancelRegistrationAndTicketLineItemCommandHandler extends CommandHandler |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 32 | - */ |
|
| 33 | - private $cancel_ticket_line_item_service; |
|
| 30 | + /** |
|
| 31 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 32 | + */ |
|
| 33 | + private $cancel_ticket_line_item_service; |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Command constructor |
|
| 38 | - * |
|
| 39 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 40 | - */ |
|
| 41 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
| 42 | - { |
|
| 43 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 44 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
| 45 | - } |
|
| 36 | + /** |
|
| 37 | + * Command constructor |
|
| 38 | + * |
|
| 39 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 40 | + */ |
|
| 41 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
| 42 | + { |
|
| 43 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 44 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command |
|
| 50 | - * @return boolean |
|
| 51 | - * @throws DomainException |
|
| 52 | - * @throws EE_Error |
|
| 53 | - * @throws EntityNotFoundException |
|
| 54 | - * @throws InvalidDataTypeException |
|
| 55 | - * @throws InvalidEntityException |
|
| 56 | - * @throws InvalidInterfaceException |
|
| 57 | - * @throws InvalidArgumentException |
|
| 58 | - * @throws ReflectionException |
|
| 59 | - * @throws RuntimeException |
|
| 60 | - */ |
|
| 61 | - public function handle(CommandInterface $command) |
|
| 62 | - { |
|
| 63 | - /** @var CancelRegistrationAndTicketLineItemCommand $command */ |
|
| 64 | - if (! $command instanceof CancelRegistrationAndTicketLineItemCommand) { |
|
| 65 | - throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand'); |
|
| 66 | - } |
|
| 67 | - $registration = $command->registration(); |
|
| 68 | - $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
| 69 | - // cancel original registration |
|
| 70 | - $registration->set_status(EEM_Registration::status_id_cancelled); |
|
| 71 | - $registration->save(); |
|
| 72 | - return true; |
|
| 73 | - } |
|
| 48 | + /** |
|
| 49 | + * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command |
|
| 50 | + * @return boolean |
|
| 51 | + * @throws DomainException |
|
| 52 | + * @throws EE_Error |
|
| 53 | + * @throws EntityNotFoundException |
|
| 54 | + * @throws InvalidDataTypeException |
|
| 55 | + * @throws InvalidEntityException |
|
| 56 | + * @throws InvalidInterfaceException |
|
| 57 | + * @throws InvalidArgumentException |
|
| 58 | + * @throws ReflectionException |
|
| 59 | + * @throws RuntimeException |
|
| 60 | + */ |
|
| 61 | + public function handle(CommandInterface $command) |
|
| 62 | + { |
|
| 63 | + /** @var CancelRegistrationAndTicketLineItemCommand $command */ |
|
| 64 | + if (! $command instanceof CancelRegistrationAndTicketLineItemCommand) { |
|
| 65 | + throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand'); |
|
| 66 | + } |
|
| 67 | + $registration = $command->registration(); |
|
| 68 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
| 69 | + // cancel original registration |
|
| 70 | + $registration->set_status(EEM_Registration::status_id_cancelled); |
|
| 71 | + $registration->save(); |
|
| 72 | + return true; |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | public function handle(CommandInterface $command) |
| 53 | 53 | { |
| 54 | 54 | /** @var CreateTicketLineItemCommand $command */ |
| 55 | - if (! $command instanceof CreateTicketLineItemCommand) { |
|
| 55 | + if ( ! $command instanceof CreateTicketLineItemCommand) { |
|
| 56 | 56 | throw new InvalidEntityException(get_class($command), 'CreateTicketLineItemCommand'); |
| 57 | 57 | } |
| 58 | 58 | // create new line item for ticket |
@@ -20,42 +20,42 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class CreateTicketLineItemCommandHandler extends CommandHandler |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var CreateTicketLineItemService $factory |
|
| 25 | - */ |
|
| 26 | - private $factory; |
|
| 23 | + /** |
|
| 24 | + * @var CreateTicketLineItemService $factory |
|
| 25 | + */ |
|
| 26 | + private $factory; |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Command constructor |
|
| 31 | - * |
|
| 32 | - * @param CreateTicketLineItemService $factory |
|
| 33 | - */ |
|
| 34 | - public function __construct(CreateTicketLineItemService $factory) |
|
| 35 | - { |
|
| 36 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 37 | - $this->factory = $factory; |
|
| 38 | - } |
|
| 29 | + /** |
|
| 30 | + * Command constructor |
|
| 31 | + * |
|
| 32 | + * @param CreateTicketLineItemService $factory |
|
| 33 | + */ |
|
| 34 | + public function __construct(CreateTicketLineItemService $factory) |
|
| 35 | + { |
|
| 36 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 37 | + $this->factory = $factory; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @param CommandInterface|CreateTicketLineItemCommand $command |
|
| 43 | - * @return EE_Line_Item |
|
| 44 | - * @throws InvalidEntityException |
|
| 45 | - * @throws UnexpectedEntityException |
|
| 46 | - * @throws EE_Error |
|
| 47 | - */ |
|
| 48 | - public function handle(CommandInterface $command) |
|
| 49 | - { |
|
| 50 | - /** @var CreateTicketLineItemCommand $command */ |
|
| 51 | - if (! $command instanceof CreateTicketLineItemCommand) { |
|
| 52 | - throw new InvalidEntityException(get_class($command), 'CreateTicketLineItemCommand'); |
|
| 53 | - } |
|
| 54 | - // create new line item for ticket |
|
| 55 | - return $this->factory->create( |
|
| 56 | - $command->transaction(), |
|
| 57 | - $command->ticket(), |
|
| 58 | - $command->quantity() |
|
| 59 | - ); |
|
| 60 | - } |
|
| 41 | + /** |
|
| 42 | + * @param CommandInterface|CreateTicketLineItemCommand $command |
|
| 43 | + * @return EE_Line_Item |
|
| 44 | + * @throws InvalidEntityException |
|
| 45 | + * @throws UnexpectedEntityException |
|
| 46 | + * @throws EE_Error |
|
| 47 | + */ |
|
| 48 | + public function handle(CommandInterface $command) |
|
| 49 | + { |
|
| 50 | + /** @var CreateTicketLineItemCommand $command */ |
|
| 51 | + if (! $command instanceof CreateTicketLineItemCommand) { |
|
| 52 | + throw new InvalidEntityException(get_class($command), 'CreateTicketLineItemCommand'); |
|
| 53 | + } |
|
| 54 | + // create new line item for ticket |
|
| 55 | + return $this->factory->create( |
|
| 56 | + $command->transaction(), |
|
| 57 | + $command->ticket(), |
|
| 58 | + $command->quantity() |
|
| 59 | + ); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | public function handle(CommandInterface $command) |
| 52 | 52 | { |
| 53 | 53 | /** @var CancelTicketLineItemCommand $command */ |
| 54 | - if (! $command instanceof CancelTicketLineItemCommand) { |
|
| 54 | + if ( ! $command instanceof CancelTicketLineItemCommand) { |
|
| 55 | 55 | throw new InvalidEntityException(get_class($command), 'CancelTicketLineItemCommand'); |
| 56 | 56 | } |
| 57 | 57 | return $this->cancel_ticket_line_item_service->cancel( |
@@ -21,41 +21,41 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class CancelTicketLineItemCommandHandler extends CommandHandler |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 26 | - */ |
|
| 27 | - private $cancel_ticket_line_item_service; |
|
| 24 | + /** |
|
| 25 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 26 | + */ |
|
| 27 | + private $cancel_ticket_line_item_service; |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Command constructor |
|
| 32 | - * |
|
| 33 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 34 | - */ |
|
| 35 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
| 36 | - { |
|
| 37 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 38 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
| 39 | - } |
|
| 30 | + /** |
|
| 31 | + * Command constructor |
|
| 32 | + * |
|
| 33 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 34 | + */ |
|
| 35 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
| 36 | + { |
|
| 37 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 38 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @param CommandInterface|CancelTicketLineItemCommand $command |
|
| 44 | - * @return mixed |
|
| 45 | - * @throws InvalidEntityException |
|
| 46 | - * @throws RuntimeException |
|
| 47 | - */ |
|
| 48 | - public function handle(CommandInterface $command) |
|
| 49 | - { |
|
| 50 | - /** @var CancelTicketLineItemCommand $command */ |
|
| 51 | - if (! $command instanceof CancelTicketLineItemCommand) { |
|
| 52 | - throw new InvalidEntityException(get_class($command), 'CancelTicketLineItemCommand'); |
|
| 53 | - } |
|
| 54 | - return $this->cancel_ticket_line_item_service->cancel( |
|
| 55 | - $command->transaction(), |
|
| 56 | - $command->ticket(), |
|
| 57 | - $command->quantity(), |
|
| 58 | - $command->ticketLineItem() |
|
| 59 | - ); |
|
| 60 | - } |
|
| 42 | + /** |
|
| 43 | + * @param CommandInterface|CancelTicketLineItemCommand $command |
|
| 44 | + * @return mixed |
|
| 45 | + * @throws InvalidEntityException |
|
| 46 | + * @throws RuntimeException |
|
| 47 | + */ |
|
| 48 | + public function handle(CommandInterface $command) |
|
| 49 | + { |
|
| 50 | + /** @var CancelTicketLineItemCommand $command */ |
|
| 51 | + if (! $command instanceof CancelTicketLineItemCommand) { |
|
| 52 | + throw new InvalidEntityException(get_class($command), 'CancelTicketLineItemCommand'); |
|
| 53 | + } |
|
| 54 | + return $this->cancel_ticket_line_item_service->cancel( |
|
| 55 | + $command->transaction(), |
|
| 56 | + $command->ticket(), |
|
| 57 | + $command->quantity(), |
|
| 58 | + $command->ticketLineItem() |
|
| 59 | + ); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | public function handle(CommandInterface $command) |
| 52 | 52 | { |
| 53 | 53 | /** @var CreateAttendeeCommand $command */ |
| 54 | - if (! $command instanceof CreateAttendeeCommand) { |
|
| 54 | + if ( ! $command instanceof CreateAttendeeCommand) { |
|
| 55 | 55 | throw new InvalidEntityException(get_class($command), 'CreateAttendeeCommand'); |
| 56 | 56 | } |
| 57 | 57 | // have we met before? |
@@ -20,142 +20,142 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class CreateAttendeeCommandHandler extends CommandHandler |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var EEM_Attendee $attendee_model |
|
| 25 | - */ |
|
| 26 | - protected $attendee_model; |
|
| 23 | + /** |
|
| 24 | + * @var EEM_Attendee $attendee_model |
|
| 25 | + */ |
|
| 26 | + protected $attendee_model; |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @param EEM_Attendee $attendee_model |
|
| 31 | - */ |
|
| 32 | - public function __construct(EEM_Attendee $attendee_model) |
|
| 33 | - { |
|
| 34 | - defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 35 | - $this->attendee_model = $attendee_model; |
|
| 36 | - } |
|
| 29 | + /** |
|
| 30 | + * @param EEM_Attendee $attendee_model |
|
| 31 | + */ |
|
| 32 | + public function __construct(EEM_Attendee $attendee_model) |
|
| 33 | + { |
|
| 34 | + defined('EVENT_ESPRESSO_VERSION') || exit; |
|
| 35 | + $this->attendee_model = $attendee_model; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param CommandInterface|CreateAttendeeCommand $command |
|
| 41 | - * @return EE_Attendee |
|
| 42 | - * @throws EE_Error |
|
| 43 | - * @throws InvalidEntityException |
|
| 44 | - */ |
|
| 45 | - public function handle(CommandInterface $command) |
|
| 46 | - { |
|
| 47 | - /** @var CreateAttendeeCommand $command */ |
|
| 48 | - if (! $command instanceof CreateAttendeeCommand) { |
|
| 49 | - throw new InvalidEntityException(get_class($command), 'CreateAttendeeCommand'); |
|
| 50 | - } |
|
| 51 | - // have we met before? |
|
| 52 | - $attendee = $this->findExistingAttendee( |
|
| 53 | - $command->registration(), |
|
| 54 | - $command->attendeeDetails() |
|
| 55 | - ); |
|
| 56 | - // did we find an already existing record for this attendee ? |
|
| 57 | - if ($attendee instanceof EE_Attendee) { |
|
| 58 | - $attendee = $this->updateExistingAttendeeData( |
|
| 59 | - $attendee, |
|
| 60 | - $command->attendeeDetails() |
|
| 61 | - ); |
|
| 62 | - } else { |
|
| 63 | - $attendee = $this->createNewAttendee( |
|
| 64 | - $command->registration(), |
|
| 65 | - $command->attendeeDetails() |
|
| 66 | - ); |
|
| 67 | - } |
|
| 68 | - return $attendee; |
|
| 69 | - } |
|
| 39 | + /** |
|
| 40 | + * @param CommandInterface|CreateAttendeeCommand $command |
|
| 41 | + * @return EE_Attendee |
|
| 42 | + * @throws EE_Error |
|
| 43 | + * @throws InvalidEntityException |
|
| 44 | + */ |
|
| 45 | + public function handle(CommandInterface $command) |
|
| 46 | + { |
|
| 47 | + /** @var CreateAttendeeCommand $command */ |
|
| 48 | + if (! $command instanceof CreateAttendeeCommand) { |
|
| 49 | + throw new InvalidEntityException(get_class($command), 'CreateAttendeeCommand'); |
|
| 50 | + } |
|
| 51 | + // have we met before? |
|
| 52 | + $attendee = $this->findExistingAttendee( |
|
| 53 | + $command->registration(), |
|
| 54 | + $command->attendeeDetails() |
|
| 55 | + ); |
|
| 56 | + // did we find an already existing record for this attendee ? |
|
| 57 | + if ($attendee instanceof EE_Attendee) { |
|
| 58 | + $attendee = $this->updateExistingAttendeeData( |
|
| 59 | + $attendee, |
|
| 60 | + $command->attendeeDetails() |
|
| 61 | + ); |
|
| 62 | + } else { |
|
| 63 | + $attendee = $this->createNewAttendee( |
|
| 64 | + $command->registration(), |
|
| 65 | + $command->attendeeDetails() |
|
| 66 | + ); |
|
| 67 | + } |
|
| 68 | + return $attendee; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * find_existing_attendee |
|
| 74 | - * |
|
| 75 | - * @param EE_Registration $registration |
|
| 76 | - * @param array $attendee_data |
|
| 77 | - * @return EE_Attendee |
|
| 78 | - * @throws EE_Error |
|
| 79 | - */ |
|
| 80 | - private function findExistingAttendee(EE_Registration $registration, array $attendee_data) |
|
| 81 | - { |
|
| 82 | - $existing_attendee = null; |
|
| 83 | - // does this attendee already exist in the db ? |
|
| 84 | - // we're searching using a combination of first name, last name, AND email address |
|
| 85 | - $ATT_fname = ! empty($attendee_data['ATT_fname']) |
|
| 86 | - ? $attendee_data['ATT_fname'] |
|
| 87 | - : ''; |
|
| 88 | - $ATT_lname = ! empty($attendee_data['ATT_lname']) |
|
| 89 | - ? $attendee_data['ATT_lname'] |
|
| 90 | - : ''; |
|
| 91 | - $ATT_email = ! empty($attendee_data['ATT_email']) |
|
| 92 | - ? $attendee_data['ATT_email'] |
|
| 93 | - : ''; |
|
| 94 | - // but only if those have values |
|
| 95 | - if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
| 96 | - $existing_attendee = $this->attendee_model->find_existing_attendee( |
|
| 97 | - [ |
|
| 98 | - 'ATT_fname' => $ATT_fname, |
|
| 99 | - 'ATT_lname' => $ATT_lname, |
|
| 100 | - 'ATT_email' => $ATT_email, |
|
| 101 | - ] |
|
| 102 | - ); |
|
| 103 | - } |
|
| 104 | - return apply_filters( |
|
| 105 | - 'FHEE_EventEspresso_core_domain_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
|
| 106 | - $existing_attendee, |
|
| 107 | - $registration, |
|
| 108 | - $attendee_data |
|
| 109 | - ); |
|
| 110 | - } |
|
| 72 | + /** |
|
| 73 | + * find_existing_attendee |
|
| 74 | + * |
|
| 75 | + * @param EE_Registration $registration |
|
| 76 | + * @param array $attendee_data |
|
| 77 | + * @return EE_Attendee |
|
| 78 | + * @throws EE_Error |
|
| 79 | + */ |
|
| 80 | + private function findExistingAttendee(EE_Registration $registration, array $attendee_data) |
|
| 81 | + { |
|
| 82 | + $existing_attendee = null; |
|
| 83 | + // does this attendee already exist in the db ? |
|
| 84 | + // we're searching using a combination of first name, last name, AND email address |
|
| 85 | + $ATT_fname = ! empty($attendee_data['ATT_fname']) |
|
| 86 | + ? $attendee_data['ATT_fname'] |
|
| 87 | + : ''; |
|
| 88 | + $ATT_lname = ! empty($attendee_data['ATT_lname']) |
|
| 89 | + ? $attendee_data['ATT_lname'] |
|
| 90 | + : ''; |
|
| 91 | + $ATT_email = ! empty($attendee_data['ATT_email']) |
|
| 92 | + ? $attendee_data['ATT_email'] |
|
| 93 | + : ''; |
|
| 94 | + // but only if those have values |
|
| 95 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
| 96 | + $existing_attendee = $this->attendee_model->find_existing_attendee( |
|
| 97 | + [ |
|
| 98 | + 'ATT_fname' => $ATT_fname, |
|
| 99 | + 'ATT_lname' => $ATT_lname, |
|
| 100 | + 'ATT_email' => $ATT_email, |
|
| 101 | + ] |
|
| 102 | + ); |
|
| 103 | + } |
|
| 104 | + return apply_filters( |
|
| 105 | + 'FHEE_EventEspresso_core_domain_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
|
| 106 | + $existing_attendee, |
|
| 107 | + $registration, |
|
| 108 | + $attendee_data |
|
| 109 | + ); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * _update_existing_attendee_data |
|
| 115 | - * in case it has changed since last time they registered for an event |
|
| 116 | - * |
|
| 117 | - * @param EE_Attendee $existing_attendee |
|
| 118 | - * @param array $attendee_data |
|
| 119 | - * @return EE_Attendee |
|
| 120 | - * @throws EE_Error |
|
| 121 | - */ |
|
| 122 | - private function updateExistingAttendeeData(EE_Attendee $existing_attendee, array $attendee_data) |
|
| 123 | - { |
|
| 124 | - // first remove fname, lname, and email from attendee data |
|
| 125 | - // because these properties will be exactly the same as the returned attendee object, |
|
| 126 | - // since they were used in the query to get the attendee object in the first place |
|
| 127 | - $dont_set = ['ATT_fname', 'ATT_lname', 'ATT_email']; |
|
| 128 | - // now loop thru what's left and add to attendee CPT |
|
| 129 | - foreach ($attendee_data as $property_name => $property_value) { |
|
| 130 | - if ( |
|
| 131 | - ! in_array($property_name, $dont_set, true) |
|
| 132 | - && $this->attendee_model->has_field($property_name) |
|
| 133 | - ) { |
|
| 134 | - $existing_attendee->set($property_name, $property_value); |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - // better save that now |
|
| 138 | - $existing_attendee->save(); |
|
| 139 | - return $existing_attendee; |
|
| 140 | - } |
|
| 113 | + /** |
|
| 114 | + * _update_existing_attendee_data |
|
| 115 | + * in case it has changed since last time they registered for an event |
|
| 116 | + * |
|
| 117 | + * @param EE_Attendee $existing_attendee |
|
| 118 | + * @param array $attendee_data |
|
| 119 | + * @return EE_Attendee |
|
| 120 | + * @throws EE_Error |
|
| 121 | + */ |
|
| 122 | + private function updateExistingAttendeeData(EE_Attendee $existing_attendee, array $attendee_data) |
|
| 123 | + { |
|
| 124 | + // first remove fname, lname, and email from attendee data |
|
| 125 | + // because these properties will be exactly the same as the returned attendee object, |
|
| 126 | + // since they were used in the query to get the attendee object in the first place |
|
| 127 | + $dont_set = ['ATT_fname', 'ATT_lname', 'ATT_email']; |
|
| 128 | + // now loop thru what's left and add to attendee CPT |
|
| 129 | + foreach ($attendee_data as $property_name => $property_value) { |
|
| 130 | + if ( |
|
| 131 | + ! in_array($property_name, $dont_set, true) |
|
| 132 | + && $this->attendee_model->has_field($property_name) |
|
| 133 | + ) { |
|
| 134 | + $existing_attendee->set($property_name, $property_value); |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + // better save that now |
|
| 138 | + $existing_attendee->save(); |
|
| 139 | + return $existing_attendee; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * create_new_attendee |
|
| 145 | - * |
|
| 146 | - * @param EE_Registration $registration |
|
| 147 | - * @param array $attendee_data |
|
| 148 | - * @return EE_Attendee |
|
| 149 | - * @throws EE_Error |
|
| 150 | - * @throws EntityNotFoundException |
|
| 151 | - */ |
|
| 152 | - private function createNewAttendee(EE_Registration $registration, array $attendee_data) |
|
| 153 | - { |
|
| 154 | - // create new attendee object |
|
| 155 | - $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
| 156 | - // set author to event creator |
|
| 157 | - $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
| 158 | - $new_attendee->save(); |
|
| 159 | - return $new_attendee; |
|
| 160 | - } |
|
| 143 | + /** |
|
| 144 | + * create_new_attendee |
|
| 145 | + * |
|
| 146 | + * @param EE_Registration $registration |
|
| 147 | + * @param array $attendee_data |
|
| 148 | + * @return EE_Attendee |
|
| 149 | + * @throws EE_Error |
|
| 150 | + * @throws EntityNotFoundException |
|
| 151 | + */ |
|
| 152 | + private function createNewAttendee(EE_Registration $registration, array $attendee_data) |
|
| 153 | + { |
|
| 154 | + // create new attendee object |
|
| 155 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
| 156 | + // set author to event creator |
|
| 157 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
| 158 | + $new_attendee->save(); |
|
| 159 | + return $new_attendee; |
|
| 160 | + } |
|
| 161 | 161 | } |
@@ -39,187 +39,187 @@ |
||
| 39 | 39 | class LocateMovedCommands implements CommandBusMiddlewareInterface |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @param CommandInterface $command |
|
| 44 | - * @param Closure $next |
|
| 45 | - * @return mixed |
|
| 46 | - */ |
|
| 47 | - public function handle(CommandInterface $command, Closure $next) |
|
| 48 | - { |
|
| 49 | - $command_class = get_class($command); |
|
| 50 | - switch ($command_class) { |
|
| 51 | - case 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommand' : |
|
| 52 | - $command = $this->getCreateAttendeeCommand($command); |
|
| 53 | - break; |
|
| 54 | - case 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommand' : |
|
| 55 | - $command = $this->getCancelRegistrationAndTicketLineItemCommand($command); |
|
| 56 | - break; |
|
| 57 | - case 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand' : |
|
| 58 | - $command = $this->getCopyRegistrationDetailsCommand($command); |
|
| 59 | - break; |
|
| 60 | - case 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand' : |
|
| 61 | - $command = $this->getCopyRegistrationPaymentsCommand($command); |
|
| 62 | - break; |
|
| 63 | - case 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand' : |
|
| 64 | - $command = $this->getCreateRegistrationCommand($command); |
|
| 65 | - break; |
|
| 66 | - case 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommand' : |
|
| 67 | - $command = $this->getUpdateRegistrationAndTransactionAfterChangeCommand($command); |
|
| 68 | - break; |
|
| 69 | - case 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommand' : |
|
| 70 | - $command = $this->getCancelTicketLineItemCommand($command); |
|
| 71 | - break; |
|
| 72 | - case 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand' : |
|
| 73 | - $command = $this->getCreateTicketLineItemCommand($command); |
|
| 74 | - break; |
|
| 75 | - case 'EventEspresso\core\services\commands\transaction\CreateTransactionCommand' : |
|
| 76 | - $command = $this->getCreateTransactionCommand($command); |
|
| 77 | - break; |
|
| 78 | - } |
|
| 79 | - return $next($command); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * @param OldCreateAttendeeCommand|CommandInterface $command |
|
| 85 | - * @return CreateAttendeeCommand|OldCreateAttendeeCommand |
|
| 86 | - */ |
|
| 87 | - private function getCreateAttendeeCommand(OldCreateAttendeeCommand $command) |
|
| 88 | - { |
|
| 89 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 90 | - ? new CreateAttendeeCommand( |
|
| 91 | - $command->attendeeDetails(), |
|
| 92 | - $command->registration() |
|
| 93 | - ) |
|
| 94 | - : $command; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @param OldCancelRegistrationAndTicketLineItemCommand|CommandInterface $command |
|
| 100 | - * @return CancelRegistrationAndTicketLineItemCommand|OldCancelRegistrationAndTicketLineItemCommand |
|
| 101 | - */ |
|
| 102 | - private function getCancelRegistrationAndTicketLineItemCommand( |
|
| 103 | - OldCancelRegistrationAndTicketLineItemCommand $command |
|
| 104 | - ) { |
|
| 105 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 106 | - ? new CancelRegistrationAndTicketLineItemCommand($command->registration()) |
|
| 107 | - : $command; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @param OldCopyRegistrationDetailsCommand|CommandInterface $command |
|
| 113 | - * @return CopyRegistrationDetailsCommand|OldCopyRegistrationDetailsCommand |
|
| 114 | - */ |
|
| 115 | - private function getCopyRegistrationDetailsCommand( |
|
| 116 | - OldCopyRegistrationDetailsCommand $command |
|
| 117 | - ) { |
|
| 118 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 119 | - ? new CopyRegistrationDetailsCommand( |
|
| 120 | - $command->targetRegistration(), |
|
| 121 | - $command->registrationToCopy() |
|
| 122 | - ) |
|
| 123 | - : $command; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @param OldCopyRegistrationPaymentsCommand|CommandInterface $command |
|
| 129 | - * @return CopyRegistrationPaymentsCommand|OldCopyRegistrationPaymentsCommand |
|
| 130 | - */ |
|
| 131 | - private function getCopyRegistrationPaymentsCommand( |
|
| 132 | - OldCopyRegistrationPaymentsCommand $command |
|
| 133 | - ) { |
|
| 134 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 135 | - ? new CopyRegistrationPaymentsCommand( |
|
| 136 | - $command->targetRegistration(), |
|
| 137 | - $command->registrationToCopy() |
|
| 138 | - ) |
|
| 139 | - : $command; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * @param OldCreateRegistrationCommand|CommandInterface $command |
|
| 145 | - * @return CreateRegistrationCommand|OldCreateRegistrationCommand |
|
| 146 | - */ |
|
| 147 | - private function getCreateRegistrationCommand( |
|
| 148 | - OldCreateRegistrationCommand $command |
|
| 149 | - ) { |
|
| 150 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 151 | - ? new CreateRegistrationCommand( |
|
| 152 | - $command->transaction(), |
|
| 153 | - $command->ticketLineItem(), |
|
| 154 | - $command->regCount(), |
|
| 155 | - $command->regGroupSize(), |
|
| 156 | - $command->regStatus(), |
|
| 157 | - $command->ticket() |
|
| 158 | - ) |
|
| 159 | - : $command; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * @param OldUpdateRegistrationAndTransactionAfterChangeCommand|CommandInterface $command |
|
| 165 | - * @return UpdateRegistrationAndTransactionAfterChangeCommand|OldUpdateRegistrationAndTransactionAfterChangeCommand |
|
| 166 | - */ |
|
| 167 | - private function getUpdateRegistrationAndTransactionAfterChangeCommand( |
|
| 168 | - OldUpdateRegistrationAndTransactionAfterChangeCommand $command |
|
| 169 | - ) { |
|
| 170 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 171 | - ? new UpdateRegistrationAndTransactionAfterChangeCommand($command->registration()) |
|
| 172 | - : $command; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * @param OldCancelTicketLineItemCommand|CommandInterface $command |
|
| 178 | - * @return CancelTicketLineItemCommand|OldCancelTicketLineItemCommand |
|
| 179 | - */ |
|
| 180 | - private function getCancelTicketLineItemCommand( |
|
| 181 | - OldCancelTicketLineItemCommand $command |
|
| 182 | - ) { |
|
| 183 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 184 | - ? new CancelTicketLineItemCommand( |
|
| 185 | - $command->transaction(), |
|
| 186 | - $command->ticket(), |
|
| 187 | - $command->quantity(), |
|
| 188 | - $command->ticketLineItem() |
|
| 189 | - ) |
|
| 190 | - : $command; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * @param OldCreateTicketLineItemCommand|CommandInterface $command |
|
| 196 | - * @return CreateTicketLineItemCommand|OldCreateTicketLineItemCommand |
|
| 197 | - */ |
|
| 198 | - private function getCreateTicketLineItemCommand( |
|
| 199 | - OldCreateTicketLineItemCommand $command |
|
| 200 | - ) { |
|
| 201 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 202 | - ? new CreateTicketLineItemCommand( |
|
| 203 | - $command->transaction(), |
|
| 204 | - $command->ticket(), |
|
| 205 | - $command->quantity() |
|
| 206 | - ) |
|
| 207 | - : $command; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * @param OldCreateTransactionCommand|CommandInterface $command |
|
| 213 | - * @return CreateTransactionCommand|OldCreateTransactionCommand |
|
| 214 | - */ |
|
| 215 | - private function getCreateTransactionCommand( |
|
| 216 | - OldCreateTransactionCommand $command |
|
| 217 | - ) { |
|
| 218 | - return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 219 | - ? new CreateTransactionCommand( |
|
| 220 | - $command->checkout(), |
|
| 221 | - $command->transactionDetails() |
|
| 222 | - ) |
|
| 223 | - : $command; |
|
| 224 | - } |
|
| 42 | + /** |
|
| 43 | + * @param CommandInterface $command |
|
| 44 | + * @param Closure $next |
|
| 45 | + * @return mixed |
|
| 46 | + */ |
|
| 47 | + public function handle(CommandInterface $command, Closure $next) |
|
| 48 | + { |
|
| 49 | + $command_class = get_class($command); |
|
| 50 | + switch ($command_class) { |
|
| 51 | + case 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommand' : |
|
| 52 | + $command = $this->getCreateAttendeeCommand($command); |
|
| 53 | + break; |
|
| 54 | + case 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommand' : |
|
| 55 | + $command = $this->getCancelRegistrationAndTicketLineItemCommand($command); |
|
| 56 | + break; |
|
| 57 | + case 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand' : |
|
| 58 | + $command = $this->getCopyRegistrationDetailsCommand($command); |
|
| 59 | + break; |
|
| 60 | + case 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand' : |
|
| 61 | + $command = $this->getCopyRegistrationPaymentsCommand($command); |
|
| 62 | + break; |
|
| 63 | + case 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand' : |
|
| 64 | + $command = $this->getCreateRegistrationCommand($command); |
|
| 65 | + break; |
|
| 66 | + case 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommand' : |
|
| 67 | + $command = $this->getUpdateRegistrationAndTransactionAfterChangeCommand($command); |
|
| 68 | + break; |
|
| 69 | + case 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommand' : |
|
| 70 | + $command = $this->getCancelTicketLineItemCommand($command); |
|
| 71 | + break; |
|
| 72 | + case 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand' : |
|
| 73 | + $command = $this->getCreateTicketLineItemCommand($command); |
|
| 74 | + break; |
|
| 75 | + case 'EventEspresso\core\services\commands\transaction\CreateTransactionCommand' : |
|
| 76 | + $command = $this->getCreateTransactionCommand($command); |
|
| 77 | + break; |
|
| 78 | + } |
|
| 79 | + return $next($command); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * @param OldCreateAttendeeCommand|CommandInterface $command |
|
| 85 | + * @return CreateAttendeeCommand|OldCreateAttendeeCommand |
|
| 86 | + */ |
|
| 87 | + private function getCreateAttendeeCommand(OldCreateAttendeeCommand $command) |
|
| 88 | + { |
|
| 89 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 90 | + ? new CreateAttendeeCommand( |
|
| 91 | + $command->attendeeDetails(), |
|
| 92 | + $command->registration() |
|
| 93 | + ) |
|
| 94 | + : $command; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * @param OldCancelRegistrationAndTicketLineItemCommand|CommandInterface $command |
|
| 100 | + * @return CancelRegistrationAndTicketLineItemCommand|OldCancelRegistrationAndTicketLineItemCommand |
|
| 101 | + */ |
|
| 102 | + private function getCancelRegistrationAndTicketLineItemCommand( |
|
| 103 | + OldCancelRegistrationAndTicketLineItemCommand $command |
|
| 104 | + ) { |
|
| 105 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 106 | + ? new CancelRegistrationAndTicketLineItemCommand($command->registration()) |
|
| 107 | + : $command; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @param OldCopyRegistrationDetailsCommand|CommandInterface $command |
|
| 113 | + * @return CopyRegistrationDetailsCommand|OldCopyRegistrationDetailsCommand |
|
| 114 | + */ |
|
| 115 | + private function getCopyRegistrationDetailsCommand( |
|
| 116 | + OldCopyRegistrationDetailsCommand $command |
|
| 117 | + ) { |
|
| 118 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 119 | + ? new CopyRegistrationDetailsCommand( |
|
| 120 | + $command->targetRegistration(), |
|
| 121 | + $command->registrationToCopy() |
|
| 122 | + ) |
|
| 123 | + : $command; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @param OldCopyRegistrationPaymentsCommand|CommandInterface $command |
|
| 129 | + * @return CopyRegistrationPaymentsCommand|OldCopyRegistrationPaymentsCommand |
|
| 130 | + */ |
|
| 131 | + private function getCopyRegistrationPaymentsCommand( |
|
| 132 | + OldCopyRegistrationPaymentsCommand $command |
|
| 133 | + ) { |
|
| 134 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 135 | + ? new CopyRegistrationPaymentsCommand( |
|
| 136 | + $command->targetRegistration(), |
|
| 137 | + $command->registrationToCopy() |
|
| 138 | + ) |
|
| 139 | + : $command; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * @param OldCreateRegistrationCommand|CommandInterface $command |
|
| 145 | + * @return CreateRegistrationCommand|OldCreateRegistrationCommand |
|
| 146 | + */ |
|
| 147 | + private function getCreateRegistrationCommand( |
|
| 148 | + OldCreateRegistrationCommand $command |
|
| 149 | + ) { |
|
| 150 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 151 | + ? new CreateRegistrationCommand( |
|
| 152 | + $command->transaction(), |
|
| 153 | + $command->ticketLineItem(), |
|
| 154 | + $command->regCount(), |
|
| 155 | + $command->regGroupSize(), |
|
| 156 | + $command->regStatus(), |
|
| 157 | + $command->ticket() |
|
| 158 | + ) |
|
| 159 | + : $command; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * @param OldUpdateRegistrationAndTransactionAfterChangeCommand|CommandInterface $command |
|
| 165 | + * @return UpdateRegistrationAndTransactionAfterChangeCommand|OldUpdateRegistrationAndTransactionAfterChangeCommand |
|
| 166 | + */ |
|
| 167 | + private function getUpdateRegistrationAndTransactionAfterChangeCommand( |
|
| 168 | + OldUpdateRegistrationAndTransactionAfterChangeCommand $command |
|
| 169 | + ) { |
|
| 170 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 171 | + ? new UpdateRegistrationAndTransactionAfterChangeCommand($command->registration()) |
|
| 172 | + : $command; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * @param OldCancelTicketLineItemCommand|CommandInterface $command |
|
| 178 | + * @return CancelTicketLineItemCommand|OldCancelTicketLineItemCommand |
|
| 179 | + */ |
|
| 180 | + private function getCancelTicketLineItemCommand( |
|
| 181 | + OldCancelTicketLineItemCommand $command |
|
| 182 | + ) { |
|
| 183 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 184 | + ? new CancelTicketLineItemCommand( |
|
| 185 | + $command->transaction(), |
|
| 186 | + $command->ticket(), |
|
| 187 | + $command->quantity(), |
|
| 188 | + $command->ticketLineItem() |
|
| 189 | + ) |
|
| 190 | + : $command; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * @param OldCreateTicketLineItemCommand|CommandInterface $command |
|
| 196 | + * @return CreateTicketLineItemCommand|OldCreateTicketLineItemCommand |
|
| 197 | + */ |
|
| 198 | + private function getCreateTicketLineItemCommand( |
|
| 199 | + OldCreateTicketLineItemCommand $command |
|
| 200 | + ) { |
|
| 201 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 202 | + ? new CreateTicketLineItemCommand( |
|
| 203 | + $command->transaction(), |
|
| 204 | + $command->ticket(), |
|
| 205 | + $command->quantity() |
|
| 206 | + ) |
|
| 207 | + : $command; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * @param OldCreateTransactionCommand|CommandInterface $command |
|
| 213 | + * @return CreateTransactionCommand|OldCreateTransactionCommand |
|
| 214 | + */ |
|
| 215 | + private function getCreateTransactionCommand( |
|
| 216 | + OldCreateTransactionCommand $command |
|
| 217 | + ) { |
|
| 218 | + return class_exists('EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommand') |
|
| 219 | + ? new CreateTransactionCommand( |
|
| 220 | + $command->checkout(), |
|
| 221 | + $command->transactionDetails() |
|
| 222 | + ) |
|
| 223 | + : $command; |
|
| 224 | + } |
|
| 225 | 225 | } |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function is_espresso_event($event = null) |
| 21 | 21 | { |
| 22 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 23 | - // extract EE_Event object from passed param regardless of what it is (within reason of course) |
|
| 24 | - $event = EEH_Event_View::get_event($event); |
|
| 25 | - // do we have a valid event ? |
|
| 26 | - return $event instanceof EE_Event; |
|
| 27 | - } |
|
| 28 | - return false; |
|
| 22 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 23 | + // extract EE_Event object from passed param regardless of what it is (within reason of course) |
|
| 24 | + $event = EEH_Event_View::get_event($event); |
|
| 25 | + // do we have a valid event ? |
|
| 26 | + return $event instanceof EE_Event; |
|
| 27 | + } |
|
| 28 | + return false; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function is_espresso_event_single() |
| 38 | 38 | { |
| 39 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 40 | - global $wp_query; |
|
| 41 | - // return conditionals set by CPTs |
|
| 42 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false; |
|
| 43 | - } |
|
| 44 | - return false; |
|
| 39 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 40 | + global $wp_query; |
|
| 41 | + // return conditionals set by CPTs |
|
| 42 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false; |
|
| 43 | + } |
|
| 44 | + return false; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | function is_espresso_event_archive() |
| 54 | 54 | { |
| 55 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 56 | - global $wp_query; |
|
| 57 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false; |
|
| 58 | - } |
|
| 59 | - return false; |
|
| 55 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 56 | + global $wp_query; |
|
| 57 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false; |
|
| 58 | + } |
|
| 59 | + return false; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function is_espresso_event_taxonomy() |
| 69 | 69 | { |
| 70 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 71 | - global $wp_query; |
|
| 72 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false; |
|
| 73 | - } |
|
| 74 | - return false; |
|
| 70 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 71 | + global $wp_query; |
|
| 72 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false; |
|
| 73 | + } |
|
| 74 | + return false; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function is_espresso_venue($venue = null) |
| 87 | 87 | { |
| 88 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 89 | - // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
|
| 90 | - $venue = EEH_Venue_View::get_venue($venue, false); |
|
| 91 | - // do we have a valid event ? |
|
| 92 | - return $venue instanceof EE_Venue; |
|
| 93 | - } |
|
| 94 | - return false; |
|
| 88 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 89 | + // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
|
| 90 | + $venue = EEH_Venue_View::get_venue($venue, false); |
|
| 91 | + // do we have a valid event ? |
|
| 92 | + return $venue instanceof EE_Venue; |
|
| 93 | + } |
|
| 94 | + return false; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | function is_espresso_venue_single() |
| 104 | 104 | { |
| 105 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 106 | - global $wp_query; |
|
| 107 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false; |
|
| 108 | - } |
|
| 109 | - return false; |
|
| 105 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 106 | + global $wp_query; |
|
| 107 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false; |
|
| 108 | + } |
|
| 109 | + return false; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | function is_espresso_venue_archive() |
| 119 | 119 | { |
| 120 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 121 | - global $wp_query; |
|
| 122 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false; |
|
| 123 | - } |
|
| 124 | - return false; |
|
| 120 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 121 | + global $wp_query; |
|
| 122 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false; |
|
| 123 | + } |
|
| 124 | + return false; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function is_espresso_venue_taxonomy() |
| 134 | 134 | { |
| 135 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 136 | - global $wp_query; |
|
| 137 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false; |
|
| 138 | - } |
|
| 139 | - return false; |
|
| 135 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 136 | + global $wp_query; |
|
| 137 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false; |
|
| 138 | + } |
|
| 139 | + return false; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -148,62 +148,62 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | function can_use_espresso_conditionals($conditional_tag) |
| 150 | 150 | { |
| 151 | - if (! did_action('AHEE__EE_System__initialize')) { |
|
| 152 | - EE_Error::doing_it_wrong( |
|
| 153 | - __FUNCTION__, |
|
| 154 | - sprintf( |
|
| 155 | - esc_html__( |
|
| 156 | - 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', |
|
| 157 | - 'event_espresso' |
|
| 158 | - ), |
|
| 159 | - $conditional_tag |
|
| 160 | - ), |
|
| 161 | - '4.4.0' |
|
| 162 | - ); |
|
| 163 | - return false; |
|
| 164 | - } |
|
| 165 | - return true; |
|
| 151 | + if (! did_action('AHEE__EE_System__initialize')) { |
|
| 152 | + EE_Error::doing_it_wrong( |
|
| 153 | + __FUNCTION__, |
|
| 154 | + sprintf( |
|
| 155 | + esc_html__( |
|
| 156 | + 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', |
|
| 157 | + 'event_espresso' |
|
| 158 | + ), |
|
| 159 | + $conditional_tag |
|
| 160 | + ), |
|
| 161 | + '4.4.0' |
|
| 162 | + ); |
|
| 163 | + return false; |
|
| 164 | + } |
|
| 165 | + return true; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | /*************************** Event Queries ***************************/ |
| 170 | 170 | |
| 171 | 171 | if (! function_exists('espresso_get_events')) { |
| 172 | - /** |
|
| 173 | - * espresso_get_events |
|
| 174 | - * |
|
| 175 | - * @param array $params |
|
| 176 | - * @return array |
|
| 177 | - */ |
|
| 178 | - function espresso_get_events($params = []) |
|
| 179 | - { |
|
| 180 | - //set default params |
|
| 181 | - $default_espresso_events_params = [ |
|
| 182 | - 'limit' => 10, |
|
| 183 | - 'show_expired' => false, |
|
| 184 | - 'month' => null, |
|
| 185 | - 'category_slug' => null, |
|
| 186 | - 'order_by' => 'start_date', |
|
| 187 | - 'sort' => 'ASC', |
|
| 188 | - ]; |
|
| 189 | - // allow the defaults to be filtered |
|
| 190 | - $default_espresso_events_params = apply_filters( |
|
| 191 | - 'espresso_get_events__default_espresso_events_params', |
|
| 192 | - $default_espresso_events_params |
|
| 193 | - ); |
|
| 194 | - // grab params and merge with defaults, then extract |
|
| 195 | - $params = array_merge($default_espresso_events_params, $params); |
|
| 196 | - // run the query |
|
| 197 | - $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
| 198 | - // assign results to a variable so we can return it |
|
| 199 | - $events = $events_query->have_posts() ? $events_query->posts : []; |
|
| 200 | - // but first reset the query and postdata |
|
| 201 | - wp_reset_query(); |
|
| 202 | - wp_reset_postdata(); |
|
| 203 | - EED_Events_Archive::remove_all_events_archive_filters(); |
|
| 204 | - unset($events_query); |
|
| 205 | - return $events; |
|
| 206 | - } |
|
| 172 | + /** |
|
| 173 | + * espresso_get_events |
|
| 174 | + * |
|
| 175 | + * @param array $params |
|
| 176 | + * @return array |
|
| 177 | + */ |
|
| 178 | + function espresso_get_events($params = []) |
|
| 179 | + { |
|
| 180 | + //set default params |
|
| 181 | + $default_espresso_events_params = [ |
|
| 182 | + 'limit' => 10, |
|
| 183 | + 'show_expired' => false, |
|
| 184 | + 'month' => null, |
|
| 185 | + 'category_slug' => null, |
|
| 186 | + 'order_by' => 'start_date', |
|
| 187 | + 'sort' => 'ASC', |
|
| 188 | + ]; |
|
| 189 | + // allow the defaults to be filtered |
|
| 190 | + $default_espresso_events_params = apply_filters( |
|
| 191 | + 'espresso_get_events__default_espresso_events_params', |
|
| 192 | + $default_espresso_events_params |
|
| 193 | + ); |
|
| 194 | + // grab params and merge with defaults, then extract |
|
| 195 | + $params = array_merge($default_espresso_events_params, $params); |
|
| 196 | + // run the query |
|
| 197 | + $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
| 198 | + // assign results to a variable so we can return it |
|
| 199 | + $events = $events_query->have_posts() ? $events_query->posts : []; |
|
| 200 | + // but first reset the query and postdata |
|
| 201 | + wp_reset_query(); |
|
| 202 | + wp_reset_postdata(); |
|
| 203 | + EED_Events_Archive::remove_all_events_archive_filters(); |
|
| 204 | + unset($events_query); |
|
| 205 | + return $events; |
|
| 206 | + } |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | |
@@ -218,357 +218,357 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | function espresso_load_ticket_selector() |
| 220 | 220 | { |
| 221 | - EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
| 221 | + EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (! function_exists('espresso_ticket_selector')) { |
| 225 | - /** |
|
| 226 | - * espresso_ticket_selector |
|
| 227 | - * |
|
| 228 | - * @param null $event |
|
| 229 | - * @throws EE_Error |
|
| 230 | - * @throws ReflectionException |
|
| 231 | - */ |
|
| 232 | - function espresso_ticket_selector($event = null) |
|
| 233 | - { |
|
| 234 | - if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
| 235 | - espresso_load_ticket_selector(); |
|
| 236 | - EED_Ticket_Selector::set_definitions(); |
|
| 237 | - echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
|
| 238 | - } |
|
| 239 | - } |
|
| 225 | + /** |
|
| 226 | + * espresso_ticket_selector |
|
| 227 | + * |
|
| 228 | + * @param null $event |
|
| 229 | + * @throws EE_Error |
|
| 230 | + * @throws ReflectionException |
|
| 231 | + */ |
|
| 232 | + function espresso_ticket_selector($event = null) |
|
| 233 | + { |
|
| 234 | + if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
| 235 | + espresso_load_ticket_selector(); |
|
| 236 | + EED_Ticket_Selector::set_definitions(); |
|
| 237 | + echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | if (! function_exists('espresso_view_details_btn')) { |
| 244 | - /** |
|
| 245 | - * espresso_view_details_btn |
|
| 246 | - * |
|
| 247 | - * @param null $event |
|
| 248 | - * @throws EE_Error |
|
| 249 | - * @throws ReflectionException |
|
| 250 | - */ |
|
| 251 | - function espresso_view_details_btn($event = null) |
|
| 252 | - { |
|
| 253 | - if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
| 254 | - espresso_load_ticket_selector(); |
|
| 255 | - echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
|
| 256 | - } |
|
| 257 | - } |
|
| 244 | + /** |
|
| 245 | + * espresso_view_details_btn |
|
| 246 | + * |
|
| 247 | + * @param null $event |
|
| 248 | + * @throws EE_Error |
|
| 249 | + * @throws ReflectionException |
|
| 250 | + */ |
|
| 251 | + function espresso_view_details_btn($event = null) |
|
| 252 | + { |
|
| 253 | + if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
| 254 | + espresso_load_ticket_selector(); |
|
| 255 | + echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | /*************************** EEH_Event_View ***************************/ |
| 262 | 262 | |
| 263 | 263 | if (! function_exists('espresso_load_event_list_assets')) { |
| 264 | - /** |
|
| 265 | - * espresso_load_event_list_assets |
|
| 266 | - * ensures that event list styles and scripts are loaded |
|
| 267 | - * |
|
| 268 | - * @return void |
|
| 269 | - */ |
|
| 270 | - function espresso_load_event_list_assets() |
|
| 271 | - { |
|
| 272 | - $event_list = EED_Events_Archive::instance(); |
|
| 273 | - add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10); |
|
| 274 | - add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
| 275 | - } |
|
| 264 | + /** |
|
| 265 | + * espresso_load_event_list_assets |
|
| 266 | + * ensures that event list styles and scripts are loaded |
|
| 267 | + * |
|
| 268 | + * @return void |
|
| 269 | + */ |
|
| 270 | + function espresso_load_event_list_assets() |
|
| 271 | + { |
|
| 272 | + $event_list = EED_Events_Archive::instance(); |
|
| 273 | + add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10); |
|
| 274 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
| 275 | + } |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | if (! function_exists('espresso_event_reg_button')) { |
| 280 | - /** |
|
| 281 | - * espresso_event_reg_button |
|
| 282 | - * returns the "Register Now" button if event is active, |
|
| 283 | - * an inactive button like status banner if the event is not active |
|
| 284 | - * or a "Read More" button if so desired |
|
| 285 | - * |
|
| 286 | - * @param null $btn_text_if_active |
|
| 287 | - * @param bool $btn_text_if_inactive |
|
| 288 | - * @param bool $EVT_ID |
|
| 289 | - * @return void |
|
| 290 | - * @throws EE_Error |
|
| 291 | - * @throws ReflectionException |
|
| 292 | - */ |
|
| 293 | - function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
|
| 294 | - { |
|
| 295 | - $event = EEH_Event_View::get_event($EVT_ID); |
|
| 296 | - if (! $event instanceof EE_Event) { |
|
| 297 | - return; |
|
| 298 | - } |
|
| 299 | - $event_status = $event->get_active_status(); |
|
| 300 | - switch ($event_status) { |
|
| 301 | - case EE_Datetime::sold_out : |
|
| 302 | - $btn_text = __('Sold Out', 'event_espresso'); |
|
| 303 | - $class = 'ee-pink'; |
|
| 304 | - break; |
|
| 305 | - case EE_Datetime::expired : |
|
| 306 | - $btn_text = __('Event is Over', 'event_espresso'); |
|
| 307 | - $class = 'ee-grey'; |
|
| 308 | - break; |
|
| 309 | - case EE_Datetime::inactive : |
|
| 310 | - $btn_text = __('Event Not Active', 'event_espresso'); |
|
| 311 | - $class = 'ee-grey'; |
|
| 312 | - break; |
|
| 313 | - case EE_Datetime::cancelled : |
|
| 314 | - $btn_text = __('Event was Cancelled', 'event_espresso'); |
|
| 315 | - $class = 'ee-red'; |
|
| 316 | - break; |
|
| 317 | - case EE_Datetime::upcoming : |
|
| 318 | - case EE_Datetime::active : |
|
| 319 | - default : |
|
| 320 | - $btn_text = ! empty($btn_text_if_active) |
|
| 321 | - ? $btn_text_if_active |
|
| 322 | - : __('Register Now', 'event_espresso'); |
|
| 323 | - $class = 'ee-green'; |
|
| 324 | - } |
|
| 325 | - if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
| 326 | - $btn_text = $btn_text_if_inactive; |
|
| 327 | - $class = 'ee-grey'; |
|
| 328 | - } |
|
| 329 | - ?> |
|
| 280 | + /** |
|
| 281 | + * espresso_event_reg_button |
|
| 282 | + * returns the "Register Now" button if event is active, |
|
| 283 | + * an inactive button like status banner if the event is not active |
|
| 284 | + * or a "Read More" button if so desired |
|
| 285 | + * |
|
| 286 | + * @param null $btn_text_if_active |
|
| 287 | + * @param bool $btn_text_if_inactive |
|
| 288 | + * @param bool $EVT_ID |
|
| 289 | + * @return void |
|
| 290 | + * @throws EE_Error |
|
| 291 | + * @throws ReflectionException |
|
| 292 | + */ |
|
| 293 | + function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
|
| 294 | + { |
|
| 295 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 296 | + if (! $event instanceof EE_Event) { |
|
| 297 | + return; |
|
| 298 | + } |
|
| 299 | + $event_status = $event->get_active_status(); |
|
| 300 | + switch ($event_status) { |
|
| 301 | + case EE_Datetime::sold_out : |
|
| 302 | + $btn_text = __('Sold Out', 'event_espresso'); |
|
| 303 | + $class = 'ee-pink'; |
|
| 304 | + break; |
|
| 305 | + case EE_Datetime::expired : |
|
| 306 | + $btn_text = __('Event is Over', 'event_espresso'); |
|
| 307 | + $class = 'ee-grey'; |
|
| 308 | + break; |
|
| 309 | + case EE_Datetime::inactive : |
|
| 310 | + $btn_text = __('Event Not Active', 'event_espresso'); |
|
| 311 | + $class = 'ee-grey'; |
|
| 312 | + break; |
|
| 313 | + case EE_Datetime::cancelled : |
|
| 314 | + $btn_text = __('Event was Cancelled', 'event_espresso'); |
|
| 315 | + $class = 'ee-red'; |
|
| 316 | + break; |
|
| 317 | + case EE_Datetime::upcoming : |
|
| 318 | + case EE_Datetime::active : |
|
| 319 | + default : |
|
| 320 | + $btn_text = ! empty($btn_text_if_active) |
|
| 321 | + ? $btn_text_if_active |
|
| 322 | + : __('Register Now', 'event_espresso'); |
|
| 323 | + $class = 'ee-green'; |
|
| 324 | + } |
|
| 325 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
| 326 | + $btn_text = $btn_text_if_inactive; |
|
| 327 | + $class = 'ee-grey'; |
|
| 328 | + } |
|
| 329 | + ?> |
|
| 330 | 330 | <a class="ee-button ee-register-button <?php echo esc_attr($class); ?>" |
| 331 | 331 | href="<?php espresso_event_link_url($EVT_ID); ?>" |
| 332 | 332 | <?php echo EED_Events_Archive::link_target(); // already escaped |
| 333 | - ?> |
|
| 333 | + ?> |
|
| 334 | 334 | > |
| 335 | 335 | <?php echo esc_html($btn_text); ?> |
| 336 | 336 | </a> |
| 337 | 337 | <?php |
| 338 | - } |
|
| 338 | + } |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | |
| 342 | 342 | if (! function_exists('espresso_display_ticket_selector')) { |
| 343 | - /** |
|
| 344 | - * espresso_display_ticket_selector |
|
| 345 | - * whether or not to display the Ticket Selector for an event |
|
| 346 | - * |
|
| 347 | - * @param bool $EVT_ID |
|
| 348 | - * @return boolean |
|
| 349 | - * @throws EE_Error |
|
| 350 | - * @throws ReflectionException |
|
| 351 | - */ |
|
| 352 | - function espresso_display_ticket_selector($EVT_ID = false) |
|
| 353 | - { |
|
| 354 | - return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
| 355 | - } |
|
| 343 | + /** |
|
| 344 | + * espresso_display_ticket_selector |
|
| 345 | + * whether or not to display the Ticket Selector for an event |
|
| 346 | + * |
|
| 347 | + * @param bool $EVT_ID |
|
| 348 | + * @return boolean |
|
| 349 | + * @throws EE_Error |
|
| 350 | + * @throws ReflectionException |
|
| 351 | + */ |
|
| 352 | + function espresso_display_ticket_selector($EVT_ID = false) |
|
| 353 | + { |
|
| 354 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
| 355 | + } |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | |
| 359 | 359 | if (! function_exists('espresso_event_status_banner')) { |
| 360 | - /** |
|
| 361 | - * espresso_event_status |
|
| 362 | - * returns a banner showing the event status if it is sold out, expired, or inactive |
|
| 363 | - * |
|
| 364 | - * @param bool $EVT_ID |
|
| 365 | - * @return string |
|
| 366 | - * @throws EE_Error |
|
| 367 | - * @throws ReflectionException |
|
| 368 | - */ |
|
| 369 | - function espresso_event_status_banner($EVT_ID = false) |
|
| 370 | - { |
|
| 371 | - return EEH_Event_View::event_status($EVT_ID); |
|
| 372 | - } |
|
| 360 | + /** |
|
| 361 | + * espresso_event_status |
|
| 362 | + * returns a banner showing the event status if it is sold out, expired, or inactive |
|
| 363 | + * |
|
| 364 | + * @param bool $EVT_ID |
|
| 365 | + * @return string |
|
| 366 | + * @throws EE_Error |
|
| 367 | + * @throws ReflectionException |
|
| 368 | + */ |
|
| 369 | + function espresso_event_status_banner($EVT_ID = false) |
|
| 370 | + { |
|
| 371 | + return EEH_Event_View::event_status($EVT_ID); |
|
| 372 | + } |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | |
| 376 | 376 | if (! function_exists('espresso_event_status')) { |
| 377 | - /** |
|
| 378 | - * espresso_event_status |
|
| 379 | - * returns the event status if it is sold out, expired, or inactive |
|
| 380 | - * |
|
| 381 | - * @param int $EVT_ID |
|
| 382 | - * @param bool $echo |
|
| 383 | - * @return string |
|
| 384 | - * @throws EE_Error |
|
| 385 | - * @throws ReflectionException |
|
| 386 | - */ |
|
| 387 | - function espresso_event_status($EVT_ID = 0, $echo = true) |
|
| 388 | - { |
|
| 389 | - return EEH_Event_View::event_active_status($EVT_ID, $echo); |
|
| 390 | - } |
|
| 377 | + /** |
|
| 378 | + * espresso_event_status |
|
| 379 | + * returns the event status if it is sold out, expired, or inactive |
|
| 380 | + * |
|
| 381 | + * @param int $EVT_ID |
|
| 382 | + * @param bool $echo |
|
| 383 | + * @return string |
|
| 384 | + * @throws EE_Error |
|
| 385 | + * @throws ReflectionException |
|
| 386 | + */ |
|
| 387 | + function espresso_event_status($EVT_ID = 0, $echo = true) |
|
| 388 | + { |
|
| 389 | + return EEH_Event_View::event_active_status($EVT_ID, $echo); |
|
| 390 | + } |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | |
| 394 | 394 | if (! function_exists('espresso_event_categories')) { |
| 395 | - /** |
|
| 396 | - * espresso_event_categories |
|
| 397 | - * returns the terms associated with an event |
|
| 398 | - * |
|
| 399 | - * @param int $EVT_ID |
|
| 400 | - * @param bool $hide_uncategorized |
|
| 401 | - * @param bool $echo |
|
| 402 | - * @return string |
|
| 403 | - * @throws EE_Error |
|
| 404 | - * @throws ReflectionException |
|
| 405 | - */ |
|
| 406 | - function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true) |
|
| 407 | - { |
|
| 408 | - if ($echo) { |
|
| 409 | - echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); // already escaped |
|
| 410 | - return ''; |
|
| 411 | - } |
|
| 412 | - return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
| 413 | - } |
|
| 395 | + /** |
|
| 396 | + * espresso_event_categories |
|
| 397 | + * returns the terms associated with an event |
|
| 398 | + * |
|
| 399 | + * @param int $EVT_ID |
|
| 400 | + * @param bool $hide_uncategorized |
|
| 401 | + * @param bool $echo |
|
| 402 | + * @return string |
|
| 403 | + * @throws EE_Error |
|
| 404 | + * @throws ReflectionException |
|
| 405 | + */ |
|
| 406 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true) |
|
| 407 | + { |
|
| 408 | + if ($echo) { |
|
| 409 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); // already escaped |
|
| 410 | + return ''; |
|
| 411 | + } |
|
| 412 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
| 413 | + } |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | if (! function_exists('espresso_event_tickets_available')) { |
| 418 | - /** |
|
| 419 | - * espresso_event_tickets_available |
|
| 420 | - * returns the ticket types available for purchase for an event |
|
| 421 | - * |
|
| 422 | - * @param int $EVT_ID |
|
| 423 | - * @param bool $echo |
|
| 424 | - * @param bool $format |
|
| 425 | - * @return string |
|
| 426 | - * @throws EE_Error |
|
| 427 | - * @throws ReflectionException |
|
| 428 | - */ |
|
| 429 | - function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true) |
|
| 430 | - { |
|
| 431 | - $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
| 432 | - if (is_array($tickets) && ! empty($tickets)) { |
|
| 433 | - // if formatting then $html will be a string, else it will be an array of ticket objects |
|
| 434 | - $html = |
|
| 435 | - $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
| 436 | - foreach ($tickets as $ticket) { |
|
| 437 | - if ($ticket instanceof EE_Ticket) { |
|
| 438 | - if ($format) { |
|
| 439 | - $html .= '<li id="ee-event-tickets-li-' |
|
| 440 | - . esc_attr($ticket->ID()) |
|
| 441 | - . '" class="ee-event-tickets-li">'; |
|
| 442 | - $html .= esc_html($ticket->name()) . ' '; |
|
| 443 | - $html .= EEH_Template::format_currency( |
|
| 444 | - $ticket->get_ticket_total_with_taxes() |
|
| 445 | - ); // already escaped |
|
| 446 | - $html .= '</li>'; |
|
| 447 | - } else { |
|
| 448 | - $html[] = $ticket; |
|
| 449 | - } |
|
| 450 | - } |
|
| 451 | - } |
|
| 452 | - if ($format) { |
|
| 453 | - $html .= '</ul>'; |
|
| 454 | - } |
|
| 455 | - if ($echo && $format) { |
|
| 456 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
| 457 | - return ''; |
|
| 458 | - } |
|
| 459 | - return $html; |
|
| 460 | - } |
|
| 461 | - return ''; |
|
| 462 | - } |
|
| 418 | + /** |
|
| 419 | + * espresso_event_tickets_available |
|
| 420 | + * returns the ticket types available for purchase for an event |
|
| 421 | + * |
|
| 422 | + * @param int $EVT_ID |
|
| 423 | + * @param bool $echo |
|
| 424 | + * @param bool $format |
|
| 425 | + * @return string |
|
| 426 | + * @throws EE_Error |
|
| 427 | + * @throws ReflectionException |
|
| 428 | + */ |
|
| 429 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true) |
|
| 430 | + { |
|
| 431 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
| 432 | + if (is_array($tickets) && ! empty($tickets)) { |
|
| 433 | + // if formatting then $html will be a string, else it will be an array of ticket objects |
|
| 434 | + $html = |
|
| 435 | + $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
| 436 | + foreach ($tickets as $ticket) { |
|
| 437 | + if ($ticket instanceof EE_Ticket) { |
|
| 438 | + if ($format) { |
|
| 439 | + $html .= '<li id="ee-event-tickets-li-' |
|
| 440 | + . esc_attr($ticket->ID()) |
|
| 441 | + . '" class="ee-event-tickets-li">'; |
|
| 442 | + $html .= esc_html($ticket->name()) . ' '; |
|
| 443 | + $html .= EEH_Template::format_currency( |
|
| 444 | + $ticket->get_ticket_total_with_taxes() |
|
| 445 | + ); // already escaped |
|
| 446 | + $html .= '</li>'; |
|
| 447 | + } else { |
|
| 448 | + $html[] = $ticket; |
|
| 449 | + } |
|
| 450 | + } |
|
| 451 | + } |
|
| 452 | + if ($format) { |
|
| 453 | + $html .= '</ul>'; |
|
| 454 | + } |
|
| 455 | + if ($echo && $format) { |
|
| 456 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
| 457 | + return ''; |
|
| 458 | + } |
|
| 459 | + return $html; |
|
| 460 | + } |
|
| 461 | + return ''; |
|
| 462 | + } |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | if (! function_exists('espresso_event_date_obj')) { |
| 466 | - /** |
|
| 467 | - * espresso_event_date_obj |
|
| 468 | - * returns the primary date object for an event |
|
| 469 | - * |
|
| 470 | - * @param bool $EVT_ID |
|
| 471 | - * @return EE_Datetime|null |
|
| 472 | - * @throws EE_Error |
|
| 473 | - * @throws ReflectionException |
|
| 474 | - */ |
|
| 475 | - function espresso_event_date_obj($EVT_ID = false) |
|
| 476 | - { |
|
| 477 | - return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 478 | - } |
|
| 466 | + /** |
|
| 467 | + * espresso_event_date_obj |
|
| 468 | + * returns the primary date object for an event |
|
| 469 | + * |
|
| 470 | + * @param bool $EVT_ID |
|
| 471 | + * @return EE_Datetime|null |
|
| 472 | + * @throws EE_Error |
|
| 473 | + * @throws ReflectionException |
|
| 474 | + */ |
|
| 475 | + function espresso_event_date_obj($EVT_ID = false) |
|
| 476 | + { |
|
| 477 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 478 | + } |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | if (! function_exists('espresso_event_date')) { |
| 483 | - /** |
|
| 484 | - * espresso_event_date |
|
| 485 | - * returns the primary date for an event |
|
| 486 | - * |
|
| 487 | - * @param string $date_format |
|
| 488 | - * @param string $time_format |
|
| 489 | - * @param bool $EVT_ID |
|
| 490 | - * @param bool $echo |
|
| 491 | - * @return string |
|
| 492 | - * @throws EE_Error |
|
| 493 | - * @throws ReflectionException |
|
| 494 | - */ |
|
| 495 | - function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
| 496 | - { |
|
| 497 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 498 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 499 | - $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
| 500 | - $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
| 501 | - if ($echo) { |
|
| 502 | - echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); // already escaped |
|
| 503 | - return ''; |
|
| 504 | - } |
|
| 505 | - return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
| 506 | - |
|
| 507 | - } |
|
| 483 | + /** |
|
| 484 | + * espresso_event_date |
|
| 485 | + * returns the primary date for an event |
|
| 486 | + * |
|
| 487 | + * @param string $date_format |
|
| 488 | + * @param string $time_format |
|
| 489 | + * @param bool $EVT_ID |
|
| 490 | + * @param bool $echo |
|
| 491 | + * @return string |
|
| 492 | + * @throws EE_Error |
|
| 493 | + * @throws ReflectionException |
|
| 494 | + */ |
|
| 495 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
| 496 | + { |
|
| 497 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 498 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 499 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
| 500 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
| 501 | + if ($echo) { |
|
| 502 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); // already escaped |
|
| 503 | + return ''; |
|
| 504 | + } |
|
| 505 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
| 506 | + |
|
| 507 | + } |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | |
| 511 | 511 | if (! function_exists('espresso_list_of_event_dates')) { |
| 512 | - /** |
|
| 513 | - * espresso_list_of_event_dates |
|
| 514 | - * returns a unordered list of dates for an event |
|
| 515 | - * |
|
| 516 | - * @param int $EVT_ID |
|
| 517 | - * @param string $date_format |
|
| 518 | - * @param string $time_format |
|
| 519 | - * @param bool $echo |
|
| 520 | - * @param null $show_expired |
|
| 521 | - * @param bool $format |
|
| 522 | - * @param bool $add_breaks |
|
| 523 | - * @param null $limit |
|
| 524 | - * @return string |
|
| 525 | - * @throws EE_Error |
|
| 526 | - * @throws ReflectionException |
|
| 527 | - */ |
|
| 528 | - function espresso_list_of_event_dates( |
|
| 529 | - $EVT_ID = 0, |
|
| 530 | - $date_format = '', |
|
| 531 | - $time_format = '', |
|
| 532 | - $echo = true, |
|
| 533 | - $show_expired = null, |
|
| 534 | - $format = true, |
|
| 535 | - $add_breaks = true, |
|
| 536 | - $limit = null |
|
| 537 | - ) { |
|
| 538 | - $allowedtags = AllowedTags::getAllowedTags(); |
|
| 539 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 540 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 541 | - $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
| 542 | - $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
| 543 | - $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit); |
|
| 544 | - if (! $format) { |
|
| 545 | - return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
| 546 | - } |
|
| 547 | - $newline = $add_breaks ? '<br />' : ''; |
|
| 548 | - if (is_array($datetimes) && ! empty($datetimes)) { |
|
| 549 | - global $post; |
|
| 550 | - $html = |
|
| 551 | - '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">'; |
|
| 552 | - foreach ($datetimes as $datetime) { |
|
| 553 | - if ($datetime instanceof EE_Datetime) { |
|
| 554 | - |
|
| 555 | - $datetime_name = $datetime->name(); |
|
| 556 | - $datetime_html = ! empty($datetime_name) |
|
| 557 | - ? ' |
|
| 512 | + /** |
|
| 513 | + * espresso_list_of_event_dates |
|
| 514 | + * returns a unordered list of dates for an event |
|
| 515 | + * |
|
| 516 | + * @param int $EVT_ID |
|
| 517 | + * @param string $date_format |
|
| 518 | + * @param string $time_format |
|
| 519 | + * @param bool $echo |
|
| 520 | + * @param null $show_expired |
|
| 521 | + * @param bool $format |
|
| 522 | + * @param bool $add_breaks |
|
| 523 | + * @param null $limit |
|
| 524 | + * @return string |
|
| 525 | + * @throws EE_Error |
|
| 526 | + * @throws ReflectionException |
|
| 527 | + */ |
|
| 528 | + function espresso_list_of_event_dates( |
|
| 529 | + $EVT_ID = 0, |
|
| 530 | + $date_format = '', |
|
| 531 | + $time_format = '', |
|
| 532 | + $echo = true, |
|
| 533 | + $show_expired = null, |
|
| 534 | + $format = true, |
|
| 535 | + $add_breaks = true, |
|
| 536 | + $limit = null |
|
| 537 | + ) { |
|
| 538 | + $allowedtags = AllowedTags::getAllowedTags(); |
|
| 539 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 540 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 541 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
| 542 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
| 543 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit); |
|
| 544 | + if (! $format) { |
|
| 545 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
| 546 | + } |
|
| 547 | + $newline = $add_breaks ? '<br />' : ''; |
|
| 548 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
| 549 | + global $post; |
|
| 550 | + $html = |
|
| 551 | + '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">'; |
|
| 552 | + foreach ($datetimes as $datetime) { |
|
| 553 | + if ($datetime instanceof EE_Datetime) { |
|
| 554 | + |
|
| 555 | + $datetime_name = $datetime->name(); |
|
| 556 | + $datetime_html = ! empty($datetime_name) |
|
| 557 | + ? ' |
|
| 558 | 558 | <strong class="ee-event-datetimes-li-date-name"> |
| 559 | 559 | ' . esc_html($datetime_name) . ' |
| 560 | 560 | </strong>' . $newline |
| 561 | - : ''; |
|
| 561 | + : ''; |
|
| 562 | 562 | |
| 563 | - $datetime_description = $datetime->description(); |
|
| 564 | - $datetime_html .= ! empty($datetime_description) |
|
| 565 | - ? ' |
|
| 563 | + $datetime_description = $datetime->description(); |
|
| 564 | + $datetime_html .= ! empty($datetime_description) |
|
| 565 | + ? ' |
|
| 566 | 566 | <span class="ee-event-datetimes-li-date-desc"> |
| 567 | 567 | ' . wp_kses($datetime_description, $allowedtags) . ' |
| 568 | 568 | </span>' . $newline |
| 569 | - : ''; |
|
| 569 | + : ''; |
|
| 570 | 570 | |
| 571 | - $datetime_html .= ' |
|
| 571 | + $datetime_html .= ' |
|
| 572 | 572 | <span class="dashicons dashicons-calendar"></span> |
| 573 | 573 | <span class="ee-event-datetimes-li-daterange">' . $datetime->date_range($date_format) . '</span> |
| 574 | 574 | <br/> |
@@ -576,482 +576,482 @@ discard block |
||
| 576 | 576 | <span class="ee-event-datetimes-li-timerange">' . $datetime->time_range($time_format) . '</span> |
| 577 | 577 | '; |
| 578 | 578 | |
| 579 | - $datetime_html = apply_filters( |
|
| 580 | - 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
| 581 | - $datetime_html, |
|
| 582 | - $datetime |
|
| 583 | - ); |
|
| 579 | + $datetime_html = apply_filters( |
|
| 580 | + 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
| 581 | + $datetime_html, |
|
| 582 | + $datetime |
|
| 583 | + ); |
|
| 584 | 584 | |
| 585 | - $DTD_ID = esc_attr($datetime->ID()); |
|
| 586 | - $active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
| 585 | + $DTD_ID = esc_attr($datetime->ID()); |
|
| 586 | + $active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
| 587 | 587 | |
| 588 | - $html .= ' |
|
| 588 | + $html .= ' |
|
| 589 | 589 | <li id="ee-event-datetimes-li-' . $DTD_ID . '" class="ee-event-datetimes-li' . $active_status . '"> |
| 590 | 590 | ' . $datetime_html . ' |
| 591 | 591 | </li>'; |
| 592 | - } |
|
| 593 | - } |
|
| 594 | - $html .= '</ul>'; |
|
| 595 | - } else { |
|
| 596 | - $html = |
|
| 597 | - ' |
|
| 592 | + } |
|
| 593 | + } |
|
| 594 | + $html .= '</ul>'; |
|
| 595 | + } else { |
|
| 596 | + $html = |
|
| 597 | + ' |
|
| 598 | 598 | <p> |
| 599 | 599 | <span class="dashicons dashicons-marker pink-text"></span> |
| 600 | 600 | ' . esc_html__( |
| 601 | - 'There are no upcoming dates for this event.', |
|
| 602 | - 'event_espresso' |
|
| 603 | - ) . ' |
|
| 601 | + 'There are no upcoming dates for this event.', |
|
| 602 | + 'event_espresso' |
|
| 603 | + ) . ' |
|
| 604 | 604 | </p> |
| 605 | 605 | <br/>'; |
| 606 | - } |
|
| 607 | - if ($echo) { |
|
| 608 | - echo wp_kses($html, AllowedTags::getWithFormTags()); |
|
| 609 | - return ''; |
|
| 610 | - } |
|
| 611 | - return $html; |
|
| 612 | - } |
|
| 606 | + } |
|
| 607 | + if ($echo) { |
|
| 608 | + echo wp_kses($html, AllowedTags::getWithFormTags()); |
|
| 609 | + return ''; |
|
| 610 | + } |
|
| 611 | + return $html; |
|
| 612 | + } |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | |
| 616 | 616 | if (! function_exists('espresso_event_end_date')) { |
| 617 | - /** |
|
| 618 | - * espresso_event_end_date |
|
| 619 | - * returns the last date for an event |
|
| 620 | - * |
|
| 621 | - * @param string $date_format |
|
| 622 | - * @param string $time_format |
|
| 623 | - * @param bool $EVT_ID |
|
| 624 | - * @param bool $echo |
|
| 625 | - * @return string |
|
| 626 | - * @throws EE_Error |
|
| 627 | - * @throws ReflectionException |
|
| 628 | - */ |
|
| 629 | - function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
| 630 | - { |
|
| 631 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 632 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 633 | - $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
| 634 | - $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
| 635 | - if ($echo) { |
|
| 636 | - echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); // already escaped |
|
| 637 | - return ''; |
|
| 638 | - } |
|
| 639 | - return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
| 640 | - } |
|
| 617 | + /** |
|
| 618 | + * espresso_event_end_date |
|
| 619 | + * returns the last date for an event |
|
| 620 | + * |
|
| 621 | + * @param string $date_format |
|
| 622 | + * @param string $time_format |
|
| 623 | + * @param bool $EVT_ID |
|
| 624 | + * @param bool $echo |
|
| 625 | + * @return string |
|
| 626 | + * @throws EE_Error |
|
| 627 | + * @throws ReflectionException |
|
| 628 | + */ |
|
| 629 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
| 630 | + { |
|
| 631 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 632 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 633 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
| 634 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
| 635 | + if ($echo) { |
|
| 636 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); // already escaped |
|
| 637 | + return ''; |
|
| 638 | + } |
|
| 639 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
| 640 | + } |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | if (! function_exists('espresso_event_date_range')) { |
| 644 | - /** |
|
| 645 | - * espresso_event_date_range |
|
| 646 | - * returns the first and last chronologically ordered dates for an event (if different) |
|
| 647 | - * |
|
| 648 | - * @param string $date_format |
|
| 649 | - * @param string $time_format |
|
| 650 | - * @param string $single_date_format |
|
| 651 | - * @param string $single_time_format |
|
| 652 | - * @param bool $EVT_ID |
|
| 653 | - * @param bool $echo |
|
| 654 | - * @return string |
|
| 655 | - * @throws EE_Error |
|
| 656 | - * @throws ReflectionException |
|
| 657 | - */ |
|
| 658 | - function espresso_event_date_range( |
|
| 659 | - $date_format = '', |
|
| 660 | - $time_format = '', |
|
| 661 | - $single_date_format = '', |
|
| 662 | - $single_time_format = '', |
|
| 663 | - $EVT_ID = false, |
|
| 664 | - $echo = true |
|
| 665 | - ) { |
|
| 666 | - // set and filter date and time formats when a range is returned |
|
| 667 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 668 | - $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
| 669 | - // get the start and end date with NO time portion |
|
| 670 | - $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
| 671 | - $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
| 672 | - // now we can determine if date range spans more than one day |
|
| 673 | - if ($the_event_date != $the_event_end_date) { |
|
| 674 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 675 | - $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
| 676 | - $html = sprintf( |
|
| 677 | - /* translators: 1: first event date, 2: last event date */ |
|
| 678 | - esc_html__('%1$s - %2$s', 'event_espresso'), |
|
| 679 | - EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
| 680 | - EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
| 681 | - ); |
|
| 682 | - } else { |
|
| 683 | - // set and filter date and time formats when only a single datetime is returned |
|
| 684 | - $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
| 685 | - $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
| 686 | - $single_date_format = |
|
| 687 | - apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
| 688 | - $single_time_format = |
|
| 689 | - apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
| 690 | - $html = |
|
| 691 | - EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
| 692 | - } |
|
| 693 | - if ($echo) { |
|
| 694 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
| 695 | - return ''; |
|
| 696 | - } |
|
| 697 | - return $html; |
|
| 698 | - } |
|
| 644 | + /** |
|
| 645 | + * espresso_event_date_range |
|
| 646 | + * returns the first and last chronologically ordered dates for an event (if different) |
|
| 647 | + * |
|
| 648 | + * @param string $date_format |
|
| 649 | + * @param string $time_format |
|
| 650 | + * @param string $single_date_format |
|
| 651 | + * @param string $single_time_format |
|
| 652 | + * @param bool $EVT_ID |
|
| 653 | + * @param bool $echo |
|
| 654 | + * @return string |
|
| 655 | + * @throws EE_Error |
|
| 656 | + * @throws ReflectionException |
|
| 657 | + */ |
|
| 658 | + function espresso_event_date_range( |
|
| 659 | + $date_format = '', |
|
| 660 | + $time_format = '', |
|
| 661 | + $single_date_format = '', |
|
| 662 | + $single_time_format = '', |
|
| 663 | + $EVT_ID = false, |
|
| 664 | + $echo = true |
|
| 665 | + ) { |
|
| 666 | + // set and filter date and time formats when a range is returned |
|
| 667 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 668 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
| 669 | + // get the start and end date with NO time portion |
|
| 670 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
| 671 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
| 672 | + // now we can determine if date range spans more than one day |
|
| 673 | + if ($the_event_date != $the_event_end_date) { |
|
| 674 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 675 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
| 676 | + $html = sprintf( |
|
| 677 | + /* translators: 1: first event date, 2: last event date */ |
|
| 678 | + esc_html__('%1$s - %2$s', 'event_espresso'), |
|
| 679 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
| 680 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
| 681 | + ); |
|
| 682 | + } else { |
|
| 683 | + // set and filter date and time formats when only a single datetime is returned |
|
| 684 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
| 685 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
| 686 | + $single_date_format = |
|
| 687 | + apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
| 688 | + $single_time_format = |
|
| 689 | + apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
| 690 | + $html = |
|
| 691 | + EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
| 692 | + } |
|
| 693 | + if ($echo) { |
|
| 694 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
| 695 | + return ''; |
|
| 696 | + } |
|
| 697 | + return $html; |
|
| 698 | + } |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | if (! function_exists('espresso_next_upcoming_datetime_obj')) { |
| 702 | - /** |
|
| 703 | - * espresso_next_upcoming_datetime_obj |
|
| 704 | - * returns the next upcoming datetime object for an event |
|
| 705 | - * |
|
| 706 | - * @param int $EVT_ID |
|
| 707 | - * @return EE_Datetime|null |
|
| 708 | - * @throws EE_Error |
|
| 709 | - */ |
|
| 710 | - function espresso_next_upcoming_datetime_obj($EVT_ID = 0) |
|
| 711 | - { |
|
| 712 | - return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID); |
|
| 713 | - } |
|
| 702 | + /** |
|
| 703 | + * espresso_next_upcoming_datetime_obj |
|
| 704 | + * returns the next upcoming datetime object for an event |
|
| 705 | + * |
|
| 706 | + * @param int $EVT_ID |
|
| 707 | + * @return EE_Datetime|null |
|
| 708 | + * @throws EE_Error |
|
| 709 | + */ |
|
| 710 | + function espresso_next_upcoming_datetime_obj($EVT_ID = 0) |
|
| 711 | + { |
|
| 712 | + return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID); |
|
| 713 | + } |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if (! function_exists('espresso_next_upcoming_datetime')) { |
| 717 | - /** |
|
| 718 | - * espresso_next_upcoming_datetime |
|
| 719 | - * returns the start date and time for the next upcoming event. |
|
| 720 | - * |
|
| 721 | - * @param string $date_format |
|
| 722 | - * @param string $time_format |
|
| 723 | - * @param int $EVT_ID |
|
| 724 | - * @param bool $echo |
|
| 725 | - * @return string |
|
| 726 | - * @throws EE_Error |
|
| 727 | - * @throws ReflectionException |
|
| 728 | - */ |
|
| 729 | - function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true) |
|
| 730 | - { |
|
| 731 | - |
|
| 732 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 733 | - $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format); |
|
| 734 | - |
|
| 735 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 736 | - $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
|
| 737 | - |
|
| 738 | - $datetime_format = trim($date_format . ' ' . $time_format); |
|
| 739 | - |
|
| 740 | - $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
|
| 741 | - |
|
| 742 | - if (! $datetime instanceof EE_Datetime) { |
|
| 743 | - return ''; |
|
| 744 | - } |
|
| 745 | - if ($echo) { |
|
| 746 | - echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format)); |
|
| 747 | - return ''; |
|
| 748 | - } |
|
| 749 | - return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format); |
|
| 750 | - } |
|
| 717 | + /** |
|
| 718 | + * espresso_next_upcoming_datetime |
|
| 719 | + * returns the start date and time for the next upcoming event. |
|
| 720 | + * |
|
| 721 | + * @param string $date_format |
|
| 722 | + * @param string $time_format |
|
| 723 | + * @param int $EVT_ID |
|
| 724 | + * @param bool $echo |
|
| 725 | + * @return string |
|
| 726 | + * @throws EE_Error |
|
| 727 | + * @throws ReflectionException |
|
| 728 | + */ |
|
| 729 | + function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true) |
|
| 730 | + { |
|
| 731 | + |
|
| 732 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 733 | + $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format); |
|
| 734 | + |
|
| 735 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 736 | + $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
|
| 737 | + |
|
| 738 | + $datetime_format = trim($date_format . ' ' . $time_format); |
|
| 739 | + |
|
| 740 | + $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
|
| 741 | + |
|
| 742 | + if (! $datetime instanceof EE_Datetime) { |
|
| 743 | + return ''; |
|
| 744 | + } |
|
| 745 | + if ($echo) { |
|
| 746 | + echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format)); |
|
| 747 | + return ''; |
|
| 748 | + } |
|
| 749 | + return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format); |
|
| 750 | + } |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if (! function_exists('espresso_event_date_as_calendar_page')) { |
| 754 | - /** |
|
| 755 | - * espresso_event_date_as_calendar_page |
|
| 756 | - * returns the primary date for an event, stylized to appear as the page of a calendar |
|
| 757 | - * |
|
| 758 | - * @param bool $EVT_ID |
|
| 759 | - * @return void |
|
| 760 | - * @throws EE_Error |
|
| 761 | - * @throws ReflectionException |
|
| 762 | - */ |
|
| 763 | - function espresso_event_date_as_calendar_page($EVT_ID = false) |
|
| 764 | - { |
|
| 765 | - EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
| 766 | - } |
|
| 754 | + /** |
|
| 755 | + * espresso_event_date_as_calendar_page |
|
| 756 | + * returns the primary date for an event, stylized to appear as the page of a calendar |
|
| 757 | + * |
|
| 758 | + * @param bool $EVT_ID |
|
| 759 | + * @return void |
|
| 760 | + * @throws EE_Error |
|
| 761 | + * @throws ReflectionException |
|
| 762 | + */ |
|
| 763 | + function espresso_event_date_as_calendar_page($EVT_ID = false) |
|
| 764 | + { |
|
| 765 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
| 766 | + } |
|
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | |
| 770 | 770 | if (! function_exists('espresso_event_link_url')) { |
| 771 | - /** |
|
| 772 | - * espresso_event_link_url |
|
| 773 | - * |
|
| 774 | - * @param int $EVT_ID |
|
| 775 | - * @param bool $echo |
|
| 776 | - * @return string |
|
| 777 | - * @throws EE_Error |
|
| 778 | - * @throws ReflectionException |
|
| 779 | - */ |
|
| 780 | - function espresso_event_link_url($EVT_ID = 0, $echo = true) |
|
| 781 | - { |
|
| 782 | - if ($echo) { |
|
| 783 | - echo EEH_Event_View::event_link_url($EVT_ID); // already escaped |
|
| 784 | - return ''; |
|
| 785 | - } |
|
| 786 | - return EEH_Event_View::event_link_url($EVT_ID); |
|
| 787 | - } |
|
| 771 | + /** |
|
| 772 | + * espresso_event_link_url |
|
| 773 | + * |
|
| 774 | + * @param int $EVT_ID |
|
| 775 | + * @param bool $echo |
|
| 776 | + * @return string |
|
| 777 | + * @throws EE_Error |
|
| 778 | + * @throws ReflectionException |
|
| 779 | + */ |
|
| 780 | + function espresso_event_link_url($EVT_ID = 0, $echo = true) |
|
| 781 | + { |
|
| 782 | + if ($echo) { |
|
| 783 | + echo EEH_Event_View::event_link_url($EVT_ID); // already escaped |
|
| 784 | + return ''; |
|
| 785 | + } |
|
| 786 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
| 787 | + } |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | |
| 791 | 791 | if (! function_exists('espresso_event_has_content_or_excerpt')) { |
| 792 | - /** |
|
| 793 | - * espresso_event_has_content_or_excerpt |
|
| 794 | - * |
|
| 795 | - * @access public |
|
| 796 | - * @param bool $EVT_ID |
|
| 797 | - * @return boolean |
|
| 798 | - * @throws EE_Error |
|
| 799 | - * @throws ReflectionException |
|
| 800 | - */ |
|
| 801 | - function espresso_event_has_content_or_excerpt($EVT_ID = false) |
|
| 802 | - { |
|
| 803 | - return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
| 804 | - } |
|
| 792 | + /** |
|
| 793 | + * espresso_event_has_content_or_excerpt |
|
| 794 | + * |
|
| 795 | + * @access public |
|
| 796 | + * @param bool $EVT_ID |
|
| 797 | + * @return boolean |
|
| 798 | + * @throws EE_Error |
|
| 799 | + * @throws ReflectionException |
|
| 800 | + */ |
|
| 801 | + function espresso_event_has_content_or_excerpt($EVT_ID = false) |
|
| 802 | + { |
|
| 803 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
| 804 | + } |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | |
| 808 | 808 | if (! function_exists('espresso_event_content_or_excerpt')) { |
| 809 | - /** |
|
| 810 | - * espresso_event_content_or_excerpt |
|
| 811 | - * |
|
| 812 | - * @param int $num_words |
|
| 813 | - * @param null $more |
|
| 814 | - * @param bool $echo |
|
| 815 | - * @return string |
|
| 816 | - */ |
|
| 817 | - function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true) |
|
| 818 | - { |
|
| 819 | - if ($echo) { |
|
| 820 | - echo EEH_Event_View::event_content_or_excerpt($num_words, $more); // already escaped |
|
| 821 | - return ''; |
|
| 822 | - } |
|
| 823 | - return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
| 824 | - } |
|
| 809 | + /** |
|
| 810 | + * espresso_event_content_or_excerpt |
|
| 811 | + * |
|
| 812 | + * @param int $num_words |
|
| 813 | + * @param null $more |
|
| 814 | + * @param bool $echo |
|
| 815 | + * @return string |
|
| 816 | + */ |
|
| 817 | + function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true) |
|
| 818 | + { |
|
| 819 | + if ($echo) { |
|
| 820 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); // already escaped |
|
| 821 | + return ''; |
|
| 822 | + } |
|
| 823 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
| 824 | + } |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | |
| 828 | 828 | if (! function_exists('espresso_event_phone')) { |
| 829 | - /** |
|
| 830 | - * espresso_event_phone |
|
| 831 | - * |
|
| 832 | - * @param int $EVT_ID |
|
| 833 | - * @param bool $echo |
|
| 834 | - * @return string |
|
| 835 | - * @throws EE_Error |
|
| 836 | - * @throws ReflectionException |
|
| 837 | - */ |
|
| 838 | - function espresso_event_phone($EVT_ID = 0, $echo = true) |
|
| 839 | - { |
|
| 840 | - if ($echo) { |
|
| 841 | - echo EEH_Event_View::event_phone($EVT_ID); // already escaped |
|
| 842 | - return ''; |
|
| 843 | - } |
|
| 844 | - return EEH_Event_View::event_phone($EVT_ID); |
|
| 845 | - } |
|
| 829 | + /** |
|
| 830 | + * espresso_event_phone |
|
| 831 | + * |
|
| 832 | + * @param int $EVT_ID |
|
| 833 | + * @param bool $echo |
|
| 834 | + * @return string |
|
| 835 | + * @throws EE_Error |
|
| 836 | + * @throws ReflectionException |
|
| 837 | + */ |
|
| 838 | + function espresso_event_phone($EVT_ID = 0, $echo = true) |
|
| 839 | + { |
|
| 840 | + if ($echo) { |
|
| 841 | + echo EEH_Event_View::event_phone($EVT_ID); // already escaped |
|
| 842 | + return ''; |
|
| 843 | + } |
|
| 844 | + return EEH_Event_View::event_phone($EVT_ID); |
|
| 845 | + } |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | |
| 849 | 849 | if (! function_exists('espresso_edit_event_link')) { |
| 850 | - /** |
|
| 851 | - * espresso_edit_event_link |
|
| 852 | - * returns a link to edit an event |
|
| 853 | - * |
|
| 854 | - * @param int $EVT_ID |
|
| 855 | - * @param bool $echo |
|
| 856 | - * @return string |
|
| 857 | - * @throws EE_Error |
|
| 858 | - * @throws ReflectionException |
|
| 859 | - */ |
|
| 860 | - function espresso_edit_event_link($EVT_ID = 0, $echo = true) |
|
| 861 | - { |
|
| 862 | - if ($echo) { |
|
| 863 | - echo EEH_Event_View::edit_event_link($EVT_ID); // already escaped |
|
| 864 | - return ''; |
|
| 865 | - } |
|
| 866 | - return EEH_Event_View::edit_event_link($EVT_ID); |
|
| 867 | - } |
|
| 850 | + /** |
|
| 851 | + * espresso_edit_event_link |
|
| 852 | + * returns a link to edit an event |
|
| 853 | + * |
|
| 854 | + * @param int $EVT_ID |
|
| 855 | + * @param bool $echo |
|
| 856 | + * @return string |
|
| 857 | + * @throws EE_Error |
|
| 858 | + * @throws ReflectionException |
|
| 859 | + */ |
|
| 860 | + function espresso_edit_event_link($EVT_ID = 0, $echo = true) |
|
| 861 | + { |
|
| 862 | + if ($echo) { |
|
| 863 | + echo EEH_Event_View::edit_event_link($EVT_ID); // already escaped |
|
| 864 | + return ''; |
|
| 865 | + } |
|
| 866 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
| 867 | + } |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | |
| 871 | 871 | if (! function_exists('espresso_organization_name')) { |
| 872 | - /** |
|
| 873 | - * espresso_organization_name |
|
| 874 | - * |
|
| 875 | - * @param bool $echo |
|
| 876 | - * @return string |
|
| 877 | - * @throws EE_Error |
|
| 878 | - */ |
|
| 879 | - function espresso_organization_name($echo = true) |
|
| 880 | - { |
|
| 881 | - if ($echo) { |
|
| 882 | - echo EE_Registry::instance()->CFG->organization->get_pretty('name'); // already escaped |
|
| 883 | - return ''; |
|
| 884 | - } |
|
| 885 | - return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
| 886 | - } |
|
| 872 | + /** |
|
| 873 | + * espresso_organization_name |
|
| 874 | + * |
|
| 875 | + * @param bool $echo |
|
| 876 | + * @return string |
|
| 877 | + * @throws EE_Error |
|
| 878 | + */ |
|
| 879 | + function espresso_organization_name($echo = true) |
|
| 880 | + { |
|
| 881 | + if ($echo) { |
|
| 882 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); // already escaped |
|
| 883 | + return ''; |
|
| 884 | + } |
|
| 885 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
| 886 | + } |
|
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | if (! function_exists('espresso_organization_address')) { |
| 890 | - /** |
|
| 891 | - * espresso_organization_address |
|
| 892 | - * |
|
| 893 | - * @param string $type |
|
| 894 | - * @return string |
|
| 895 | - */ |
|
| 896 | - function espresso_organization_address($type = 'inline') |
|
| 897 | - { |
|
| 898 | - if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
| 899 | - $address = new EventEspresso\core\domain\entities\GenericAddress( |
|
| 900 | - EE_Registry::instance()->CFG->organization->address_1, |
|
| 901 | - EE_Registry::instance()->CFG->organization->address_2, |
|
| 902 | - EE_Registry::instance()->CFG->organization->city, |
|
| 903 | - EE_Registry::instance()->CFG->organization->STA_ID, |
|
| 904 | - EE_Registry::instance()->CFG->organization->zip, |
|
| 905 | - EE_Registry::instance()->CFG->organization->CNT_ISO |
|
| 906 | - ); |
|
| 907 | - return EEH_Address::format($address, $type); |
|
| 908 | - } |
|
| 909 | - return ''; |
|
| 910 | - } |
|
| 890 | + /** |
|
| 891 | + * espresso_organization_address |
|
| 892 | + * |
|
| 893 | + * @param string $type |
|
| 894 | + * @return string |
|
| 895 | + */ |
|
| 896 | + function espresso_organization_address($type = 'inline') |
|
| 897 | + { |
|
| 898 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
| 899 | + $address = new EventEspresso\core\domain\entities\GenericAddress( |
|
| 900 | + EE_Registry::instance()->CFG->organization->address_1, |
|
| 901 | + EE_Registry::instance()->CFG->organization->address_2, |
|
| 902 | + EE_Registry::instance()->CFG->organization->city, |
|
| 903 | + EE_Registry::instance()->CFG->organization->STA_ID, |
|
| 904 | + EE_Registry::instance()->CFG->organization->zip, |
|
| 905 | + EE_Registry::instance()->CFG->organization->CNT_ISO |
|
| 906 | + ); |
|
| 907 | + return EEH_Address::format($address, $type); |
|
| 908 | + } |
|
| 909 | + return ''; |
|
| 910 | + } |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | if (! function_exists('espresso_organization_email')) { |
| 914 | - /** |
|
| 915 | - * espresso_organization_email |
|
| 916 | - * |
|
| 917 | - * @param bool $echo |
|
| 918 | - * @return string |
|
| 919 | - * @throws EE_Error |
|
| 920 | - */ |
|
| 921 | - function espresso_organization_email($echo = true) |
|
| 922 | - { |
|
| 923 | - if ($echo) { |
|
| 924 | - echo EE_Registry::instance()->CFG->organization->get_pretty('email'); // already escaped |
|
| 925 | - return ''; |
|
| 926 | - } |
|
| 927 | - return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
| 928 | - } |
|
| 914 | + /** |
|
| 915 | + * espresso_organization_email |
|
| 916 | + * |
|
| 917 | + * @param bool $echo |
|
| 918 | + * @return string |
|
| 919 | + * @throws EE_Error |
|
| 920 | + */ |
|
| 921 | + function espresso_organization_email($echo = true) |
|
| 922 | + { |
|
| 923 | + if ($echo) { |
|
| 924 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); // already escaped |
|
| 925 | + return ''; |
|
| 926 | + } |
|
| 927 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
| 928 | + } |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | if (! function_exists('espresso_organization_logo_url')) { |
| 932 | - /** |
|
| 933 | - * espresso_organization_logo_url |
|
| 934 | - * |
|
| 935 | - * @param bool $echo |
|
| 936 | - * @return string |
|
| 937 | - * @throws EE_Error |
|
| 938 | - */ |
|
| 939 | - function espresso_organization_logo_url($echo = true) |
|
| 940 | - { |
|
| 941 | - if ($echo) { |
|
| 942 | - echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); // already escaped |
|
| 943 | - return ''; |
|
| 944 | - } |
|
| 945 | - return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
| 946 | - } |
|
| 932 | + /** |
|
| 933 | + * espresso_organization_logo_url |
|
| 934 | + * |
|
| 935 | + * @param bool $echo |
|
| 936 | + * @return string |
|
| 937 | + * @throws EE_Error |
|
| 938 | + */ |
|
| 939 | + function espresso_organization_logo_url($echo = true) |
|
| 940 | + { |
|
| 941 | + if ($echo) { |
|
| 942 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); // already escaped |
|
| 943 | + return ''; |
|
| 944 | + } |
|
| 945 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
| 946 | + } |
|
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | if (! function_exists('espresso_organization_facebook')) { |
| 950 | - /** |
|
| 951 | - * espresso_organization_facebook |
|
| 952 | - * |
|
| 953 | - * @param bool $echo |
|
| 954 | - * @return string |
|
| 955 | - * @throws EE_Error |
|
| 956 | - */ |
|
| 957 | - function espresso_organization_facebook($echo = true) |
|
| 958 | - { |
|
| 959 | - if ($echo) { |
|
| 960 | - echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); // already escaped |
|
| 961 | - return ''; |
|
| 962 | - } |
|
| 963 | - return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
| 964 | - } |
|
| 950 | + /** |
|
| 951 | + * espresso_organization_facebook |
|
| 952 | + * |
|
| 953 | + * @param bool $echo |
|
| 954 | + * @return string |
|
| 955 | + * @throws EE_Error |
|
| 956 | + */ |
|
| 957 | + function espresso_organization_facebook($echo = true) |
|
| 958 | + { |
|
| 959 | + if ($echo) { |
|
| 960 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); // already escaped |
|
| 961 | + return ''; |
|
| 962 | + } |
|
| 963 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
| 964 | + } |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if (! function_exists('espresso_organization_twitter')) { |
| 968 | - /** |
|
| 969 | - * espresso_organization_twitter |
|
| 970 | - * |
|
| 971 | - * @param bool $echo |
|
| 972 | - * @return string |
|
| 973 | - * @throws EE_Error |
|
| 974 | - */ |
|
| 975 | - function espresso_organization_twitter($echo = true) |
|
| 976 | - { |
|
| 977 | - if ($echo) { |
|
| 978 | - echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); // already escaped |
|
| 979 | - return ''; |
|
| 980 | - } |
|
| 981 | - return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
| 982 | - } |
|
| 968 | + /** |
|
| 969 | + * espresso_organization_twitter |
|
| 970 | + * |
|
| 971 | + * @param bool $echo |
|
| 972 | + * @return string |
|
| 973 | + * @throws EE_Error |
|
| 974 | + */ |
|
| 975 | + function espresso_organization_twitter($echo = true) |
|
| 976 | + { |
|
| 977 | + if ($echo) { |
|
| 978 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); // already escaped |
|
| 979 | + return ''; |
|
| 980 | + } |
|
| 981 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
| 982 | + } |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | if (! function_exists('espresso_organization_linkedin')) { |
| 986 | - /** |
|
| 987 | - * espresso_organization_linkedin |
|
| 988 | - * |
|
| 989 | - * @param bool $echo |
|
| 990 | - * @return string |
|
| 991 | - * @throws EE_Error |
|
| 992 | - */ |
|
| 993 | - function espresso_organization_linkedin($echo = true) |
|
| 994 | - { |
|
| 995 | - if ($echo) { |
|
| 996 | - echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); // already escaped |
|
| 997 | - return ''; |
|
| 998 | - } |
|
| 999 | - return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
| 1000 | - } |
|
| 986 | + /** |
|
| 987 | + * espresso_organization_linkedin |
|
| 988 | + * |
|
| 989 | + * @param bool $echo |
|
| 990 | + * @return string |
|
| 991 | + * @throws EE_Error |
|
| 992 | + */ |
|
| 993 | + function espresso_organization_linkedin($echo = true) |
|
| 994 | + { |
|
| 995 | + if ($echo) { |
|
| 996 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); // already escaped |
|
| 997 | + return ''; |
|
| 998 | + } |
|
| 999 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
| 1000 | + } |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | if (! function_exists('espresso_organization_pinterest')) { |
| 1004 | - /** |
|
| 1005 | - * espresso_organization_pinterest |
|
| 1006 | - * |
|
| 1007 | - * @param bool $echo |
|
| 1008 | - * @return string |
|
| 1009 | - * @throws EE_Error |
|
| 1010 | - */ |
|
| 1011 | - function espresso_organization_pinterest($echo = true) |
|
| 1012 | - { |
|
| 1013 | - if ($echo) { |
|
| 1014 | - echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); // already escaped |
|
| 1015 | - return ''; |
|
| 1016 | - } |
|
| 1017 | - return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
| 1018 | - } |
|
| 1004 | + /** |
|
| 1005 | + * espresso_organization_pinterest |
|
| 1006 | + * |
|
| 1007 | + * @param bool $echo |
|
| 1008 | + * @return string |
|
| 1009 | + * @throws EE_Error |
|
| 1010 | + */ |
|
| 1011 | + function espresso_organization_pinterest($echo = true) |
|
| 1012 | + { |
|
| 1013 | + if ($echo) { |
|
| 1014 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); // already escaped |
|
| 1015 | + return ''; |
|
| 1016 | + } |
|
| 1017 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
| 1018 | + } |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | if (! function_exists('espresso_organization_google')) { |
| 1022 | - /** |
|
| 1023 | - * espresso_organization_google |
|
| 1024 | - * |
|
| 1025 | - * @param bool $echo |
|
| 1026 | - * @return string |
|
| 1027 | - * @throws EE_Error |
|
| 1028 | - */ |
|
| 1029 | - function espresso_organization_google($echo = true) |
|
| 1030 | - { |
|
| 1031 | - if ($echo) { |
|
| 1032 | - echo EE_Registry::instance()->CFG->organization->get_pretty('google'); // already escaped |
|
| 1033 | - return ''; |
|
| 1034 | - } |
|
| 1035 | - return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
| 1036 | - } |
|
| 1022 | + /** |
|
| 1023 | + * espresso_organization_google |
|
| 1024 | + * |
|
| 1025 | + * @param bool $echo |
|
| 1026 | + * @return string |
|
| 1027 | + * @throws EE_Error |
|
| 1028 | + */ |
|
| 1029 | + function espresso_organization_google($echo = true) |
|
| 1030 | + { |
|
| 1031 | + if ($echo) { |
|
| 1032 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); // already escaped |
|
| 1033 | + return ''; |
|
| 1034 | + } |
|
| 1035 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
| 1036 | + } |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | if (! function_exists('espresso_organization_instagram')) { |
| 1040 | - /** |
|
| 1041 | - * espresso_organization_instagram |
|
| 1042 | - * |
|
| 1043 | - * @param bool $echo |
|
| 1044 | - * @return string |
|
| 1045 | - * @throws EE_Error |
|
| 1046 | - */ |
|
| 1047 | - function espresso_organization_instagram($echo = true) |
|
| 1048 | - { |
|
| 1049 | - if ($echo) { |
|
| 1050 | - echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); // already escaped |
|
| 1051 | - return ''; |
|
| 1052 | - } |
|
| 1053 | - return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
| 1054 | - } |
|
| 1040 | + /** |
|
| 1041 | + * espresso_organization_instagram |
|
| 1042 | + * |
|
| 1043 | + * @param bool $echo |
|
| 1044 | + * @return string |
|
| 1045 | + * @throws EE_Error |
|
| 1046 | + */ |
|
| 1047 | + function espresso_organization_instagram($echo = true) |
|
| 1048 | + { |
|
| 1049 | + if ($echo) { |
|
| 1050 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); // already escaped |
|
| 1051 | + return ''; |
|
| 1052 | + } |
|
| 1053 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
| 1054 | + } |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | |
@@ -1059,345 +1059,345 @@ discard block |
||
| 1059 | 1059 | |
| 1060 | 1060 | |
| 1061 | 1061 | if (! function_exists('espresso_event_venues')) { |
| 1062 | - /** |
|
| 1063 | - * espresso_event_venues |
|
| 1064 | - * |
|
| 1065 | - * @return array all venues related to an event |
|
| 1066 | - * @throws EE_Error |
|
| 1067 | - * @throws ReflectionException |
|
| 1068 | - */ |
|
| 1069 | - function espresso_event_venues() |
|
| 1070 | - { |
|
| 1071 | - return EEH_Venue_View::get_event_venues(); |
|
| 1072 | - } |
|
| 1062 | + /** |
|
| 1063 | + * espresso_event_venues |
|
| 1064 | + * |
|
| 1065 | + * @return array all venues related to an event |
|
| 1066 | + * @throws EE_Error |
|
| 1067 | + * @throws ReflectionException |
|
| 1068 | + */ |
|
| 1069 | + function espresso_event_venues() |
|
| 1070 | + { |
|
| 1071 | + return EEH_Venue_View::get_event_venues(); |
|
| 1072 | + } |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | |
| 1076 | 1076 | if (! function_exists('espresso_venue_id')) { |
| 1077 | - /** |
|
| 1078 | - * espresso_venue_name |
|
| 1079 | - * |
|
| 1080 | - * @access public |
|
| 1081 | - * @param int $EVT_ID |
|
| 1082 | - * @return string |
|
| 1083 | - * @throws EE_Error |
|
| 1084 | - * @throws ReflectionException |
|
| 1085 | - */ |
|
| 1086 | - function espresso_venue_id($EVT_ID = 0) |
|
| 1087 | - { |
|
| 1088 | - $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
| 1089 | - return $venue instanceof EE_Venue ? $venue->ID() : 0; |
|
| 1090 | - } |
|
| 1077 | + /** |
|
| 1078 | + * espresso_venue_name |
|
| 1079 | + * |
|
| 1080 | + * @access public |
|
| 1081 | + * @param int $EVT_ID |
|
| 1082 | + * @return string |
|
| 1083 | + * @throws EE_Error |
|
| 1084 | + * @throws ReflectionException |
|
| 1085 | + */ |
|
| 1086 | + function espresso_venue_id($EVT_ID = 0) |
|
| 1087 | + { |
|
| 1088 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
| 1089 | + return $venue instanceof EE_Venue ? $venue->ID() : 0; |
|
| 1090 | + } |
|
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | |
| 1094 | 1094 | if (! function_exists('espresso_is_venue_private')) { |
| 1095 | - /** |
|
| 1096 | - * Return whether a venue is private or not. |
|
| 1097 | - * |
|
| 1098 | - * @param int $VNU_ID optional, the venue id to check. |
|
| 1099 | - * |
|
| 1100 | - * @return bool | null |
|
| 1101 | - * @throws EE_Error |
|
| 1102 | - * @throws ReflectionException |
|
| 1103 | - * @see EEH_Venue_View::get_venue() for more info on expected return results. |
|
| 1104 | - */ |
|
| 1105 | - function espresso_is_venue_private($VNU_ID = 0) |
|
| 1106 | - { |
|
| 1107 | - return EEH_Venue_View::is_venue_private($VNU_ID); |
|
| 1108 | - } |
|
| 1095 | + /** |
|
| 1096 | + * Return whether a venue is private or not. |
|
| 1097 | + * |
|
| 1098 | + * @param int $VNU_ID optional, the venue id to check. |
|
| 1099 | + * |
|
| 1100 | + * @return bool | null |
|
| 1101 | + * @throws EE_Error |
|
| 1102 | + * @throws ReflectionException |
|
| 1103 | + * @see EEH_Venue_View::get_venue() for more info on expected return results. |
|
| 1104 | + */ |
|
| 1105 | + function espresso_is_venue_private($VNU_ID = 0) |
|
| 1106 | + { |
|
| 1107 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
| 1108 | + } |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | |
| 1112 | 1112 | if (! function_exists('espresso_venue_is_password_protected')) { |
| 1113 | - /** |
|
| 1114 | - * returns true or false if a venue is password protected or not |
|
| 1115 | - * |
|
| 1116 | - * @param int $VNU_ID optional, the venue id to check. |
|
| 1117 | - * @return bool |
|
| 1118 | - * @throws EE_Error |
|
| 1119 | - * @throws ReflectionException |
|
| 1120 | - */ |
|
| 1121 | - function espresso_venue_is_password_protected($VNU_ID = 0) |
|
| 1122 | - { |
|
| 1123 | - EE_Registry::instance()->load_helper('Venue_View'); |
|
| 1124 | - return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
| 1125 | - } |
|
| 1113 | + /** |
|
| 1114 | + * returns true or false if a venue is password protected or not |
|
| 1115 | + * |
|
| 1116 | + * @param int $VNU_ID optional, the venue id to check. |
|
| 1117 | + * @return bool |
|
| 1118 | + * @throws EE_Error |
|
| 1119 | + * @throws ReflectionException |
|
| 1120 | + */ |
|
| 1121 | + function espresso_venue_is_password_protected($VNU_ID = 0) |
|
| 1122 | + { |
|
| 1123 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 1124 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
| 1125 | + } |
|
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | |
| 1129 | 1129 | if (! function_exists('espresso_password_protected_venue_form')) { |
| 1130 | - /** |
|
| 1131 | - * Returns a password form if venue is password protected. |
|
| 1132 | - * |
|
| 1133 | - * @param int $VNU_ID optional, the venue id to check. |
|
| 1134 | - * @return string |
|
| 1135 | - * @throws EE_Error |
|
| 1136 | - * @throws ReflectionException |
|
| 1137 | - */ |
|
| 1138 | - function espresso_password_protected_venue_form($VNU_ID = 0) |
|
| 1139 | - { |
|
| 1140 | - EE_Registry::instance()->load_helper('Venue_View'); |
|
| 1141 | - return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
| 1142 | - } |
|
| 1130 | + /** |
|
| 1131 | + * Returns a password form if venue is password protected. |
|
| 1132 | + * |
|
| 1133 | + * @param int $VNU_ID optional, the venue id to check. |
|
| 1134 | + * @return string |
|
| 1135 | + * @throws EE_Error |
|
| 1136 | + * @throws ReflectionException |
|
| 1137 | + */ |
|
| 1138 | + function espresso_password_protected_venue_form($VNU_ID = 0) |
|
| 1139 | + { |
|
| 1140 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 1141 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
| 1142 | + } |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | |
| 1146 | 1146 | if (! function_exists('espresso_venue_name')) { |
| 1147 | - /** |
|
| 1148 | - * espresso_venue_name |
|
| 1149 | - * |
|
| 1150 | - * @access public |
|
| 1151 | - * @param int $VNU_ID |
|
| 1152 | - * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website |
|
| 1153 | - * @param bool $echo |
|
| 1154 | - * @return string |
|
| 1155 | - * @throws EE_Error |
|
| 1156 | - * @throws ReflectionException |
|
| 1157 | - */ |
|
| 1158 | - function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true) |
|
| 1159 | - { |
|
| 1160 | - if ($echo) { |
|
| 1161 | - echo EEH_Venue_View::venue_name($link_to, $VNU_ID); // already escaped |
|
| 1162 | - return ''; |
|
| 1163 | - } |
|
| 1164 | - return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
| 1165 | - } |
|
| 1147 | + /** |
|
| 1148 | + * espresso_venue_name |
|
| 1149 | + * |
|
| 1150 | + * @access public |
|
| 1151 | + * @param int $VNU_ID |
|
| 1152 | + * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website |
|
| 1153 | + * @param bool $echo |
|
| 1154 | + * @return string |
|
| 1155 | + * @throws EE_Error |
|
| 1156 | + * @throws ReflectionException |
|
| 1157 | + */ |
|
| 1158 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true) |
|
| 1159 | + { |
|
| 1160 | + if ($echo) { |
|
| 1161 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); // already escaped |
|
| 1162 | + return ''; |
|
| 1163 | + } |
|
| 1164 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
| 1165 | + } |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | |
| 1169 | 1169 | if (! function_exists('espresso_venue_link')) { |
| 1170 | - /** |
|
| 1171 | - * espresso_venue_link |
|
| 1172 | - * |
|
| 1173 | - * @access public |
|
| 1174 | - * @param int $VNU_ID |
|
| 1175 | - * @param string $text |
|
| 1176 | - * @return string |
|
| 1177 | - * @throws EE_Error |
|
| 1178 | - * @throws ReflectionException |
|
| 1179 | - */ |
|
| 1180 | - function espresso_venue_link($VNU_ID = 0, $text = '') |
|
| 1181 | - { |
|
| 1182 | - return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
| 1183 | - } |
|
| 1170 | + /** |
|
| 1171 | + * espresso_venue_link |
|
| 1172 | + * |
|
| 1173 | + * @access public |
|
| 1174 | + * @param int $VNU_ID |
|
| 1175 | + * @param string $text |
|
| 1176 | + * @return string |
|
| 1177 | + * @throws EE_Error |
|
| 1178 | + * @throws ReflectionException |
|
| 1179 | + */ |
|
| 1180 | + function espresso_venue_link($VNU_ID = 0, $text = '') |
|
| 1181 | + { |
|
| 1182 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
| 1183 | + } |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | |
| 1187 | 1187 | if (! function_exists('espresso_venue_description')) { |
| 1188 | - /** |
|
| 1189 | - * espresso_venue_description |
|
| 1190 | - * |
|
| 1191 | - * @access public |
|
| 1192 | - * @param bool $VNU_ID |
|
| 1193 | - * @param bool $echo |
|
| 1194 | - * @return string |
|
| 1195 | - * @throws EE_Error |
|
| 1196 | - * @throws ReflectionException |
|
| 1197 | - */ |
|
| 1198 | - function espresso_venue_description($VNU_ID = false, $echo = true) |
|
| 1199 | - { |
|
| 1200 | - if ($echo) { |
|
| 1201 | - echo EEH_Venue_View::venue_description($VNU_ID); // already escaped |
|
| 1202 | - return ''; |
|
| 1203 | - } |
|
| 1204 | - return EEH_Venue_View::venue_description($VNU_ID); |
|
| 1205 | - } |
|
| 1188 | + /** |
|
| 1189 | + * espresso_venue_description |
|
| 1190 | + * |
|
| 1191 | + * @access public |
|
| 1192 | + * @param bool $VNU_ID |
|
| 1193 | + * @param bool $echo |
|
| 1194 | + * @return string |
|
| 1195 | + * @throws EE_Error |
|
| 1196 | + * @throws ReflectionException |
|
| 1197 | + */ |
|
| 1198 | + function espresso_venue_description($VNU_ID = false, $echo = true) |
|
| 1199 | + { |
|
| 1200 | + if ($echo) { |
|
| 1201 | + echo EEH_Venue_View::venue_description($VNU_ID); // already escaped |
|
| 1202 | + return ''; |
|
| 1203 | + } |
|
| 1204 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
| 1205 | + } |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | |
| 1209 | 1209 | if (! function_exists('espresso_venue_excerpt')) { |
| 1210 | - /** |
|
| 1211 | - * espresso_venue_excerpt |
|
| 1212 | - * |
|
| 1213 | - * @access public |
|
| 1214 | - * @param int $VNU_ID |
|
| 1215 | - * @param bool $echo |
|
| 1216 | - * @return string |
|
| 1217 | - * @throws EE_Error |
|
| 1218 | - * @throws ReflectionException |
|
| 1219 | - */ |
|
| 1220 | - function espresso_venue_excerpt($VNU_ID = 0, $echo = true) |
|
| 1221 | - { |
|
| 1222 | - if ($echo) { |
|
| 1223 | - echo EEH_Venue_View::venue_excerpt($VNU_ID); // already escaped |
|
| 1224 | - return ''; |
|
| 1225 | - } |
|
| 1226 | - return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
| 1227 | - } |
|
| 1210 | + /** |
|
| 1211 | + * espresso_venue_excerpt |
|
| 1212 | + * |
|
| 1213 | + * @access public |
|
| 1214 | + * @param int $VNU_ID |
|
| 1215 | + * @param bool $echo |
|
| 1216 | + * @return string |
|
| 1217 | + * @throws EE_Error |
|
| 1218 | + * @throws ReflectionException |
|
| 1219 | + */ |
|
| 1220 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = true) |
|
| 1221 | + { |
|
| 1222 | + if ($echo) { |
|
| 1223 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); // already escaped |
|
| 1224 | + return ''; |
|
| 1225 | + } |
|
| 1226 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
| 1227 | + } |
|
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | |
| 1231 | 1231 | if (! function_exists('espresso_venue_categories')) { |
| 1232 | - /** |
|
| 1233 | - * espresso_venue_categories |
|
| 1234 | - * returns the terms associated with a venue |
|
| 1235 | - * |
|
| 1236 | - * @param int $VNU_ID |
|
| 1237 | - * @param bool $hide_uncategorized |
|
| 1238 | - * @param bool $echo |
|
| 1239 | - * @return string |
|
| 1240 | - * @throws EE_Error |
|
| 1241 | - * @throws ReflectionException |
|
| 1242 | - */ |
|
| 1243 | - function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true) |
|
| 1244 | - { |
|
| 1245 | - if ($echo) { |
|
| 1246 | - echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); // already escaped |
|
| 1247 | - return ''; |
|
| 1248 | - } |
|
| 1249 | - return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
| 1250 | - } |
|
| 1232 | + /** |
|
| 1233 | + * espresso_venue_categories |
|
| 1234 | + * returns the terms associated with a venue |
|
| 1235 | + * |
|
| 1236 | + * @param int $VNU_ID |
|
| 1237 | + * @param bool $hide_uncategorized |
|
| 1238 | + * @param bool $echo |
|
| 1239 | + * @return string |
|
| 1240 | + * @throws EE_Error |
|
| 1241 | + * @throws ReflectionException |
|
| 1242 | + */ |
|
| 1243 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true) |
|
| 1244 | + { |
|
| 1245 | + if ($echo) { |
|
| 1246 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); // already escaped |
|
| 1247 | + return ''; |
|
| 1248 | + } |
|
| 1249 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
| 1250 | + } |
|
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | |
| 1254 | 1254 | if (! function_exists('espresso_venue_address')) { |
| 1255 | - /** |
|
| 1256 | - * espresso_venue_address |
|
| 1257 | - * returns a formatted block of html for displaying a venue's address |
|
| 1258 | - * |
|
| 1259 | - * @param string $type 'inline' or 'multiline' |
|
| 1260 | - * @param int $VNU_ID |
|
| 1261 | - * @param bool $echo |
|
| 1262 | - * @return string |
|
| 1263 | - * @throws EE_Error |
|
| 1264 | - * @throws ReflectionException |
|
| 1265 | - */ |
|
| 1266 | - function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
| 1267 | - { |
|
| 1268 | - if ($echo) { |
|
| 1269 | - echo EEH_Venue_View::venue_address($type, $VNU_ID); // already escaped |
|
| 1270 | - return ''; |
|
| 1271 | - } |
|
| 1272 | - return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
| 1273 | - } |
|
| 1255 | + /** |
|
| 1256 | + * espresso_venue_address |
|
| 1257 | + * returns a formatted block of html for displaying a venue's address |
|
| 1258 | + * |
|
| 1259 | + * @param string $type 'inline' or 'multiline' |
|
| 1260 | + * @param int $VNU_ID |
|
| 1261 | + * @param bool $echo |
|
| 1262 | + * @return string |
|
| 1263 | + * @throws EE_Error |
|
| 1264 | + * @throws ReflectionException |
|
| 1265 | + */ |
|
| 1266 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
| 1267 | + { |
|
| 1268 | + if ($echo) { |
|
| 1269 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); // already escaped |
|
| 1270 | + return ''; |
|
| 1271 | + } |
|
| 1272 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
| 1273 | + } |
|
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | 1276 | |
| 1277 | 1277 | if (! function_exists('espresso_venue_raw_address')) { |
| 1278 | - /** |
|
| 1279 | - * espresso_venue_address |
|
| 1280 | - * returns an UN-formatted string containing a venue's address |
|
| 1281 | - * |
|
| 1282 | - * @param string $type 'inline' or 'multiline' |
|
| 1283 | - * @param int $VNU_ID |
|
| 1284 | - * @param bool $echo |
|
| 1285 | - * @return string |
|
| 1286 | - * @throws EE_Error |
|
| 1287 | - * @throws ReflectionException |
|
| 1288 | - */ |
|
| 1289 | - function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
| 1290 | - { |
|
| 1291 | - if ($echo) { |
|
| 1292 | - echo EEH_Venue_View::venue_address($type, $VNU_ID, false, false); // already escaped |
|
| 1293 | - return ''; |
|
| 1294 | - } |
|
| 1295 | - return EEH_Venue_View::venue_address($type, $VNU_ID, false, false); |
|
| 1296 | - } |
|
| 1278 | + /** |
|
| 1279 | + * espresso_venue_address |
|
| 1280 | + * returns an UN-formatted string containing a venue's address |
|
| 1281 | + * |
|
| 1282 | + * @param string $type 'inline' or 'multiline' |
|
| 1283 | + * @param int $VNU_ID |
|
| 1284 | + * @param bool $echo |
|
| 1285 | + * @return string |
|
| 1286 | + * @throws EE_Error |
|
| 1287 | + * @throws ReflectionException |
|
| 1288 | + */ |
|
| 1289 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
| 1290 | + { |
|
| 1291 | + if ($echo) { |
|
| 1292 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, false, false); // already escaped |
|
| 1293 | + return ''; |
|
| 1294 | + } |
|
| 1295 | + return EEH_Venue_View::venue_address($type, $VNU_ID, false, false); |
|
| 1296 | + } |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | |
| 1300 | 1300 | if (! function_exists('espresso_venue_has_address')) { |
| 1301 | - /** |
|
| 1302 | - * espresso_venue_has_address |
|
| 1303 | - * returns TRUE or FALSE if a Venue has address information |
|
| 1304 | - * |
|
| 1305 | - * @param int $VNU_ID |
|
| 1306 | - * @return bool |
|
| 1307 | - * @throws EE_Error |
|
| 1308 | - * @throws ReflectionException |
|
| 1309 | - */ |
|
| 1310 | - function espresso_venue_has_address($VNU_ID = 0) |
|
| 1311 | - { |
|
| 1312 | - return EEH_Venue_View::venue_has_address($VNU_ID); |
|
| 1313 | - } |
|
| 1301 | + /** |
|
| 1302 | + * espresso_venue_has_address |
|
| 1303 | + * returns TRUE or FALSE if a Venue has address information |
|
| 1304 | + * |
|
| 1305 | + * @param int $VNU_ID |
|
| 1306 | + * @return bool |
|
| 1307 | + * @throws EE_Error |
|
| 1308 | + * @throws ReflectionException |
|
| 1309 | + */ |
|
| 1310 | + function espresso_venue_has_address($VNU_ID = 0) |
|
| 1311 | + { |
|
| 1312 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
| 1313 | + } |
|
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | |
| 1317 | 1317 | if (! function_exists('espresso_venue_gmap')) { |
| 1318 | - /** |
|
| 1319 | - * espresso_venue_gmap |
|
| 1320 | - * returns a google map for the venue address |
|
| 1321 | - * |
|
| 1322 | - * @param int $VNU_ID |
|
| 1323 | - * @param bool $map_ID |
|
| 1324 | - * @param array $gmap |
|
| 1325 | - * @param bool $echo |
|
| 1326 | - * @return string |
|
| 1327 | - * @throws EE_Error |
|
| 1328 | - * @throws ReflectionException |
|
| 1329 | - */ |
|
| 1330 | - function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true) |
|
| 1331 | - { |
|
| 1332 | - if ($echo) { |
|
| 1333 | - echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped |
|
| 1334 | - return ''; |
|
| 1335 | - } |
|
| 1336 | - return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
| 1337 | - } |
|
| 1318 | + /** |
|
| 1319 | + * espresso_venue_gmap |
|
| 1320 | + * returns a google map for the venue address |
|
| 1321 | + * |
|
| 1322 | + * @param int $VNU_ID |
|
| 1323 | + * @param bool $map_ID |
|
| 1324 | + * @param array $gmap |
|
| 1325 | + * @param bool $echo |
|
| 1326 | + * @return string |
|
| 1327 | + * @throws EE_Error |
|
| 1328 | + * @throws ReflectionException |
|
| 1329 | + */ |
|
| 1330 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true) |
|
| 1331 | + { |
|
| 1332 | + if ($echo) { |
|
| 1333 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped |
|
| 1334 | + return ''; |
|
| 1335 | + } |
|
| 1336 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
| 1337 | + } |
|
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | |
| 1341 | 1341 | if (! function_exists('espresso_venue_phone')) { |
| 1342 | - /** |
|
| 1343 | - * espresso_venue_phone |
|
| 1344 | - * |
|
| 1345 | - * @param int $VNU_ID |
|
| 1346 | - * @param bool $echo |
|
| 1347 | - * @return string |
|
| 1348 | - * @throws EE_Error |
|
| 1349 | - * @throws ReflectionException |
|
| 1350 | - */ |
|
| 1351 | - function espresso_venue_phone($VNU_ID = 0, $echo = true) |
|
| 1352 | - { |
|
| 1353 | - if ($echo) { |
|
| 1354 | - echo EEH_Venue_View::venue_phone($VNU_ID); // already escaped |
|
| 1355 | - return ''; |
|
| 1356 | - } |
|
| 1357 | - return EEH_Venue_View::venue_phone($VNU_ID); |
|
| 1358 | - } |
|
| 1342 | + /** |
|
| 1343 | + * espresso_venue_phone |
|
| 1344 | + * |
|
| 1345 | + * @param int $VNU_ID |
|
| 1346 | + * @param bool $echo |
|
| 1347 | + * @return string |
|
| 1348 | + * @throws EE_Error |
|
| 1349 | + * @throws ReflectionException |
|
| 1350 | + */ |
|
| 1351 | + function espresso_venue_phone($VNU_ID = 0, $echo = true) |
|
| 1352 | + { |
|
| 1353 | + if ($echo) { |
|
| 1354 | + echo EEH_Venue_View::venue_phone($VNU_ID); // already escaped |
|
| 1355 | + return ''; |
|
| 1356 | + } |
|
| 1357 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
| 1358 | + } |
|
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | |
| 1362 | 1362 | if (! function_exists('espresso_venue_website')) { |
| 1363 | - /** |
|
| 1364 | - * espresso_venue_website |
|
| 1365 | - * |
|
| 1366 | - * @param int $VNU_ID |
|
| 1367 | - * @param bool $echo |
|
| 1368 | - * @return string |
|
| 1369 | - * @throws EE_Error |
|
| 1370 | - * @throws ReflectionException |
|
| 1371 | - */ |
|
| 1372 | - function espresso_venue_website($VNU_ID = 0, $echo = true) |
|
| 1373 | - { |
|
| 1374 | - if ($echo) { |
|
| 1375 | - echo EEH_Venue_View::venue_website_link($VNU_ID); // already escaped |
|
| 1376 | - return ''; |
|
| 1377 | - } |
|
| 1378 | - return EEH_Venue_View::venue_website_link($VNU_ID); |
|
| 1379 | - } |
|
| 1363 | + /** |
|
| 1364 | + * espresso_venue_website |
|
| 1365 | + * |
|
| 1366 | + * @param int $VNU_ID |
|
| 1367 | + * @param bool $echo |
|
| 1368 | + * @return string |
|
| 1369 | + * @throws EE_Error |
|
| 1370 | + * @throws ReflectionException |
|
| 1371 | + */ |
|
| 1372 | + function espresso_venue_website($VNU_ID = 0, $echo = true) |
|
| 1373 | + { |
|
| 1374 | + if ($echo) { |
|
| 1375 | + echo EEH_Venue_View::venue_website_link($VNU_ID); // already escaped |
|
| 1376 | + return ''; |
|
| 1377 | + } |
|
| 1378 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
| 1379 | + } |
|
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | 1382 | |
| 1383 | 1383 | if (! function_exists('espresso_edit_venue_link')) { |
| 1384 | - /** |
|
| 1385 | - * espresso_edit_venue_link |
|
| 1386 | - * |
|
| 1387 | - * @param int $VNU_ID |
|
| 1388 | - * @param bool $echo |
|
| 1389 | - * @return string |
|
| 1390 | - * @throws EE_Error |
|
| 1391 | - * @throws ReflectionException |
|
| 1392 | - */ |
|
| 1393 | - function espresso_edit_venue_link($VNU_ID = 0, $echo = true) |
|
| 1394 | - { |
|
| 1395 | - if ($echo) { |
|
| 1396 | - echo EEH_Venue_View::edit_venue_link($VNU_ID); // already escaped |
|
| 1397 | - return ''; |
|
| 1398 | - } |
|
| 1399 | - return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
| 1400 | - } |
|
| 1384 | + /** |
|
| 1385 | + * espresso_edit_venue_link |
|
| 1386 | + * |
|
| 1387 | + * @param int $VNU_ID |
|
| 1388 | + * @param bool $echo |
|
| 1389 | + * @return string |
|
| 1390 | + * @throws EE_Error |
|
| 1391 | + * @throws ReflectionException |
|
| 1392 | + */ |
|
| 1393 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = true) |
|
| 1394 | + { |
|
| 1395 | + if ($echo) { |
|
| 1396 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); // already escaped |
|
| 1397 | + return ''; |
|
| 1398 | + } |
|
| 1399 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
| 1400 | + } |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | |