@@ -13,60 +13,60 @@ |
||
13 | 13 | class CustomTaxonomyTerm |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var string $taxonomy_slug |
|
18 | - */ |
|
19 | - public $taxonomy_slug; |
|
16 | + /** |
|
17 | + * @var string $taxonomy_slug |
|
18 | + */ |
|
19 | + public $taxonomy_slug; |
|
20 | 20 | |
21 | - /** |
|
22 | - * @var string $term_slug |
|
23 | - */ |
|
24 | - public $term_slug; |
|
21 | + /** |
|
22 | + * @var string $term_slug |
|
23 | + */ |
|
24 | + public $term_slug; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var array $custom_post_type_slugs |
|
28 | - */ |
|
29 | - public $custom_post_type_slugs; |
|
26 | + /** |
|
27 | + * @var array $custom_post_type_slugs |
|
28 | + */ |
|
29 | + public $custom_post_type_slugs; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * CustomTaxonomyTerm constructor. |
|
34 | - * |
|
35 | - * @param string $taxonomy_slug |
|
36 | - * @param string $term_slug |
|
37 | - * @param array $custom_post_type_slugs |
|
38 | - */ |
|
39 | - public function __construct($taxonomy_slug, $term_slug, array $custom_post_type_slugs = array()) |
|
40 | - { |
|
41 | - $this->taxonomy_slug = $taxonomy_slug; |
|
42 | - $this->term_slug = $term_slug; |
|
43 | - $this->custom_post_type_slugs = $custom_post_type_slugs; |
|
44 | - } |
|
32 | + /** |
|
33 | + * CustomTaxonomyTerm constructor. |
|
34 | + * |
|
35 | + * @param string $taxonomy_slug |
|
36 | + * @param string $term_slug |
|
37 | + * @param array $custom_post_type_slugs |
|
38 | + */ |
|
39 | + public function __construct($taxonomy_slug, $term_slug, array $custom_post_type_slugs = array()) |
|
40 | + { |
|
41 | + $this->taxonomy_slug = $taxonomy_slug; |
|
42 | + $this->term_slug = $term_slug; |
|
43 | + $this->custom_post_type_slugs = $custom_post_type_slugs; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public function taxonomySlug() |
|
51 | - { |
|
52 | - return $this->taxonomy_slug; |
|
53 | - } |
|
47 | + /** |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public function taxonomySlug() |
|
51 | + { |
|
52 | + return $this->taxonomy_slug; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function termSlug() |
|
60 | - { |
|
61 | - return $this->term_slug; |
|
62 | - } |
|
56 | + /** |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function termSlug() |
|
60 | + { |
|
61 | + return $this->term_slug; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * @return array |
|
67 | - */ |
|
68 | - public function customPostTypeSlugs() |
|
69 | - { |
|
70 | - return $this->custom_post_type_slugs; |
|
71 | - } |
|
65 | + /** |
|
66 | + * @return array |
|
67 | + */ |
|
68 | + public function customPostTypeSlugs() |
|
69 | + { |
|
70 | + return $this->custom_post_type_slugs; |
|
71 | + } |
|
72 | 72 | } |
@@ -14,49 +14,49 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | |
17 | - /* |
|
17 | + /* |
|
18 | 18 | * @var string $reg_code |
19 | 19 | */ |
20 | - private $reg_code; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * RegCode constructor. |
|
25 | - * |
|
26 | - * @param RegUrlLink $reg_url_link |
|
27 | - * @param \EE_Transaction $transaction |
|
28 | - * @param \EE_Ticket $ticket |
|
29 | - */ |
|
30 | - public function __construct( |
|
31 | - RegUrlLink $reg_url_link, |
|
32 | - \EE_Transaction $transaction, |
|
33 | - \EE_Ticket $ticket |
|
34 | - ) { |
|
35 | - // figure out where to start parsing the reg code |
|
36 | - $chars = strpos($reg_url_link, '-') + 5; |
|
37 | - // TXN_ID + TKT_ID + first 3 and last 3 chars of reg_url_link |
|
38 | - $this->reg_code = array( |
|
39 | - $transaction->ID(), |
|
40 | - $ticket->ID(), |
|
41 | - substr($reg_url_link, 0, $chars), |
|
42 | - ); |
|
43 | - // now put it all together |
|
44 | - $this->reg_code = apply_filters( |
|
45 | - 'FHEE__Create__regCode__new_reg_code', |
|
46 | - implode('-', $this->reg_code), |
|
47 | - $transaction, |
|
48 | - $ticket |
|
49 | - ); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * Return the object as a string |
|
55 | - * |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function __toString() |
|
59 | - { |
|
60 | - return $this->reg_code; |
|
61 | - } |
|
20 | + private $reg_code; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * RegCode constructor. |
|
25 | + * |
|
26 | + * @param RegUrlLink $reg_url_link |
|
27 | + * @param \EE_Transaction $transaction |
|
28 | + * @param \EE_Ticket $ticket |
|
29 | + */ |
|
30 | + public function __construct( |
|
31 | + RegUrlLink $reg_url_link, |
|
32 | + \EE_Transaction $transaction, |
|
33 | + \EE_Ticket $ticket |
|
34 | + ) { |
|
35 | + // figure out where to start parsing the reg code |
|
36 | + $chars = strpos($reg_url_link, '-') + 5; |
|
37 | + // TXN_ID + TKT_ID + first 3 and last 3 chars of reg_url_link |
|
38 | + $this->reg_code = array( |
|
39 | + $transaction->ID(), |
|
40 | + $ticket->ID(), |
|
41 | + substr($reg_url_link, 0, $chars), |
|
42 | + ); |
|
43 | + // now put it all together |
|
44 | + $this->reg_code = apply_filters( |
|
45 | + 'FHEE__Create__regCode__new_reg_code', |
|
46 | + implode('-', $this->reg_code), |
|
47 | + $transaction, |
|
48 | + $ticket |
|
49 | + ); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * Return the object as a string |
|
55 | + * |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function __toString() |
|
59 | + { |
|
60 | + return $this->reg_code; |
|
61 | + } |
|
62 | 62 | } |
@@ -16,71 +16,71 @@ |
||
16 | 16 | class EspressoThankYou extends EspressoShortcode |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var boolean $is_thank_you_page |
|
21 | - */ |
|
22 | - private $is_thank_you_page = false; |
|
19 | + /** |
|
20 | + * @var boolean $is_thank_you_page |
|
21 | + */ |
|
22 | + private $is_thank_you_page = false; |
|
23 | 23 | |
24 | - /** |
|
25 | - * the actual shortcode tag that gets registered with WordPress |
|
26 | - * |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function getTag() |
|
30 | - { |
|
31 | - return 'ESPRESSO_THANK_YOU'; |
|
32 | - } |
|
24 | + /** |
|
25 | + * the actual shortcode tag that gets registered with WordPress |
|
26 | + * |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function getTag() |
|
30 | + { |
|
31 | + return 'ESPRESSO_THANK_YOU'; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * the time in seconds to cache the results of the processShortcode() method |
|
37 | - * 0 means the processShortcode() results will NOT be cached at all |
|
38 | - * |
|
39 | - * @return int |
|
40 | - */ |
|
41 | - public function cacheExpiration() |
|
42 | - { |
|
43 | - return 0; |
|
44 | - } |
|
35 | + /** |
|
36 | + * the time in seconds to cache the results of the processShortcode() method |
|
37 | + * 0 means the processShortcode() results will NOT be cached at all |
|
38 | + * |
|
39 | + * @return int |
|
40 | + */ |
|
41 | + public function cacheExpiration() |
|
42 | + { |
|
43 | + return 0; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
49 | - * this may be required for shortcodes that utilize a corresponding module, |
|
50 | - * and need to enqueue assets for that module |
|
51 | - * |
|
52 | - * @return void |
|
53 | - * @throws \EE_Error |
|
54 | - */ |
|
55 | - public function initializeShortcode() |
|
56 | - { |
|
57 | - global $wp_query; |
|
58 | - if (empty($wp_query->posts) || count($wp_query->posts) > 1) { |
|
59 | - return; |
|
60 | - } |
|
61 | - $post = reset($wp_query->posts); |
|
62 | - if (! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
63 | - return; |
|
64 | - } |
|
65 | - $this->is_thank_you_page = true; |
|
66 | - \EED_Thank_You_Page::instance()->load_resources(); |
|
67 | - $this->shortcodeHasBeenInitialized(); |
|
68 | - } |
|
47 | + /** |
|
48 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
49 | + * this may be required for shortcodes that utilize a corresponding module, |
|
50 | + * and need to enqueue assets for that module |
|
51 | + * |
|
52 | + * @return void |
|
53 | + * @throws \EE_Error |
|
54 | + */ |
|
55 | + public function initializeShortcode() |
|
56 | + { |
|
57 | + global $wp_query; |
|
58 | + if (empty($wp_query->posts) || count($wp_query->posts) > 1) { |
|
59 | + return; |
|
60 | + } |
|
61 | + $post = reset($wp_query->posts); |
|
62 | + if (! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
63 | + return; |
|
64 | + } |
|
65 | + $this->is_thank_you_page = true; |
|
66 | + \EED_Thank_You_Page::instance()->load_resources(); |
|
67 | + $this->shortcodeHasBeenInitialized(); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * callback that runs when the shortcode is encountered in post content. |
|
73 | - * IMPORTANT !!! |
|
74 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
75 | - * |
|
76 | - * @param array $attributes |
|
77 | - * @return string |
|
78 | - * @throws \EE_Error |
|
79 | - */ |
|
80 | - public function processShortcode($attributes = array()) |
|
81 | - { |
|
82 | - return $this->is_thank_you_page |
|
83 | - ? \EED_Thank_You_Page::instance()->thank_you_page_results() |
|
84 | - : ''; |
|
85 | - } |
|
71 | + /** |
|
72 | + * callback that runs when the shortcode is encountered in post content. |
|
73 | + * IMPORTANT !!! |
|
74 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
75 | + * |
|
76 | + * @param array $attributes |
|
77 | + * @return string |
|
78 | + * @throws \EE_Error |
|
79 | + */ |
|
80 | + public function processShortcode($attributes = array()) |
|
81 | + { |
|
82 | + return $this->is_thank_you_page |
|
83 | + ? \EED_Thank_You_Page::instance()->thank_you_page_results() |
|
84 | + : ''; |
|
85 | + } |
|
86 | 86 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | return; |
60 | 60 | } |
61 | 61 | $post = reset($wp_query->posts); |
62 | - if (! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
62 | + if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | $this->is_thank_you_page = true; |
@@ -18,55 +18,55 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * the actual shortcode tag that gets registered with WordPress |
|
23 | - * |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - public function getTag() |
|
27 | - { |
|
28 | - return 'ESPRESSO_CHECKOUT'; |
|
29 | - } |
|
21 | + /** |
|
22 | + * the actual shortcode tag that gets registered with WordPress |
|
23 | + * |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + public function getTag() |
|
27 | + { |
|
28 | + return 'ESPRESSO_CHECKOUT'; |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * the time in seconds to cache the results of the processShortcode() method |
|
34 | - * 0 means the processShortcode() results will NOT be cached at all |
|
35 | - * |
|
36 | - * @return int |
|
37 | - */ |
|
38 | - public function cacheExpiration() |
|
39 | - { |
|
40 | - return 0; |
|
41 | - } |
|
32 | + /** |
|
33 | + * the time in seconds to cache the results of the processShortcode() method |
|
34 | + * 0 means the processShortcode() results will NOT be cached at all |
|
35 | + * |
|
36 | + * @return int |
|
37 | + */ |
|
38 | + public function cacheExpiration() |
|
39 | + { |
|
40 | + return 0; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
46 | - * this may be required for shortcodes that utilize a corresponding module, |
|
47 | - * and need to enqueue assets for that module |
|
48 | - * |
|
49 | - * @return void |
|
50 | - * @throws \EE_Error |
|
51 | - */ |
|
52 | - public function initializeShortcode() |
|
53 | - { |
|
54 | - global $wp_query; |
|
55 | - EED_Single_Page_Checkout::init($wp_query); |
|
56 | - $this->shortcodeHasBeenInitialized(); |
|
57 | - } |
|
44 | + /** |
|
45 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
46 | + * this may be required for shortcodes that utilize a corresponding module, |
|
47 | + * and need to enqueue assets for that module |
|
48 | + * |
|
49 | + * @return void |
|
50 | + * @throws \EE_Error |
|
51 | + */ |
|
52 | + public function initializeShortcode() |
|
53 | + { |
|
54 | + global $wp_query; |
|
55 | + EED_Single_Page_Checkout::init($wp_query); |
|
56 | + $this->shortcodeHasBeenInitialized(); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * callback that runs when the shortcode is encountered in post content. |
|
62 | - * IMPORTANT !!! |
|
63 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
64 | - * |
|
65 | - * @param array $attributes |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function processShortcode($attributes = array()) |
|
69 | - { |
|
70 | - return EE_Registry::instance()->REQ->get_output(); |
|
71 | - } |
|
60 | + /** |
|
61 | + * callback that runs when the shortcode is encountered in post content. |
|
62 | + * IMPORTANT !!! |
|
63 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
64 | + * |
|
65 | + * @param array $attributes |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function processShortcode($attributes = array()) |
|
69 | + { |
|
70 | + return EE_Registry::instance()->REQ->get_output(); |
|
71 | + } |
|
72 | 72 | } |
@@ -22,87 +22,87 @@ |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * the actual shortcode tag that gets registered with WordPress |
|
27 | - * |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function getTag() |
|
31 | - { |
|
32 | - return 'ESPRESSO_TXN_PAGE'; |
|
33 | - } |
|
25 | + /** |
|
26 | + * the actual shortcode tag that gets registered with WordPress |
|
27 | + * |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function getTag() |
|
31 | + { |
|
32 | + return 'ESPRESSO_TXN_PAGE'; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * the time in seconds to cache the results of the processShortcode() method |
|
38 | - * 0 means the processShortcode() results will NOT be cached at all |
|
39 | - * |
|
40 | - * @return int |
|
41 | - */ |
|
42 | - public function cacheExpiration() |
|
43 | - { |
|
44 | - return 0; |
|
45 | - } |
|
36 | + /** |
|
37 | + * the time in seconds to cache the results of the processShortcode() method |
|
38 | + * 0 means the processShortcode() results will NOT be cached at all |
|
39 | + * |
|
40 | + * @return int |
|
41 | + */ |
|
42 | + public function cacheExpiration() |
|
43 | + { |
|
44 | + return 0; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
50 | - * this may be required for shortcodes that utilize a corresponding module, |
|
51 | - * and need to enqueue assets for that module |
|
52 | - * |
|
53 | - * @return void |
|
54 | - * @throws \Exception |
|
55 | - * @throws \EE_Error |
|
56 | - */ |
|
57 | - public function initializeShortcode() |
|
58 | - { |
|
59 | - $transaction = null; |
|
60 | - if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
61 | - /** @var EEM_Transaction $EEM_Transaction */ |
|
62 | - $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
63 | - $transaction = $EEM_Transaction->get_transaction_from_reg_url_link(); |
|
64 | - } |
|
65 | - if ($transaction instanceof EE_Transaction) { |
|
66 | - $payment_method = null; |
|
67 | - $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
68 | - if ($payment_method_slug) { |
|
69 | - $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
70 | - } |
|
71 | - if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
72 | - $gateway = $payment_method->type_obj()->get_gateway(); |
|
73 | - if ($gateway instanceof EE_Offsite_Gateway |
|
74 | - && $gateway->handle_IPN_in_this_request( |
|
75 | - \EE_Registry::instance()->REQ->params(), |
|
76 | - true |
|
77 | - ) |
|
78 | - ) { |
|
79 | - /** @type EE_Payment_Processor $payment_processor */ |
|
80 | - $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
81 | - $payment_processor->process_ipn($_REQUEST, $transaction, $payment_method); |
|
82 | - } |
|
83 | - } |
|
84 | - // allow gateways to add a filter to stop rendering the page |
|
85 | - if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', false)) { |
|
86 | - exit; |
|
87 | - } |
|
88 | - } |
|
89 | - $this->shortcodeHasBeenInitialized(); |
|
90 | - } |
|
48 | + /** |
|
49 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
50 | + * this may be required for shortcodes that utilize a corresponding module, |
|
51 | + * and need to enqueue assets for that module |
|
52 | + * |
|
53 | + * @return void |
|
54 | + * @throws \Exception |
|
55 | + * @throws \EE_Error |
|
56 | + */ |
|
57 | + public function initializeShortcode() |
|
58 | + { |
|
59 | + $transaction = null; |
|
60 | + if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
61 | + /** @var EEM_Transaction $EEM_Transaction */ |
|
62 | + $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
63 | + $transaction = $EEM_Transaction->get_transaction_from_reg_url_link(); |
|
64 | + } |
|
65 | + if ($transaction instanceof EE_Transaction) { |
|
66 | + $payment_method = null; |
|
67 | + $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
68 | + if ($payment_method_slug) { |
|
69 | + $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
70 | + } |
|
71 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
72 | + $gateway = $payment_method->type_obj()->get_gateway(); |
|
73 | + if ($gateway instanceof EE_Offsite_Gateway |
|
74 | + && $gateway->handle_IPN_in_this_request( |
|
75 | + \EE_Registry::instance()->REQ->params(), |
|
76 | + true |
|
77 | + ) |
|
78 | + ) { |
|
79 | + /** @type EE_Payment_Processor $payment_processor */ |
|
80 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
81 | + $payment_processor->process_ipn($_REQUEST, $transaction, $payment_method); |
|
82 | + } |
|
83 | + } |
|
84 | + // allow gateways to add a filter to stop rendering the page |
|
85 | + if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', false)) { |
|
86 | + exit; |
|
87 | + } |
|
88 | + } |
|
89 | + $this->shortcodeHasBeenInitialized(); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - /** |
|
94 | - * callback that runs when the shortcode is encountered in post content. |
|
95 | - * IMPORTANT !!! |
|
96 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
97 | - * |
|
98 | - * @param array $attributes |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function processShortcode($attributes = array()) |
|
102 | - { |
|
103 | - return esc_html__( |
|
104 | - 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', |
|
105 | - 'event_espresso' |
|
106 | - ); |
|
107 | - } |
|
93 | + /** |
|
94 | + * callback that runs when the shortcode is encountered in post content. |
|
95 | + * IMPORTANT !!! |
|
96 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
97 | + * |
|
98 | + * @param array $attributes |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function processShortcode($attributes = array()) |
|
102 | + { |
|
103 | + return esc_html__( |
|
104 | + 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', |
|
105 | + 'event_espresso' |
|
106 | + ); |
|
107 | + } |
|
108 | 108 | } |
@@ -16,54 +16,54 @@ |
||
16 | 16 | class Factory |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @param string $class_name |
|
21 | - * @param array $arguments |
|
22 | - * @return mixed|null |
|
23 | - * @throws \EE_Error |
|
24 | - */ |
|
25 | - public static function create($class_name, $arguments = array()) |
|
26 | - { |
|
27 | - if (empty($class_name)) { |
|
28 | - throw new \EE_Error( |
|
29 | - __('You must provide a class name in order to instantiate it.', 'event_espresso') |
|
30 | - ); |
|
31 | - } |
|
32 | - // if ( ! class_exists( $class_name ) ) { |
|
33 | - // throw new \EE_Error( |
|
34 | - // sprintf( |
|
35 | - // __('The "%1$s" class was not found. Please include the correct file or set an autoloader for it', |
|
36 | - // 'event_espresso'), |
|
37 | - // $class_name |
|
38 | - // ) |
|
39 | - // ); |
|
40 | - // } |
|
41 | - $object = null; |
|
42 | - switch ($class_name) { |
|
43 | - case 'EE_Request': |
|
44 | - $object = new \EE_Request($_GET, $_POST, $_COOKIE); |
|
45 | - break; |
|
46 | - case 'Iframe': |
|
47 | - $title = isset($arguments['title']) ? $arguments['title'] : null; |
|
48 | - $content = isset($arguments['content']) ? $arguments['content'] : null; |
|
49 | - $object = new Iframe($title, $content); |
|
50 | - break; |
|
51 | - default: |
|
52 | - $object = new $class_name($arguments); |
|
53 | - } |
|
19 | + /** |
|
20 | + * @param string $class_name |
|
21 | + * @param array $arguments |
|
22 | + * @return mixed|null |
|
23 | + * @throws \EE_Error |
|
24 | + */ |
|
25 | + public static function create($class_name, $arguments = array()) |
|
26 | + { |
|
27 | + if (empty($class_name)) { |
|
28 | + throw new \EE_Error( |
|
29 | + __('You must provide a class name in order to instantiate it.', 'event_espresso') |
|
30 | + ); |
|
31 | + } |
|
32 | + // if ( ! class_exists( $class_name ) ) { |
|
33 | + // throw new \EE_Error( |
|
34 | + // sprintf( |
|
35 | + // __('The "%1$s" class was not found. Please include the correct file or set an autoloader for it', |
|
36 | + // 'event_espresso'), |
|
37 | + // $class_name |
|
38 | + // ) |
|
39 | + // ); |
|
40 | + // } |
|
41 | + $object = null; |
|
42 | + switch ($class_name) { |
|
43 | + case 'EE_Request': |
|
44 | + $object = new \EE_Request($_GET, $_POST, $_COOKIE); |
|
45 | + break; |
|
46 | + case 'Iframe': |
|
47 | + $title = isset($arguments['title']) ? $arguments['title'] : null; |
|
48 | + $content = isset($arguments['content']) ? $arguments['content'] : null; |
|
49 | + $object = new Iframe($title, $content); |
|
50 | + break; |
|
51 | + default: |
|
52 | + $object = new $class_name($arguments); |
|
53 | + } |
|
54 | 54 | |
55 | - // if ( ! $object instanceof $class_name ) { |
|
56 | - // throw new \EE_Error( |
|
57 | - // sprintf( |
|
58 | - // __( |
|
59 | - // 'An error occurred during class instantiation and the requested object could not be created. The result was: %1$s %2$s', |
|
60 | - // 'event_espresso' |
|
61 | - // ), |
|
62 | - // '<br />', |
|
63 | - // var_export($object, true) |
|
64 | - // ) |
|
65 | - // ); |
|
66 | - // } |
|
67 | - return $object; |
|
68 | - } |
|
55 | + // if ( ! $object instanceof $class_name ) { |
|
56 | + // throw new \EE_Error( |
|
57 | + // sprintf( |
|
58 | + // __( |
|
59 | + // 'An error occurred during class instantiation and the requested object could not be created. The result was: %1$s %2$s', |
|
60 | + // 'event_espresso' |
|
61 | + // ), |
|
62 | + // '<br />', |
|
63 | + // var_export($object, true) |
|
64 | + // ) |
|
65 | + // ); |
|
66 | + // } |
|
67 | + return $object; |
|
68 | + } |
|
69 | 69 | } |
@@ -12,138 +12,138 @@ |
||
12 | 12 | class PostShortcodeTracking |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @deprecated 4.9.26 |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public static function set_hooks_admin() |
|
20 | - { |
|
21 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * @deprecated 4.9.26 |
|
27 | - * @param $post_ID |
|
28 | - * @param $post |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public static function parse_post_content_on_save($post_ID, $post) |
|
32 | - { |
|
33 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @deprecated 4.9.26 |
|
39 | - * @param $page_for_posts |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - protected static function set_post_shortcodes_for_posts_page($page_for_posts) |
|
43 | - { |
|
44 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * @deprecated 4.9.26 |
|
50 | - * @param $page_for_posts |
|
51 | - * @param $EES_Shortcode |
|
52 | - * @param $post_ID |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID) |
|
56 | - { |
|
57 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * @deprecated 4.9.26 |
|
63 | - * @param $ID |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public static function unset_post_shortcodes_on_delete($ID) |
|
67 | - { |
|
68 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @deprecated 4.9.26 |
|
74 | - * @param $ID |
|
75 | - * @param $shortcode_class |
|
76 | - * @param $shortcode_posts |
|
77 | - * @param $page_for_posts |
|
78 | - * @param bool $update_post_shortcodes |
|
79 | - * @return void |
|
80 | - */ |
|
81 | - protected static function unset_posts_page_shortcode_for_post( |
|
82 | - $ID, |
|
83 | - $shortcode_class, |
|
84 | - $shortcode_posts, |
|
85 | - $page_for_posts, |
|
86 | - $update_post_shortcodes = false |
|
87 | - ) { |
|
88 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * @deprecated 4.9.26 |
|
94 | - * @param string $page_for_posts |
|
95 | - * @return void |
|
96 | - */ |
|
97 | - public static function update_post_shortcodes($page_for_posts = '') |
|
98 | - { |
|
99 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * @deprecated 4.9.26 |
|
105 | - * @param $option |
|
106 | - * @param $value |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public static function reset_page_for_posts_on_initial_set($option, $value) |
|
110 | - { |
|
111 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @deprecated 4.9.26 |
|
117 | - * @param $option |
|
118 | - * @param string $old_value |
|
119 | - * @param string $value |
|
120 | - * @return void |
|
121 | - */ |
|
122 | - public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '') |
|
123 | - { |
|
124 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * @deprecated 4.9.26 |
|
130 | - * @param $option |
|
131 | - * @return void |
|
132 | - */ |
|
133 | - public static function reset_page_for_posts_on_delete($option) |
|
134 | - { |
|
135 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @deprecated 4.9.26 |
|
141 | - * @param $shortcodes |
|
142 | - * @param bool $index_results |
|
143 | - * @return void |
|
144 | - */ |
|
145 | - public static function get_post_ids_for_shortcode($shortcodes, $index_results = true) |
|
146 | - { |
|
147 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
148 | - } |
|
15 | + /** |
|
16 | + * @deprecated 4.9.26 |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public static function set_hooks_admin() |
|
20 | + { |
|
21 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * @deprecated 4.9.26 |
|
27 | + * @param $post_ID |
|
28 | + * @param $post |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public static function parse_post_content_on_save($post_ID, $post) |
|
32 | + { |
|
33 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @deprecated 4.9.26 |
|
39 | + * @param $page_for_posts |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + protected static function set_post_shortcodes_for_posts_page($page_for_posts) |
|
43 | + { |
|
44 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * @deprecated 4.9.26 |
|
50 | + * @param $page_for_posts |
|
51 | + * @param $EES_Shortcode |
|
52 | + * @param $post_ID |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID) |
|
56 | + { |
|
57 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * @deprecated 4.9.26 |
|
63 | + * @param $ID |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public static function unset_post_shortcodes_on_delete($ID) |
|
67 | + { |
|
68 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @deprecated 4.9.26 |
|
74 | + * @param $ID |
|
75 | + * @param $shortcode_class |
|
76 | + * @param $shortcode_posts |
|
77 | + * @param $page_for_posts |
|
78 | + * @param bool $update_post_shortcodes |
|
79 | + * @return void |
|
80 | + */ |
|
81 | + protected static function unset_posts_page_shortcode_for_post( |
|
82 | + $ID, |
|
83 | + $shortcode_class, |
|
84 | + $shortcode_posts, |
|
85 | + $page_for_posts, |
|
86 | + $update_post_shortcodes = false |
|
87 | + ) { |
|
88 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * @deprecated 4.9.26 |
|
94 | + * @param string $page_for_posts |
|
95 | + * @return void |
|
96 | + */ |
|
97 | + public static function update_post_shortcodes($page_for_posts = '') |
|
98 | + { |
|
99 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * @deprecated 4.9.26 |
|
105 | + * @param $option |
|
106 | + * @param $value |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public static function reset_page_for_posts_on_initial_set($option, $value) |
|
110 | + { |
|
111 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @deprecated 4.9.26 |
|
117 | + * @param $option |
|
118 | + * @param string $old_value |
|
119 | + * @param string $value |
|
120 | + * @return void |
|
121 | + */ |
|
122 | + public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '') |
|
123 | + { |
|
124 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * @deprecated 4.9.26 |
|
130 | + * @param $option |
|
131 | + * @return void |
|
132 | + */ |
|
133 | + public static function reset_page_for_posts_on_delete($option) |
|
134 | + { |
|
135 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @deprecated 4.9.26 |
|
141 | + * @param $shortcodes |
|
142 | + * @param bool $index_results |
|
143 | + * @return void |
|
144 | + */ |
|
145 | + public static function get_post_ids_for_shortcode($shortcodes, $index_results = true) |
|
146 | + { |
|
147 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
148 | + } |
|
149 | 149 | } |
@@ -14,62 +14,62 @@ |
||
14 | 14 | class Context implements ContextInterface |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @var string $slug |
|
19 | - */ |
|
20 | - private $slug; |
|
17 | + /** |
|
18 | + * @var string $slug |
|
19 | + */ |
|
20 | + private $slug; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @var string $description |
|
24 | - */ |
|
25 | - private $description; |
|
22 | + /** |
|
23 | + * @var string $description |
|
24 | + */ |
|
25 | + private $description; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * Context constructor. |
|
30 | - * |
|
31 | - * @param string $slug |
|
32 | - * @param string $description |
|
33 | - */ |
|
34 | - public function __construct($slug, $description) |
|
35 | - { |
|
36 | - $this->setSlug($slug); |
|
37 | - $this->setDescription($description); |
|
38 | - } |
|
28 | + /** |
|
29 | + * Context constructor. |
|
30 | + * |
|
31 | + * @param string $slug |
|
32 | + * @param string $description |
|
33 | + */ |
|
34 | + public function __construct($slug, $description) |
|
35 | + { |
|
36 | + $this->setSlug($slug); |
|
37 | + $this->setDescription($description); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function slug() |
|
45 | - { |
|
46 | - return $this->slug; |
|
47 | - } |
|
41 | + /** |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function slug() |
|
45 | + { |
|
46 | + return $this->slug; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param string $slug |
|
52 | - */ |
|
53 | - private function setSlug($slug) |
|
54 | - { |
|
55 | - $this->slug = sanitize_key($slug); |
|
56 | - } |
|
50 | + /** |
|
51 | + * @param string $slug |
|
52 | + */ |
|
53 | + private function setSlug($slug) |
|
54 | + { |
|
55 | + $this->slug = sanitize_key($slug); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @return string |
|
61 | - */ |
|
62 | - public function description() |
|
63 | - { |
|
64 | - return $this->description; |
|
65 | - } |
|
59 | + /** |
|
60 | + * @return string |
|
61 | + */ |
|
62 | + public function description() |
|
63 | + { |
|
64 | + return $this->description; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @param string $description |
|
70 | - */ |
|
71 | - private function setDescription($description) |
|
72 | - { |
|
73 | - $this->description = sanitize_text_field($description); |
|
74 | - } |
|
68 | + /** |
|
69 | + * @param string $description |
|
70 | + */ |
|
71 | + private function setDescription($description) |
|
72 | + { |
|
73 | + $this->description = sanitize_text_field($description); |
|
74 | + } |
|
75 | 75 | } |
@@ -13,178 +13,178 @@ |
||
13 | 13 | class InvalidCheckoutAccess |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * key used for saving invalid checkout access data to the wp_options table |
|
18 | - */ |
|
19 | - const OPTION_KEY = 'ee_invalid_checkout_access'; |
|
16 | + /** |
|
17 | + * key used for saving invalid checkout access data to the wp_options table |
|
18 | + */ |
|
19 | + const OPTION_KEY = 'ee_invalid_checkout_access'; |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * _block_bots |
|
24 | - * checks that the incoming request has either of the following set: |
|
25 | - * a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector |
|
26 | - * a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN |
|
27 | - * so if you're not coming from the Ticket Selector nor returning for a valid IP... |
|
28 | - * then where you coming from man? |
|
29 | - * |
|
30 | - * @param \EE_Checkout $checkout |
|
31 | - * @return bool true if access to registration checkout appears to be invalid |
|
32 | - */ |
|
33 | - public function checkoutAccessIsInvalid(\EE_Checkout $checkout) |
|
34 | - { |
|
35 | - if (! ($checkout->uts || $checkout->reg_url_link) |
|
36 | - && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
37 | - && \EE_Config::instance()->registration->track_invalid_checkout_access() |
|
38 | - ) { |
|
39 | - /** @var \EE_Request $request */ |
|
40 | - $request = \EE_Registry::instance()->load_core('EE_Request'); |
|
41 | - $ip_address = $request->ip_address(); |
|
42 | - $ee_bot_checkout = get_option(InvalidCheckoutAccess::OPTION_KEY); |
|
43 | - if ($ee_bot_checkout === false) { |
|
44 | - $ee_bot_checkout = array(); |
|
45 | - add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false); |
|
46 | - } |
|
47 | - if (! isset($ee_bot_checkout[ $ip_address ])) { |
|
48 | - $ee_bot_checkout[ $ip_address ] = array(); |
|
49 | - } |
|
50 | - $http_referer = isset($_SERVER['HTTP_REFERER']) |
|
51 | - ? esc_attr($_SERVER['HTTP_REFERER']) |
|
52 | - : 0; |
|
53 | - if (! isset($ee_bot_checkout[ $ip_address ][ $http_referer ])) { |
|
54 | - $ee_bot_checkout[ $ip_address ][ $http_referer ] = 0; |
|
55 | - } |
|
56 | - $ee_bot_checkout[ $ip_address ][ $http_referer ]++; |
|
57 | - update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout); |
|
58 | - if (WP_DEBUG) { |
|
59 | - \EE_Error::add_error( |
|
60 | - esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'), |
|
61 | - __FILE__, |
|
62 | - __FUNCTION__, |
|
63 | - __LINE__ |
|
64 | - ); |
|
65 | - } |
|
66 | - return true; |
|
67 | - } |
|
68 | - return false; |
|
69 | - } |
|
22 | + /** |
|
23 | + * _block_bots |
|
24 | + * checks that the incoming request has either of the following set: |
|
25 | + * a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector |
|
26 | + * a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN |
|
27 | + * so if you're not coming from the Ticket Selector nor returning for a valid IP... |
|
28 | + * then where you coming from man? |
|
29 | + * |
|
30 | + * @param \EE_Checkout $checkout |
|
31 | + * @return bool true if access to registration checkout appears to be invalid |
|
32 | + */ |
|
33 | + public function checkoutAccessIsInvalid(\EE_Checkout $checkout) |
|
34 | + { |
|
35 | + if (! ($checkout->uts || $checkout->reg_url_link) |
|
36 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
37 | + && \EE_Config::instance()->registration->track_invalid_checkout_access() |
|
38 | + ) { |
|
39 | + /** @var \EE_Request $request */ |
|
40 | + $request = \EE_Registry::instance()->load_core('EE_Request'); |
|
41 | + $ip_address = $request->ip_address(); |
|
42 | + $ee_bot_checkout = get_option(InvalidCheckoutAccess::OPTION_KEY); |
|
43 | + if ($ee_bot_checkout === false) { |
|
44 | + $ee_bot_checkout = array(); |
|
45 | + add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false); |
|
46 | + } |
|
47 | + if (! isset($ee_bot_checkout[ $ip_address ])) { |
|
48 | + $ee_bot_checkout[ $ip_address ] = array(); |
|
49 | + } |
|
50 | + $http_referer = isset($_SERVER['HTTP_REFERER']) |
|
51 | + ? esc_attr($_SERVER['HTTP_REFERER']) |
|
52 | + : 0; |
|
53 | + if (! isset($ee_bot_checkout[ $ip_address ][ $http_referer ])) { |
|
54 | + $ee_bot_checkout[ $ip_address ][ $http_referer ] = 0; |
|
55 | + } |
|
56 | + $ee_bot_checkout[ $ip_address ][ $http_referer ]++; |
|
57 | + update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout); |
|
58 | + if (WP_DEBUG) { |
|
59 | + \EE_Error::add_error( |
|
60 | + esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'), |
|
61 | + __FILE__, |
|
62 | + __FUNCTION__, |
|
63 | + __LINE__ |
|
64 | + ); |
|
65 | + } |
|
66 | + return true; |
|
67 | + } |
|
68 | + return false; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * _invalid_checkout_access_form |
|
74 | - * |
|
75 | - * @return \EE_Form_Section_Proper |
|
76 | - * @throws \EE_Error |
|
77 | - */ |
|
78 | - public function getForm() |
|
79 | - { |
|
80 | - return new \EE_Form_Section_Proper( |
|
81 | - array( |
|
82 | - 'name' => 'invalid_checkout_access', |
|
83 | - 'html_id' => 'invalid_checkout_access', |
|
84 | - 'layout_strategy' => new \EE_Admin_Two_Column_Layout(), |
|
85 | - 'subsections' => array( |
|
86 | - 'invalid_checkout_access_hdr' => new \EE_Form_Section_HTML( |
|
87 | - \EEH_HTML::h2(esc_html__('Invalid Checkout Access', 'event_espresso')) |
|
88 | - ), |
|
89 | - 'ee_bot_checkout_data' => new \EE_Text_Area_Input( |
|
90 | - array( |
|
91 | - 'html_label_text' => esc_html__('Invalid Checkout Data', 'event_espresso'), |
|
92 | - 'default' => var_export( |
|
93 | - get_option(InvalidCheckoutAccess::OPTION_KEY, array()), |
|
94 | - true |
|
95 | - ), |
|
96 | - 'required' => false, |
|
97 | - 'html_help_text' => esc_html__( |
|
98 | - 'Event Espresso blocks any attempt to directly access the registration checkout page, that is NOT from a Ticket Selector or for a return visit for a valid transaction. These are not valid requests accessing your checkout page, so we track the IP addresses, what web page they just came from, and the number of times that they have attempted to access your registration page. This information may help you with protecting your site by other means, such as firewalls, etc, but please note that IP addresses are almost guaranteed to be spoofed by malicious agents.', |
|
99 | - 'event_espresso' |
|
100 | - ), |
|
101 | - ) |
|
102 | - ), |
|
103 | - 'track_invalid_checkout_access' => new \EE_Yes_No_Input( |
|
104 | - array( |
|
105 | - 'html_label_text' => __('Track Invalid Checkout Access?', 'event_espresso'), |
|
106 | - 'html_help_text' => esc_html__( |
|
107 | - 'Controls whether or not invalid attempts to directly access the registration checkout page should be tracked. Setting this to "No" means that the above data will no longer be collected.', |
|
108 | - 'event_espresso' |
|
109 | - ), |
|
110 | - 'default' => \EE_Config::instance() |
|
111 | - ->registration |
|
112 | - ->track_invalid_checkout_access(), |
|
113 | - 'display_html_label_text' => false, |
|
114 | - ) |
|
115 | - ), |
|
116 | - 'delete_invalid_checkout_data' => new \EE_Yes_No_Input( |
|
117 | - array( |
|
118 | - 'html_label_text' => __('Reset Invalid Checkout Data', 'event_espresso'), |
|
119 | - 'html_help_text' => esc_html__( |
|
120 | - 'Setting this to "Yes" will delete all existing invalid checkout access data.', |
|
121 | - 'event_espresso' |
|
122 | - ), |
|
123 | - 'default' => false, |
|
124 | - 'display_html_label_text' => false, |
|
125 | - ) |
|
126 | - ), |
|
127 | - ), |
|
128 | - ) |
|
129 | - ); |
|
130 | - } |
|
72 | + /** |
|
73 | + * _invalid_checkout_access_form |
|
74 | + * |
|
75 | + * @return \EE_Form_Section_Proper |
|
76 | + * @throws \EE_Error |
|
77 | + */ |
|
78 | + public function getForm() |
|
79 | + { |
|
80 | + return new \EE_Form_Section_Proper( |
|
81 | + array( |
|
82 | + 'name' => 'invalid_checkout_access', |
|
83 | + 'html_id' => 'invalid_checkout_access', |
|
84 | + 'layout_strategy' => new \EE_Admin_Two_Column_Layout(), |
|
85 | + 'subsections' => array( |
|
86 | + 'invalid_checkout_access_hdr' => new \EE_Form_Section_HTML( |
|
87 | + \EEH_HTML::h2(esc_html__('Invalid Checkout Access', 'event_espresso')) |
|
88 | + ), |
|
89 | + 'ee_bot_checkout_data' => new \EE_Text_Area_Input( |
|
90 | + array( |
|
91 | + 'html_label_text' => esc_html__('Invalid Checkout Data', 'event_espresso'), |
|
92 | + 'default' => var_export( |
|
93 | + get_option(InvalidCheckoutAccess::OPTION_KEY, array()), |
|
94 | + true |
|
95 | + ), |
|
96 | + 'required' => false, |
|
97 | + 'html_help_text' => esc_html__( |
|
98 | + 'Event Espresso blocks any attempt to directly access the registration checkout page, that is NOT from a Ticket Selector or for a return visit for a valid transaction. These are not valid requests accessing your checkout page, so we track the IP addresses, what web page they just came from, and the number of times that they have attempted to access your registration page. This information may help you with protecting your site by other means, such as firewalls, etc, but please note that IP addresses are almost guaranteed to be spoofed by malicious agents.', |
|
99 | + 'event_espresso' |
|
100 | + ), |
|
101 | + ) |
|
102 | + ), |
|
103 | + 'track_invalid_checkout_access' => new \EE_Yes_No_Input( |
|
104 | + array( |
|
105 | + 'html_label_text' => __('Track Invalid Checkout Access?', 'event_espresso'), |
|
106 | + 'html_help_text' => esc_html__( |
|
107 | + 'Controls whether or not invalid attempts to directly access the registration checkout page should be tracked. Setting this to "No" means that the above data will no longer be collected.', |
|
108 | + 'event_espresso' |
|
109 | + ), |
|
110 | + 'default' => \EE_Config::instance() |
|
111 | + ->registration |
|
112 | + ->track_invalid_checkout_access(), |
|
113 | + 'display_html_label_text' => false, |
|
114 | + ) |
|
115 | + ), |
|
116 | + 'delete_invalid_checkout_data' => new \EE_Yes_No_Input( |
|
117 | + array( |
|
118 | + 'html_label_text' => __('Reset Invalid Checkout Data', 'event_espresso'), |
|
119 | + 'html_help_text' => esc_html__( |
|
120 | + 'Setting this to "Yes" will delete all existing invalid checkout access data.', |
|
121 | + 'event_espresso' |
|
122 | + ), |
|
123 | + 'default' => false, |
|
124 | + 'display_html_label_text' => false, |
|
125 | + ) |
|
126 | + ), |
|
127 | + ), |
|
128 | + ) |
|
129 | + ); |
|
130 | + } |
|
131 | 131 | |
132 | 132 | |
133 | - /** |
|
134 | - * update_invalid_checkout_access_form |
|
135 | - * |
|
136 | - * @param \EE_Registration_Config $EE_Registration_Config |
|
137 | - * @return \EE_Registration_Config |
|
138 | - */ |
|
139 | - public function processForm(\EE_Registration_Config $EE_Registration_Config) |
|
140 | - { |
|
141 | - try { |
|
142 | - $invalid_checkout_access_form = $this->getForm(); |
|
143 | - // if not displaying a form, then check for form submission |
|
144 | - if ($invalid_checkout_access_form->was_submitted()) { |
|
145 | - // capture form data |
|
146 | - $invalid_checkout_access_form->receive_form_submission(); |
|
147 | - // validate form data |
|
148 | - if ($invalid_checkout_access_form->is_valid()) { |
|
149 | - // grab validated data from form |
|
150 | - $valid_data = $invalid_checkout_access_form->valid_data(); |
|
151 | - // ensure form inputs we want are set |
|
152 | - if (isset( |
|
153 | - $valid_data['track_invalid_checkout_access'], |
|
154 | - $valid_data['delete_invalid_checkout_data'] |
|
155 | - )) { |
|
156 | - $EE_Registration_Config->set_track_invalid_checkout_access( |
|
157 | - $valid_data['track_invalid_checkout_access'] |
|
158 | - ); |
|
159 | - // if deleting, then update option with empty array |
|
160 | - if (filter_var($valid_data['delete_invalid_checkout_data'], FILTER_VALIDATE_BOOLEAN)) { |
|
161 | - update_option(InvalidCheckoutAccess::OPTION_KEY, array()); |
|
162 | - } |
|
163 | - } else { |
|
164 | - \EE_Error::add_error( |
|
165 | - esc_html__( |
|
166 | - 'Invalid or missing Invalid Checkout Access form data. Please refresh the form and try again.', |
|
167 | - 'event_espresso' |
|
168 | - ), |
|
169 | - __FILE__, |
|
170 | - __FUNCTION__, |
|
171 | - __LINE__ |
|
172 | - ); |
|
173 | - } |
|
174 | - } else { |
|
175 | - if ($invalid_checkout_access_form->submission_error_message() !== '') { |
|
176 | - \EE_Error::add_error( |
|
177 | - $invalid_checkout_access_form->submission_error_message(), |
|
178 | - __FILE__, |
|
179 | - __FUNCTION__, |
|
180 | - __LINE__ |
|
181 | - ); |
|
182 | - } |
|
183 | - } |
|
184 | - } |
|
185 | - } catch (\EE_Error $e) { |
|
186 | - $e->get_error(); |
|
187 | - } |
|
188 | - return $EE_Registration_Config; |
|
189 | - } |
|
133 | + /** |
|
134 | + * update_invalid_checkout_access_form |
|
135 | + * |
|
136 | + * @param \EE_Registration_Config $EE_Registration_Config |
|
137 | + * @return \EE_Registration_Config |
|
138 | + */ |
|
139 | + public function processForm(\EE_Registration_Config $EE_Registration_Config) |
|
140 | + { |
|
141 | + try { |
|
142 | + $invalid_checkout_access_form = $this->getForm(); |
|
143 | + // if not displaying a form, then check for form submission |
|
144 | + if ($invalid_checkout_access_form->was_submitted()) { |
|
145 | + // capture form data |
|
146 | + $invalid_checkout_access_form->receive_form_submission(); |
|
147 | + // validate form data |
|
148 | + if ($invalid_checkout_access_form->is_valid()) { |
|
149 | + // grab validated data from form |
|
150 | + $valid_data = $invalid_checkout_access_form->valid_data(); |
|
151 | + // ensure form inputs we want are set |
|
152 | + if (isset( |
|
153 | + $valid_data['track_invalid_checkout_access'], |
|
154 | + $valid_data['delete_invalid_checkout_data'] |
|
155 | + )) { |
|
156 | + $EE_Registration_Config->set_track_invalid_checkout_access( |
|
157 | + $valid_data['track_invalid_checkout_access'] |
|
158 | + ); |
|
159 | + // if deleting, then update option with empty array |
|
160 | + if (filter_var($valid_data['delete_invalid_checkout_data'], FILTER_VALIDATE_BOOLEAN)) { |
|
161 | + update_option(InvalidCheckoutAccess::OPTION_KEY, array()); |
|
162 | + } |
|
163 | + } else { |
|
164 | + \EE_Error::add_error( |
|
165 | + esc_html__( |
|
166 | + 'Invalid or missing Invalid Checkout Access form data. Please refresh the form and try again.', |
|
167 | + 'event_espresso' |
|
168 | + ), |
|
169 | + __FILE__, |
|
170 | + __FUNCTION__, |
|
171 | + __LINE__ |
|
172 | + ); |
|
173 | + } |
|
174 | + } else { |
|
175 | + if ($invalid_checkout_access_form->submission_error_message() !== '') { |
|
176 | + \EE_Error::add_error( |
|
177 | + $invalid_checkout_access_form->submission_error_message(), |
|
178 | + __FILE__, |
|
179 | + __FUNCTION__, |
|
180 | + __LINE__ |
|
181 | + ); |
|
182 | + } |
|
183 | + } |
|
184 | + } |
|
185 | + } catch (\EE_Error $e) { |
|
186 | + $e->get_error(); |
|
187 | + } |
|
188 | + return $EE_Registration_Config; |
|
189 | + } |
|
190 | 190 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function checkoutAccessIsInvalid(\EE_Checkout $checkout) |
34 | 34 | { |
35 | - if (! ($checkout->uts || $checkout->reg_url_link) |
|
35 | + if ( ! ($checkout->uts || $checkout->reg_url_link) |
|
36 | 36 | && ! (defined('DOING_AJAX') && DOING_AJAX) |
37 | 37 | && \EE_Config::instance()->registration->track_invalid_checkout_access() |
38 | 38 | ) { |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | $ee_bot_checkout = array(); |
45 | 45 | add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false); |
46 | 46 | } |
47 | - if (! isset($ee_bot_checkout[ $ip_address ])) { |
|
48 | - $ee_bot_checkout[ $ip_address ] = array(); |
|
47 | + if ( ! isset($ee_bot_checkout[$ip_address])) { |
|
48 | + $ee_bot_checkout[$ip_address] = array(); |
|
49 | 49 | } |
50 | 50 | $http_referer = isset($_SERVER['HTTP_REFERER']) |
51 | 51 | ? esc_attr($_SERVER['HTTP_REFERER']) |
52 | 52 | : 0; |
53 | - if (! isset($ee_bot_checkout[ $ip_address ][ $http_referer ])) { |
|
54 | - $ee_bot_checkout[ $ip_address ][ $http_referer ] = 0; |
|
53 | + if ( ! isset($ee_bot_checkout[$ip_address][$http_referer])) { |
|
54 | + $ee_bot_checkout[$ip_address][$http_referer] = 0; |
|
55 | 55 | } |
56 | - $ee_bot_checkout[ $ip_address ][ $http_referer ]++; |
|
56 | + $ee_bot_checkout[$ip_address][$http_referer]++; |
|
57 | 57 | update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout); |
58 | 58 | if (WP_DEBUG) { |
59 | 59 | \EE_Error::add_error( |