@@ -13,25 +13,25 @@ discard block |
||
13 | 13 | <div id="ee-block-event-attendees" class="ee-core-blocks event-espresso-blocks event-attendees"> |
14 | 14 | <ul> |
15 | 15 | <?php |
16 | - foreach ($attendees as $attendee) { |
|
17 | - $attendee_name = esc_html($attendee->full_name()); |
|
16 | + foreach ($attendees as $attendee) { |
|
17 | + $attendee_name = esc_html($attendee->full_name()); |
|
18 | 18 | |
19 | - $gravatar = $attributes['showGravatar'] |
|
20 | - ? get_avatar_url( |
|
21 | - $attendee->email(), |
|
22 | - array( |
|
23 | - 'width' => $attributes['avatarSize'], |
|
24 | - 'height' => $attributes['avatarSize'] |
|
25 | - ) |
|
26 | - ) |
|
27 | - : ''; |
|
19 | + $gravatar = $attributes['showGravatar'] |
|
20 | + ? get_avatar_url( |
|
21 | + $attendee->email(), |
|
22 | + array( |
|
23 | + 'width' => $attributes['avatarSize'], |
|
24 | + 'height' => $attributes['avatarSize'] |
|
25 | + ) |
|
26 | + ) |
|
27 | + : ''; |
|
28 | 28 | |
29 | - $gravatar_class = $attributes['avatarClass'] |
|
30 | - ? $attributes['avatarClass'] . ' contact-avatar-img avatar' |
|
31 | - : 'contact-avatar-img avatar'; |
|
29 | + $gravatar_class = $attributes['avatarClass'] |
|
30 | + ? $attributes['avatarClass'] . ' contact-avatar-img avatar' |
|
31 | + : 'contact-avatar-img avatar'; |
|
32 | 32 | |
33 | - $gravatar = $gravatar !== '' |
|
34 | - ? ' |
|
33 | + $gravatar = $gravatar !== '' |
|
34 | + ? ' |
|
35 | 35 | <div class="contact-image-wrap-div"> |
36 | 36 | <img class="' . esc_attr($gravatar_class) . '" |
37 | 37 | width="' . esc_attr($attributes['avatarSize']) . '" |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | alt="contact avatar" |
41 | 41 | > |
42 | 42 | </div>' |
43 | - : ''; |
|
43 | + : ''; |
|
44 | 44 | |
45 | - echo " |
|
45 | + echo " |
|
46 | 46 | <li> |
47 | 47 | {$gravatar}<span>{$attendee_name}</span> |
48 | 48 | </li>"; |
49 | - } |
|
50 | - ?> |
|
49 | + } |
|
50 | + ?> |
|
51 | 51 | </ul> |
52 | 52 | </div> |
@@ -27,16 +27,16 @@ |
||
27 | 27 | : ''; |
28 | 28 | |
29 | 29 | $gravatar_class = $attributes['avatarClass'] |
30 | - ? $attributes['avatarClass'] . ' contact-avatar-img avatar' |
|
30 | + ? $attributes['avatarClass'].' contact-avatar-img avatar' |
|
31 | 31 | : 'contact-avatar-img avatar'; |
32 | 32 | |
33 | 33 | $gravatar = $gravatar !== '' |
34 | 34 | ? ' |
35 | 35 | <div class="contact-image-wrap-div"> |
36 | - <img class="' . esc_attr($gravatar_class) . '" |
|
37 | - width="' . esc_attr($attributes['avatarSize']) . '" |
|
38 | - height="' . esc_attr($attributes['avatarSize']) . '" |
|
39 | - src="' . esc_url_raw($gravatar) . '" |
|
36 | + <img class="' . esc_attr($gravatar_class).'" |
|
37 | + width="' . esc_attr($attributes['avatarSize']).'" |
|
38 | + height="' . esc_attr($attributes['avatarSize']).'" |
|
39 | + src="' . esc_url_raw($gravatar).'" |
|
40 | 40 | alt="contact avatar" |
41 | 41 | > |
42 | 42 | </div>' |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function setId($id = '') |
123 | 123 | { |
124 | - if (! is_string($id)) { |
|
124 | + if ( ! is_string($id)) { |
|
125 | 125 | throw new InvalidDataTypeException('$id', $id, 'string'); |
126 | 126 | } |
127 | 127 | $this->id = $id; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | protected function setOrder($order = 0) |
146 | 146 | { |
147 | - if (! is_int($order)) { |
|
147 | + if ( ! is_int($order)) { |
|
148 | 148 | throw new InvalidDataTypeException('$order', $order, 'integer'); |
149 | 149 | } |
150 | 150 | $this->order = absint($order); |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function setHtmlClass($html_class) |
175 | 175 | { |
176 | - if (! is_string($html_class)) { |
|
176 | + if ( ! is_string($html_class)) { |
|
177 | 177 | throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
178 | 178 | } |
179 | 179 | if (strpos($html_class, 'progress-step-') === false) { |
180 | - $html_class = 'progress-step-' . $html_class; |
|
180 | + $html_class = 'progress-step-'.$html_class; |
|
181 | 181 | } |
182 | 182 | $this->html_class = $html_class; |
183 | 183 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function setText($text) |
201 | 201 | { |
202 | - if (! is_string($text)) { |
|
202 | + if ( ! is_string($text)) { |
|
203 | 203 | throw new InvalidDataTypeException('$text', $text, 'string'); |
204 | 204 | } |
205 | 205 | $this->text = sanitize_text_field($text); |
@@ -16,190 +16,190 @@ |
||
16 | 16 | */ |
17 | 17 | class ProgressStep implements ProgressStepInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * @var boolean $current |
|
21 | - */ |
|
22 | - private $current = false; |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * @var boolean $completed |
|
27 | - */ |
|
28 | - private $completed = false; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * @var string $html_class |
|
33 | - */ |
|
34 | - private $html_class; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string $id |
|
38 | - */ |
|
39 | - private $id = ''; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var int $order |
|
43 | - */ |
|
44 | - private $order = 0; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var string $text |
|
48 | - */ |
|
49 | - private $text = ''; |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * ProgressStep constructor |
|
54 | - * |
|
55 | - * @param int $order |
|
56 | - * @param string $id |
|
57 | - * @param string $html_class |
|
58 | - * @param string $text |
|
59 | - * @throws InvalidDataTypeException |
|
60 | - */ |
|
61 | - public function __construct($order, $id, $html_class, $text) |
|
62 | - { |
|
63 | - $this->setOrder($order); |
|
64 | - $this->setId($id); |
|
65 | - $this->setHtmlClass($html_class); |
|
66 | - $this->setText($text); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * @return boolean |
|
72 | - */ |
|
73 | - public function isCurrent() |
|
74 | - { |
|
75 | - return $this->current; |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @param boolean $current |
|
81 | - */ |
|
82 | - public function setIsCurrent($current = true) |
|
83 | - { |
|
84 | - $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @return boolean |
|
90 | - */ |
|
91 | - public function isCompleted() |
|
92 | - { |
|
93 | - return $this->completed; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param boolean $completed |
|
99 | - */ |
|
100 | - public function setIsCompleted($completed = true) |
|
101 | - { |
|
102 | - $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - public function id() |
|
110 | - { |
|
111 | - return $this->id; |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @access protected |
|
117 | - * @param string $id |
|
118 | - * @throws InvalidDataTypeException |
|
119 | - */ |
|
120 | - protected function setId($id = '') |
|
121 | - { |
|
122 | - if (! is_string($id)) { |
|
123 | - throw new InvalidDataTypeException('$id', $id, 'string'); |
|
124 | - } |
|
125 | - $this->id = $id; |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * @return int |
|
131 | - */ |
|
132 | - public function order() |
|
133 | - { |
|
134 | - return $this->order; |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * @access protected |
|
140 | - * @param int $order |
|
141 | - * @throws InvalidDataTypeException |
|
142 | - */ |
|
143 | - protected function setOrder($order = 0) |
|
144 | - { |
|
145 | - if (! is_int($order)) { |
|
146 | - throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
147 | - } |
|
148 | - $this->order = absint($order); |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * @return string |
|
154 | - */ |
|
155 | - public function htmlClass() |
|
156 | - { |
|
157 | - $html_class = $this->html_class; |
|
158 | - if ($this->isCurrent()) { |
|
159 | - $html_class .= ' progress-step-active'; |
|
160 | - } elseif ($this->isCompleted()) { |
|
161 | - $html_class .= ' progress-step-completed'; |
|
162 | - } |
|
163 | - return $html_class; |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * @access protected |
|
169 | - * @param string $html_class |
|
170 | - * @throws InvalidDataTypeException |
|
171 | - */ |
|
172 | - protected function setHtmlClass($html_class) |
|
173 | - { |
|
174 | - if (! is_string($html_class)) { |
|
175 | - throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
176 | - } |
|
177 | - if (strpos($html_class, 'progress-step-') === false) { |
|
178 | - $html_class = 'progress-step-' . $html_class; |
|
179 | - } |
|
180 | - $this->html_class = $html_class; |
|
181 | - } |
|
182 | - |
|
183 | - |
|
184 | - /** |
|
185 | - * @return string |
|
186 | - */ |
|
187 | - public function text() |
|
188 | - { |
|
189 | - return $this->text; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * @access protected |
|
195 | - * @param string $text |
|
196 | - * @throws InvalidDataTypeException |
|
197 | - */ |
|
198 | - protected function setText($text) |
|
199 | - { |
|
200 | - if (! is_string($text)) { |
|
201 | - throw new InvalidDataTypeException('$text', $text, 'string'); |
|
202 | - } |
|
203 | - $this->text = sanitize_text_field($text); |
|
204 | - } |
|
19 | + /** |
|
20 | + * @var boolean $current |
|
21 | + */ |
|
22 | + private $current = false; |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * @var boolean $completed |
|
27 | + */ |
|
28 | + private $completed = false; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * @var string $html_class |
|
33 | + */ |
|
34 | + private $html_class; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string $id |
|
38 | + */ |
|
39 | + private $id = ''; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var int $order |
|
43 | + */ |
|
44 | + private $order = 0; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var string $text |
|
48 | + */ |
|
49 | + private $text = ''; |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * ProgressStep constructor |
|
54 | + * |
|
55 | + * @param int $order |
|
56 | + * @param string $id |
|
57 | + * @param string $html_class |
|
58 | + * @param string $text |
|
59 | + * @throws InvalidDataTypeException |
|
60 | + */ |
|
61 | + public function __construct($order, $id, $html_class, $text) |
|
62 | + { |
|
63 | + $this->setOrder($order); |
|
64 | + $this->setId($id); |
|
65 | + $this->setHtmlClass($html_class); |
|
66 | + $this->setText($text); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * @return boolean |
|
72 | + */ |
|
73 | + public function isCurrent() |
|
74 | + { |
|
75 | + return $this->current; |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @param boolean $current |
|
81 | + */ |
|
82 | + public function setIsCurrent($current = true) |
|
83 | + { |
|
84 | + $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @return boolean |
|
90 | + */ |
|
91 | + public function isCompleted() |
|
92 | + { |
|
93 | + return $this->completed; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param boolean $completed |
|
99 | + */ |
|
100 | + public function setIsCompleted($completed = true) |
|
101 | + { |
|
102 | + $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + public function id() |
|
110 | + { |
|
111 | + return $this->id; |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @access protected |
|
117 | + * @param string $id |
|
118 | + * @throws InvalidDataTypeException |
|
119 | + */ |
|
120 | + protected function setId($id = '') |
|
121 | + { |
|
122 | + if (! is_string($id)) { |
|
123 | + throw new InvalidDataTypeException('$id', $id, 'string'); |
|
124 | + } |
|
125 | + $this->id = $id; |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * @return int |
|
131 | + */ |
|
132 | + public function order() |
|
133 | + { |
|
134 | + return $this->order; |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * @access protected |
|
140 | + * @param int $order |
|
141 | + * @throws InvalidDataTypeException |
|
142 | + */ |
|
143 | + protected function setOrder($order = 0) |
|
144 | + { |
|
145 | + if (! is_int($order)) { |
|
146 | + throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
147 | + } |
|
148 | + $this->order = absint($order); |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * @return string |
|
154 | + */ |
|
155 | + public function htmlClass() |
|
156 | + { |
|
157 | + $html_class = $this->html_class; |
|
158 | + if ($this->isCurrent()) { |
|
159 | + $html_class .= ' progress-step-active'; |
|
160 | + } elseif ($this->isCompleted()) { |
|
161 | + $html_class .= ' progress-step-completed'; |
|
162 | + } |
|
163 | + return $html_class; |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * @access protected |
|
169 | + * @param string $html_class |
|
170 | + * @throws InvalidDataTypeException |
|
171 | + */ |
|
172 | + protected function setHtmlClass($html_class) |
|
173 | + { |
|
174 | + if (! is_string($html_class)) { |
|
175 | + throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
176 | + } |
|
177 | + if (strpos($html_class, 'progress-step-') === false) { |
|
178 | + $html_class = 'progress-step-' . $html_class; |
|
179 | + } |
|
180 | + $this->html_class = $html_class; |
|
181 | + } |
|
182 | + |
|
183 | + |
|
184 | + /** |
|
185 | + * @return string |
|
186 | + */ |
|
187 | + public function text() |
|
188 | + { |
|
189 | + return $this->text; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * @access protected |
|
195 | + * @param string $text |
|
196 | + * @throws InvalidDataTypeException |
|
197 | + */ |
|
198 | + protected function setText($text) |
|
199 | + { |
|
200 | + if (! is_string($text)) { |
|
201 | + throw new InvalidDataTypeException('$text', $text, 'string'); |
|
202 | + } |
|
203 | + $this->text = sanitize_text_field($text); |
|
204 | + } |
|
205 | 205 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | public function get_shortcode_helper() |
148 | 148 | { |
149 | - if (! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) { |
|
149 | + if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) { |
|
150 | 150 | $this->_set_shortcode_helper(); |
151 | 151 | } |
152 | 152 | return $this->_shortcode_helper; |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | |
171 | 171 | // we need to setup any dynamic shortcodes so that they work with the array_key_exists |
172 | 172 | preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches); |
173 | - $sc_to_verify = ! empty($matches[0]) ? $matches[0][0] . ']' : $shortcode; |
|
173 | + $sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode; |
|
174 | 174 | |
175 | 175 | // first we want to make sure this is a valid shortcode |
176 | - if (! array_key_exists($sc_to_verify, $this->_shortcodes)) { |
|
176 | + if ( ! array_key_exists($sc_to_verify, $this->_shortcodes)) { |
|
177 | 177 | return false; |
178 | 178 | } //get out, this parser doesn't handle the incoming shortcode. |
179 | 179 | $this->_data = $data; |
180 | 180 | $this->_extra_data = $extra_data; |
181 | 181 | $this->_set_messages_properties(); |
182 | 182 | $parsed = apply_filters( |
183 | - 'FHEE__' . get_class($this) . '__parser_after', |
|
183 | + 'FHEE__'.get_class($this).'__parser_after', |
|
184 | 184 | $this->_parser($shortcode), |
185 | 185 | $shortcode, |
186 | 186 | $data, |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function get_shortcodes() |
203 | 203 | { |
204 | - $this->_shortcodes = apply_filters('FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this); |
|
204 | + $this->_shortcodes = apply_filters('FHEE__'.get_class($this).'__shortcodes', $this->_shortcodes, $this); |
|
205 | 205 | |
206 | 206 | // note the below filter applies to ALL shortcode parsers... be careful! |
207 | 207 | $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | { |
249 | 249 | |
250 | 250 | // first test to make sure we've got an array! |
251 | - if (! is_array($this->_data)) { |
|
251 | + if ( ! is_array($this->_data)) { |
|
252 | 252 | throw new EE_Error( |
253 | 253 | sprintf( |
254 | 254 | esc_html__( |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | // next test to make sure we've got the required template in the index! |
265 | - if (! isset($this->_data['template'])) { |
|
265 | + if ( ! isset($this->_data['template'])) { |
|
266 | 266 | throw new EE_Error( |
267 | 267 | sprintf( |
268 | 268 | esc_html__( |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | // next test to make sure we've got got a data index in the incoming data array |
277 | - if (! isset($this->_data['data'])) { |
|
277 | + if ( ! isset($this->_data['data'])) { |
|
278 | 278 | throw new EE_Error( |
279 | 279 | esc_html__( |
280 | 280 | 'The incoming data does not have the required data index in its array', |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | { |
304 | 304 | // make sure the required wp helper function is present |
305 | 305 | // require the shortcode file if necessary |
306 | - if (! function_exists('shortcode_parse_atts')) { |
|
307 | - require_once(ABSPATH . WPINC . '/shortcodes.php'); |
|
306 | + if ( ! function_exists('shortcode_parse_atts')) { |
|
307 | + require_once(ABSPATH.WPINC.'/shortcodes.php'); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // let's get any attributes that may be present and set the defaults. |
@@ -329,15 +329,15 @@ discard block |
||
329 | 329 | protected function _mutate_conditional_block_in_template($shortcode, $show = true) |
330 | 330 | { |
331 | 331 | // first let's get all the matches in the template for this particular shortcode. |
332 | - preg_match_all('~' . $this->_get_conditional_block_regex($shortcode) . '~', $this->_data['template'], $matches); |
|
332 | + preg_match_all('~'.$this->_get_conditional_block_regex($shortcode).'~', $this->_data['template'], $matches); |
|
333 | 333 | |
334 | 334 | if ($matches && is_array($matches[0]) && ! empty($matches[0])) { |
335 | 335 | // we need to hide all instances of the matches |
336 | 336 | foreach ($matches[0] as $index => $content_to_show_or_hide) { |
337 | 337 | $content_to_show_or_hide = preg_quote($content_to_show_or_hide); |
338 | - $replacement = $show ? $matches[4][ $index ] : ''; |
|
338 | + $replacement = $show ? $matches[4][$index] : ''; |
|
339 | 339 | $this->_data['template'] = preg_replace( |
340 | - '~' . $content_to_show_or_hide . '~', |
|
340 | + '~'.$content_to_show_or_hide.'~', |
|
341 | 341 | $replacement, |
342 | 342 | $this->_data['template'] |
343 | 343 | ); |
@@ -16,456 +16,456 @@ |
||
16 | 16 | */ |
17 | 17 | abstract class EE_Shortcodes extends EE_Base |
18 | 18 | { |
19 | - /** |
|
20 | - * holds label for library |
|
21 | - * This is used for referencing the library label |
|
22 | - * |
|
23 | - * @access public |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - public $label; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * This property is used for referencing a short description of the library |
|
31 | - * |
|
32 | - * @access public |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - public $description; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This will hold an array of shortcodes with the key as the shortcode ([shortcode]) and the value as a |
|
40 | - * label/description for the shortcode. |
|
41 | - * |
|
42 | - * @access protected |
|
43 | - * @var array |
|
44 | - */ |
|
45 | - protected $_shortcodes; |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * This will hold the incoming data item sent to the parser method |
|
50 | - * |
|
51 | - * @access protected |
|
52 | - * @var mixed (array|object) |
|
53 | - */ |
|
54 | - protected $_data; |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * some shortcodes may require extra data to parse. This property is provided for that. |
|
59 | - * |
|
60 | - * @var array |
|
61 | - */ |
|
62 | - protected $_extra_data; |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * EE_messenger used to generate the template being parsed. |
|
67 | - * |
|
68 | - * @since 4.5.0 |
|
69 | - * @var EE_messenger |
|
70 | - */ |
|
71 | - protected $_messenger; |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * message type used to generate the template being parsed. |
|
76 | - * |
|
77 | - * @since 4.5.0 |
|
78 | - * @var EE_message_type |
|
79 | - */ |
|
80 | - protected $_message_type; |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * context used for the template being parsed |
|
85 | - * |
|
86 | - * @since 4.5.0 |
|
87 | - * @var string |
|
88 | - */ |
|
89 | - protected $_context; |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * Specific Message Template Group ID |
|
94 | - * |
|
95 | - * @since 4.5.0 |
|
96 | - * @var int |
|
97 | - */ |
|
98 | - protected $_GRP_ID; |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * @since 4.9.0 |
|
103 | - * @type EE_Message |
|
104 | - */ |
|
105 | - protected $_message; |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * This will hold an instance of the EEH_Parse_Shortcodes helper that will be used when handling list type |
|
110 | - * shortcodes |
|
111 | - * |
|
112 | - * @var EEH_Parse_Shortcodes |
|
113 | - */ |
|
114 | - protected $_shortcode_helper; |
|
115 | - |
|
116 | - |
|
117 | - public function __construct() |
|
118 | - { |
|
119 | - $this->_set_defaults(); |
|
120 | - $this->_init_props(); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * This sets the defaults for the properties. Child classes will override these properties in their _init_props |
|
126 | - * method |
|
127 | - */ |
|
128 | - private function _set_defaults() |
|
129 | - { |
|
130 | - $this->name = $this->description = ''; |
|
131 | - $this->_shortcodes = array(); |
|
132 | - $this->_set_shortcode_helper(); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * loads an instance of the EE_Shortcode_Parser helper when requested |
|
138 | - */ |
|
139 | - protected function _set_shortcode_helper() |
|
140 | - { |
|
141 | - // get shortcode_replace instance- set when _get_messages is called in child... |
|
142 | - $this->_shortcode_helper = new EEH_Parse_Shortcodes(); |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - public function get_shortcode_helper() |
|
147 | - { |
|
148 | - if (! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) { |
|
149 | - $this->_set_shortcode_helper(); |
|
150 | - } |
|
151 | - return $this->_shortcode_helper; |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * This is the public method for kicking of the parser included with each child. It can be overridden by child |
|
157 | - * classes if necessary (see EE_Questions_Answers for example) |
|
158 | - * |
|
159 | - * @param string $shortcode incoming shortcode to be parsed |
|
160 | - * @param mixed (object|array) $data incoming data to be be used for parsing |
|
161 | - * @param mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee) |
|
162 | - * @return string parsed shortcode. |
|
163 | - */ |
|
164 | - public function parser($shortcode, $data, $extra_data = array()) |
|
165 | - { |
|
166 | - |
|
167 | - // filter setup shortcodes |
|
168 | - $this->_shortcodes = $this->get_shortcodes(); |
|
169 | - |
|
170 | - // we need to setup any dynamic shortcodes so that they work with the array_key_exists |
|
171 | - preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches); |
|
172 | - $sc_to_verify = ! empty($matches[0]) ? $matches[0][0] . ']' : $shortcode; |
|
173 | - |
|
174 | - // first we want to make sure this is a valid shortcode |
|
175 | - if (! array_key_exists($sc_to_verify, $this->_shortcodes)) { |
|
176 | - return false; |
|
177 | - } //get out, this parser doesn't handle the incoming shortcode. |
|
178 | - $this->_data = $data; |
|
179 | - $this->_extra_data = $extra_data; |
|
180 | - $this->_set_messages_properties(); |
|
181 | - $parsed = apply_filters( |
|
182 | - 'FHEE__' . get_class($this) . '__parser_after', |
|
183 | - $this->_parser($shortcode), |
|
184 | - $shortcode, |
|
185 | - $data, |
|
186 | - $extra_data, |
|
187 | - $this |
|
188 | - ); |
|
189 | - |
|
190 | - // note the below filter applies to ALL shortcode parsers... be careful! |
|
191 | - return apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this); |
|
192 | - } |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * This method just returns the shortcodes in the $_shortcodes array property. |
|
197 | - * |
|
198 | - * @access public |
|
199 | - * @return array array of shortcodes => description pairs |
|
200 | - */ |
|
201 | - public function get_shortcodes() |
|
202 | - { |
|
203 | - $this->_shortcodes = apply_filters('FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this); |
|
204 | - |
|
205 | - // note the below filter applies to ALL shortcode parsers... be careful! |
|
206 | - $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this); |
|
207 | - |
|
208 | - return $this->_shortcodes; |
|
209 | - } |
|
210 | - |
|
211 | - |
|
212 | - /** |
|
213 | - * Child classes use this method to set the $name, $description, and $_shortcodes properties. |
|
214 | - * |
|
215 | - * @abstract |
|
216 | - * @access protected |
|
217 | - * @return void |
|
218 | - */ |
|
219 | - abstract protected function _init_props(); |
|
220 | - |
|
221 | - |
|
222 | - /** |
|
223 | - * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
224 | - * will have to take care of handling. |
|
225 | - * |
|
226 | - * @abstract |
|
227 | - * @access protected |
|
228 | - * @param string $shortcode the shortcode to be parsed. |
|
229 | - * @param mixed (object|array) $data incoming data for the parser. The data could be either an object or |
|
230 | - * array because there are some shortcodes that might be replaced by prepared data that |
|
231 | - * has multiple items in a list (i.e. list of attendees in an event and we're showing |
|
232 | - * fname/lname for each attendee). In this case data will be in an array. Otherwise |
|
233 | - * the data shoudl be in a properly formatted object. The |
|
234 | - * EEH_Parse_Shortcodes.helper.php describes the data object we're expecting. |
|
235 | - * @return string parsed shortcode |
|
236 | - */ |
|
237 | - abstract protected function _parser($shortcode); |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * This just validates incoming data for list type shortcode parsers (and they call this method) to make sure it |
|
242 | - * meets their requirements |
|
243 | - * |
|
244 | - * @return mixed (void|exception) If validation fails we'll throw an exception. |
|
245 | - */ |
|
246 | - protected function _validate_list_requirements() |
|
247 | - { |
|
248 | - |
|
249 | - // first test to make sure we've got an array! |
|
250 | - if (! is_array($this->_data)) { |
|
251 | - throw new EE_Error( |
|
252 | - sprintf( |
|
253 | - esc_html__( |
|
254 | - 'Expecting an array for the data sent to %s. Instead it was %s', |
|
255 | - 'event_espresso' |
|
256 | - ), |
|
257 | - get_class($this), |
|
258 | - gettype($this->_data) |
|
259 | - ) |
|
260 | - ); |
|
261 | - } |
|
262 | - |
|
263 | - // next test to make sure we've got the required template in the index! |
|
264 | - if (! isset($this->_data['template'])) { |
|
265 | - throw new EE_Error( |
|
266 | - sprintf( |
|
267 | - esc_html__( |
|
268 | - 'The incoming data does not have the required template index in its array', |
|
269 | - 'event_espresso' |
|
270 | - ) |
|
271 | - ) |
|
272 | - ); |
|
273 | - } |
|
274 | - |
|
275 | - // next test to make sure we've got got a data index in the incoming data array |
|
276 | - if (! isset($this->_data['data'])) { |
|
277 | - throw new EE_Error( |
|
278 | - esc_html__( |
|
279 | - 'The incoming data does not have the required data index in its array', |
|
280 | - 'event_espresso' |
|
281 | - ) |
|
282 | - ); |
|
283 | - } |
|
284 | - |
|
285 | - // all is well let's make sure _extra_data always has the values needed. |
|
286 | - // let's make sure that extra_data includes all templates (for later parsing if necessary) |
|
287 | - if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) { |
|
288 | - $this->_extra_data['data'] = $this->_data['data']; |
|
289 | - $this->_extra_data['template'] = $this->_data['template']; |
|
290 | - } |
|
291 | - } |
|
292 | - |
|
293 | - |
|
294 | - /** |
|
295 | - * This returns any attributes that may be existing on an EE_Shortcode |
|
296 | - * |
|
297 | - * @since 4.5.0 |
|
298 | - * @param string $shortcode incoming shortcode |
|
299 | - * @return array An array with the attributes |
|
300 | - */ |
|
301 | - protected function _get_shortcode_attrs($shortcode) |
|
302 | - { |
|
303 | - // make sure the required wp helper function is present |
|
304 | - // require the shortcode file if necessary |
|
305 | - if (! function_exists('shortcode_parse_atts')) { |
|
306 | - require_once(ABSPATH . WPINC . '/shortcodes.php'); |
|
307 | - } |
|
308 | - |
|
309 | - // let's get any attributes that may be present and set the defaults. |
|
310 | - $shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode)); |
|
311 | - return shortcode_parse_atts($shortcode_to_parse); |
|
312 | - } |
|
313 | - |
|
314 | - |
|
315 | - /** |
|
316 | - * Conditional blocks are shortcode patterns with an opening conditional tag `[IF_*]` and a corresponding |
|
317 | - * closing tag (eg `[/IF_*]`). The content within the tags will be displayed/hidden depending on whatever |
|
318 | - * conditions existed in the opening tag. This method handles parsing the actual template to show/hide this |
|
319 | - * conditional content. |
|
320 | - * |
|
321 | - * @since 4.9.32 |
|
322 | - * |
|
323 | - * @param string $shortcode This should be original shortcode as used in the template and passed to the parser. |
|
324 | - * @param bool $show true means the opening and closing tags are removed and the content is left showing, |
|
325 | - * false means the opening and closing tags and the contained content are removed. |
|
326 | - * @return string The template for the shortcode is returned. |
|
327 | - */ |
|
328 | - protected function _mutate_conditional_block_in_template($shortcode, $show = true) |
|
329 | - { |
|
330 | - // first let's get all the matches in the template for this particular shortcode. |
|
331 | - preg_match_all('~' . $this->_get_conditional_block_regex($shortcode) . '~', $this->_data['template'], $matches); |
|
332 | - |
|
333 | - if ($matches && is_array($matches[0]) && ! empty($matches[0])) { |
|
334 | - // we need to hide all instances of the matches |
|
335 | - foreach ($matches[0] as $index => $content_to_show_or_hide) { |
|
336 | - $content_to_show_or_hide = preg_quote($content_to_show_or_hide); |
|
337 | - $replacement = $show ? $matches[4][ $index ] : ''; |
|
338 | - $this->_data['template'] = preg_replace( |
|
339 | - '~' . $content_to_show_or_hide . '~', |
|
340 | - $replacement, |
|
341 | - $this->_data['template'] |
|
342 | - ); |
|
343 | - } |
|
344 | - } |
|
345 | - // return $template |
|
346 | - return $this->_data['template']; |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - /** |
|
351 | - * This returns the regex pattern to use for conditional shortcodes parsing. |
|
352 | - * |
|
353 | - * Note: regex comes in part from the WP `get_shortcode_regex` expression in \wp-includes\shortcodes.php |
|
354 | - * |
|
355 | - * @param $shortcode |
|
356 | - * @since 4.9.32 |
|
357 | - * @return string |
|
358 | - */ |
|
359 | - private function _get_conditional_block_regex($shortcode) |
|
360 | - { |
|
361 | - // get just the shortcode tag for the match |
|
362 | - preg_match('@\[([^<>&/\[\]\x00-\x20=]++)@', $shortcode, $shortcode_tag_matches); |
|
363 | - if (empty($shortcode_tag_matches[1])) { |
|
364 | - return $this->_data['template']; |
|
365 | - } |
|
366 | - |
|
367 | - $shortcode_tag = $shortcode_tag_matches[1]; |
|
368 | - // get attributes_part_of_tag |
|
369 | - $attributes_part = preg_quote(str_replace(array($shortcode_tag, '[', ']'), '', $shortcode)); |
|
370 | - // escape |
|
371 | - $shortcode_tag = preg_quote($shortcode_tag); |
|
372 | - |
|
373 | - return |
|
374 | - '\[' // Opening Bracket |
|
375 | - . "($shortcode_tag)$attributes_part" // 1: Shortcode Name |
|
376 | - . '(?![\w-])' // Not followed by word character or hyphen |
|
377 | - . '(' // 2: Unroll the loop: Inside the opening shortcode tag |
|
378 | - . '[^\]\/]*' // Not a closing bracket or forward slash |
|
379 | - . '(?:' |
|
380 | - . '\/(?!\])' // A forward slash not followed by a closing bracket |
|
381 | - . '[^\]\/]*' // Not a closing bracket or forward slash. |
|
382 | - . ')*?' |
|
383 | - . ')' |
|
384 | - . '(?:' |
|
385 | - . '(\/)' // 3. Self closing tag ... |
|
386 | - . '\]' // ... and closing bracket |
|
387 | - . '|' |
|
388 | - . '\]' // Closing bracket |
|
389 | - . '(?:' |
|
390 | - . '(' // 4: Unroll the loop: Optionally, anything between the opening and closing brackets |
|
391 | - . '[^\[]*+' // Not an opening bracket |
|
392 | - . '(?:' |
|
393 | - . '\[(?!\/\1\])' // An opening bracket not followed by the closing shortcode tag. |
|
394 | - . '[^\[]*+' // Not an opening bracket |
|
395 | - . ')*+' |
|
396 | - . ')' |
|
397 | - . '\[\/\1\]' // Closing shortcode tag |
|
398 | - . ')?' |
|
399 | - . ')'; |
|
400 | - } |
|
401 | - |
|
402 | - |
|
403 | - /** |
|
404 | - * This sets the properties related to the messages system |
|
405 | - * |
|
406 | - * @since 4.5.0 |
|
407 | - * @return void |
|
408 | - */ |
|
409 | - protected function _set_messages_properties() |
|
410 | - { |
|
411 | - // should be in _extra_data |
|
412 | - if (isset($this->_extra_data['messenger'])) { |
|
413 | - $this->_messenger = $this->_extra_data['messenger']; |
|
414 | - $this->_message_type = $this->_extra_data['message_type']; |
|
415 | - $this->_context = $this->_extra_data['message'] instanceof EE_Message |
|
416 | - ? $this->_extra_data['message']->context() : ''; |
|
417 | - $this->_GRP_ID = $this->_extra_data['message'] instanceof EE_Message |
|
418 | - ? $this->_extra_data['message']->GRP_ID() : 0; |
|
419 | - $this->_message = $this->_extra_data['message'] instanceof EE_Message ? $this->_extra_data['message'] |
|
420 | - : null; |
|
421 | - } |
|
422 | - } |
|
423 | - |
|
424 | - |
|
425 | - /** |
|
426 | - * This returns whatever the set message type object is that was set on this shortcode parser. |
|
427 | - * |
|
428 | - * @since 4.5.0 |
|
429 | - * @return EE_message_type |
|
430 | - */ |
|
431 | - public function get_set_message_type() |
|
432 | - { |
|
433 | - return $this->_message_type; |
|
434 | - } |
|
435 | - |
|
436 | - |
|
437 | - /** |
|
438 | - * This returns whatever the set messenger object is that was set on this shortcode parser |
|
439 | - * |
|
440 | - * @since 4.5.0 |
|
441 | - * @return EE_messenger |
|
442 | - */ |
|
443 | - public function get_set_messenger() |
|
444 | - { |
|
445 | - return $this->_messenger; |
|
446 | - } |
|
447 | - |
|
448 | - |
|
449 | - /** |
|
450 | - * This returns whatever the set context string is on this shortcode parser. |
|
451 | - * |
|
452 | - * @since 4.5.0 |
|
453 | - * @return string |
|
454 | - */ |
|
455 | - public function get_set_context() |
|
456 | - { |
|
457 | - return $this->_context; |
|
458 | - } |
|
459 | - |
|
460 | - |
|
461 | - /** |
|
462 | - * This returns whatever the set EE_Message object is on this shortcode. |
|
463 | - * |
|
464 | - * @since 4.9.0 |
|
465 | - * @return EE_Message |
|
466 | - */ |
|
467 | - public function get_set_message() |
|
468 | - { |
|
469 | - return $this->_message; |
|
470 | - } |
|
19 | + /** |
|
20 | + * holds label for library |
|
21 | + * This is used for referencing the library label |
|
22 | + * |
|
23 | + * @access public |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + public $label; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * This property is used for referencing a short description of the library |
|
31 | + * |
|
32 | + * @access public |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + public $description; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This will hold an array of shortcodes with the key as the shortcode ([shortcode]) and the value as a |
|
40 | + * label/description for the shortcode. |
|
41 | + * |
|
42 | + * @access protected |
|
43 | + * @var array |
|
44 | + */ |
|
45 | + protected $_shortcodes; |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * This will hold the incoming data item sent to the parser method |
|
50 | + * |
|
51 | + * @access protected |
|
52 | + * @var mixed (array|object) |
|
53 | + */ |
|
54 | + protected $_data; |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * some shortcodes may require extra data to parse. This property is provided for that. |
|
59 | + * |
|
60 | + * @var array |
|
61 | + */ |
|
62 | + protected $_extra_data; |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * EE_messenger used to generate the template being parsed. |
|
67 | + * |
|
68 | + * @since 4.5.0 |
|
69 | + * @var EE_messenger |
|
70 | + */ |
|
71 | + protected $_messenger; |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * message type used to generate the template being parsed. |
|
76 | + * |
|
77 | + * @since 4.5.0 |
|
78 | + * @var EE_message_type |
|
79 | + */ |
|
80 | + protected $_message_type; |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * context used for the template being parsed |
|
85 | + * |
|
86 | + * @since 4.5.0 |
|
87 | + * @var string |
|
88 | + */ |
|
89 | + protected $_context; |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * Specific Message Template Group ID |
|
94 | + * |
|
95 | + * @since 4.5.0 |
|
96 | + * @var int |
|
97 | + */ |
|
98 | + protected $_GRP_ID; |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * @since 4.9.0 |
|
103 | + * @type EE_Message |
|
104 | + */ |
|
105 | + protected $_message; |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * This will hold an instance of the EEH_Parse_Shortcodes helper that will be used when handling list type |
|
110 | + * shortcodes |
|
111 | + * |
|
112 | + * @var EEH_Parse_Shortcodes |
|
113 | + */ |
|
114 | + protected $_shortcode_helper; |
|
115 | + |
|
116 | + |
|
117 | + public function __construct() |
|
118 | + { |
|
119 | + $this->_set_defaults(); |
|
120 | + $this->_init_props(); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * This sets the defaults for the properties. Child classes will override these properties in their _init_props |
|
126 | + * method |
|
127 | + */ |
|
128 | + private function _set_defaults() |
|
129 | + { |
|
130 | + $this->name = $this->description = ''; |
|
131 | + $this->_shortcodes = array(); |
|
132 | + $this->_set_shortcode_helper(); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * loads an instance of the EE_Shortcode_Parser helper when requested |
|
138 | + */ |
|
139 | + protected function _set_shortcode_helper() |
|
140 | + { |
|
141 | + // get shortcode_replace instance- set when _get_messages is called in child... |
|
142 | + $this->_shortcode_helper = new EEH_Parse_Shortcodes(); |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + public function get_shortcode_helper() |
|
147 | + { |
|
148 | + if (! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) { |
|
149 | + $this->_set_shortcode_helper(); |
|
150 | + } |
|
151 | + return $this->_shortcode_helper; |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * This is the public method for kicking of the parser included with each child. It can be overridden by child |
|
157 | + * classes if necessary (see EE_Questions_Answers for example) |
|
158 | + * |
|
159 | + * @param string $shortcode incoming shortcode to be parsed |
|
160 | + * @param mixed (object|array) $data incoming data to be be used for parsing |
|
161 | + * @param mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee) |
|
162 | + * @return string parsed shortcode. |
|
163 | + */ |
|
164 | + public function parser($shortcode, $data, $extra_data = array()) |
|
165 | + { |
|
166 | + |
|
167 | + // filter setup shortcodes |
|
168 | + $this->_shortcodes = $this->get_shortcodes(); |
|
169 | + |
|
170 | + // we need to setup any dynamic shortcodes so that they work with the array_key_exists |
|
171 | + preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches); |
|
172 | + $sc_to_verify = ! empty($matches[0]) ? $matches[0][0] . ']' : $shortcode; |
|
173 | + |
|
174 | + // first we want to make sure this is a valid shortcode |
|
175 | + if (! array_key_exists($sc_to_verify, $this->_shortcodes)) { |
|
176 | + return false; |
|
177 | + } //get out, this parser doesn't handle the incoming shortcode. |
|
178 | + $this->_data = $data; |
|
179 | + $this->_extra_data = $extra_data; |
|
180 | + $this->_set_messages_properties(); |
|
181 | + $parsed = apply_filters( |
|
182 | + 'FHEE__' . get_class($this) . '__parser_after', |
|
183 | + $this->_parser($shortcode), |
|
184 | + $shortcode, |
|
185 | + $data, |
|
186 | + $extra_data, |
|
187 | + $this |
|
188 | + ); |
|
189 | + |
|
190 | + // note the below filter applies to ALL shortcode parsers... be careful! |
|
191 | + return apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this); |
|
192 | + } |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * This method just returns the shortcodes in the $_shortcodes array property. |
|
197 | + * |
|
198 | + * @access public |
|
199 | + * @return array array of shortcodes => description pairs |
|
200 | + */ |
|
201 | + public function get_shortcodes() |
|
202 | + { |
|
203 | + $this->_shortcodes = apply_filters('FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this); |
|
204 | + |
|
205 | + // note the below filter applies to ALL shortcode parsers... be careful! |
|
206 | + $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this); |
|
207 | + |
|
208 | + return $this->_shortcodes; |
|
209 | + } |
|
210 | + |
|
211 | + |
|
212 | + /** |
|
213 | + * Child classes use this method to set the $name, $description, and $_shortcodes properties. |
|
214 | + * |
|
215 | + * @abstract |
|
216 | + * @access protected |
|
217 | + * @return void |
|
218 | + */ |
|
219 | + abstract protected function _init_props(); |
|
220 | + |
|
221 | + |
|
222 | + /** |
|
223 | + * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
224 | + * will have to take care of handling. |
|
225 | + * |
|
226 | + * @abstract |
|
227 | + * @access protected |
|
228 | + * @param string $shortcode the shortcode to be parsed. |
|
229 | + * @param mixed (object|array) $data incoming data for the parser. The data could be either an object or |
|
230 | + * array because there are some shortcodes that might be replaced by prepared data that |
|
231 | + * has multiple items in a list (i.e. list of attendees in an event and we're showing |
|
232 | + * fname/lname for each attendee). In this case data will be in an array. Otherwise |
|
233 | + * the data shoudl be in a properly formatted object. The |
|
234 | + * EEH_Parse_Shortcodes.helper.php describes the data object we're expecting. |
|
235 | + * @return string parsed shortcode |
|
236 | + */ |
|
237 | + abstract protected function _parser($shortcode); |
|
238 | + |
|
239 | + |
|
240 | + /** |
|
241 | + * This just validates incoming data for list type shortcode parsers (and they call this method) to make sure it |
|
242 | + * meets their requirements |
|
243 | + * |
|
244 | + * @return mixed (void|exception) If validation fails we'll throw an exception. |
|
245 | + */ |
|
246 | + protected function _validate_list_requirements() |
|
247 | + { |
|
248 | + |
|
249 | + // first test to make sure we've got an array! |
|
250 | + if (! is_array($this->_data)) { |
|
251 | + throw new EE_Error( |
|
252 | + sprintf( |
|
253 | + esc_html__( |
|
254 | + 'Expecting an array for the data sent to %s. Instead it was %s', |
|
255 | + 'event_espresso' |
|
256 | + ), |
|
257 | + get_class($this), |
|
258 | + gettype($this->_data) |
|
259 | + ) |
|
260 | + ); |
|
261 | + } |
|
262 | + |
|
263 | + // next test to make sure we've got the required template in the index! |
|
264 | + if (! isset($this->_data['template'])) { |
|
265 | + throw new EE_Error( |
|
266 | + sprintf( |
|
267 | + esc_html__( |
|
268 | + 'The incoming data does not have the required template index in its array', |
|
269 | + 'event_espresso' |
|
270 | + ) |
|
271 | + ) |
|
272 | + ); |
|
273 | + } |
|
274 | + |
|
275 | + // next test to make sure we've got got a data index in the incoming data array |
|
276 | + if (! isset($this->_data['data'])) { |
|
277 | + throw new EE_Error( |
|
278 | + esc_html__( |
|
279 | + 'The incoming data does not have the required data index in its array', |
|
280 | + 'event_espresso' |
|
281 | + ) |
|
282 | + ); |
|
283 | + } |
|
284 | + |
|
285 | + // all is well let's make sure _extra_data always has the values needed. |
|
286 | + // let's make sure that extra_data includes all templates (for later parsing if necessary) |
|
287 | + if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) { |
|
288 | + $this->_extra_data['data'] = $this->_data['data']; |
|
289 | + $this->_extra_data['template'] = $this->_data['template']; |
|
290 | + } |
|
291 | + } |
|
292 | + |
|
293 | + |
|
294 | + /** |
|
295 | + * This returns any attributes that may be existing on an EE_Shortcode |
|
296 | + * |
|
297 | + * @since 4.5.0 |
|
298 | + * @param string $shortcode incoming shortcode |
|
299 | + * @return array An array with the attributes |
|
300 | + */ |
|
301 | + protected function _get_shortcode_attrs($shortcode) |
|
302 | + { |
|
303 | + // make sure the required wp helper function is present |
|
304 | + // require the shortcode file if necessary |
|
305 | + if (! function_exists('shortcode_parse_atts')) { |
|
306 | + require_once(ABSPATH . WPINC . '/shortcodes.php'); |
|
307 | + } |
|
308 | + |
|
309 | + // let's get any attributes that may be present and set the defaults. |
|
310 | + $shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode)); |
|
311 | + return shortcode_parse_atts($shortcode_to_parse); |
|
312 | + } |
|
313 | + |
|
314 | + |
|
315 | + /** |
|
316 | + * Conditional blocks are shortcode patterns with an opening conditional tag `[IF_*]` and a corresponding |
|
317 | + * closing tag (eg `[/IF_*]`). The content within the tags will be displayed/hidden depending on whatever |
|
318 | + * conditions existed in the opening tag. This method handles parsing the actual template to show/hide this |
|
319 | + * conditional content. |
|
320 | + * |
|
321 | + * @since 4.9.32 |
|
322 | + * |
|
323 | + * @param string $shortcode This should be original shortcode as used in the template and passed to the parser. |
|
324 | + * @param bool $show true means the opening and closing tags are removed and the content is left showing, |
|
325 | + * false means the opening and closing tags and the contained content are removed. |
|
326 | + * @return string The template for the shortcode is returned. |
|
327 | + */ |
|
328 | + protected function _mutate_conditional_block_in_template($shortcode, $show = true) |
|
329 | + { |
|
330 | + // first let's get all the matches in the template for this particular shortcode. |
|
331 | + preg_match_all('~' . $this->_get_conditional_block_regex($shortcode) . '~', $this->_data['template'], $matches); |
|
332 | + |
|
333 | + if ($matches && is_array($matches[0]) && ! empty($matches[0])) { |
|
334 | + // we need to hide all instances of the matches |
|
335 | + foreach ($matches[0] as $index => $content_to_show_or_hide) { |
|
336 | + $content_to_show_or_hide = preg_quote($content_to_show_or_hide); |
|
337 | + $replacement = $show ? $matches[4][ $index ] : ''; |
|
338 | + $this->_data['template'] = preg_replace( |
|
339 | + '~' . $content_to_show_or_hide . '~', |
|
340 | + $replacement, |
|
341 | + $this->_data['template'] |
|
342 | + ); |
|
343 | + } |
|
344 | + } |
|
345 | + // return $template |
|
346 | + return $this->_data['template']; |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + /** |
|
351 | + * This returns the regex pattern to use for conditional shortcodes parsing. |
|
352 | + * |
|
353 | + * Note: regex comes in part from the WP `get_shortcode_regex` expression in \wp-includes\shortcodes.php |
|
354 | + * |
|
355 | + * @param $shortcode |
|
356 | + * @since 4.9.32 |
|
357 | + * @return string |
|
358 | + */ |
|
359 | + private function _get_conditional_block_regex($shortcode) |
|
360 | + { |
|
361 | + // get just the shortcode tag for the match |
|
362 | + preg_match('@\[([^<>&/\[\]\x00-\x20=]++)@', $shortcode, $shortcode_tag_matches); |
|
363 | + if (empty($shortcode_tag_matches[1])) { |
|
364 | + return $this->_data['template']; |
|
365 | + } |
|
366 | + |
|
367 | + $shortcode_tag = $shortcode_tag_matches[1]; |
|
368 | + // get attributes_part_of_tag |
|
369 | + $attributes_part = preg_quote(str_replace(array($shortcode_tag, '[', ']'), '', $shortcode)); |
|
370 | + // escape |
|
371 | + $shortcode_tag = preg_quote($shortcode_tag); |
|
372 | + |
|
373 | + return |
|
374 | + '\[' // Opening Bracket |
|
375 | + . "($shortcode_tag)$attributes_part" // 1: Shortcode Name |
|
376 | + . '(?![\w-])' // Not followed by word character or hyphen |
|
377 | + . '(' // 2: Unroll the loop: Inside the opening shortcode tag |
|
378 | + . '[^\]\/]*' // Not a closing bracket or forward slash |
|
379 | + . '(?:' |
|
380 | + . '\/(?!\])' // A forward slash not followed by a closing bracket |
|
381 | + . '[^\]\/]*' // Not a closing bracket or forward slash. |
|
382 | + . ')*?' |
|
383 | + . ')' |
|
384 | + . '(?:' |
|
385 | + . '(\/)' // 3. Self closing tag ... |
|
386 | + . '\]' // ... and closing bracket |
|
387 | + . '|' |
|
388 | + . '\]' // Closing bracket |
|
389 | + . '(?:' |
|
390 | + . '(' // 4: Unroll the loop: Optionally, anything between the opening and closing brackets |
|
391 | + . '[^\[]*+' // Not an opening bracket |
|
392 | + . '(?:' |
|
393 | + . '\[(?!\/\1\])' // An opening bracket not followed by the closing shortcode tag. |
|
394 | + . '[^\[]*+' // Not an opening bracket |
|
395 | + . ')*+' |
|
396 | + . ')' |
|
397 | + . '\[\/\1\]' // Closing shortcode tag |
|
398 | + . ')?' |
|
399 | + . ')'; |
|
400 | + } |
|
401 | + |
|
402 | + |
|
403 | + /** |
|
404 | + * This sets the properties related to the messages system |
|
405 | + * |
|
406 | + * @since 4.5.0 |
|
407 | + * @return void |
|
408 | + */ |
|
409 | + protected function _set_messages_properties() |
|
410 | + { |
|
411 | + // should be in _extra_data |
|
412 | + if (isset($this->_extra_data['messenger'])) { |
|
413 | + $this->_messenger = $this->_extra_data['messenger']; |
|
414 | + $this->_message_type = $this->_extra_data['message_type']; |
|
415 | + $this->_context = $this->_extra_data['message'] instanceof EE_Message |
|
416 | + ? $this->_extra_data['message']->context() : ''; |
|
417 | + $this->_GRP_ID = $this->_extra_data['message'] instanceof EE_Message |
|
418 | + ? $this->_extra_data['message']->GRP_ID() : 0; |
|
419 | + $this->_message = $this->_extra_data['message'] instanceof EE_Message ? $this->_extra_data['message'] |
|
420 | + : null; |
|
421 | + } |
|
422 | + } |
|
423 | + |
|
424 | + |
|
425 | + /** |
|
426 | + * This returns whatever the set message type object is that was set on this shortcode parser. |
|
427 | + * |
|
428 | + * @since 4.5.0 |
|
429 | + * @return EE_message_type |
|
430 | + */ |
|
431 | + public function get_set_message_type() |
|
432 | + { |
|
433 | + return $this->_message_type; |
|
434 | + } |
|
435 | + |
|
436 | + |
|
437 | + /** |
|
438 | + * This returns whatever the set messenger object is that was set on this shortcode parser |
|
439 | + * |
|
440 | + * @since 4.5.0 |
|
441 | + * @return EE_messenger |
|
442 | + */ |
|
443 | + public function get_set_messenger() |
|
444 | + { |
|
445 | + return $this->_messenger; |
|
446 | + } |
|
447 | + |
|
448 | + |
|
449 | + /** |
|
450 | + * This returns whatever the set context string is on this shortcode parser. |
|
451 | + * |
|
452 | + * @since 4.5.0 |
|
453 | + * @return string |
|
454 | + */ |
|
455 | + public function get_set_context() |
|
456 | + { |
|
457 | + return $this->_context; |
|
458 | + } |
|
459 | + |
|
460 | + |
|
461 | + /** |
|
462 | + * This returns whatever the set EE_Message object is on this shortcode. |
|
463 | + * |
|
464 | + * @since 4.9.0 |
|
465 | + * @return EE_Message |
|
466 | + */ |
|
467 | + public function get_set_message() |
|
468 | + { |
|
469 | + return $this->_message; |
|
470 | + } |
|
471 | 471 | } |
@@ -174,7 +174,7 @@ |
||
174 | 174 | $this->rewind(); |
175 | 175 | while ($this->valid()) { |
176 | 176 | echo '<h5 style="color:#2EA2CC;"> |
177 | - ' . __CLASS__ . ' class : <span style="color:#E76700">' . esc_html($this->getInfo()) . '</span> |
|
177 | + ' . __CLASS__.' class : <span style="color:#E76700">'.esc_html($this->getInfo()).'</span> |
|
178 | 178 | </h5>'; |
179 | 179 | $this->next(); |
180 | 180 | } |
@@ -13,143 +13,143 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Message_Type_Collection extends EE_Object_Collection |
15 | 15 | { |
16 | - /** |
|
17 | - * EE_Message_Type_Collection constructor. |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - $this->interface = 'EE_message_type'; |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * attaches an object to the Collection |
|
28 | - * and sets any supplied data associated with the current iterator entry |
|
29 | - * by calling EE_Object_Collection::set_info() |
|
30 | - * |
|
31 | - * @param object $object |
|
32 | - * @param mixed $info |
|
33 | - * @return bool |
|
34 | - */ |
|
35 | - public function add($object, $info = ''): bool |
|
36 | - { |
|
37 | - $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
38 | - return parent::add($object, $info); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * Sets the data associated with an object in the Collection |
|
45 | - * if no $info is supplied, then the spl_object_hash() is used |
|
46 | - * |
|
47 | - * @param object $object |
|
48 | - * @param mixed $info |
|
49 | - * @return bool |
|
50 | - */ |
|
51 | - public function set_info($object, $info = ''): bool |
|
52 | - { |
|
53 | - $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
54 | - return parent::set_info($object, $info); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * finds and returns an object in the Collection based on the info that was set using addObject() |
|
61 | - * PLZ NOTE: the pointer is reset to the beginning of the collection before returning |
|
62 | - * |
|
63 | - * @param mixed |
|
64 | - * @return null | object |
|
65 | - */ |
|
66 | - public function get_by_info($info = '') |
|
67 | - { |
|
68 | - return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * returns TRUE or FALSE depending on whether the supplied object is within the Collection |
|
75 | - * |
|
76 | - * @param object $object |
|
77 | - * @return bool |
|
78 | - */ |
|
79 | - public function has($object): bool |
|
80 | - { |
|
81 | - return parent::has($object); |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - |
|
86 | - /** |
|
87 | - * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection |
|
88 | - * |
|
89 | - * @param string $message_type_name |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function has_by_name(string $message_type_name): bool |
|
93 | - { |
|
94 | - return $this->get_by_info($message_type_name) instanceof $this->interface; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * detaches an object from the Collection |
|
101 | - * |
|
102 | - * @param $object |
|
103 | - * @return bool |
|
104 | - */ |
|
105 | - public function remove($object): bool |
|
106 | - { |
|
107 | - return parent::remove($object); |
|
108 | - } |
|
109 | - |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * advances pointer to the provided object |
|
114 | - * |
|
115 | - * @param $object |
|
116 | - * @return void |
|
117 | - */ |
|
118 | - public function set_current($object) |
|
119 | - { |
|
120 | - parent::set_current($object); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * advances pointer to the object whose info matches that which was provided |
|
127 | - * |
|
128 | - * @param $info |
|
129 | - * @return void |
|
130 | - */ |
|
131 | - public function set_current_by_info($info) |
|
132 | - { |
|
133 | - parent::set_current_by_info($info); |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * displays list of collection classes if WP_DEBUG is on |
|
140 | - * |
|
141 | - * @return void |
|
142 | - */ |
|
143 | - public function show_collection_classes() |
|
144 | - { |
|
145 | - if (WP_DEBUG) { |
|
146 | - $this->rewind(); |
|
147 | - while ($this->valid()) { |
|
148 | - echo '<h5 style="color:#2EA2CC;"> |
|
16 | + /** |
|
17 | + * EE_Message_Type_Collection constructor. |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + $this->interface = 'EE_message_type'; |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * attaches an object to the Collection |
|
28 | + * and sets any supplied data associated with the current iterator entry |
|
29 | + * by calling EE_Object_Collection::set_info() |
|
30 | + * |
|
31 | + * @param object $object |
|
32 | + * @param mixed $info |
|
33 | + * @return bool |
|
34 | + */ |
|
35 | + public function add($object, $info = ''): bool |
|
36 | + { |
|
37 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
38 | + return parent::add($object, $info); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * Sets the data associated with an object in the Collection |
|
45 | + * if no $info is supplied, then the spl_object_hash() is used |
|
46 | + * |
|
47 | + * @param object $object |
|
48 | + * @param mixed $info |
|
49 | + * @return bool |
|
50 | + */ |
|
51 | + public function set_info($object, $info = ''): bool |
|
52 | + { |
|
53 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
54 | + return parent::set_info($object, $info); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * finds and returns an object in the Collection based on the info that was set using addObject() |
|
61 | + * PLZ NOTE: the pointer is reset to the beginning of the collection before returning |
|
62 | + * |
|
63 | + * @param mixed |
|
64 | + * @return null | object |
|
65 | + */ |
|
66 | + public function get_by_info($info = '') |
|
67 | + { |
|
68 | + return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * returns TRUE or FALSE depending on whether the supplied object is within the Collection |
|
75 | + * |
|
76 | + * @param object $object |
|
77 | + * @return bool |
|
78 | + */ |
|
79 | + public function has($object): bool |
|
80 | + { |
|
81 | + return parent::has($object); |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + |
|
86 | + /** |
|
87 | + * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection |
|
88 | + * |
|
89 | + * @param string $message_type_name |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function has_by_name(string $message_type_name): bool |
|
93 | + { |
|
94 | + return $this->get_by_info($message_type_name) instanceof $this->interface; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * detaches an object from the Collection |
|
101 | + * |
|
102 | + * @param $object |
|
103 | + * @return bool |
|
104 | + */ |
|
105 | + public function remove($object): bool |
|
106 | + { |
|
107 | + return parent::remove($object); |
|
108 | + } |
|
109 | + |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * advances pointer to the provided object |
|
114 | + * |
|
115 | + * @param $object |
|
116 | + * @return void |
|
117 | + */ |
|
118 | + public function set_current($object) |
|
119 | + { |
|
120 | + parent::set_current($object); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * advances pointer to the object whose info matches that which was provided |
|
127 | + * |
|
128 | + * @param $info |
|
129 | + * @return void |
|
130 | + */ |
|
131 | + public function set_current_by_info($info) |
|
132 | + { |
|
133 | + parent::set_current_by_info($info); |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * displays list of collection classes if WP_DEBUG is on |
|
140 | + * |
|
141 | + * @return void |
|
142 | + */ |
|
143 | + public function show_collection_classes() |
|
144 | + { |
|
145 | + if (WP_DEBUG) { |
|
146 | + $this->rewind(); |
|
147 | + while ($this->valid()) { |
|
148 | + echo '<h5 style="color:#2EA2CC;"> |
|
149 | 149 | ' . __CLASS__ . ' class : <span style="color:#E76700">' . esc_html($this->getInfo()) . '</span> |
150 | 150 | </h5>'; |
151 | - $this->next(); |
|
152 | - } |
|
153 | - } |
|
154 | - } |
|
151 | + $this->next(); |
|
152 | + } |
|
153 | + } |
|
154 | + } |
|
155 | 155 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | <div class="ticket-time-and-place-details"> |
25 | 25 | <div class="ticket-time-details"> |
26 | 26 | <h4 class="sub-section-title no-bottom-margin"> |
27 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'clock-16x16.png'); ?>"> |
|
27 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'clock-16x16.png'); ?>"> |
|
28 | 28 | <?php esc_html_e('Date/Time:', 'event_espresso'); ?> |
29 | 29 | </h4> |
30 | 30 | <ul class="event-dates">[DATETIME_LIST]</ul> |
31 | 31 | </div> |
32 | 32 | <div class="ticket-place-details"> |
33 | 33 | <h4 class="sub-section-title no-bottom-margin"> |
34 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'location-pin-16x16.png'); ?>"> |
|
34 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'location-pin-16x16.png'); ?>"> |
|
35 | 35 | <?php esc_html_e('Venue', 'event_espresso'); ?> |
36 | 36 | </h4> |
37 | 37 | <ul class="event-venues"> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | </div> |
46 | 46 | <div class="ticket-registrations-area"> |
47 | 47 | <h4 class="sub-section-title"> |
48 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'users-16x16.png'); ?>"> |
|
48 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'users-16x16.png'); ?>"> |
|
49 | 49 | <?php esc_html_e("Registration Details", "event_espresso"); ?> |
50 | 50 | <span class="small-text link"> |
51 | 51 | ( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]"> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | ?> |
8 | 8 | <h3 class="section-title event-name"> |
9 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'calendar_year-24x24.png'); ?>"> |
|
9 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'calendar_year-24x24.png'); ?>"> |
|
10 | 10 | <?php esc_html_e("Event Name:", "event_espresso") ?> |
11 | 11 | <span class="plain-text">[EVENT_NAME]</span> |
12 | 12 | <span class="small-text link"> |
@@ -8,11 +8,11 @@ |
||
8 | 8 | <li class="ticket-registration"> |
9 | 9 | <table class="registration-details"> |
10 | 10 | <tr class="odd"> |
11 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
11 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
12 | 12 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
13 | 13 | </tr> |
14 | 14 | <tr> |
15 | - <th><?php esc_html_e("Registration Code:", "event_espresso");?></th> |
|
15 | + <th><?php esc_html_e("Registration Code:", "event_espresso"); ?></th> |
|
16 | 16 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
17 | 17 | </tr> |
18 | 18 | </table> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | <div id="ee-single-page-checkout-dv" class=""> |
16 | 16 | <?php |
17 | - if (! $empty_cart) { |
|
17 | + if ( ! $empty_cart) { |
|
18 | 18 | if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
19 | 19 | <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice" |
20 | 20 | style="display: none;"> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <span id="spco-registration-expiration-spn" class="" style="display:none;"></span> |
32 | 32 | </p> |
33 | 33 | <?php } |
34 | - if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
34 | + if ( ! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
35 | 35 | ?> |
36 | 36 | <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"> |
37 | 37 | <?php esc_html_e(' Steps', 'event_espresso'); ?> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | foreach ($reg_steps as $reg_step) { |
78 | 78 | if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
79 | 79 | $slug = $reg_step->slug(); |
80 | - do_action('AHEE__' . $slug . '__reg_step_start', $reg_step); |
|
80 | + do_action('AHEE__'.$slug.'__reg_step_start', $reg_step); |
|
81 | 81 | // todo: deprecate hook AHEE__registration_page_attendee_information__start |
82 | 82 | ?> |
83 | 83 | <div id="spco-<?php echo esc_attr($slug); ?>-dv" |
@@ -16,38 +16,38 @@ discard block |
||
16 | 16 | |
17 | 17 | <div id="ee-single-page-checkout-dv" class=""> |
18 | 18 | <?php |
19 | - if (! $empty_cart) { |
|
20 | - if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
|
19 | + if (! $empty_cart) { |
|
20 | + if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
|
21 | 21 | <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice" |
22 | 22 | style="display: none;"> |
23 | 23 | <?php echo sprintf( |
24 | - apply_filters( |
|
25 | - 'FHEE__registration_page_wrapper_template___time_limit', |
|
26 | - esc_html__('You have %1$s to complete your registration.', 'event_espresso') |
|
27 | - ), |
|
28 | - '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' |
|
29 | - . $registration_time_limit |
|
30 | - . '</span>' |
|
31 | - ); |
|
32 | - ?> |
|
24 | + apply_filters( |
|
25 | + 'FHEE__registration_page_wrapper_template___time_limit', |
|
26 | + esc_html__('You have %1$s to complete your registration.', 'event_espresso') |
|
27 | + ), |
|
28 | + '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' |
|
29 | + . $registration_time_limit |
|
30 | + . '</span>' |
|
31 | + ); |
|
32 | + ?> |
|
33 | 33 | <span id="spco-registration-expiration-spn" class="" style="display:none;"></span> |
34 | 34 | </p> |
35 | 35 | <?php } |
36 | - if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
37 | - ?> |
|
36 | + if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
37 | + ?> |
|
38 | 38 | <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"> |
39 | 39 | <?php esc_html_e(' Steps', 'event_espresso'); ?> |
40 | 40 | </h2> |
41 | 41 | |
42 | 42 | <div id="spco-steps-display-dv"> |
43 | 43 | <?php |
44 | - $step_nmbr = 1; |
|
45 | - $total_steps = count($reg_steps) - 1; |
|
46 | - foreach ($reg_steps as $reg_step) { |
|
47 | - if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
48 | - $slug = $reg_step->slug(); |
|
49 | - $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step'; |
|
50 | - ?> |
|
44 | + $step_nmbr = 1; |
|
45 | + $total_steps = count($reg_steps) - 1; |
|
46 | + foreach ($reg_steps as $reg_step) { |
|
47 | + if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
48 | + $slug = $reg_step->slug(); |
|
49 | + $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step'; |
|
50 | + ?> |
|
51 | 51 | <div id="spco-step-<?php echo esc_attr($slug); ?>-display-dv" |
52 | 52 | class="spco-step-display-dv <?php echo esc_attr($step_display_dv_class); ?> steps-<?php echo esc_attr($total_steps); ?>" |
53 | 53 | > |
@@ -60,28 +60,28 @@ discard block |
||
60 | 60 | </div> |
61 | 61 | |
62 | 62 | <?php |
63 | - if ($step_nmbr < $total_steps) { ?> |
|
63 | + if ($step_nmbr < $total_steps) { ?> |
|
64 | 64 | <div class="spco-step-arrow-dv">»</div> |
65 | 65 | <?php |
66 | - } |
|
67 | - $step_nmbr++; |
|
68 | - } |
|
69 | - } |
|
70 | - ?> |
|
66 | + } |
|
67 | + $step_nmbr++; |
|
68 | + } |
|
69 | + } |
|
70 | + ?> |
|
71 | 71 | <div class="clear-float"></div> |
72 | 72 | </div> |
73 | 73 | |
74 | 74 | <?php |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - do_action('AHEE__SPCO__before_registration_steps'); |
|
78 | - $step_nmbr = 1; |
|
79 | - foreach ($reg_steps as $reg_step) { |
|
80 | - if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
81 | - $slug = $reg_step->slug(); |
|
82 | - do_action('AHEE__' . $slug . '__reg_step_start', $reg_step); |
|
83 | - // todo: deprecate hook AHEE__registration_page_attendee_information__start |
|
84 | - ?> |
|
77 | + do_action('AHEE__SPCO__before_registration_steps'); |
|
78 | + $step_nmbr = 1; |
|
79 | + foreach ($reg_steps as $reg_step) { |
|
80 | + if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
81 | + $slug = $reg_step->slug(); |
|
82 | + do_action('AHEE__' . $slug . '__reg_step_start', $reg_step); |
|
83 | + // todo: deprecate hook AHEE__registration_page_attendee_information__start |
|
84 | + ?> |
|
85 | 85 | <div id="spco-<?php echo esc_attr($slug); ?>-dv" |
86 | 86 | class="spco-step-dv <?php echo esc_attr($reg_step->div_class()); ?>" |
87 | 87 | > |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?> |
90 | 90 | </div> |
91 | 91 | <?php $step_nmbr++; |
92 | - } |
|
93 | - } |
|
94 | - do_action('AHEE__SPCO__after_registration_steps'); |
|
95 | - } else { |
|
96 | - ?> |
|
92 | + } |
|
93 | + } |
|
94 | + do_action('AHEE__SPCO__after_registration_steps'); |
|
95 | + } else { |
|
96 | + ?> |
|
97 | 97 | <h3 id="spco-empty-cart-hdr" class="spco-step-title-hdr"> |
98 | 98 | <?php esc_html_e('Nothing in your Event Queue', 'event_espresso'); ?> |
99 | 99 | </h3> |
100 | 100 | <p><?php echo wp_kses($empty_msg, AllowedTags::getWithFormTags()); ?></p> |
101 | 101 | <?php echo wp_kses($cookies_not_set_msg, AllowedTags::getWithFormTags()); ?> |
102 | 102 | <?php |
103 | - } |
|
104 | - do_action('AHEE__SPCO__reg_form_footer'); |
|
105 | - ?> |
|
103 | + } |
|
104 | + do_action('AHEE__SPCO__reg_form_footer'); |
|
105 | + ?> |
|
106 | 106 | |
107 | 107 | </div> |
108 | 108 |
@@ -3,36 +3,36 @@ |
||
3 | 3 | /** @type array $registrations_for_free_events */ |
4 | 4 | |
5 | 5 | if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) { |
6 | - echo apply_filters( |
|
7 | - 'FHEE__registration_page_payment_options__no_payment_required_hdr', |
|
8 | - sprintf( |
|
9 | - esc_html__('%1$sNo Payment Required%2$s', 'event_espresso'), |
|
10 | - '<h6>', |
|
11 | - '</h6>' |
|
12 | - ) |
|
13 | - ); |
|
14 | - foreach ($registrations_for_free_events as $registration_for_free_event) { |
|
15 | - if ( |
|
16 | - $registration_for_free_event instanceof EE_Registration |
|
17 | - && $registration_for_free_event->ticket()->is_free() |
|
18 | - ) { |
|
19 | - if ($registration_for_free_event->event() instanceof EE_Event) { |
|
20 | - ?> |
|
6 | + echo apply_filters( |
|
7 | + 'FHEE__registration_page_payment_options__no_payment_required_hdr', |
|
8 | + sprintf( |
|
9 | + esc_html__('%1$sNo Payment Required%2$s', 'event_espresso'), |
|
10 | + '<h6>', |
|
11 | + '</h6>' |
|
12 | + ) |
|
13 | + ); |
|
14 | + foreach ($registrations_for_free_events as $registration_for_free_event) { |
|
15 | + if ( |
|
16 | + $registration_for_free_event instanceof EE_Registration |
|
17 | + && $registration_for_free_event->ticket()->is_free() |
|
18 | + ) { |
|
19 | + if ($registration_for_free_event->event() instanceof EE_Event) { |
|
20 | + ?> |
|
21 | 21 | <p> |
22 | 22 | <?php echo apply_filters( |
23 | - 'FHEE__registration_page_payment_options__no_payment_required_pg', |
|
24 | - sprintf( |
|
25 | - esc_html__( |
|
26 | - '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', |
|
27 | - 'event_espresso' |
|
28 | - ), |
|
29 | - $registration_for_free_event->ticket()->name(), |
|
30 | - $registration_for_free_event->event()->name() |
|
31 | - ) |
|
32 | - ); ?> |
|
23 | + 'FHEE__registration_page_payment_options__no_payment_required_pg', |
|
24 | + sprintf( |
|
25 | + esc_html__( |
|
26 | + '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', |
|
27 | + 'event_espresso' |
|
28 | + ), |
|
29 | + $registration_for_free_event->ticket()->name(), |
|
30 | + $registration_for_free_event->event()->name() |
|
31 | + ) |
|
32 | + ); ?> |
|
33 | 33 | </p> |
34 | 34 | <?php |
35 | - } |
|
36 | - } |
|
37 | - } |
|
35 | + } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |