@@ -14,24 +14,24 @@ |
||
| 14 | 14 | class TicketSelectorIframeEmbedButton extends IframeEmbedButton |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * TicketSelectorIframeEmbedButton constructor. |
|
| 19 | - */ |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - parent::__construct( |
|
| 23 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
| 24 | - 'ticket_selector' |
|
| 25 | - ); |
|
| 26 | - } |
|
| 17 | + /** |
|
| 18 | + * TicketSelectorIframeEmbedButton constructor. |
|
| 19 | + */ |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + parent::__construct( |
|
| 23 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
| 24 | + 'ticket_selector' |
|
| 25 | + ); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Adds an iframe embed code button to the Event editor. |
|
| 31 | - */ |
|
| 32 | - public function addEventEditorIframeEmbedButton() |
|
| 33 | - { |
|
| 34 | - // add button for iframe code to event editor. |
|
| 35 | - $this->addEventEditorIframeEmbedButtonFilter(); |
|
| 36 | - } |
|
| 29 | + /** |
|
| 30 | + * Adds an iframe embed code button to the Event editor. |
|
| 31 | + */ |
|
| 32 | + public function addEventEditorIframeEmbedButton() |
|
| 33 | + { |
|
| 34 | + // add button for iframe code to event editor. |
|
| 35 | + $this->addEventEditorIframeEmbedButtonFilter(); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -14,26 +14,26 @@ |
||
| 14 | 14 | class TicketSelectorRowSimple extends TicketSelectorRow |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @throws EE_Error |
|
| 19 | - */ |
|
| 20 | - public function setupTicketStatusDisplay() |
|
| 21 | - { |
|
| 22 | - $remaining = $this->ticket->remaining(); |
|
| 23 | - $this->setTicketMinAndMax($remaining); |
|
| 24 | - $this->setTicketStatusClasses($remaining); |
|
| 25 | - $this->setTicketStatusDisplay($remaining); |
|
| 26 | - } |
|
| 17 | + /** |
|
| 18 | + * @throws EE_Error |
|
| 19 | + */ |
|
| 20 | + public function setupTicketStatusDisplay() |
|
| 21 | + { |
|
| 22 | + $remaining = $this->ticket->remaining(); |
|
| 23 | + $this->setTicketMinAndMax($remaining); |
|
| 24 | + $this->setTicketStatusClasses($remaining); |
|
| 25 | + $this->setTicketStatusDisplay($remaining); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - public function getTicketDescription() |
|
| 30 | - { |
|
| 31 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
| 32 | - if ($filtered_row_content !== false) { |
|
| 33 | - remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 34 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
| 35 | - return $filtered_row_content; |
|
| 36 | - } |
|
| 37 | - return $this->ticket->description(); |
|
| 38 | - } |
|
| 29 | + public function getTicketDescription() |
|
| 30 | + { |
|
| 31 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
| 32 | + if ($filtered_row_content !== false) { |
|
| 33 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 34 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
| 35 | + return $filtered_row_content; |
|
| 36 | + } |
|
| 37 | + return $this->ticket->description(); |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this |
| 61 | 61 | ) |
| 62 | 62 | ); |
| 63 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
| 63 | + if ( ! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
| 64 | 64 | $this->addStylesheets(array('site_theme' => '')); |
| 65 | 65 | } |
| 66 | 66 | $this->addScripts( |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | array(), |
| 80 | 80 | $this |
| 81 | 81 | ); |
| 82 | - if (! empty($js_attributes)) { |
|
| 82 | + if ( ! empty($js_attributes)) { |
|
| 83 | 83 | $this->addScriptAttributes($js_attributes); |
| 84 | 84 | } |
| 85 | 85 | $this->addLocalizedVars( |
@@ -23,83 +23,83 @@ |
||
| 23 | 23 | class TicketSelectorIframe extends Iframe |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * TicketSelectorIframe constructor. |
|
| 28 | - * |
|
| 29 | - * @throws InvalidArgumentException |
|
| 30 | - * @throws InvalidInterfaceException |
|
| 31 | - * @throws InvalidDataTypeException |
|
| 32 | - * @throws DomainException |
|
| 33 | - * @throws EE_Error |
|
| 34 | - * @throws ReflectionException |
|
| 35 | - */ |
|
| 36 | - public function __construct() |
|
| 37 | - { |
|
| 38 | - EE_Registry::instance()->REQ->set_espresso_page(true); |
|
| 39 | - /** @type \EEM_Event $EEM_Event */ |
|
| 40 | - $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
| 41 | - $event = $EEM_Event->get_one_by_ID( |
|
| 42 | - EE_Registry::instance()->REQ->get('event', 0) |
|
| 43 | - ); |
|
| 44 | - $ticket_selector = LoaderFactory::getLoader()->getShared( |
|
| 45 | - DisplayTicketSelector::class, |
|
| 46 | - [null, true] |
|
| 47 | - ); |
|
| 48 | - parent::__construct( |
|
| 49 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
| 50 | - $ticket_selector->display($event) |
|
| 51 | - ); |
|
| 52 | - $this->addStylesheets( |
|
| 53 | - apply_filters( |
|
| 54 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
| 55 | - array( |
|
| 56 | - 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
| 57 | - . 'ticket_selector_embed.css?ver=' |
|
| 58 | - . EVENT_ESPRESSO_VERSION, |
|
| 59 | - 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
| 60 | - . 'ticket_selector.css?ver=' |
|
| 61 | - . EVENT_ESPRESSO_VERSION, |
|
| 62 | - ), |
|
| 63 | - $this |
|
| 64 | - ) |
|
| 65 | - ); |
|
| 66 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
| 67 | - $this->addStylesheets(array('site_theme' => '')); |
|
| 68 | - } |
|
| 69 | - $this->addScripts( |
|
| 70 | - apply_filters( |
|
| 71 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
| 72 | - array( |
|
| 73 | - 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
| 74 | - . 'ticket_selector_iframe_embed.js?ver=' |
|
| 75 | - . EVENT_ESPRESSO_VERSION, |
|
| 76 | - ), |
|
| 77 | - $this |
|
| 78 | - ) |
|
| 79 | - ); |
|
| 80 | - $js_attributes = apply_filters( |
|
| 81 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
| 82 | - array(), |
|
| 83 | - $this |
|
| 84 | - ); |
|
| 85 | - if (! empty($js_attributes)) { |
|
| 86 | - $this->addScriptAttributes($js_attributes); |
|
| 87 | - } |
|
| 88 | - $this->addLocalizedVars( |
|
| 89 | - apply_filters( |
|
| 90 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
| 91 | - array( |
|
| 92 | - 'ticket_selector_iframe' => true, |
|
| 93 | - 'EEDTicketSelectorMsg' => __( |
|
| 94 | - 'Please choose at least one ticket before continuing.', |
|
| 95 | - 'event_espresso' |
|
| 96 | - ), |
|
| 97 | - ) |
|
| 98 | - ) |
|
| 99 | - ); |
|
| 100 | - do_action( |
|
| 101 | - 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
| 102 | - $this |
|
| 103 | - ); |
|
| 104 | - } |
|
| 26 | + /** |
|
| 27 | + * TicketSelectorIframe constructor. |
|
| 28 | + * |
|
| 29 | + * @throws InvalidArgumentException |
|
| 30 | + * @throws InvalidInterfaceException |
|
| 31 | + * @throws InvalidDataTypeException |
|
| 32 | + * @throws DomainException |
|
| 33 | + * @throws EE_Error |
|
| 34 | + * @throws ReflectionException |
|
| 35 | + */ |
|
| 36 | + public function __construct() |
|
| 37 | + { |
|
| 38 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
| 39 | + /** @type \EEM_Event $EEM_Event */ |
|
| 40 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
| 41 | + $event = $EEM_Event->get_one_by_ID( |
|
| 42 | + EE_Registry::instance()->REQ->get('event', 0) |
|
| 43 | + ); |
|
| 44 | + $ticket_selector = LoaderFactory::getLoader()->getShared( |
|
| 45 | + DisplayTicketSelector::class, |
|
| 46 | + [null, true] |
|
| 47 | + ); |
|
| 48 | + parent::__construct( |
|
| 49 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
| 50 | + $ticket_selector->display($event) |
|
| 51 | + ); |
|
| 52 | + $this->addStylesheets( |
|
| 53 | + apply_filters( |
|
| 54 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
| 55 | + array( |
|
| 56 | + 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
| 57 | + . 'ticket_selector_embed.css?ver=' |
|
| 58 | + . EVENT_ESPRESSO_VERSION, |
|
| 59 | + 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
| 60 | + . 'ticket_selector.css?ver=' |
|
| 61 | + . EVENT_ESPRESSO_VERSION, |
|
| 62 | + ), |
|
| 63 | + $this |
|
| 64 | + ) |
|
| 65 | + ); |
|
| 66 | + if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
| 67 | + $this->addStylesheets(array('site_theme' => '')); |
|
| 68 | + } |
|
| 69 | + $this->addScripts( |
|
| 70 | + apply_filters( |
|
| 71 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
| 72 | + array( |
|
| 73 | + 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
| 74 | + . 'ticket_selector_iframe_embed.js?ver=' |
|
| 75 | + . EVENT_ESPRESSO_VERSION, |
|
| 76 | + ), |
|
| 77 | + $this |
|
| 78 | + ) |
|
| 79 | + ); |
|
| 80 | + $js_attributes = apply_filters( |
|
| 81 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
| 82 | + array(), |
|
| 83 | + $this |
|
| 84 | + ); |
|
| 85 | + if (! empty($js_attributes)) { |
|
| 86 | + $this->addScriptAttributes($js_attributes); |
|
| 87 | + } |
|
| 88 | + $this->addLocalizedVars( |
|
| 89 | + apply_filters( |
|
| 90 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
| 91 | + array( |
|
| 92 | + 'ticket_selector_iframe' => true, |
|
| 93 | + 'EEDTicketSelectorMsg' => __( |
|
| 94 | + 'Please choose at least one ticket before continuing.', |
|
| 95 | + 'event_espresso' |
|
| 96 | + ), |
|
| 97 | + ) |
|
| 98 | + ) |
|
| 99 | + ); |
|
| 100 | + do_action( |
|
| 101 | + 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
| 102 | + $this |
|
| 103 | + ); |
|
| 104 | + } |
|
| 105 | 105 | } |
@@ -15,186 +15,186 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var \EE_Ticket $ticket |
|
| 20 | - */ |
|
| 21 | - protected $ticket; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
| 25 | - */ |
|
| 26 | - protected $template_settings; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var string $date_format |
|
| 30 | - */ |
|
| 31 | - protected $date_format; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var string $time_format |
|
| 35 | - */ |
|
| 36 | - protected $time_format; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var boolean $event_is_expired |
|
| 40 | - */ |
|
| 41 | - protected $event_is_expired; |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * TicketDetails constructor. |
|
| 46 | - * |
|
| 47 | - * @param \EE_Ticket $ticket |
|
| 48 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
| 49 | - * @param array $template_args |
|
| 50 | - */ |
|
| 51 | - public function __construct( |
|
| 52 | - \EE_Ticket $ticket, |
|
| 53 | - \EE_Ticket_Selector_Config $template_settings, |
|
| 54 | - array $template_args |
|
| 55 | - ) { |
|
| 56 | - $this->ticket = $ticket; |
|
| 57 | - $this->template_settings = $template_settings; |
|
| 58 | - $this->date_format = $template_args['date_format']; |
|
| 59 | - $this->time_format = $template_args['time_format']; |
|
| 60 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @return \EE_Ticket |
|
| 66 | - */ |
|
| 67 | - public function getTicket() |
|
| 68 | - { |
|
| 69 | - return $this->ticket; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @return bool |
|
| 75 | - */ |
|
| 76 | - public function showTicketDetails() |
|
| 77 | - { |
|
| 78 | - return $this->template_settings->show_ticket_details; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @return \EE_Ticket_Selector_Config |
|
| 84 | - */ |
|
| 85 | - public function getTemplateSettings() |
|
| 86 | - { |
|
| 87 | - return $this->template_settings; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * @return string |
|
| 93 | - */ |
|
| 94 | - public function getDateFormat() |
|
| 95 | - { |
|
| 96 | - return $this->date_format; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function getTimeFormat() |
|
| 104 | - { |
|
| 105 | - return $this->time_format; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @return string |
|
| 111 | - */ |
|
| 112 | - public function getShowHideLinks() |
|
| 113 | - { |
|
| 114 | - if (! $this->showTicketDetails()) { |
|
| 115 | - return ''; |
|
| 116 | - } |
|
| 117 | - return \EEH_HTML::link( |
|
| 118 | - '', |
|
| 119 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 120 | - esc_attr( |
|
| 121 | - apply_filters( |
|
| 122 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 123 | - __('click to show additional ticket details', 'event_espresso') |
|
| 124 | - ) |
|
| 125 | - ), |
|
| 126 | - "display-{$this->cssId()}", |
|
| 127 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 128 | - '', |
|
| 129 | - 'rel="' . $this->cssId() . '"' |
|
| 130 | - ) . \EEH_HTML::link( |
|
| 131 | - '', |
|
| 132 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 133 | - esc_attr( |
|
| 134 | - apply_filters( |
|
| 135 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 136 | - __('click to hide additional ticket details', 'event_espresso') |
|
| 137 | - ) |
|
| 138 | - ), |
|
| 139 | - "hide-{$this->cssId()}", |
|
| 140 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 141 | - 'display:none;', |
|
| 142 | - 'rel="' . $this->cssId() . '"' |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * @return string |
|
| 149 | - */ |
|
| 150 | - public function cssId() |
|
| 151 | - { |
|
| 152 | - return apply_filters( |
|
| 153 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 154 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 155 | - ); |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * @param float $ticket_price |
|
| 161 | - * @param int $remaining |
|
| 162 | - * @param int $cols |
|
| 163 | - * @return string |
|
| 164 | - */ |
|
| 165 | - public function display( |
|
| 166 | - $ticket_price = 0.00, |
|
| 167 | - $remaining, |
|
| 168 | - $cols = 2 |
|
| 169 | - ) { |
|
| 170 | - $template_args = array(); |
|
| 171 | - $template_args['ticket'] = $this->ticket; |
|
| 172 | - $template_args['ticket_price'] = $ticket_price; |
|
| 173 | - $template_args['remaining'] = $remaining; |
|
| 174 | - $template_args['cols'] = $cols; |
|
| 175 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 176 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 177 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 178 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 179 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
| 180 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 181 | - true |
|
| 182 | - ); |
|
| 183 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
| 184 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 185 | - esc_html__('Price', 'event_espresso') |
|
| 186 | - ); |
|
| 187 | - $template_args['date_format'] = $this->date_format; |
|
| 188 | - $template_args['time_format'] = $this->time_format; |
|
| 189 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 190 | - |
|
| 191 | - return \EEH_Template::locate_template( |
|
| 192 | - apply_filters( |
|
| 193 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 195 | - $this->ticket |
|
| 196 | - ), |
|
| 197 | - $template_args |
|
| 198 | - ); |
|
| 199 | - } |
|
| 18 | + /** |
|
| 19 | + * @var \EE_Ticket $ticket |
|
| 20 | + */ |
|
| 21 | + protected $ticket; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
| 25 | + */ |
|
| 26 | + protected $template_settings; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var string $date_format |
|
| 30 | + */ |
|
| 31 | + protected $date_format; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var string $time_format |
|
| 35 | + */ |
|
| 36 | + protected $time_format; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var boolean $event_is_expired |
|
| 40 | + */ |
|
| 41 | + protected $event_is_expired; |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * TicketDetails constructor. |
|
| 46 | + * |
|
| 47 | + * @param \EE_Ticket $ticket |
|
| 48 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
| 49 | + * @param array $template_args |
|
| 50 | + */ |
|
| 51 | + public function __construct( |
|
| 52 | + \EE_Ticket $ticket, |
|
| 53 | + \EE_Ticket_Selector_Config $template_settings, |
|
| 54 | + array $template_args |
|
| 55 | + ) { |
|
| 56 | + $this->ticket = $ticket; |
|
| 57 | + $this->template_settings = $template_settings; |
|
| 58 | + $this->date_format = $template_args['date_format']; |
|
| 59 | + $this->time_format = $template_args['time_format']; |
|
| 60 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @return \EE_Ticket |
|
| 66 | + */ |
|
| 67 | + public function getTicket() |
|
| 68 | + { |
|
| 69 | + return $this->ticket; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @return bool |
|
| 75 | + */ |
|
| 76 | + public function showTicketDetails() |
|
| 77 | + { |
|
| 78 | + return $this->template_settings->show_ticket_details; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @return \EE_Ticket_Selector_Config |
|
| 84 | + */ |
|
| 85 | + public function getTemplateSettings() |
|
| 86 | + { |
|
| 87 | + return $this->template_settings; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * @return string |
|
| 93 | + */ |
|
| 94 | + public function getDateFormat() |
|
| 95 | + { |
|
| 96 | + return $this->date_format; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function getTimeFormat() |
|
| 104 | + { |
|
| 105 | + return $this->time_format; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @return string |
|
| 111 | + */ |
|
| 112 | + public function getShowHideLinks() |
|
| 113 | + { |
|
| 114 | + if (! $this->showTicketDetails()) { |
|
| 115 | + return ''; |
|
| 116 | + } |
|
| 117 | + return \EEH_HTML::link( |
|
| 118 | + '', |
|
| 119 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 120 | + esc_attr( |
|
| 121 | + apply_filters( |
|
| 122 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 123 | + __('click to show additional ticket details', 'event_espresso') |
|
| 124 | + ) |
|
| 125 | + ), |
|
| 126 | + "display-{$this->cssId()}", |
|
| 127 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 128 | + '', |
|
| 129 | + 'rel="' . $this->cssId() . '"' |
|
| 130 | + ) . \EEH_HTML::link( |
|
| 131 | + '', |
|
| 132 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 133 | + esc_attr( |
|
| 134 | + apply_filters( |
|
| 135 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 136 | + __('click to hide additional ticket details', 'event_espresso') |
|
| 137 | + ) |
|
| 138 | + ), |
|
| 139 | + "hide-{$this->cssId()}", |
|
| 140 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 141 | + 'display:none;', |
|
| 142 | + 'rel="' . $this->cssId() . '"' |
|
| 143 | + ); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * @return string |
|
| 149 | + */ |
|
| 150 | + public function cssId() |
|
| 151 | + { |
|
| 152 | + return apply_filters( |
|
| 153 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 154 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 155 | + ); |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * @param float $ticket_price |
|
| 161 | + * @param int $remaining |
|
| 162 | + * @param int $cols |
|
| 163 | + * @return string |
|
| 164 | + */ |
|
| 165 | + public function display( |
|
| 166 | + $ticket_price = 0.00, |
|
| 167 | + $remaining, |
|
| 168 | + $cols = 2 |
|
| 169 | + ) { |
|
| 170 | + $template_args = array(); |
|
| 171 | + $template_args['ticket'] = $this->ticket; |
|
| 172 | + $template_args['ticket_price'] = $ticket_price; |
|
| 173 | + $template_args['remaining'] = $remaining; |
|
| 174 | + $template_args['cols'] = $cols; |
|
| 175 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 176 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 177 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 178 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 179 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
| 180 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 181 | + true |
|
| 182 | + ); |
|
| 183 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
| 184 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 185 | + esc_html__('Price', 'event_espresso') |
|
| 186 | + ); |
|
| 187 | + $template_args['date_format'] = $this->date_format; |
|
| 188 | + $template_args['time_format'] = $this->time_format; |
|
| 189 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 190 | + |
|
| 191 | + return \EEH_Template::locate_template( |
|
| 192 | + apply_filters( |
|
| 193 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 194 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 195 | + $this->ticket |
|
| 196 | + ), |
|
| 197 | + $template_args |
|
| 198 | + ); |
|
| 199 | + } |
|
| 200 | 200 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getShowHideLinks() |
| 113 | 113 | { |
| 114 | - if (! $this->showTicketDetails()) { |
|
| 114 | + if ( ! $this->showTicketDetails()) { |
|
| 115 | 115 | return ''; |
| 116 | 116 | } |
| 117 | 117 | return \EEH_HTML::link( |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | "display-{$this->cssId()}", |
| 127 | 127 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
| 128 | 128 | '', |
| 129 | - 'rel="' . $this->cssId() . '"' |
|
| 130 | - ) . \EEH_HTML::link( |
|
| 129 | + 'rel="'.$this->cssId().'"' |
|
| 130 | + ).\EEH_HTML::link( |
|
| 131 | 131 | '', |
| 132 | 132 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
| 133 | 133 | esc_attr( |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | "hide-{$this->cssId()}", |
| 140 | 140 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
| 141 | 141 | 'display:none;', |
| 142 | - 'rel="' . $this->cssId() . '"' |
|
| 142 | + 'rel="'.$this->cssId().'"' |
|
| 143 | 143 | ); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return \EEH_Template::locate_template( |
| 192 | 192 | apply_filters( |
| 193 | 193 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
| 194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 194 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
| 195 | 195 | $this->ticket |
| 196 | 196 | ), |
| 197 | 197 | $template_args |
@@ -19,57 +19,57 @@ |
||
| 19 | 19 | class TicketSelectorSimple extends TicketSelector |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var EE_Ticket $ticket |
|
| 24 | - */ |
|
| 25 | - protected $ticket; |
|
| 22 | + /** |
|
| 23 | + * @var EE_Ticket $ticket |
|
| 24 | + */ |
|
| 25 | + protected $ticket; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * TicketSelectorSimple constructor. |
|
| 30 | - * |
|
| 31 | - * @param EE_Event $event |
|
| 32 | - * @param EE_Ticket $ticket |
|
| 33 | - * @param int $max_attendees |
|
| 34 | - * @param array $template_args |
|
| 35 | - * @throws EE_Error |
|
| 36 | - */ |
|
| 37 | - public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args) |
|
| 38 | - { |
|
| 39 | - $this->ticket = $ticket; |
|
| 40 | - parent::__construct( |
|
| 41 | - $event, |
|
| 42 | - array($this->ticket), |
|
| 43 | - $max_attendees, |
|
| 44 | - $template_args |
|
| 45 | - ); |
|
| 46 | - } |
|
| 28 | + /** |
|
| 29 | + * TicketSelectorSimple constructor. |
|
| 30 | + * |
|
| 31 | + * @param EE_Event $event |
|
| 32 | + * @param EE_Ticket $ticket |
|
| 33 | + * @param int $max_attendees |
|
| 34 | + * @param array $template_args |
|
| 35 | + * @throws EE_Error |
|
| 36 | + */ |
|
| 37 | + public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args) |
|
| 38 | + { |
|
| 39 | + $this->ticket = $ticket; |
|
| 40 | + parent::__construct( |
|
| 41 | + $event, |
|
| 42 | + array($this->ticket), |
|
| 43 | + $max_attendees, |
|
| 44 | + $template_args |
|
| 45 | + ); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * sets any and all template args that are required for this Ticket Selector |
|
| 51 | - * |
|
| 52 | - * @return void |
|
| 53 | - * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
| 54 | - * @throws EE_Error |
|
| 55 | - */ |
|
| 56 | - protected function addTemplateArgs() |
|
| 57 | - { |
|
| 58 | - unset($this->template_args['tickets']); |
|
| 59 | - $this->template_args['ticket'] = $this->ticket; |
|
| 60 | - $ticket_selector_row = new TicketSelectorRowSimple( |
|
| 61 | - $this->ticket, |
|
| 62 | - $this->max_attendees, |
|
| 63 | - $this->template_args['date_format'], |
|
| 64 | - $this->template_args['event_status'] |
|
| 65 | - ); |
|
| 66 | - $this->template_args['TKT_ID'] = $this->ticket->ID(); |
|
| 67 | - $ticket_selector_row->setupTicketStatusDisplay(); |
|
| 68 | - $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
| 69 | - if (empty($this->template_args['ticket_status_display'])) { |
|
| 70 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 71 | - } |
|
| 72 | - $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
|
| 73 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 74 | - } |
|
| 49 | + /** |
|
| 50 | + * sets any and all template args that are required for this Ticket Selector |
|
| 51 | + * |
|
| 52 | + * @return void |
|
| 53 | + * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
| 54 | + * @throws EE_Error |
|
| 55 | + */ |
|
| 56 | + protected function addTemplateArgs() |
|
| 57 | + { |
|
| 58 | + unset($this->template_args['tickets']); |
|
| 59 | + $this->template_args['ticket'] = $this->ticket; |
|
| 60 | + $ticket_selector_row = new TicketSelectorRowSimple( |
|
| 61 | + $this->ticket, |
|
| 62 | + $this->max_attendees, |
|
| 63 | + $this->template_args['date_format'], |
|
| 64 | + $this->template_args['event_status'] |
|
| 65 | + ); |
|
| 66 | + $this->template_args['TKT_ID'] = $this->ticket->ID(); |
|
| 67 | + $ticket_selector_row->setupTicketStatusDisplay(); |
|
| 68 | + $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
| 69 | + if (empty($this->template_args['ticket_status_display'])) { |
|
| 70 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 71 | + } |
|
| 72 | + $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
|
| 73 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -70,6 +70,6 @@ |
||
| 70 | 70 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 71 | 71 | } |
| 72 | 72 | $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
| 73 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 73 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php'; |
|
| 74 | 74 | } |
| 75 | 75 | } |
@@ -15,55 +15,55 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * EventsArchiveIframe constructor. |
|
| 20 | - * |
|
| 21 | - * @param \EED_Events_Archive $EED_Events_Archive |
|
| 22 | - * @throws \DomainException |
|
| 23 | - */ |
|
| 24 | - public function __construct($EED_Events_Archive) |
|
| 25 | - { |
|
| 26 | - \EE_Registry::instance()->REQ->set_espresso_page(true); |
|
| 27 | - add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true'); |
|
| 28 | - $EED_Events_Archive->event_list(); |
|
| 29 | - /** @var \EventEspresso\core\domain\entities\shortcodes\EspressoEvents $event_list */ |
|
| 30 | - $event_list = \EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents'); |
|
| 31 | - parent::__construct( |
|
| 32 | - esc_html__('Event List', 'event_espresso'), |
|
| 33 | - $event_list->processShortcode() |
|
| 34 | - ); |
|
| 35 | - $this->addStylesheets( |
|
| 36 | - apply_filters( |
|
| 37 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
| 38 | - array( |
|
| 39 | - 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
| 40 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
| 41 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
| 42 | - ), |
|
| 43 | - $this |
|
| 44 | - ) |
|
| 45 | - ); |
|
| 46 | - $this->addScripts( |
|
| 47 | - apply_filters( |
|
| 48 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
| 49 | - array( |
|
| 50 | - 'gmap_api' => sprintf( |
|
| 51 | - 'https://maps.googleapis.com/maps/api/js?key=%s', |
|
| 52 | - apply_filters( |
|
| 53 | - 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
| 54 | - \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
| 55 | - ) |
|
| 56 | - ), |
|
| 57 | - 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
| 58 | - ), |
|
| 59 | - $this |
|
| 60 | - ) |
|
| 61 | - ); |
|
| 62 | - $this->addLocalizedVars( |
|
| 63 | - array( |
|
| 64 | - 'ee_gmap' => \EEH_Maps::$gmap_vars, |
|
| 65 | - ), |
|
| 66 | - 'ee_gmap_vars' |
|
| 67 | - ); |
|
| 68 | - } |
|
| 18 | + /** |
|
| 19 | + * EventsArchiveIframe constructor. |
|
| 20 | + * |
|
| 21 | + * @param \EED_Events_Archive $EED_Events_Archive |
|
| 22 | + * @throws \DomainException |
|
| 23 | + */ |
|
| 24 | + public function __construct($EED_Events_Archive) |
|
| 25 | + { |
|
| 26 | + \EE_Registry::instance()->REQ->set_espresso_page(true); |
|
| 27 | + add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true'); |
|
| 28 | + $EED_Events_Archive->event_list(); |
|
| 29 | + /** @var \EventEspresso\core\domain\entities\shortcodes\EspressoEvents $event_list */ |
|
| 30 | + $event_list = \EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents'); |
|
| 31 | + parent::__construct( |
|
| 32 | + esc_html__('Event List', 'event_espresso'), |
|
| 33 | + $event_list->processShortcode() |
|
| 34 | + ); |
|
| 35 | + $this->addStylesheets( |
|
| 36 | + apply_filters( |
|
| 37 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
| 38 | + array( |
|
| 39 | + 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
| 40 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
| 41 | + : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
| 42 | + ), |
|
| 43 | + $this |
|
| 44 | + ) |
|
| 45 | + ); |
|
| 46 | + $this->addScripts( |
|
| 47 | + apply_filters( |
|
| 48 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
| 49 | + array( |
|
| 50 | + 'gmap_api' => sprintf( |
|
| 51 | + 'https://maps.googleapis.com/maps/api/js?key=%s', |
|
| 52 | + apply_filters( |
|
| 53 | + 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
| 54 | + \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
| 55 | + ) |
|
| 56 | + ), |
|
| 57 | + 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
| 58 | + ), |
|
| 59 | + $this |
|
| 60 | + ) |
|
| 61 | + ); |
|
| 62 | + $this->addLocalizedVars( |
|
| 63 | + array( |
|
| 64 | + 'ee_gmap' => \EEH_Maps::$gmap_vars, |
|
| 65 | + ), |
|
| 66 | + 'ee_gmap_vars' |
|
| 67 | + ); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | apply_filters( |
| 37 | 37 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
| 38 | 38 | array( |
| 39 | - 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
| 40 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
| 41 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
| 39 | + 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css') |
|
| 40 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
| 41 | + : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION, |
|
| 42 | 42 | ), |
| 43 | 43 | $this |
| 44 | 44 | ) |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
| 55 | 55 | ) |
| 56 | 56 | ), |
| 57 | - 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
| 57 | + 'ee_gmap' => EE_HELPERS_ASSETS.'ee_gmap.js?ver=1.0', |
|
| 58 | 58 | ), |
| 59 | 59 | $this |
| 60 | 60 | ) |
@@ -19,35 +19,35 @@ |
||
| 19 | 19 | class RecaptchaFactory implements FactoryInterface |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @param array $arguments |
|
| 24 | - * @return InvisibleRecaptcha |
|
| 25 | - * @throws InvalidDataTypeException |
|
| 26 | - * @throws InvalidInterfaceException |
|
| 27 | - * @throws InvalidArgumentException |
|
| 28 | - */ |
|
| 29 | - public static function create($arguments = array()) |
|
| 30 | - { |
|
| 31 | - return LoaderFactory::getLoader()->getShared( |
|
| 32 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha', |
|
| 33 | - $arguments |
|
| 34 | - ); |
|
| 35 | - } |
|
| 22 | + /** |
|
| 23 | + * @param array $arguments |
|
| 24 | + * @return InvisibleRecaptcha |
|
| 25 | + * @throws InvalidDataTypeException |
|
| 26 | + * @throws InvalidInterfaceException |
|
| 27 | + * @throws InvalidArgumentException |
|
| 28 | + */ |
|
| 29 | + public static function create($arguments = array()) |
|
| 30 | + { |
|
| 31 | + return LoaderFactory::getLoader()->getShared( |
|
| 32 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha', |
|
| 33 | + $arguments |
|
| 34 | + ); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param array $arguments |
|
| 41 | - * @return RecaptchaAdminSettings |
|
| 42 | - * @throws InvalidDataTypeException |
|
| 43 | - * @throws InvalidInterfaceException |
|
| 44 | - * @throws InvalidArgumentException |
|
| 45 | - */ |
|
| 46 | - public static function getAdminModule($arguments = array()) |
|
| 47 | - { |
|
| 48 | - return LoaderFactory::getLoader()->getShared( |
|
| 49 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings', |
|
| 50 | - $arguments |
|
| 51 | - ); |
|
| 52 | - } |
|
| 39 | + /** |
|
| 40 | + * @param array $arguments |
|
| 41 | + * @return RecaptchaAdminSettings |
|
| 42 | + * @throws InvalidDataTypeException |
|
| 43 | + * @throws InvalidInterfaceException |
|
| 44 | + * @throws InvalidArgumentException |
|
| 45 | + */ |
|
| 46 | + public static function getAdminModule($arguments = array()) |
|
| 47 | + { |
|
| 48 | + return LoaderFactory::getLoader()->getShared( |
|
| 49 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings', |
|
| 50 | + $arguments |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -33,87 +33,87 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class SocketPost implements RequestMethod |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * reCAPTCHA service host. |
|
| 38 | - * |
|
| 39 | - * @const string |
|
| 40 | - */ |
|
| 41 | - const RECAPTCHA_HOST = 'www.google.com'; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @const string reCAPTCHA service path |
|
| 45 | - */ |
|
| 46 | - const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @const string Bad request error |
|
| 50 | - */ |
|
| 51 | - const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @const string Bad response error |
|
| 55 | - */ |
|
| 56 | - const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Socket to the reCAPTCHA service |
|
| 60 | - * |
|
| 61 | - * @var Socket |
|
| 62 | - */ |
|
| 63 | - private $socket; |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Constructor |
|
| 67 | - * |
|
| 68 | - * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
|
| 69 | - */ |
|
| 70 | - public function __construct(Socket $socket = null) |
|
| 71 | - { |
|
| 72 | - if (! is_null($socket)) { |
|
| 73 | - $this->socket = $socket; |
|
| 74 | - } else { |
|
| 75 | - $this->socket = new Socket(); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Submit the POST request with the specified parameters. |
|
| 81 | - * |
|
| 82 | - * @param RequestParameters $params Request parameters |
|
| 83 | - * @return string Body of the reCAPTCHA response |
|
| 84 | - */ |
|
| 85 | - public function submit(RequestParameters $params) |
|
| 86 | - { |
|
| 87 | - $errno = 0; |
|
| 88 | - $errstr = ''; |
|
| 89 | - |
|
| 90 | - if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 91 | - $content = $params->toQueryString(); |
|
| 92 | - |
|
| 93 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
| 94 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
| 95 | - $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
| 96 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
| 97 | - $request .= "Connection: close\r\n\r\n"; |
|
| 98 | - $request .= $content . "\r\n\r\n"; |
|
| 99 | - |
|
| 100 | - $this->socket->fwrite($request); |
|
| 101 | - $response = ''; |
|
| 102 | - |
|
| 103 | - while (! $this->socket->feof()) { |
|
| 104 | - $response .= $this->socket->fgets(4096); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $this->socket->fclose(); |
|
| 108 | - |
|
| 109 | - if (0 === strpos($response, 'HTTP/1.1 200 OK')) { |
|
| 110 | - $parts = preg_split("#\n\s*\n#Uis", $response); |
|
| 111 | - return $parts[1]; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - return self::BAD_RESPONSE; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - return self::BAD_REQUEST; |
|
| 118 | - } |
|
| 36 | + /** |
|
| 37 | + * reCAPTCHA service host. |
|
| 38 | + * |
|
| 39 | + * @const string |
|
| 40 | + */ |
|
| 41 | + const RECAPTCHA_HOST = 'www.google.com'; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @const string reCAPTCHA service path |
|
| 45 | + */ |
|
| 46 | + const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @const string Bad request error |
|
| 50 | + */ |
|
| 51 | + const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @const string Bad response error |
|
| 55 | + */ |
|
| 56 | + const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Socket to the reCAPTCHA service |
|
| 60 | + * |
|
| 61 | + * @var Socket |
|
| 62 | + */ |
|
| 63 | + private $socket; |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Constructor |
|
| 67 | + * |
|
| 68 | + * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
|
| 69 | + */ |
|
| 70 | + public function __construct(Socket $socket = null) |
|
| 71 | + { |
|
| 72 | + if (! is_null($socket)) { |
|
| 73 | + $this->socket = $socket; |
|
| 74 | + } else { |
|
| 75 | + $this->socket = new Socket(); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Submit the POST request with the specified parameters. |
|
| 81 | + * |
|
| 82 | + * @param RequestParameters $params Request parameters |
|
| 83 | + * @return string Body of the reCAPTCHA response |
|
| 84 | + */ |
|
| 85 | + public function submit(RequestParameters $params) |
|
| 86 | + { |
|
| 87 | + $errno = 0; |
|
| 88 | + $errstr = ''; |
|
| 89 | + |
|
| 90 | + if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 91 | + $content = $params->toQueryString(); |
|
| 92 | + |
|
| 93 | + $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
| 94 | + $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
| 95 | + $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
| 96 | + $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
| 97 | + $request .= "Connection: close\r\n\r\n"; |
|
| 98 | + $request .= $content . "\r\n\r\n"; |
|
| 99 | + |
|
| 100 | + $this->socket->fwrite($request); |
|
| 101 | + $response = ''; |
|
| 102 | + |
|
| 103 | + while (! $this->socket->feof()) { |
|
| 104 | + $response .= $this->socket->fgets(4096); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $this->socket->fclose(); |
|
| 108 | + |
|
| 109 | + if (0 === strpos($response, 'HTTP/1.1 200 OK')) { |
|
| 110 | + $parts = preg_split("#\n\s*\n#Uis", $response); |
|
| 111 | + return $parts[1]; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + return self::BAD_RESPONSE; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + return self::BAD_REQUEST; |
|
| 118 | + } |
|
| 119 | 119 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __construct(Socket $socket = null) |
| 71 | 71 | { |
| 72 | - if (! is_null($socket)) { |
|
| 72 | + if ( ! is_null($socket)) { |
|
| 73 | 73 | $this->socket = $socket; |
| 74 | 74 | } else { |
| 75 | 75 | $this->socket = new Socket(); |
@@ -87,20 +87,20 @@ discard block |
||
| 87 | 87 | $errno = 0; |
| 88 | 88 | $errstr = ''; |
| 89 | 89 | |
| 90 | - if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 90 | + if ($this->socket->fsockopen('ssl://'.self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 91 | 91 | $content = $params->toQueryString(); |
| 92 | 92 | |
| 93 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
| 94 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
| 93 | + $request = "POST ".self::SITE_VERIFY_PATH." HTTP/1.1\r\n"; |
|
| 94 | + $request .= "Host: ".self::RECAPTCHA_HOST."\r\n"; |
|
| 95 | 95 | $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
| 96 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
| 96 | + $request .= "Content-length: ".strlen($content)."\r\n"; |
|
| 97 | 97 | $request .= "Connection: close\r\n\r\n"; |
| 98 | - $request .= $content . "\r\n\r\n"; |
|
| 98 | + $request .= $content."\r\n\r\n"; |
|
| 99 | 99 | |
| 100 | 100 | $this->socket->fwrite($request); |
| 101 | 101 | $response = ''; |
| 102 | 102 | |
| 103 | - while (! $this->socket->feof()) { |
|
| 103 | + while ( ! $this->socket->feof()) { |
|
| 104 | 104 | $response .= $this->socket->fgets(4096); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -29,79 +29,79 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Socket |
| 31 | 31 | { |
| 32 | - private $handle = null; |
|
| 32 | + private $handle = null; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * fsockopen |
|
| 36 | - * |
|
| 37 | - * @see http://php.net/fsockopen |
|
| 38 | - * @param string $hostname |
|
| 39 | - * @param int $port |
|
| 40 | - * @param int $errno |
|
| 41 | - * @param string $errstr |
|
| 42 | - * @param float $timeout |
|
| 43 | - * @return resource |
|
| 44 | - */ |
|
| 45 | - public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) |
|
| 46 | - { |
|
| 47 | - $this->handle = fsockopen( |
|
| 48 | - $hostname, |
|
| 49 | - $port, |
|
| 50 | - $errno, |
|
| 51 | - $errstr, |
|
| 52 | - (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout) |
|
| 53 | - ); |
|
| 34 | + /** |
|
| 35 | + * fsockopen |
|
| 36 | + * |
|
| 37 | + * @see http://php.net/fsockopen |
|
| 38 | + * @param string $hostname |
|
| 39 | + * @param int $port |
|
| 40 | + * @param int $errno |
|
| 41 | + * @param string $errstr |
|
| 42 | + * @param float $timeout |
|
| 43 | + * @return resource |
|
| 44 | + */ |
|
| 45 | + public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) |
|
| 46 | + { |
|
| 47 | + $this->handle = fsockopen( |
|
| 48 | + $hostname, |
|
| 49 | + $port, |
|
| 50 | + $errno, |
|
| 51 | + $errstr, |
|
| 52 | + (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout) |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - if ($this->handle != false && $errno === 0 && $errstr === '') { |
|
| 56 | - return $this->handle; |
|
| 57 | - } else { |
|
| 58 | - return false; |
|
| 59 | - } |
|
| 60 | - } |
|
| 55 | + if ($this->handle != false && $errno === 0 && $errstr === '') { |
|
| 56 | + return $this->handle; |
|
| 57 | + } else { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * fwrite |
|
| 64 | - * |
|
| 65 | - * @see http://php.net/fwrite |
|
| 66 | - * @param string $string |
|
| 67 | - * @param int $length |
|
| 68 | - * @return int | bool |
|
| 69 | - */ |
|
| 70 | - public function fwrite($string, $length = null) |
|
| 71 | - { |
|
| 72 | - return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length)); |
|
| 73 | - } |
|
| 62 | + /** |
|
| 63 | + * fwrite |
|
| 64 | + * |
|
| 65 | + * @see http://php.net/fwrite |
|
| 66 | + * @param string $string |
|
| 67 | + * @param int $length |
|
| 68 | + * @return int | bool |
|
| 69 | + */ |
|
| 70 | + public function fwrite($string, $length = null) |
|
| 71 | + { |
|
| 72 | + return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length)); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * fgets |
|
| 77 | - * |
|
| 78 | - * @see http://php.net/fgets |
|
| 79 | - * @param int $length |
|
| 80 | - */ |
|
| 81 | - public function fgets($length = null) |
|
| 82 | - { |
|
| 83 | - return fgets($this->handle, $length); |
|
| 84 | - } |
|
| 75 | + /** |
|
| 76 | + * fgets |
|
| 77 | + * |
|
| 78 | + * @see http://php.net/fgets |
|
| 79 | + * @param int $length |
|
| 80 | + */ |
|
| 81 | + public function fgets($length = null) |
|
| 82 | + { |
|
| 83 | + return fgets($this->handle, $length); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * feof |
|
| 88 | - * |
|
| 89 | - * @see http://php.net/feof |
|
| 90 | - * @return bool |
|
| 91 | - */ |
|
| 92 | - public function feof() |
|
| 93 | - { |
|
| 94 | - return feof($this->handle); |
|
| 95 | - } |
|
| 86 | + /** |
|
| 87 | + * feof |
|
| 88 | + * |
|
| 89 | + * @see http://php.net/feof |
|
| 90 | + * @return bool |
|
| 91 | + */ |
|
| 92 | + public function feof() |
|
| 93 | + { |
|
| 94 | + return feof($this->handle); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * fclose |
|
| 99 | - * |
|
| 100 | - * @see http://php.net/fclose |
|
| 101 | - * @return bool |
|
| 102 | - */ |
|
| 103 | - public function fclose() |
|
| 104 | - { |
|
| 105 | - return fclose($this->handle); |
|
| 106 | - } |
|
| 97 | + /** |
|
| 98 | + * fclose |
|
| 99 | + * |
|
| 100 | + * @see http://php.net/fclose |
|
| 101 | + * @return bool |
|
| 102 | + */ |
|
| 103 | + public function fclose() |
|
| 104 | + { |
|
| 105 | + return fclose($this->handle); |
|
| 106 | + } |
|
| 107 | 107 | } |