@@ -13,28 +13,28 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * @param string $name |
|
18 | - * @param array $widget_options |
|
19 | - * @param array $control_options |
|
20 | - */ |
|
21 | - public function __construct($name = '', array $widget_options = array(), array $control_options = array()) |
|
22 | - { |
|
23 | - $id_base = EspressoWidget::getIdBase(get_class($this)); |
|
24 | - $control_options['id_base'] = $id_base; |
|
25 | - $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300; |
|
26 | - $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350; |
|
27 | - // Register widget with WordPress |
|
28 | - parent::__construct($id_base, $name, $widget_options, $control_options); |
|
29 | - } |
|
16 | + /** |
|
17 | + * @param string $name |
|
18 | + * @param array $widget_options |
|
19 | + * @param array $control_options |
|
20 | + */ |
|
21 | + public function __construct($name = '', array $widget_options = array(), array $control_options = array()) |
|
22 | + { |
|
23 | + $id_base = EspressoWidget::getIdBase(get_class($this)); |
|
24 | + $control_options['id_base'] = $id_base; |
|
25 | + $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300; |
|
26 | + $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350; |
|
27 | + // Register widget with WordPress |
|
28 | + parent::__construct($id_base, $name, $widget_options, $control_options); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @param string $widget_class |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public static function getIdBase($widget_class) |
|
37 | - { |
|
38 | - return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget'; |
|
39 | - } |
|
32 | + /** |
|
33 | + * @param string $widget_class |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public static function getIdBase($widget_class) |
|
37 | + { |
|
38 | + return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget'; |
|
39 | + } |
|
40 | 40 | } |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | public static function getIdBase($widget_class) |
37 | 37 | { |
38 | - return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget'; |
|
38 | + return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)).'-widget'; |
|
39 | 39 | } |
40 | 40 | } |
@@ -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 | } |
@@ -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( |
@@ -19,77 +19,77 @@ |
||
19 | 19 | */ |
20 | 20 | class TicketSelectorIframe extends Iframe |
21 | 21 | { |
22 | - /** |
|
23 | - * TicketSelectorIframe constructor. |
|
24 | - * |
|
25 | - * @param EEM_Event $event_model |
|
26 | - * @param CurrentPage $current_page |
|
27 | - * @param RequestInterface $request |
|
28 | - * @throws EE_Error |
|
29 | - */ |
|
30 | - public function __construct(EEM_Event $event_model, CurrentPage $current_page, RequestInterface $request) |
|
31 | - { |
|
32 | - $current_page->setEspressoPage(true); |
|
33 | - $ticket_selector = LoaderFactory::getLoader()->getNew(DisplayTicketSelector::class); |
|
34 | - $ticket_selector->setIframe(); |
|
35 | - $event = $event_model->get_one_by_ID($request->getRequestParam('event', 0, 'int')); |
|
36 | - parent::__construct( |
|
37 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
38 | - $ticket_selector->display($event) |
|
39 | - ); |
|
40 | - $this->addStylesheets( |
|
41 | - apply_filters( |
|
42 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
43 | - array( |
|
44 | - 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
45 | - . 'ticket_selector_embed.css?ver=' |
|
46 | - . EVENT_ESPRESSO_VERSION, |
|
47 | - 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
48 | - . 'ticket_selector.css?ver=' |
|
49 | - . EVENT_ESPRESSO_VERSION, |
|
50 | - ), |
|
51 | - $this |
|
52 | - ) |
|
53 | - ); |
|
54 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
55 | - $this->addStylesheets(array('site_theme' => '')); |
|
56 | - } |
|
57 | - $this->addScripts( |
|
58 | - apply_filters( |
|
59 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
60 | - array( |
|
61 | - 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
62 | - . 'ticket_selector_iframe_embed.js?ver=' |
|
63 | - . EVENT_ESPRESSO_VERSION, |
|
64 | - ), |
|
65 | - $this |
|
66 | - ) |
|
67 | - ); |
|
68 | - $js_attributes = apply_filters( |
|
69 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
70 | - array(), |
|
71 | - $this |
|
72 | - ); |
|
73 | - if (! empty($js_attributes)) { |
|
74 | - $this->addScriptAttributes($js_attributes); |
|
75 | - } |
|
76 | - $this->addLocalizedVars( |
|
77 | - apply_filters( |
|
78 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
79 | - array( |
|
80 | - 'ticket_selector_iframe' => true, |
|
81 | - 'EEDTicketSelectorMsg' => wp_strip_all_tags( |
|
82 | - __( |
|
83 | - 'Please choose at least one ticket before continuing.', |
|
84 | - 'event_espresso' |
|
85 | - ) |
|
86 | - ), |
|
87 | - ) |
|
88 | - ) |
|
89 | - ); |
|
90 | - do_action( |
|
91 | - 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
92 | - $this |
|
93 | - ); |
|
94 | - } |
|
22 | + /** |
|
23 | + * TicketSelectorIframe constructor. |
|
24 | + * |
|
25 | + * @param EEM_Event $event_model |
|
26 | + * @param CurrentPage $current_page |
|
27 | + * @param RequestInterface $request |
|
28 | + * @throws EE_Error |
|
29 | + */ |
|
30 | + public function __construct(EEM_Event $event_model, CurrentPage $current_page, RequestInterface $request) |
|
31 | + { |
|
32 | + $current_page->setEspressoPage(true); |
|
33 | + $ticket_selector = LoaderFactory::getLoader()->getNew(DisplayTicketSelector::class); |
|
34 | + $ticket_selector->setIframe(); |
|
35 | + $event = $event_model->get_one_by_ID($request->getRequestParam('event', 0, 'int')); |
|
36 | + parent::__construct( |
|
37 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
38 | + $ticket_selector->display($event) |
|
39 | + ); |
|
40 | + $this->addStylesheets( |
|
41 | + apply_filters( |
|
42 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
43 | + array( |
|
44 | + 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
45 | + . 'ticket_selector_embed.css?ver=' |
|
46 | + . EVENT_ESPRESSO_VERSION, |
|
47 | + 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
48 | + . 'ticket_selector.css?ver=' |
|
49 | + . EVENT_ESPRESSO_VERSION, |
|
50 | + ), |
|
51 | + $this |
|
52 | + ) |
|
53 | + ); |
|
54 | + if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
55 | + $this->addStylesheets(array('site_theme' => '')); |
|
56 | + } |
|
57 | + $this->addScripts( |
|
58 | + apply_filters( |
|
59 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
60 | + array( |
|
61 | + 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
62 | + . 'ticket_selector_iframe_embed.js?ver=' |
|
63 | + . EVENT_ESPRESSO_VERSION, |
|
64 | + ), |
|
65 | + $this |
|
66 | + ) |
|
67 | + ); |
|
68 | + $js_attributes = apply_filters( |
|
69 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
70 | + array(), |
|
71 | + $this |
|
72 | + ); |
|
73 | + if (! empty($js_attributes)) { |
|
74 | + $this->addScriptAttributes($js_attributes); |
|
75 | + } |
|
76 | + $this->addLocalizedVars( |
|
77 | + apply_filters( |
|
78 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
79 | + array( |
|
80 | + 'ticket_selector_iframe' => true, |
|
81 | + 'EEDTicketSelectorMsg' => wp_strip_all_tags( |
|
82 | + __( |
|
83 | + 'Please choose at least one ticket before continuing.', |
|
84 | + 'event_espresso' |
|
85 | + ) |
|
86 | + ), |
|
87 | + ) |
|
88 | + ) |
|
89 | + ); |
|
90 | + do_action( |
|
91 | + 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
92 | + $this |
|
93 | + ); |
|
94 | + } |
|
95 | 95 | } |
@@ -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 | } |
@@ -15,66 +15,66 @@ |
||
15 | 15 | class IpnException extends \LogicException |
16 | 16 | { |
17 | 17 | |
18 | - const DUPLICATE = 1; |
|
18 | + const DUPLICATE = 1; |
|
19 | 19 | |
20 | - const UNABLE_TO_VALIDATE = 2; |
|
20 | + const UNABLE_TO_VALIDATE = 2; |
|
21 | 21 | |
22 | - const UNSUPPORTED = 3; |
|
22 | + const UNSUPPORTED = 3; |
|
23 | 23 | |
24 | - /** |
|
25 | - * @var \EE_Payment |
|
26 | - */ |
|
27 | - protected $payment; |
|
24 | + /** |
|
25 | + * @var \EE_Payment |
|
26 | + */ |
|
27 | + protected $payment; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @var mixed IPN data, usually an array or object |
|
31 | - */ |
|
32 | - protected $ipn_data; |
|
29 | + /** |
|
30 | + * @var mixed IPN data, usually an array or object |
|
31 | + */ |
|
32 | + protected $ipn_data; |
|
33 | 33 | |
34 | 34 | |
35 | - public function __construct( |
|
36 | - $message, |
|
37 | - $code = 0, |
|
38 | - \Exception $previous = null, |
|
39 | - \EE_Payment $payment = null, |
|
40 | - $ipn_data = array() |
|
41 | - ) { |
|
42 | - parent::__construct($message, $code, $previous); |
|
43 | - $this->payment = $payment; |
|
44 | - $this->ipn_data = $ipn_data; |
|
45 | - } |
|
35 | + public function __construct( |
|
36 | + $message, |
|
37 | + $code = 0, |
|
38 | + \Exception $previous = null, |
|
39 | + \EE_Payment $payment = null, |
|
40 | + $ipn_data = array() |
|
41 | + ) { |
|
42 | + parent::__construct($message, $code, $previous); |
|
43 | + $this->payment = $payment; |
|
44 | + $this->ipn_data = $ipn_data; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Gets the payment associated with this IPN, if known |
|
50 | - * |
|
51 | - * @return \EE_Payment |
|
52 | - */ |
|
53 | - public function getPayment() |
|
54 | - { |
|
55 | - return $this->payment; |
|
56 | - } |
|
48 | + /** |
|
49 | + * Gets the payment associated with this IPN, if known |
|
50 | + * |
|
51 | + * @return \EE_Payment |
|
52 | + */ |
|
53 | + public function getPayment() |
|
54 | + { |
|
55 | + return $this->payment; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array) |
|
61 | - * |
|
62 | - * @return array |
|
63 | - * @throws \EE_Error |
|
64 | - */ |
|
65 | - public function getPaymentProperties() |
|
66 | - { |
|
67 | - return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array(); |
|
68 | - } |
|
59 | + /** |
|
60 | + * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array) |
|
61 | + * |
|
62 | + * @return array |
|
63 | + * @throws \EE_Error |
|
64 | + */ |
|
65 | + public function getPaymentProperties() |
|
66 | + { |
|
67 | + return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array(); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * Returns an array, object, or string, however, the IPN data was received |
|
73 | - * |
|
74 | - * @return mixed |
|
75 | - */ |
|
76 | - public function getIpnData() |
|
77 | - { |
|
78 | - return $this->ipn_data; |
|
79 | - } |
|
71 | + /** |
|
72 | + * Returns an array, object, or string, however, the IPN data was received |
|
73 | + * |
|
74 | + * @return mixed |
|
75 | + */ |
|
76 | + public function getIpnData() |
|
77 | + { |
|
78 | + return $this->ipn_data; |
|
79 | + } |
|
80 | 80 | } |
@@ -12,18 +12,18 @@ |
||
12 | 12 | class InvalidSessionDataException extends \Exception |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * InvalidInterfaceException constructor. |
|
17 | - * |
|
18 | - * @param string $message |
|
19 | - * @param int $code |
|
20 | - * @param \Exception $previous |
|
21 | - */ |
|
22 | - public function __construct($message = '', $code = 0, \Exception $previous = null) |
|
23 | - { |
|
24 | - if (empty($message)) { |
|
25 | - $message = esc_html__('The session data is either missing or invalid.', 'event_espresso'); |
|
26 | - } |
|
27 | - parent::__construct($message, $code, $previous); |
|
28 | - } |
|
15 | + /** |
|
16 | + * InvalidInterfaceException constructor. |
|
17 | + * |
|
18 | + * @param string $message |
|
19 | + * @param int $code |
|
20 | + * @param \Exception $previous |
|
21 | + */ |
|
22 | + public function __construct($message = '', $code = 0, \Exception $previous = null) |
|
23 | + { |
|
24 | + if (empty($message)) { |
|
25 | + $message = esc_html__('The session data is either missing or invalid.', 'event_espresso'); |
|
26 | + } |
|
27 | + parent::__construct($message, $code, $previous); |
|
28 | + } |
|
29 | 29 | } |
@@ -14,39 +14,39 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * ExceptionLogger constructor. |
|
19 | - * |
|
20 | - * @param \Exception $exception |
|
21 | - */ |
|
22 | - public function __construct(\Exception $exception) |
|
23 | - { |
|
24 | - $this->log($exception); |
|
25 | - } |
|
17 | + /** |
|
18 | + * ExceptionLogger constructor. |
|
19 | + * |
|
20 | + * @param \Exception $exception |
|
21 | + */ |
|
22 | + public function __construct(\Exception $exception) |
|
23 | + { |
|
24 | + $this->log($exception); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * write exception details to log file |
|
30 | - * |
|
31 | - * @param \Exception $exception |
|
32 | - * @param int $time |
|
33 | - */ |
|
34 | - public function log(\Exception $exception, $time = 0) |
|
35 | - { |
|
36 | - if (! $time) { |
|
37 | - $time = time(); |
|
38 | - } |
|
39 | - $exception_log = '----------------------------------------------------------------------------------------'; |
|
40 | - $exception_log .= PHP_EOL; |
|
41 | - $exception_log .= '[' . date('Y-m-d H:i:s', $time) . '] Exception Details' . PHP_EOL; |
|
42 | - $exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL; |
|
43 | - $exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL; |
|
44 | - $exception_log .= 'File: ' . $exception->getFile() . PHP_EOL; |
|
45 | - $exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL; |
|
46 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
47 | - $exception_log .= $exception->getTraceAsString() . PHP_EOL; |
|
48 | - $exception_log .= '----------------------------------------------------------------------------------------'; |
|
49 | - $exception_log .= PHP_EOL; |
|
50 | - error_log($exception_log); |
|
51 | - } |
|
28 | + /** |
|
29 | + * write exception details to log file |
|
30 | + * |
|
31 | + * @param \Exception $exception |
|
32 | + * @param int $time |
|
33 | + */ |
|
34 | + public function log(\Exception $exception, $time = 0) |
|
35 | + { |
|
36 | + if (! $time) { |
|
37 | + $time = time(); |
|
38 | + } |
|
39 | + $exception_log = '----------------------------------------------------------------------------------------'; |
|
40 | + $exception_log .= PHP_EOL; |
|
41 | + $exception_log .= '[' . date('Y-m-d H:i:s', $time) . '] Exception Details' . PHP_EOL; |
|
42 | + $exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL; |
|
43 | + $exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL; |
|
44 | + $exception_log .= 'File: ' . $exception->getFile() . PHP_EOL; |
|
45 | + $exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL; |
|
46 | + $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
47 | + $exception_log .= $exception->getTraceAsString() . PHP_EOL; |
|
48 | + $exception_log .= '----------------------------------------------------------------------------------------'; |
|
49 | + $exception_log .= PHP_EOL; |
|
50 | + error_log($exception_log); |
|
51 | + } |
|
52 | 52 | } |
@@ -33,18 +33,18 @@ |
||
33 | 33 | */ |
34 | 34 | public function log(\Exception $exception, $time = 0) |
35 | 35 | { |
36 | - if (! $time) { |
|
36 | + if ( ! $time) { |
|
37 | 37 | $time = time(); |
38 | 38 | } |
39 | 39 | $exception_log = '----------------------------------------------------------------------------------------'; |
40 | 40 | $exception_log .= PHP_EOL; |
41 | - $exception_log .= '[' . date('Y-m-d H:i:s', $time) . '] Exception Details' . PHP_EOL; |
|
42 | - $exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL; |
|
43 | - $exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL; |
|
44 | - $exception_log .= 'File: ' . $exception->getFile() . PHP_EOL; |
|
45 | - $exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL; |
|
46 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
47 | - $exception_log .= $exception->getTraceAsString() . PHP_EOL; |
|
41 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
42 | + $exception_log .= 'Message: '.$exception->getMessage().PHP_EOL; |
|
43 | + $exception_log .= 'Code: '.$exception->getCode().PHP_EOL; |
|
44 | + $exception_log .= 'File: '.$exception->getFile().PHP_EOL; |
|
45 | + $exception_log .= 'Line No: '.$exception->getLine().PHP_EOL; |
|
46 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
47 | + $exception_log .= $exception->getTraceAsString().PHP_EOL; |
|
48 | 48 | $exception_log .= '----------------------------------------------------------------------------------------'; |
49 | 49 | $exception_log .= PHP_EOL; |
50 | 50 | error_log($exception_log); |