@@ -15,8 +15,8 @@ |
||
15 | 15 | interface RequiresRegistryInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param EE_Registry $registry |
|
20 | - */ |
|
21 | - public function setRegistry($registry); |
|
18 | + /** |
|
19 | + * @param EE_Registry $registry |
|
20 | + */ |
|
21 | + public function setRegistry($registry); |
|
22 | 22 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | DbSafeDateTime::db_safe_timestamp_format, |
72 | 72 | $this->_datetime_string |
73 | 73 | ); |
74 | - if (! $date instanceof DateTime) { |
|
74 | + if ( ! $date instanceof DateTime) { |
|
75 | 75 | try { |
76 | 76 | // we want a stack trace to determine where the malformed date came from, so... |
77 | 77 | throw new DomainException(''); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | DbSafeDateTime::db_safe_timestamp_format, |
119 | 119 | $this->_datetime_string |
120 | 120 | ); |
121 | - if (! $date instanceof DateTime) { |
|
121 | + if ( ! $date instanceof DateTime) { |
|
122 | 122 | $this->writeToErrorLog( |
123 | 123 | sprintf( |
124 | 124 | __( |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function writeToErrorLog($message) |
162 | 162 | { |
163 | - if (! empty($this->_error_log_dir)) { |
|
163 | + if ( ! empty($this->_error_log_dir)) { |
|
164 | 164 | /** @noinspection ForgottenDebugOutputInspection */ |
165 | 165 | error_log($message, 3, $this->_error_log_dir); |
166 | 166 | } else { |
@@ -18,156 +18,156 @@ |
||
18 | 18 | class DbSafeDateTime extends DateTime |
19 | 19 | { |
20 | 20 | |
21 | - // phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase |
|
22 | - /** |
|
23 | - * @type string db_safe_timestamp_format |
|
24 | - */ |
|
25 | - const db_safe_timestamp_format = 'Y-m-d H:i:s O e'; |
|
26 | - // phpcs:enable |
|
27 | - |
|
28 | - // phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore |
|
29 | - /** |
|
30 | - * DateTime object converted to a string that includes the date, time, UTC offset, and timezone identifier |
|
31 | - * |
|
32 | - * @type string $_datetime_string |
|
33 | - */ |
|
34 | - protected $_datetime_string = ''; |
|
35 | - |
|
36 | - /** |
|
37 | - * where to write the error log to |
|
38 | - * |
|
39 | - * @type string $_error_log_dir |
|
40 | - */ |
|
41 | - protected $_error_log_dir = ''; |
|
42 | - // phpcs:enable |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @param string $error_log_dir |
|
47 | - */ |
|
48 | - public function setErrorLogDir($error_log_dir) |
|
49 | - { |
|
50 | - // if the folder path is writable, then except the path + filename, else keep empty |
|
51 | - $this->_error_log_dir = is_writable(str_replace(basename($error_log_dir), '', $error_log_dir)) |
|
52 | - ? $error_log_dir |
|
53 | - : ''; |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function __toString() |
|
61 | - { |
|
62 | - return $this->format(DbSafeDateTime::db_safe_timestamp_format); |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * @return array |
|
68 | - */ |
|
69 | - public function __sleep() |
|
70 | - { |
|
71 | - $this->_datetime_string = $this->format(DbSafeDateTime::db_safe_timestamp_format); |
|
72 | - $date = DateTime::createFromFormat( |
|
73 | - DbSafeDateTime::db_safe_timestamp_format, |
|
74 | - $this->_datetime_string |
|
75 | - ); |
|
76 | - if (! $date instanceof DateTime) { |
|
77 | - try { |
|
78 | - // we want a stack trace to determine where the malformed date came from, so... |
|
79 | - throw new DomainException(''); |
|
80 | - } catch (DomainException $e) { |
|
81 | - $stack_trace = $e->getTraceAsString(); |
|
82 | - } |
|
83 | - $this->writeToErrorLog( |
|
84 | - sprintf( |
|
85 | - __( |
|
86 | - 'A valid DateTime could not be generated from "%1$s" because the following errors occurred: %2$s %3$s %2$s PHP version: %4$s %2$s Stack Trace: %5$s', |
|
87 | - 'event_espresso' |
|
88 | - ), |
|
89 | - $this->_datetime_string, |
|
90 | - '<br />', |
|
91 | - print_r(DateTime::getLastErrors(), true), |
|
92 | - PHP_VERSION, |
|
93 | - $stack_trace |
|
94 | - ) |
|
95 | - ); |
|
96 | - } |
|
97 | - return array('_datetime_string'); |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * if an empty or null value got saved to the db for a datetime, |
|
103 | - * then some servers and/or PHP itself will incorrectly convert that date string |
|
104 | - * resulting in "-0001-11-30" for the year-month-day. |
|
105 | - * see the Notes section |
|
106 | - * |
|
107 | - * @link http://php.net/manual/en/datetime.formats.date.php |
|
108 | - * We'll replace those with "0000-00-00" which will allow a valid DateTime object to be created, |
|
109 | - * but still result in the internal date for that object being set to "-0001-11-30 10:00:00.000000". |
|
110 | - * so we're no better off, but at least things won't go fatal on us. |
|
111 | - */ |
|
112 | - public function __wakeup() |
|
113 | - { |
|
114 | - $this->_datetime_string = str_replace( |
|
115 | - array('-0001-11-29', '-0001-11-30'), |
|
116 | - '0000-00-00', |
|
117 | - $this->_datetime_string |
|
118 | - ); |
|
119 | - $date = DateTime::createFromFormat( |
|
120 | - DbSafeDateTime::db_safe_timestamp_format, |
|
121 | - $this->_datetime_string |
|
122 | - ); |
|
123 | - if (! $date instanceof DateTime) { |
|
124 | - $this->writeToErrorLog( |
|
125 | - sprintf( |
|
126 | - __( |
|
127 | - 'A valid DateTime could not be recreated from "%1$s" because the following errors occurred: %2$s %3$s %2$s PHP version: %4$s', |
|
128 | - 'event_espresso' |
|
129 | - ), |
|
130 | - $this->_datetime_string, |
|
131 | - '<br />', |
|
132 | - print_r(DateTime::getLastErrors(), true), |
|
133 | - PHP_VERSION |
|
134 | - ) |
|
135 | - ); |
|
136 | - } else { |
|
137 | - $this->__construct( |
|
138 | - $date->format(\EE_Datetime_Field::mysql_timestamp_format), |
|
139 | - new DateTimeZone($date->format('e')) |
|
140 | - ); |
|
141 | - } |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * Creates a DbSafeDateTime from ye old DateTime |
|
147 | - * |
|
148 | - * @param DateTime $datetime |
|
149 | - * @return \EventEspresso\core\domain\entities\DbSafeDateTime |
|
150 | - */ |
|
151 | - public static function createFromDateTime(DateTime $datetime) |
|
152 | - { |
|
153 | - return new DbSafeDateTime( |
|
154 | - $datetime->format(\EE_Datetime_Field::mysql_timestamp_format), |
|
155 | - new DateTimeZone($datetime->format('e')) |
|
156 | - ); |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @param string $message |
|
162 | - */ |
|
163 | - private function writeToErrorLog($message) |
|
164 | - { |
|
165 | - if (! empty($this->_error_log_dir)) { |
|
166 | - /** @noinspection ForgottenDebugOutputInspection */ |
|
167 | - error_log($message, 3, $this->_error_log_dir); |
|
168 | - } else { |
|
169 | - /** @noinspection ForgottenDebugOutputInspection */ |
|
170 | - error_log($message); |
|
171 | - } |
|
172 | - } |
|
21 | + // phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase |
|
22 | + /** |
|
23 | + * @type string db_safe_timestamp_format |
|
24 | + */ |
|
25 | + const db_safe_timestamp_format = 'Y-m-d H:i:s O e'; |
|
26 | + // phpcs:enable |
|
27 | + |
|
28 | + // phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore |
|
29 | + /** |
|
30 | + * DateTime object converted to a string that includes the date, time, UTC offset, and timezone identifier |
|
31 | + * |
|
32 | + * @type string $_datetime_string |
|
33 | + */ |
|
34 | + protected $_datetime_string = ''; |
|
35 | + |
|
36 | + /** |
|
37 | + * where to write the error log to |
|
38 | + * |
|
39 | + * @type string $_error_log_dir |
|
40 | + */ |
|
41 | + protected $_error_log_dir = ''; |
|
42 | + // phpcs:enable |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @param string $error_log_dir |
|
47 | + */ |
|
48 | + public function setErrorLogDir($error_log_dir) |
|
49 | + { |
|
50 | + // if the folder path is writable, then except the path + filename, else keep empty |
|
51 | + $this->_error_log_dir = is_writable(str_replace(basename($error_log_dir), '', $error_log_dir)) |
|
52 | + ? $error_log_dir |
|
53 | + : ''; |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function __toString() |
|
61 | + { |
|
62 | + return $this->format(DbSafeDateTime::db_safe_timestamp_format); |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * @return array |
|
68 | + */ |
|
69 | + public function __sleep() |
|
70 | + { |
|
71 | + $this->_datetime_string = $this->format(DbSafeDateTime::db_safe_timestamp_format); |
|
72 | + $date = DateTime::createFromFormat( |
|
73 | + DbSafeDateTime::db_safe_timestamp_format, |
|
74 | + $this->_datetime_string |
|
75 | + ); |
|
76 | + if (! $date instanceof DateTime) { |
|
77 | + try { |
|
78 | + // we want a stack trace to determine where the malformed date came from, so... |
|
79 | + throw new DomainException(''); |
|
80 | + } catch (DomainException $e) { |
|
81 | + $stack_trace = $e->getTraceAsString(); |
|
82 | + } |
|
83 | + $this->writeToErrorLog( |
|
84 | + sprintf( |
|
85 | + __( |
|
86 | + 'A valid DateTime could not be generated from "%1$s" because the following errors occurred: %2$s %3$s %2$s PHP version: %4$s %2$s Stack Trace: %5$s', |
|
87 | + 'event_espresso' |
|
88 | + ), |
|
89 | + $this->_datetime_string, |
|
90 | + '<br />', |
|
91 | + print_r(DateTime::getLastErrors(), true), |
|
92 | + PHP_VERSION, |
|
93 | + $stack_trace |
|
94 | + ) |
|
95 | + ); |
|
96 | + } |
|
97 | + return array('_datetime_string'); |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * if an empty or null value got saved to the db for a datetime, |
|
103 | + * then some servers and/or PHP itself will incorrectly convert that date string |
|
104 | + * resulting in "-0001-11-30" for the year-month-day. |
|
105 | + * see the Notes section |
|
106 | + * |
|
107 | + * @link http://php.net/manual/en/datetime.formats.date.php |
|
108 | + * We'll replace those with "0000-00-00" which will allow a valid DateTime object to be created, |
|
109 | + * but still result in the internal date for that object being set to "-0001-11-30 10:00:00.000000". |
|
110 | + * so we're no better off, but at least things won't go fatal on us. |
|
111 | + */ |
|
112 | + public function __wakeup() |
|
113 | + { |
|
114 | + $this->_datetime_string = str_replace( |
|
115 | + array('-0001-11-29', '-0001-11-30'), |
|
116 | + '0000-00-00', |
|
117 | + $this->_datetime_string |
|
118 | + ); |
|
119 | + $date = DateTime::createFromFormat( |
|
120 | + DbSafeDateTime::db_safe_timestamp_format, |
|
121 | + $this->_datetime_string |
|
122 | + ); |
|
123 | + if (! $date instanceof DateTime) { |
|
124 | + $this->writeToErrorLog( |
|
125 | + sprintf( |
|
126 | + __( |
|
127 | + 'A valid DateTime could not be recreated from "%1$s" because the following errors occurred: %2$s %3$s %2$s PHP version: %4$s', |
|
128 | + 'event_espresso' |
|
129 | + ), |
|
130 | + $this->_datetime_string, |
|
131 | + '<br />', |
|
132 | + print_r(DateTime::getLastErrors(), true), |
|
133 | + PHP_VERSION |
|
134 | + ) |
|
135 | + ); |
|
136 | + } else { |
|
137 | + $this->__construct( |
|
138 | + $date->format(\EE_Datetime_Field::mysql_timestamp_format), |
|
139 | + new DateTimeZone($date->format('e')) |
|
140 | + ); |
|
141 | + } |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * Creates a DbSafeDateTime from ye old DateTime |
|
147 | + * |
|
148 | + * @param DateTime $datetime |
|
149 | + * @return \EventEspresso\core\domain\entities\DbSafeDateTime |
|
150 | + */ |
|
151 | + public static function createFromDateTime(DateTime $datetime) |
|
152 | + { |
|
153 | + return new DbSafeDateTime( |
|
154 | + $datetime->format(\EE_Datetime_Field::mysql_timestamp_format), |
|
155 | + new DateTimeZone($datetime->format('e')) |
|
156 | + ); |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @param string $message |
|
162 | + */ |
|
163 | + private function writeToErrorLog($message) |
|
164 | + { |
|
165 | + if (! empty($this->_error_log_dir)) { |
|
166 | + /** @noinspection ForgottenDebugOutputInspection */ |
|
167 | + error_log($message, 3, $this->_error_log_dir); |
|
168 | + } else { |
|
169 | + /** @noinspection ForgottenDebugOutputInspection */ |
|
170 | + error_log($message); |
|
171 | + } |
|
172 | + } |
|
173 | 173 | } |
@@ -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,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 | } |
@@ -13,130 +13,130 @@ |
||
13 | 13 | class CustomTaxonomyDefinitions |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var array $taxonomies |
|
18 | - */ |
|
19 | - private $taxonomies; |
|
16 | + /** |
|
17 | + * @var array $taxonomies |
|
18 | + */ |
|
19 | + private $taxonomies; |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * EspressoCustomPostTypeDefinitions constructor. |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - $this->setTaxonomies(); |
|
28 | - add_filter('pre_term_description', array($this, 'filterCustomTermDescription'), 1, 2); |
|
29 | - } |
|
22 | + /** |
|
23 | + * EspressoCustomPostTypeDefinitions constructor. |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + $this->setTaxonomies(); |
|
28 | + add_filter('pre_term_description', array($this, 'filterCustomTermDescription'), 1, 2); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - private function setTaxonomies() |
|
33 | - { |
|
34 | - $this->taxonomies = array( |
|
35 | - 'espresso_event_categories' => array( |
|
36 | - 'singular_name' => esc_html__('Event Category', 'event_espresso'), |
|
37 | - 'plural_name' => esc_html__('Event Categories', 'event_espresso'), |
|
38 | - 'args' => array( |
|
39 | - 'public' => true, |
|
40 | - 'show_in_nav_menus' => true, |
|
41 | - 'show_in_rest' => true, |
|
42 | - 'capabilities' => array( |
|
43 | - 'manage_terms' => 'ee_manage_event_categories', |
|
44 | - 'edit_terms' => 'ee_edit_event_category', |
|
45 | - 'delete_terms' => 'ee_delete_event_category', |
|
46 | - 'assign_terms' => 'ee_assign_event_category', |
|
47 | - ), |
|
48 | - 'rewrite' => array('slug' => esc_html__('event-category', 'event_espresso')), |
|
49 | - ), |
|
50 | - ), |
|
51 | - 'espresso_venue_categories' => array( |
|
52 | - 'singular_name' => esc_html__('Venue Category', 'event_espresso'), |
|
53 | - 'plural_name' => esc_html__('Venue Categories', 'event_espresso'), |
|
54 | - 'args' => array( |
|
55 | - 'public' => true, |
|
56 | - 'show_in_nav_menus' => false, // by default this doesn't show for decaf |
|
57 | - 'show_in_rest' => true, |
|
58 | - 'capabilities' => array( |
|
59 | - 'manage_terms' => 'ee_manage_venue_categories', |
|
60 | - 'edit_terms' => 'ee_edit_venue_category', |
|
61 | - 'delete_terms' => 'ee_delete_venue_category', |
|
62 | - 'assign_terms' => 'ee_assign_venue_category', |
|
63 | - ), |
|
64 | - 'rewrite' => array('slug' => esc_html__('venue-category', 'event_espresso')), |
|
65 | - ), |
|
66 | - ), |
|
67 | - 'espresso_event_type' => array( |
|
68 | - 'singular_name' => esc_html__('Event Type', 'event_espresso'), |
|
69 | - 'plural_name' => esc_html__('Event Types', 'event_espresso'), |
|
70 | - 'args' => array( |
|
71 | - 'public' => true, |
|
72 | - 'show_ui' => false, |
|
73 | - 'show_in_rest' => true, |
|
74 | - 'capabilities' => array( |
|
75 | - 'manage_terms' => 'ee_read_event_type', |
|
76 | - 'edit_terms' => 'ee_edit_event_type', |
|
77 | - 'delete_terms' => 'ee_delete_event_type', |
|
78 | - 'assign_terms' => 'ee_assign_event_type', |
|
79 | - ), |
|
80 | - 'rewrite' => array('slug' => esc_html__('event-type', 'event_espresso')), |
|
81 | - 'hierarchical' => true, |
|
82 | - ), |
|
83 | - ), |
|
84 | - ); |
|
85 | - } |
|
32 | + private function setTaxonomies() |
|
33 | + { |
|
34 | + $this->taxonomies = array( |
|
35 | + 'espresso_event_categories' => array( |
|
36 | + 'singular_name' => esc_html__('Event Category', 'event_espresso'), |
|
37 | + 'plural_name' => esc_html__('Event Categories', 'event_espresso'), |
|
38 | + 'args' => array( |
|
39 | + 'public' => true, |
|
40 | + 'show_in_nav_menus' => true, |
|
41 | + 'show_in_rest' => true, |
|
42 | + 'capabilities' => array( |
|
43 | + 'manage_terms' => 'ee_manage_event_categories', |
|
44 | + 'edit_terms' => 'ee_edit_event_category', |
|
45 | + 'delete_terms' => 'ee_delete_event_category', |
|
46 | + 'assign_terms' => 'ee_assign_event_category', |
|
47 | + ), |
|
48 | + 'rewrite' => array('slug' => esc_html__('event-category', 'event_espresso')), |
|
49 | + ), |
|
50 | + ), |
|
51 | + 'espresso_venue_categories' => array( |
|
52 | + 'singular_name' => esc_html__('Venue Category', 'event_espresso'), |
|
53 | + 'plural_name' => esc_html__('Venue Categories', 'event_espresso'), |
|
54 | + 'args' => array( |
|
55 | + 'public' => true, |
|
56 | + 'show_in_nav_menus' => false, // by default this doesn't show for decaf |
|
57 | + 'show_in_rest' => true, |
|
58 | + 'capabilities' => array( |
|
59 | + 'manage_terms' => 'ee_manage_venue_categories', |
|
60 | + 'edit_terms' => 'ee_edit_venue_category', |
|
61 | + 'delete_terms' => 'ee_delete_venue_category', |
|
62 | + 'assign_terms' => 'ee_assign_venue_category', |
|
63 | + ), |
|
64 | + 'rewrite' => array('slug' => esc_html__('venue-category', 'event_espresso')), |
|
65 | + ), |
|
66 | + ), |
|
67 | + 'espresso_event_type' => array( |
|
68 | + 'singular_name' => esc_html__('Event Type', 'event_espresso'), |
|
69 | + 'plural_name' => esc_html__('Event Types', 'event_espresso'), |
|
70 | + 'args' => array( |
|
71 | + 'public' => true, |
|
72 | + 'show_ui' => false, |
|
73 | + 'show_in_rest' => true, |
|
74 | + 'capabilities' => array( |
|
75 | + 'manage_terms' => 'ee_read_event_type', |
|
76 | + 'edit_terms' => 'ee_edit_event_type', |
|
77 | + 'delete_terms' => 'ee_delete_event_type', |
|
78 | + 'assign_terms' => 'ee_assign_event_type', |
|
79 | + ), |
|
80 | + 'rewrite' => array('slug' => esc_html__('event-type', 'event_espresso')), |
|
81 | + 'hierarchical' => true, |
|
82 | + ), |
|
83 | + ), |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * @return array |
|
90 | - */ |
|
91 | - public function getCustomTaxonomyDefinitions() |
|
92 | - { |
|
93 | - return (array) apply_filters( |
|
94 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
95 | - // legacy filter applied for now, |
|
96 | - // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice |
|
97 | - apply_filters( |
|
98 | - 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', |
|
99 | - $this->taxonomies |
|
100 | - ) |
|
101 | - ); |
|
102 | - } |
|
88 | + /** |
|
89 | + * @return array |
|
90 | + */ |
|
91 | + public function getCustomTaxonomyDefinitions() |
|
92 | + { |
|
93 | + return (array) apply_filters( |
|
94 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
95 | + // legacy filter applied for now, |
|
96 | + // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice |
|
97 | + apply_filters( |
|
98 | + 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', |
|
99 | + $this->taxonomies |
|
100 | + ) |
|
101 | + ); |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | - /** |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - public function getCustomTaxonomySlugs() |
|
109 | - { |
|
110 | - return array_keys($this->getCustomTaxonomyDefinitions()); |
|
111 | - } |
|
105 | + /** |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + public function getCustomTaxonomySlugs() |
|
109 | + { |
|
110 | + return array_keys($this->getCustomTaxonomyDefinitions()); |
|
111 | + } |
|
112 | 112 | |
113 | 113 | |
114 | - /** |
|
115 | - * By default, WordPress strips all html from term taxonomy description content. |
|
116 | - * The purpose of this method is to remove that restriction |
|
117 | - * and ensure that we still run ee term taxonomy descriptions |
|
118 | - * through some full html sanitization equivalent to the post content field. |
|
119 | - * So first we remove default filter for term description |
|
120 | - * but we have to do this earlier before wp sets their own filter |
|
121 | - * because they just set a global filter on all term descriptions |
|
122 | - * before the custom term description filter. |
|
123 | - * Really sux. |
|
124 | - * |
|
125 | - * @param string $description The description content. |
|
126 | - * @param string $taxonomy The taxonomy name for the taxonomy being filtered. |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function filterCustomTermDescription($description, $taxonomy) |
|
130 | - { |
|
131 | - // get a list of EE taxonomies |
|
132 | - $custom_taxonomies = $this->getCustomTaxonomySlugs(); |
|
133 | - // only do our own thing if the taxonomy listed is an ee taxonomy. |
|
134 | - if (in_array($taxonomy, $custom_taxonomies, true)) { |
|
135 | - // remove default wp filter |
|
136 | - remove_filter('pre_term_description', 'wp_filter_kses'); |
|
137 | - // sanitize THIS content. |
|
138 | - $description = wp_kses($description, wp_kses_allowed_html('post')); |
|
139 | - } |
|
140 | - return $description; |
|
141 | - } |
|
114 | + /** |
|
115 | + * By default, WordPress strips all html from term taxonomy description content. |
|
116 | + * The purpose of this method is to remove that restriction |
|
117 | + * and ensure that we still run ee term taxonomy descriptions |
|
118 | + * through some full html sanitization equivalent to the post content field. |
|
119 | + * So first we remove default filter for term description |
|
120 | + * but we have to do this earlier before wp sets their own filter |
|
121 | + * because they just set a global filter on all term descriptions |
|
122 | + * before the custom term description filter. |
|
123 | + * Really sux. |
|
124 | + * |
|
125 | + * @param string $description The description content. |
|
126 | + * @param string $taxonomy The taxonomy name for the taxonomy being filtered. |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function filterCustomTermDescription($description, $taxonomy) |
|
130 | + { |
|
131 | + // get a list of EE taxonomies |
|
132 | + $custom_taxonomies = $this->getCustomTaxonomySlugs(); |
|
133 | + // only do our own thing if the taxonomy listed is an ee taxonomy. |
|
134 | + if (in_array($taxonomy, $custom_taxonomies, true)) { |
|
135 | + // remove default wp filter |
|
136 | + remove_filter('pre_term_description', 'wp_filter_kses'); |
|
137 | + // sanitize THIS content. |
|
138 | + $description = wp_kses($description, wp_kses_allowed_html('post')); |
|
139 | + } |
|
140 | + return $description; |
|
141 | + } |
|
142 | 142 | } |
@@ -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 | } |