@@ -12,369 +12,369 @@ |
||
12 | 12 | final class EE_Request_Handler implements InterminableInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var EE_Request $request |
|
17 | - */ |
|
18 | - private $request; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var array $_notice |
|
22 | - */ |
|
23 | - private $_notice = array(); |
|
24 | - |
|
25 | - /** |
|
26 | - * rendered output to be returned to WP |
|
27 | - * |
|
28 | - * @var string $_output |
|
29 | - */ |
|
30 | - private $_output = ''; |
|
31 | - |
|
32 | - /** |
|
33 | - * whether current request is via AJAX |
|
34 | - * |
|
35 | - * @var boolean $ajax |
|
36 | - */ |
|
37 | - public $ajax = false; |
|
38 | - |
|
39 | - /** |
|
40 | - * whether current request is via AJAX from the frontend of the site |
|
41 | - * |
|
42 | - * @var boolean $front_ajax |
|
43 | - */ |
|
44 | - public $front_ajax = false; |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @param EE_Request $request |
|
49 | - */ |
|
50 | - public function __construct(EE_Request $request) |
|
51 | - { |
|
52 | - $this->request = $request; |
|
53 | - $this->ajax = $this->request->ajax; |
|
54 | - $this->front_ajax = $this->request->front_ajax; |
|
55 | - do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * @param WP $wp |
|
61 | - * @return void |
|
62 | - * @throws EE_Error |
|
63 | - * @throws ReflectionException |
|
64 | - */ |
|
65 | - public function parse_request($wp = null) |
|
66 | - { |
|
67 | - // if somebody forgot to provide us with WP, that's ok because its global |
|
68 | - if (! $wp instanceof WP) { |
|
69 | - global $wp; |
|
70 | - } |
|
71 | - $this->set_request_vars($wp); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @param WP $wp |
|
77 | - * @return void |
|
78 | - * @throws EE_Error |
|
79 | - * @throws ReflectionException |
|
80 | - */ |
|
81 | - public function set_request_vars($wp = null) |
|
82 | - { |
|
83 | - if (! is_admin()) { |
|
84 | - // set request post_id |
|
85 | - $this->request->set('post_id', $this->get_post_id_from_request($wp)); |
|
86 | - // set request post name |
|
87 | - $this->request->set('post_name', $this->get_post_name_from_request($wp)); |
|
88 | - // set request post_type |
|
89 | - $this->request->set('post_type', $this->get_post_type_from_request($wp)); |
|
90 | - // true or false ? is this page being used by EE ? |
|
91 | - $this->set_espresso_page(); |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * @param WP $wp |
|
98 | - * @return int |
|
99 | - */ |
|
100 | - public function get_post_id_from_request($wp = null) |
|
101 | - { |
|
102 | - if (! $wp instanceof WP) { |
|
103 | - global $wp; |
|
104 | - } |
|
105 | - $post_id = null; |
|
106 | - if (isset($wp->query_vars['p'])) { |
|
107 | - $post_id = $wp->query_vars['p']; |
|
108 | - } |
|
109 | - if (! $post_id && isset($wp->query_vars['page_id'])) { |
|
110 | - $post_id = $wp->query_vars['page_id']; |
|
111 | - } |
|
112 | - if (! $post_id && $wp->request !== null && is_numeric(basename($wp->request))) { |
|
113 | - $post_id = basename($wp->request); |
|
114 | - } |
|
115 | - return $post_id; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @param WP $wp |
|
121 | - * @return string |
|
122 | - */ |
|
123 | - public function get_post_name_from_request($wp = null) |
|
124 | - { |
|
125 | - if (! $wp instanceof WP) { |
|
126 | - global $wp; |
|
127 | - } |
|
128 | - $post_name = null; |
|
129 | - if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
130 | - $post_name = $wp->query_vars['name']; |
|
131 | - } |
|
132 | - if (! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
133 | - $post_name = $wp->query_vars['pagename']; |
|
134 | - } |
|
135 | - if (! $post_name && $wp->request !== null && ! empty($wp->request)) { |
|
136 | - $possible_post_name = basename($wp->request); |
|
137 | - if (! is_numeric($possible_post_name)) { |
|
138 | - /** @type WPDB $wpdb */ |
|
139 | - global $wpdb; |
|
140 | - $SQL = |
|
141 | - "SELECT ID from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND post_name=%s"; |
|
142 | - $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
143 | - if ($possible_post_name) { |
|
144 | - $post_name = $possible_post_name; |
|
145 | - } |
|
146 | - } |
|
147 | - } |
|
148 | - if (! $post_name && $this->get('post_id')) { |
|
149 | - /** @type WPDB $wpdb */ |
|
150 | - global $wpdb; |
|
151 | - $SQL = |
|
152 | - "SELECT post_name from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND ID=%d"; |
|
153 | - $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
154 | - if ($possible_post_name) { |
|
155 | - $post_name = $possible_post_name; |
|
156 | - } |
|
157 | - } |
|
158 | - return $post_name; |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * @param WP $wp |
|
164 | - * @return mixed |
|
165 | - */ |
|
166 | - public function get_post_type_from_request($wp = null) |
|
167 | - { |
|
168 | - if (! $wp instanceof WP) { |
|
169 | - global $wp; |
|
170 | - } |
|
171 | - return isset($wp->query_vars['post_type']) |
|
172 | - ? $wp->query_vars['post_type'] |
|
173 | - : null; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * Just a helper method for getting the url for the displayed page. |
|
179 | - * |
|
180 | - * @param WP $wp |
|
181 | - * @return string |
|
182 | - */ |
|
183 | - public function get_current_page_permalink($wp = null) |
|
184 | - { |
|
185 | - $post_id = $this->get_post_id_from_request($wp); |
|
186 | - if ($post_id) { |
|
187 | - $current_page_permalink = get_permalink($post_id); |
|
188 | - } else { |
|
189 | - if (! $wp instanceof WP) { |
|
190 | - global $wp; |
|
191 | - } |
|
192 | - if ($wp->request) { |
|
193 | - $current_page_permalink = site_url($wp->request); |
|
194 | - } else { |
|
195 | - $current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI'])); |
|
196 | - } |
|
197 | - } |
|
198 | - return $current_page_permalink; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * @return bool |
|
204 | - * @throws EE_Error |
|
205 | - * @throws ReflectionException |
|
206 | - */ |
|
207 | - public function test_for_espresso_page() |
|
208 | - { |
|
209 | - global $wp; |
|
210 | - /** @type EE_CPT_Strategy $EE_CPT_Strategy */ |
|
211 | - $EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy'); |
|
212 | - $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
|
213 | - if (is_array($espresso_CPT_taxonomies)) { |
|
214 | - foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy => $details) { |
|
215 | - if (isset($wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ])) { |
|
216 | - return true; |
|
217 | - } |
|
218 | - } |
|
219 | - } |
|
220 | - // load espresso CPT endpoints |
|
221 | - $espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints(); |
|
222 | - $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
223 | - $post_types = (array) $this->get('post_type'); |
|
224 | - foreach ($post_types as $post_type) { |
|
225 | - // was a post name passed ? |
|
226 | - if (isset($post_type_CPT_endpoints[ $post_type ])) { |
|
227 | - // kk we know this is an espresso page, but is it a specific post ? |
|
228 | - if (! $this->get('post_name')) { |
|
229 | - // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
|
230 | - $post_name = isset($post_type_CPT_endpoints[ $this->get('post_type') ]) |
|
231 | - ? $post_type_CPT_endpoints[ $this->get('post_type') ] |
|
232 | - : ''; |
|
233 | - // if the post type matches on of our then set the endpoint |
|
234 | - if ($post_name) { |
|
235 | - $this->set('post_name', $post_name); |
|
236 | - } |
|
237 | - } |
|
238 | - return true; |
|
239 | - } |
|
240 | - } |
|
241 | - return false; |
|
242 | - } |
|
243 | - |
|
244 | - /** |
|
245 | - * @param $key |
|
246 | - * @param $value |
|
247 | - * @return void |
|
248 | - */ |
|
249 | - public function set_notice($key, $value) |
|
250 | - { |
|
251 | - $this->_notice[ $key ] = $value; |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * @param $key |
|
257 | - * @return mixed |
|
258 | - */ |
|
259 | - public function get_notice($key) |
|
260 | - { |
|
261 | - return isset($this->_notice[ $key ]) |
|
262 | - ? $this->_notice[ $key ] |
|
263 | - : null; |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * @param $string |
|
269 | - * @return void |
|
270 | - */ |
|
271 | - public function add_output($string) |
|
272 | - { |
|
273 | - $this->_output .= $string; |
|
274 | - } |
|
275 | - |
|
276 | - |
|
277 | - /** |
|
278 | - * @return string |
|
279 | - */ |
|
280 | - public function get_output() |
|
281 | - { |
|
282 | - return $this->_output; |
|
283 | - } |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * @param $item |
|
288 | - * @param $key |
|
289 | - */ |
|
290 | - public function sanitize_text_field_for_array_walk(&$item, &$key) |
|
291 | - { |
|
292 | - $item = strpos($item, 'email') !== false |
|
293 | - ? sanitize_email($item) |
|
294 | - : sanitize_text_field($item); |
|
295 | - } |
|
296 | - |
|
297 | - |
|
298 | - /** |
|
299 | - * @param null|bool $value |
|
300 | - * @return void |
|
301 | - * @throws EE_Error |
|
302 | - * @throws ReflectionException |
|
303 | - */ |
|
304 | - public function set_espresso_page($value = null) |
|
305 | - { |
|
306 | - $this->request->set( |
|
307 | - 'is_espresso_page', |
|
308 | - ! empty($value) |
|
309 | - ? $value |
|
310 | - : $this->test_for_espresso_page() |
|
311 | - ); |
|
312 | - } |
|
313 | - |
|
314 | - |
|
315 | - /** |
|
316 | - * @return mixed |
|
317 | - */ |
|
318 | - public function is_espresso_page() |
|
319 | - { |
|
320 | - return $this->request->is_set('is_espresso_page'); |
|
321 | - } |
|
322 | - |
|
323 | - |
|
324 | - /** |
|
325 | - * returns contents of $_REQUEST |
|
326 | - * |
|
327 | - * @return array |
|
328 | - */ |
|
329 | - public function params() |
|
330 | - { |
|
331 | - return $this->request->params(); |
|
332 | - } |
|
333 | - |
|
334 | - |
|
335 | - /** |
|
336 | - * @param $key |
|
337 | - * @param $value |
|
338 | - * @param bool $override_ee |
|
339 | - * @return void |
|
340 | - */ |
|
341 | - public function set($key, $value, $override_ee = false) |
|
342 | - { |
|
343 | - $this->request->set($key, $value, $override_ee); |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * @param $key |
|
349 | - * @param null $default |
|
350 | - * @return mixed |
|
351 | - */ |
|
352 | - public function get($key, $default = null) |
|
353 | - { |
|
354 | - return $this->request->get($key, $default); |
|
355 | - } |
|
356 | - |
|
357 | - |
|
358 | - /** |
|
359 | - * check if param exists |
|
360 | - * |
|
361 | - * @param $key |
|
362 | - * @return boolean |
|
363 | - */ |
|
364 | - public function is_set($key) |
|
365 | - { |
|
366 | - return $this->request->is_set($key); |
|
367 | - } |
|
368 | - |
|
369 | - |
|
370 | - /** |
|
371 | - * remove param |
|
372 | - * |
|
373 | - * @param $key |
|
374 | - * @return void |
|
375 | - */ |
|
376 | - public function un_set($key) |
|
377 | - { |
|
378 | - $this->request->un_set($key); |
|
379 | - } |
|
15 | + /** |
|
16 | + * @var EE_Request $request |
|
17 | + */ |
|
18 | + private $request; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var array $_notice |
|
22 | + */ |
|
23 | + private $_notice = array(); |
|
24 | + |
|
25 | + /** |
|
26 | + * rendered output to be returned to WP |
|
27 | + * |
|
28 | + * @var string $_output |
|
29 | + */ |
|
30 | + private $_output = ''; |
|
31 | + |
|
32 | + /** |
|
33 | + * whether current request is via AJAX |
|
34 | + * |
|
35 | + * @var boolean $ajax |
|
36 | + */ |
|
37 | + public $ajax = false; |
|
38 | + |
|
39 | + /** |
|
40 | + * whether current request is via AJAX from the frontend of the site |
|
41 | + * |
|
42 | + * @var boolean $front_ajax |
|
43 | + */ |
|
44 | + public $front_ajax = false; |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @param EE_Request $request |
|
49 | + */ |
|
50 | + public function __construct(EE_Request $request) |
|
51 | + { |
|
52 | + $this->request = $request; |
|
53 | + $this->ajax = $this->request->ajax; |
|
54 | + $this->front_ajax = $this->request->front_ajax; |
|
55 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * @param WP $wp |
|
61 | + * @return void |
|
62 | + * @throws EE_Error |
|
63 | + * @throws ReflectionException |
|
64 | + */ |
|
65 | + public function parse_request($wp = null) |
|
66 | + { |
|
67 | + // if somebody forgot to provide us with WP, that's ok because its global |
|
68 | + if (! $wp instanceof WP) { |
|
69 | + global $wp; |
|
70 | + } |
|
71 | + $this->set_request_vars($wp); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @param WP $wp |
|
77 | + * @return void |
|
78 | + * @throws EE_Error |
|
79 | + * @throws ReflectionException |
|
80 | + */ |
|
81 | + public function set_request_vars($wp = null) |
|
82 | + { |
|
83 | + if (! is_admin()) { |
|
84 | + // set request post_id |
|
85 | + $this->request->set('post_id', $this->get_post_id_from_request($wp)); |
|
86 | + // set request post name |
|
87 | + $this->request->set('post_name', $this->get_post_name_from_request($wp)); |
|
88 | + // set request post_type |
|
89 | + $this->request->set('post_type', $this->get_post_type_from_request($wp)); |
|
90 | + // true or false ? is this page being used by EE ? |
|
91 | + $this->set_espresso_page(); |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * @param WP $wp |
|
98 | + * @return int |
|
99 | + */ |
|
100 | + public function get_post_id_from_request($wp = null) |
|
101 | + { |
|
102 | + if (! $wp instanceof WP) { |
|
103 | + global $wp; |
|
104 | + } |
|
105 | + $post_id = null; |
|
106 | + if (isset($wp->query_vars['p'])) { |
|
107 | + $post_id = $wp->query_vars['p']; |
|
108 | + } |
|
109 | + if (! $post_id && isset($wp->query_vars['page_id'])) { |
|
110 | + $post_id = $wp->query_vars['page_id']; |
|
111 | + } |
|
112 | + if (! $post_id && $wp->request !== null && is_numeric(basename($wp->request))) { |
|
113 | + $post_id = basename($wp->request); |
|
114 | + } |
|
115 | + return $post_id; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @param WP $wp |
|
121 | + * @return string |
|
122 | + */ |
|
123 | + public function get_post_name_from_request($wp = null) |
|
124 | + { |
|
125 | + if (! $wp instanceof WP) { |
|
126 | + global $wp; |
|
127 | + } |
|
128 | + $post_name = null; |
|
129 | + if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
130 | + $post_name = $wp->query_vars['name']; |
|
131 | + } |
|
132 | + if (! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
133 | + $post_name = $wp->query_vars['pagename']; |
|
134 | + } |
|
135 | + if (! $post_name && $wp->request !== null && ! empty($wp->request)) { |
|
136 | + $possible_post_name = basename($wp->request); |
|
137 | + if (! is_numeric($possible_post_name)) { |
|
138 | + /** @type WPDB $wpdb */ |
|
139 | + global $wpdb; |
|
140 | + $SQL = |
|
141 | + "SELECT ID from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND post_name=%s"; |
|
142 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
143 | + if ($possible_post_name) { |
|
144 | + $post_name = $possible_post_name; |
|
145 | + } |
|
146 | + } |
|
147 | + } |
|
148 | + if (! $post_name && $this->get('post_id')) { |
|
149 | + /** @type WPDB $wpdb */ |
|
150 | + global $wpdb; |
|
151 | + $SQL = |
|
152 | + "SELECT post_name from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND ID=%d"; |
|
153 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
154 | + if ($possible_post_name) { |
|
155 | + $post_name = $possible_post_name; |
|
156 | + } |
|
157 | + } |
|
158 | + return $post_name; |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * @param WP $wp |
|
164 | + * @return mixed |
|
165 | + */ |
|
166 | + public function get_post_type_from_request($wp = null) |
|
167 | + { |
|
168 | + if (! $wp instanceof WP) { |
|
169 | + global $wp; |
|
170 | + } |
|
171 | + return isset($wp->query_vars['post_type']) |
|
172 | + ? $wp->query_vars['post_type'] |
|
173 | + : null; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * Just a helper method for getting the url for the displayed page. |
|
179 | + * |
|
180 | + * @param WP $wp |
|
181 | + * @return string |
|
182 | + */ |
|
183 | + public function get_current_page_permalink($wp = null) |
|
184 | + { |
|
185 | + $post_id = $this->get_post_id_from_request($wp); |
|
186 | + if ($post_id) { |
|
187 | + $current_page_permalink = get_permalink($post_id); |
|
188 | + } else { |
|
189 | + if (! $wp instanceof WP) { |
|
190 | + global $wp; |
|
191 | + } |
|
192 | + if ($wp->request) { |
|
193 | + $current_page_permalink = site_url($wp->request); |
|
194 | + } else { |
|
195 | + $current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI'])); |
|
196 | + } |
|
197 | + } |
|
198 | + return $current_page_permalink; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * @return bool |
|
204 | + * @throws EE_Error |
|
205 | + * @throws ReflectionException |
|
206 | + */ |
|
207 | + public function test_for_espresso_page() |
|
208 | + { |
|
209 | + global $wp; |
|
210 | + /** @type EE_CPT_Strategy $EE_CPT_Strategy */ |
|
211 | + $EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy'); |
|
212 | + $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
|
213 | + if (is_array($espresso_CPT_taxonomies)) { |
|
214 | + foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy => $details) { |
|
215 | + if (isset($wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ])) { |
|
216 | + return true; |
|
217 | + } |
|
218 | + } |
|
219 | + } |
|
220 | + // load espresso CPT endpoints |
|
221 | + $espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints(); |
|
222 | + $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
223 | + $post_types = (array) $this->get('post_type'); |
|
224 | + foreach ($post_types as $post_type) { |
|
225 | + // was a post name passed ? |
|
226 | + if (isset($post_type_CPT_endpoints[ $post_type ])) { |
|
227 | + // kk we know this is an espresso page, but is it a specific post ? |
|
228 | + if (! $this->get('post_name')) { |
|
229 | + // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
|
230 | + $post_name = isset($post_type_CPT_endpoints[ $this->get('post_type') ]) |
|
231 | + ? $post_type_CPT_endpoints[ $this->get('post_type') ] |
|
232 | + : ''; |
|
233 | + // if the post type matches on of our then set the endpoint |
|
234 | + if ($post_name) { |
|
235 | + $this->set('post_name', $post_name); |
|
236 | + } |
|
237 | + } |
|
238 | + return true; |
|
239 | + } |
|
240 | + } |
|
241 | + return false; |
|
242 | + } |
|
243 | + |
|
244 | + /** |
|
245 | + * @param $key |
|
246 | + * @param $value |
|
247 | + * @return void |
|
248 | + */ |
|
249 | + public function set_notice($key, $value) |
|
250 | + { |
|
251 | + $this->_notice[ $key ] = $value; |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * @param $key |
|
257 | + * @return mixed |
|
258 | + */ |
|
259 | + public function get_notice($key) |
|
260 | + { |
|
261 | + return isset($this->_notice[ $key ]) |
|
262 | + ? $this->_notice[ $key ] |
|
263 | + : null; |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * @param $string |
|
269 | + * @return void |
|
270 | + */ |
|
271 | + public function add_output($string) |
|
272 | + { |
|
273 | + $this->_output .= $string; |
|
274 | + } |
|
275 | + |
|
276 | + |
|
277 | + /** |
|
278 | + * @return string |
|
279 | + */ |
|
280 | + public function get_output() |
|
281 | + { |
|
282 | + return $this->_output; |
|
283 | + } |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * @param $item |
|
288 | + * @param $key |
|
289 | + */ |
|
290 | + public function sanitize_text_field_for_array_walk(&$item, &$key) |
|
291 | + { |
|
292 | + $item = strpos($item, 'email') !== false |
|
293 | + ? sanitize_email($item) |
|
294 | + : sanitize_text_field($item); |
|
295 | + } |
|
296 | + |
|
297 | + |
|
298 | + /** |
|
299 | + * @param null|bool $value |
|
300 | + * @return void |
|
301 | + * @throws EE_Error |
|
302 | + * @throws ReflectionException |
|
303 | + */ |
|
304 | + public function set_espresso_page($value = null) |
|
305 | + { |
|
306 | + $this->request->set( |
|
307 | + 'is_espresso_page', |
|
308 | + ! empty($value) |
|
309 | + ? $value |
|
310 | + : $this->test_for_espresso_page() |
|
311 | + ); |
|
312 | + } |
|
313 | + |
|
314 | + |
|
315 | + /** |
|
316 | + * @return mixed |
|
317 | + */ |
|
318 | + public function is_espresso_page() |
|
319 | + { |
|
320 | + return $this->request->is_set('is_espresso_page'); |
|
321 | + } |
|
322 | + |
|
323 | + |
|
324 | + /** |
|
325 | + * returns contents of $_REQUEST |
|
326 | + * |
|
327 | + * @return array |
|
328 | + */ |
|
329 | + public function params() |
|
330 | + { |
|
331 | + return $this->request->params(); |
|
332 | + } |
|
333 | + |
|
334 | + |
|
335 | + /** |
|
336 | + * @param $key |
|
337 | + * @param $value |
|
338 | + * @param bool $override_ee |
|
339 | + * @return void |
|
340 | + */ |
|
341 | + public function set($key, $value, $override_ee = false) |
|
342 | + { |
|
343 | + $this->request->set($key, $value, $override_ee); |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * @param $key |
|
349 | + * @param null $default |
|
350 | + * @return mixed |
|
351 | + */ |
|
352 | + public function get($key, $default = null) |
|
353 | + { |
|
354 | + return $this->request->get($key, $default); |
|
355 | + } |
|
356 | + |
|
357 | + |
|
358 | + /** |
|
359 | + * check if param exists |
|
360 | + * |
|
361 | + * @param $key |
|
362 | + * @return boolean |
|
363 | + */ |
|
364 | + public function is_set($key) |
|
365 | + { |
|
366 | + return $this->request->is_set($key); |
|
367 | + } |
|
368 | + |
|
369 | + |
|
370 | + /** |
|
371 | + * remove param |
|
372 | + * |
|
373 | + * @param $key |
|
374 | + * @return void |
|
375 | + */ |
|
376 | + public function un_set($key) |
|
377 | + { |
|
378 | + $this->request->un_set($key); |
|
379 | + } |
|
380 | 380 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function parse_request($wp = null) |
66 | 66 | { |
67 | 67 | // if somebody forgot to provide us with WP, that's ok because its global |
68 | - if (! $wp instanceof WP) { |
|
68 | + if ( ! $wp instanceof WP) { |
|
69 | 69 | global $wp; |
70 | 70 | } |
71 | 71 | $this->set_request_vars($wp); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function set_request_vars($wp = null) |
82 | 82 | { |
83 | - if (! is_admin()) { |
|
83 | + if ( ! is_admin()) { |
|
84 | 84 | // set request post_id |
85 | 85 | $this->request->set('post_id', $this->get_post_id_from_request($wp)); |
86 | 86 | // set request post name |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function get_post_id_from_request($wp = null) |
101 | 101 | { |
102 | - if (! $wp instanceof WP) { |
|
102 | + if ( ! $wp instanceof WP) { |
|
103 | 103 | global $wp; |
104 | 104 | } |
105 | 105 | $post_id = null; |
106 | 106 | if (isset($wp->query_vars['p'])) { |
107 | 107 | $post_id = $wp->query_vars['p']; |
108 | 108 | } |
109 | - if (! $post_id && isset($wp->query_vars['page_id'])) { |
|
109 | + if ( ! $post_id && isset($wp->query_vars['page_id'])) { |
|
110 | 110 | $post_id = $wp->query_vars['page_id']; |
111 | 111 | } |
112 | - if (! $post_id && $wp->request !== null && is_numeric(basename($wp->request))) { |
|
112 | + if ( ! $post_id && $wp->request !== null && is_numeric(basename($wp->request))) { |
|
113 | 113 | $post_id = basename($wp->request); |
114 | 114 | } |
115 | 115 | return $post_id; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_post_name_from_request($wp = null) |
124 | 124 | { |
125 | - if (! $wp instanceof WP) { |
|
125 | + if ( ! $wp instanceof WP) { |
|
126 | 126 | global $wp; |
127 | 127 | } |
128 | 128 | $post_name = null; |
129 | 129 | if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
130 | 130 | $post_name = $wp->query_vars['name']; |
131 | 131 | } |
132 | - if (! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
132 | + if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
133 | 133 | $post_name = $wp->query_vars['pagename']; |
134 | 134 | } |
135 | - if (! $post_name && $wp->request !== null && ! empty($wp->request)) { |
|
135 | + if ( ! $post_name && $wp->request !== null && ! empty($wp->request)) { |
|
136 | 136 | $possible_post_name = basename($wp->request); |
137 | - if (! is_numeric($possible_post_name)) { |
|
137 | + if ( ! is_numeric($possible_post_name)) { |
|
138 | 138 | /** @type WPDB $wpdb */ |
139 | 139 | global $wpdb; |
140 | 140 | $SQL = |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
148 | - if (! $post_name && $this->get('post_id')) { |
|
148 | + if ( ! $post_name && $this->get('post_id')) { |
|
149 | 149 | /** @type WPDB $wpdb */ |
150 | 150 | global $wpdb; |
151 | 151 | $SQL = |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function get_post_type_from_request($wp = null) |
167 | 167 | { |
168 | - if (! $wp instanceof WP) { |
|
168 | + if ( ! $wp instanceof WP) { |
|
169 | 169 | global $wp; |
170 | 170 | } |
171 | 171 | return isset($wp->query_vars['post_type']) |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ($post_id) { |
187 | 187 | $current_page_permalink = get_permalink($post_id); |
188 | 188 | } else { |
189 | - if (! $wp instanceof WP) { |
|
189 | + if ( ! $wp instanceof WP) { |
|
190 | 190 | global $wp; |
191 | 191 | } |
192 | 192 | if ($wp->request) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
213 | 213 | if (is_array($espresso_CPT_taxonomies)) { |
214 | 214 | foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy => $details) { |
215 | - if (isset($wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ])) { |
|
215 | + if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) { |
|
216 | 216 | return true; |
217 | 217 | } |
218 | 218 | } |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $post_types = (array) $this->get('post_type'); |
224 | 224 | foreach ($post_types as $post_type) { |
225 | 225 | // was a post name passed ? |
226 | - if (isset($post_type_CPT_endpoints[ $post_type ])) { |
|
226 | + if (isset($post_type_CPT_endpoints[$post_type])) { |
|
227 | 227 | // kk we know this is an espresso page, but is it a specific post ? |
228 | - if (! $this->get('post_name')) { |
|
228 | + if ( ! $this->get('post_name')) { |
|
229 | 229 | // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
230 | - $post_name = isset($post_type_CPT_endpoints[ $this->get('post_type') ]) |
|
231 | - ? $post_type_CPT_endpoints[ $this->get('post_type') ] |
|
230 | + $post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) |
|
231 | + ? $post_type_CPT_endpoints[$this->get('post_type')] |
|
232 | 232 | : ''; |
233 | 233 | // if the post type matches on of our then set the endpoint |
234 | 234 | if ($post_name) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function set_notice($key, $value) |
250 | 250 | { |
251 | - $this->_notice[ $key ] = $value; |
|
251 | + $this->_notice[$key] = $value; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function get_notice($key) |
260 | 260 | { |
261 | - return isset($this->_notice[ $key ]) |
|
262 | - ? $this->_notice[ $key ] |
|
261 | + return isset($this->_notice[$key]) |
|
262 | + ? $this->_notice[$key] |
|
263 | 263 | : null; |
264 | 264 | } |
265 | 265 |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | public function get_stops() |
257 | 257 | { |
258 | 258 | foreach ($this->_stops as $ind => $stop) { |
259 | - if (! isset($stop['button_text'])) { |
|
260 | - $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
259 | + if ( ! isset($stop['button_text'])) { |
|
260 | + $this->_stops[$ind]['button_text'] = $this->_options['button_text']; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | return $this->_stops; |
@@ -277,6 +277,6 @@ discard block |
||
277 | 277 | $this->_options['pauseAfter'][] = $ind; |
278 | 278 | } |
279 | 279 | } |
280 | - return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
280 | + return apply_filters('FHEE__'.get_class($this).'__get_options', $this->_options, $this); |
|
281 | 281 | } |
282 | 282 | } |
@@ -15,269 +15,269 @@ |
||
15 | 15 | abstract class EE_Help_Tour extends EE_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the |
|
20 | - * constructor of the child class. |
|
21 | - * |
|
22 | - * @access protected |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_label = ''; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * This is the slug for the tour. It should be unique from all tours and is used for starting a tour and setting |
|
30 | - * cookies for the tour. Set this in the constructor of the child class. |
|
31 | - * |
|
32 | - * @access protected |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $_slug = ''; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for |
|
40 | - * setting up a tour on a given page. format for array is: array( |
|
41 | - * 0 => array( |
|
42 | - * 'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take |
|
43 | - * precendence even if you also set class. |
|
44 | - * 'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use |
|
45 | - * this param. The first element for that class is the anchor. If the class or the id are empty then the |
|
46 | - * stop will be a modal on the page anchored to the main body. |
|
47 | - * 'custom_class' => 'some_custom_class', //optional custom class to add for this stop. |
|
48 | - * 'button_text' => 'custom text for button', //optional |
|
49 | - * 'content' => 'The content for the stop', //required |
|
50 | - * 'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get |
|
51 | - * added to the pauseAfter global option array setup for the joyride instance. This is only applicable |
|
52 | - * when this tour has been set to run on timer. |
|
53 | - * 'options' => array( |
|
54 | - * //override any of the global options set via the help_tour "option_callback" for the joyride |
|
55 | - * instance on this specific stop. |
|
56 | - * ) |
|
57 | - * ) |
|
58 | - * ); |
|
59 | - * |
|
60 | - * @access protected |
|
61 | - * @var array |
|
62 | - */ |
|
63 | - protected $_stops = array(); |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * This contains any stop specific options for the tour. |
|
68 | - * defaults are set but child classes can override. |
|
69 | - * |
|
70 | - * @access protected |
|
71 | - * @var array |
|
72 | - */ |
|
73 | - protected $_options = array(); |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * holds anything found in the $_REQUEST object (however we override any _gets with _post data). |
|
78 | - * |
|
79 | - * @access protected |
|
80 | - * @var array |
|
81 | - */ |
|
82 | - protected $_req_data = array(); |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * a flag that is set on init for whether this help_tour is happening on a caf install or not. |
|
87 | - * |
|
88 | - * @var boolean |
|
89 | - */ |
|
90 | - protected $_is_caf = false; |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * _constructor |
|
95 | - * initialized the tour object and sets up important properties required to setup the tour. |
|
96 | - * |
|
97 | - * @access public |
|
98 | - * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
|
99 | - * @return void |
|
100 | - */ |
|
101 | - public function __construct($caf = false) |
|
102 | - { |
|
103 | - $this->_is_caf = $caf; |
|
104 | - $this->_req_data = array_merge($_GET, $_POST); |
|
105 | - $this->_set_tour_properties(); |
|
106 | - $this->_set_tour_stops(); |
|
107 | - $this->_set_tour_options(); |
|
108 | - |
|
109 | - // make sure the last tour stop has "end tour" for its button |
|
110 | - $end = array_pop($this->_stops); |
|
111 | - $end['button_text'] = __('End Tour', 'event_espresso'); |
|
112 | - // add back to stops |
|
113 | - $this->_stops[] = $end; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * required method that has the sole purpose of setting up the tour $_label and $_slug properties |
|
119 | - * |
|
120 | - * @abstract |
|
121 | - * @access protected |
|
122 | - * @return void |
|
123 | - */ |
|
124 | - abstract protected function _set_tour_properties(); |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * required method that's sole purpose is to setup the $_stops property |
|
129 | - * |
|
130 | - * @abstract |
|
131 | - * @access protected |
|
132 | - * @return void |
|
133 | - */ |
|
134 | - abstract protected function _set_tour_stops(); |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * The method can optionally be overridden by child classes to set the _options array if there are any default |
|
139 | - * options the child wishes to override for a this tour. See property definition for more info |
|
140 | - * |
|
141 | - * @access protected |
|
142 | - * @return void |
|
143 | - */ |
|
144 | - protected function _set_tour_options($options = array()) |
|
145 | - { |
|
146 | - $defaults = array( |
|
147 | - 'tipLocation' => 'bottom', |
|
148 | - // 'top', 'bottom', 'right', 'left' in relation to parent |
|
149 | - 'nubPosition' => 'auto', |
|
150 | - // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
151 | - 'tipAdjustmentY' => 0, |
|
152 | - // allow for adjustment of tip |
|
153 | - 'tipAdjustmentX' => 0, |
|
154 | - // allow for adjustment of tip |
|
155 | - 'scroll' => true, |
|
156 | - // whether to scrollTo the next step or not |
|
157 | - 'scrollSpeed' => 300, |
|
158 | - // Page scrolling speed in ms |
|
159 | - 'timer' => 0, |
|
160 | - // 0 = off, all other numbers = time(ms) |
|
161 | - 'autoStart' => true, |
|
162 | - // true or false - false tour starts when restart called |
|
163 | - 'startTimerOnClick' => true, |
|
164 | - // true/false to start timer on first click |
|
165 | - 'nextButton' => true, |
|
166 | - // true/false for next button visibility |
|
167 | - 'button_text' => __('Next', 'event_espresso'), |
|
168 | - 'tipAnimation' => 'fade', |
|
169 | - // 'pop' or 'fade' in each tip |
|
170 | - 'pauseAfter' => array(), |
|
171 | - // array of indexes where to pause the tour after |
|
172 | - 'tipAnimationFadeSpeed' => 300, |
|
173 | - // if 'fade'- speed in ms of transition |
|
174 | - 'cookieMonster' => true, |
|
175 | - // true/false for whether cookies are used |
|
176 | - 'cookieName' => $this->get_slug(), |
|
177 | - // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
178 | - // set to false or yoursite.com |
|
179 | - 'cookieDomain' => false, |
|
180 | - // Where the tip be attached if not inline |
|
181 | - // 'tipContainer' => 'body', |
|
182 | - 'modal' => false, |
|
183 | - // Whether to cover page with modal during the tour |
|
184 | - 'expose' => false, |
|
185 | - // Whether to expose the elements at each step in the tour (requires modal:true), |
|
186 | - 'postExposeCallback' => 'EEHelpTour.postExposeCallback', |
|
187 | - // A method to call after an element has been exposed |
|
188 | - 'preRideCallback' => 'EEHelpTour_preRideCallback', |
|
189 | - // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
190 | - 'postRideCallback' => 'EEHelpTour_postRideCallback', |
|
191 | - // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
192 | - 'preStepCallback' => 'EEHelpTour_preStepCallback', |
|
193 | - // A method to call before each step |
|
194 | - 'postStepCallback' => 'EEHelpTour_postStepCallback', |
|
195 | - // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
196 | - ); |
|
197 | - |
|
198 | - $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
199 | - $this->_options = $options; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * getter functions to return all the properties for the tour. |
|
205 | - */ |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * get_slug |
|
210 | - * |
|
211 | - * @return string slug for the tour |
|
212 | - */ |
|
213 | - public function get_slug() |
|
214 | - { |
|
215 | - if (empty($this->_slug)) { |
|
216 | - throw new EE_Error( |
|
217 | - sprintf( |
|
218 | - __( |
|
219 | - 'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', |
|
220 | - 'event_espresso' |
|
221 | - ), |
|
222 | - get_class($this) |
|
223 | - ) |
|
224 | - ); |
|
225 | - } |
|
226 | - return $this->_slug; |
|
227 | - } |
|
228 | - |
|
229 | - |
|
230 | - /** |
|
231 | - * get_label |
|
232 | - * |
|
233 | - * @return string |
|
234 | - */ |
|
235 | - public function get_label() |
|
236 | - { |
|
237 | - if (empty($this->_label)) { |
|
238 | - throw new EE_Error( |
|
239 | - sprintf( |
|
240 | - __( |
|
241 | - 'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', |
|
242 | - 'event_espresso' |
|
243 | - ), |
|
244 | - get_class($this) |
|
245 | - ) |
|
246 | - ); |
|
247 | - } |
|
248 | - return $this->_label; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * get_stops |
|
254 | - * |
|
255 | - * @return array |
|
256 | - */ |
|
257 | - public function get_stops() |
|
258 | - { |
|
259 | - foreach ($this->_stops as $ind => $stop) { |
|
260 | - if (! isset($stop['button_text'])) { |
|
261 | - $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
262 | - } |
|
263 | - } |
|
264 | - return $this->_stops; |
|
265 | - } |
|
266 | - |
|
267 | - |
|
268 | - /** |
|
269 | - * get options |
|
270 | - * |
|
271 | - * @return array |
|
272 | - */ |
|
273 | - public function get_options() |
|
274 | - { |
|
275 | - // let's make sure there are not pauses set |
|
276 | - foreach ($this->_stops as $ind => $stop) { |
|
277 | - if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
278 | - $this->_options['pauseAfter'][] = $ind; |
|
279 | - } |
|
280 | - } |
|
281 | - return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
282 | - } |
|
18 | + /** |
|
19 | + * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the |
|
20 | + * constructor of the child class. |
|
21 | + * |
|
22 | + * @access protected |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_label = ''; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * This is the slug for the tour. It should be unique from all tours and is used for starting a tour and setting |
|
30 | + * cookies for the tour. Set this in the constructor of the child class. |
|
31 | + * |
|
32 | + * @access protected |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $_slug = ''; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for |
|
40 | + * setting up a tour on a given page. format for array is: array( |
|
41 | + * 0 => array( |
|
42 | + * 'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take |
|
43 | + * precendence even if you also set class. |
|
44 | + * 'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use |
|
45 | + * this param. The first element for that class is the anchor. If the class or the id are empty then the |
|
46 | + * stop will be a modal on the page anchored to the main body. |
|
47 | + * 'custom_class' => 'some_custom_class', //optional custom class to add for this stop. |
|
48 | + * 'button_text' => 'custom text for button', //optional |
|
49 | + * 'content' => 'The content for the stop', //required |
|
50 | + * 'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get |
|
51 | + * added to the pauseAfter global option array setup for the joyride instance. This is only applicable |
|
52 | + * when this tour has been set to run on timer. |
|
53 | + * 'options' => array( |
|
54 | + * //override any of the global options set via the help_tour "option_callback" for the joyride |
|
55 | + * instance on this specific stop. |
|
56 | + * ) |
|
57 | + * ) |
|
58 | + * ); |
|
59 | + * |
|
60 | + * @access protected |
|
61 | + * @var array |
|
62 | + */ |
|
63 | + protected $_stops = array(); |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * This contains any stop specific options for the tour. |
|
68 | + * defaults are set but child classes can override. |
|
69 | + * |
|
70 | + * @access protected |
|
71 | + * @var array |
|
72 | + */ |
|
73 | + protected $_options = array(); |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * holds anything found in the $_REQUEST object (however we override any _gets with _post data). |
|
78 | + * |
|
79 | + * @access protected |
|
80 | + * @var array |
|
81 | + */ |
|
82 | + protected $_req_data = array(); |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * a flag that is set on init for whether this help_tour is happening on a caf install or not. |
|
87 | + * |
|
88 | + * @var boolean |
|
89 | + */ |
|
90 | + protected $_is_caf = false; |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * _constructor |
|
95 | + * initialized the tour object and sets up important properties required to setup the tour. |
|
96 | + * |
|
97 | + * @access public |
|
98 | + * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
|
99 | + * @return void |
|
100 | + */ |
|
101 | + public function __construct($caf = false) |
|
102 | + { |
|
103 | + $this->_is_caf = $caf; |
|
104 | + $this->_req_data = array_merge($_GET, $_POST); |
|
105 | + $this->_set_tour_properties(); |
|
106 | + $this->_set_tour_stops(); |
|
107 | + $this->_set_tour_options(); |
|
108 | + |
|
109 | + // make sure the last tour stop has "end tour" for its button |
|
110 | + $end = array_pop($this->_stops); |
|
111 | + $end['button_text'] = __('End Tour', 'event_espresso'); |
|
112 | + // add back to stops |
|
113 | + $this->_stops[] = $end; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * required method that has the sole purpose of setting up the tour $_label and $_slug properties |
|
119 | + * |
|
120 | + * @abstract |
|
121 | + * @access protected |
|
122 | + * @return void |
|
123 | + */ |
|
124 | + abstract protected function _set_tour_properties(); |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * required method that's sole purpose is to setup the $_stops property |
|
129 | + * |
|
130 | + * @abstract |
|
131 | + * @access protected |
|
132 | + * @return void |
|
133 | + */ |
|
134 | + abstract protected function _set_tour_stops(); |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * The method can optionally be overridden by child classes to set the _options array if there are any default |
|
139 | + * options the child wishes to override for a this tour. See property definition for more info |
|
140 | + * |
|
141 | + * @access protected |
|
142 | + * @return void |
|
143 | + */ |
|
144 | + protected function _set_tour_options($options = array()) |
|
145 | + { |
|
146 | + $defaults = array( |
|
147 | + 'tipLocation' => 'bottom', |
|
148 | + // 'top', 'bottom', 'right', 'left' in relation to parent |
|
149 | + 'nubPosition' => 'auto', |
|
150 | + // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
151 | + 'tipAdjustmentY' => 0, |
|
152 | + // allow for adjustment of tip |
|
153 | + 'tipAdjustmentX' => 0, |
|
154 | + // allow for adjustment of tip |
|
155 | + 'scroll' => true, |
|
156 | + // whether to scrollTo the next step or not |
|
157 | + 'scrollSpeed' => 300, |
|
158 | + // Page scrolling speed in ms |
|
159 | + 'timer' => 0, |
|
160 | + // 0 = off, all other numbers = time(ms) |
|
161 | + 'autoStart' => true, |
|
162 | + // true or false - false tour starts when restart called |
|
163 | + 'startTimerOnClick' => true, |
|
164 | + // true/false to start timer on first click |
|
165 | + 'nextButton' => true, |
|
166 | + // true/false for next button visibility |
|
167 | + 'button_text' => __('Next', 'event_espresso'), |
|
168 | + 'tipAnimation' => 'fade', |
|
169 | + // 'pop' or 'fade' in each tip |
|
170 | + 'pauseAfter' => array(), |
|
171 | + // array of indexes where to pause the tour after |
|
172 | + 'tipAnimationFadeSpeed' => 300, |
|
173 | + // if 'fade'- speed in ms of transition |
|
174 | + 'cookieMonster' => true, |
|
175 | + // true/false for whether cookies are used |
|
176 | + 'cookieName' => $this->get_slug(), |
|
177 | + // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
178 | + // set to false or yoursite.com |
|
179 | + 'cookieDomain' => false, |
|
180 | + // Where the tip be attached if not inline |
|
181 | + // 'tipContainer' => 'body', |
|
182 | + 'modal' => false, |
|
183 | + // Whether to cover page with modal during the tour |
|
184 | + 'expose' => false, |
|
185 | + // Whether to expose the elements at each step in the tour (requires modal:true), |
|
186 | + 'postExposeCallback' => 'EEHelpTour.postExposeCallback', |
|
187 | + // A method to call after an element has been exposed |
|
188 | + 'preRideCallback' => 'EEHelpTour_preRideCallback', |
|
189 | + // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
190 | + 'postRideCallback' => 'EEHelpTour_postRideCallback', |
|
191 | + // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
192 | + 'preStepCallback' => 'EEHelpTour_preStepCallback', |
|
193 | + // A method to call before each step |
|
194 | + 'postStepCallback' => 'EEHelpTour_postStepCallback', |
|
195 | + // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
196 | + ); |
|
197 | + |
|
198 | + $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
199 | + $this->_options = $options; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * getter functions to return all the properties for the tour. |
|
205 | + */ |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * get_slug |
|
210 | + * |
|
211 | + * @return string slug for the tour |
|
212 | + */ |
|
213 | + public function get_slug() |
|
214 | + { |
|
215 | + if (empty($this->_slug)) { |
|
216 | + throw new EE_Error( |
|
217 | + sprintf( |
|
218 | + __( |
|
219 | + 'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', |
|
220 | + 'event_espresso' |
|
221 | + ), |
|
222 | + get_class($this) |
|
223 | + ) |
|
224 | + ); |
|
225 | + } |
|
226 | + return $this->_slug; |
|
227 | + } |
|
228 | + |
|
229 | + |
|
230 | + /** |
|
231 | + * get_label |
|
232 | + * |
|
233 | + * @return string |
|
234 | + */ |
|
235 | + public function get_label() |
|
236 | + { |
|
237 | + if (empty($this->_label)) { |
|
238 | + throw new EE_Error( |
|
239 | + sprintf( |
|
240 | + __( |
|
241 | + 'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', |
|
242 | + 'event_espresso' |
|
243 | + ), |
|
244 | + get_class($this) |
|
245 | + ) |
|
246 | + ); |
|
247 | + } |
|
248 | + return $this->_label; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * get_stops |
|
254 | + * |
|
255 | + * @return array |
|
256 | + */ |
|
257 | + public function get_stops() |
|
258 | + { |
|
259 | + foreach ($this->_stops as $ind => $stop) { |
|
260 | + if (! isset($stop['button_text'])) { |
|
261 | + $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
262 | + } |
|
263 | + } |
|
264 | + return $this->_stops; |
|
265 | + } |
|
266 | + |
|
267 | + |
|
268 | + /** |
|
269 | + * get options |
|
270 | + * |
|
271 | + * @return array |
|
272 | + */ |
|
273 | + public function get_options() |
|
274 | + { |
|
275 | + // let's make sure there are not pauses set |
|
276 | + foreach ($this->_stops as $ind => $stop) { |
|
277 | + if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
278 | + $this->_options['pauseAfter'][] = $ind; |
|
279 | + } |
|
280 | + } |
|
281 | + return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
282 | + } |
|
283 | 283 | } |
@@ -4,19 +4,19 @@ |
||
4 | 4 | <div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
5 | 5 | <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" |
6 | 6 | width="90" height="90" alt="<?php |
7 | - printf( |
|
8 | - esc_attr__('%s Logo', 'event_espresso'), |
|
9 | - 'Event Espresso' |
|
10 | - ); ?>"/> |
|
7 | + printf( |
|
8 | + esc_attr__('%s Logo', 'event_espresso'), |
|
9 | + 'Event Espresso' |
|
10 | + ); ?>"/> |
|
11 | 11 | <br/><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div> |
12 | 12 | |
13 | 13 | <?php echo $nav_tabs; ?> |
14 | 14 | |
15 | 15 | |
16 | 16 | <?php |
17 | - do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
18 | - echo $about_admin_page_content; |
|
19 | - do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
20 | - ?> |
|
17 | + do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
18 | + echo $about_admin_page_content; |
|
19 | + do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
20 | + ?> |
|
21 | 21 | |
22 | 22 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | <?php echo $nav_tabs; ?> |
8 | 8 | |
9 | 9 | <?php |
10 | - do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
11 | - echo $before_admin_page_content; |
|
12 | - echo $admin_page_content; |
|
13 | - echo $after_admin_page_content; |
|
14 | - do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
15 | - ?> |
|
10 | + do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
11 | + echo $before_admin_page_content; |
|
12 | + echo $admin_page_content; |
|
13 | + echo $after_admin_page_content; |
|
14 | + do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
15 | + ?> |
|
16 | 16 | |
17 | 17 | </div> |
@@ -9,11 +9,11 @@ |
||
9 | 9 | </div> <!-- post-body-content --> |
10 | 10 | |
11 | 11 | <?php |
12 | - // let's loop through the columns |
|
13 | - for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | - $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | - ?> |
|
12 | + // let's loop through the columns |
|
13 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | + $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | + $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | + ?> |
|
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
19 | 19 | <?php do_meta_boxes($current_page, $metaref, null); ?> |
@@ -12,7 +12,7 @@ |
||
12 | 12 | // let's loop through the columns |
13 | 13 | for ($i = 1; $i <= $num_columns; $i++) { |
14 | 14 | $metaref = ($i === 1) ? 'normal' : 'side'; |
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
15 | + $metaref = ($i > 2) ? 'column'.$i : $metaref; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
@@ -2,16 +2,16 @@ discard block |
||
2 | 2 | <ul class="infolinks"> |
3 | 3 | <li> |
4 | 4 | <?php |
5 | - echo '<a href="http://eventespresso.com/wiki/installation/" target="_blank">' |
|
6 | - . __( |
|
7 | - 'Installation', |
|
8 | - 'event_espresso' |
|
9 | - ) |
|
10 | - . '</a> & <a href="http://eventespresso.com/wiki/setting-up-event-espresso/" target="_blank">' |
|
11 | - . __( |
|
12 | - 'Usage Guide', |
|
13 | - 'event_espresso' |
|
14 | - ) . '</a>'; ?> |
|
5 | + echo '<a href="http://eventespresso.com/wiki/installation/" target="_blank">' |
|
6 | + . __( |
|
7 | + 'Installation', |
|
8 | + 'event_espresso' |
|
9 | + ) |
|
10 | + . '</a> & <a href="http://eventespresso.com/wiki/setting-up-event-espresso/" target="_blank">' |
|
11 | + . __( |
|
12 | + 'Usage Guide', |
|
13 | + 'event_espresso' |
|
14 | + ) . '</a>'; ?> |
|
15 | 15 | </li> |
16 | 16 | <li> |
17 | 17 | <a href="http://eventespresso.com/wiki/put-custom-templates/" target="_blank"> |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | </li> |
42 | 42 | <li> |
43 | 43 | <?php echo '<a href="http://eventespresso.com/pricing/" target="_blank">' |
44 | - . __( |
|
45 | - 'Plugins', |
|
46 | - 'event_espresso' |
|
47 | - ) |
|
48 | - . '</a> & <a href="http://eventespresso.com/add-ons/" target="_blank">' |
|
49 | - . __( |
|
50 | - 'Add-ons', |
|
51 | - 'event_espresso' |
|
52 | - ) . '</a>'; ?><br/> |
|
44 | + . __( |
|
45 | + 'Plugins', |
|
46 | + 'event_espresso' |
|
47 | + ) |
|
48 | + . '</a> & <a href="http://eventespresso.com/add-ons/" target="_blank">' |
|
49 | + . __( |
|
50 | + 'Add-ons', |
|
51 | + 'event_espresso' |
|
52 | + ) . '</a>'; ?><br/> |
|
53 | 53 | <br/> |
54 | 54 | <ol> |
55 | 55 | <li> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | . __( |
12 | 12 | 'Usage Guide', |
13 | 13 | 'event_espresso' |
14 | - ) . '</a>'; ?> |
|
14 | + ).'</a>'; ?> |
|
15 | 15 | </li> |
16 | 16 | <li> |
17 | 17 | <a href="http://eventespresso.com/wiki/put-custom-templates/" target="_blank"> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | . __( |
50 | 50 | 'Add-ons', |
51 | 51 | 'event_espresso' |
52 | - ) . '</a>'; ?><br/> |
|
52 | + ).'</a>'; ?><br/> |
|
53 | 53 | <br/> |
54 | 54 | <ol> |
55 | 55 | <li> |
@@ -3,11 +3,11 @@ |
||
3 | 3 | |
4 | 4 | <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; ?></div> |
5 | 5 | <?php |
6 | - do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
7 | - echo $before_admin_page_content; |
|
8 | - echo $admin_page_content; |
|
9 | - echo $after_admin_page_content; |
|
10 | - do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
11 | - ?> |
|
6 | + do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
7 | + echo $before_admin_page_content; |
|
8 | + echo $admin_page_content; |
|
9 | + echo $after_admin_page_content; |
|
10 | + do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
11 | + ?> |
|
12 | 12 | </div> |
13 | 13 | <!-- espresso-admin --> |
14 | 14 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <div id="<?php echo $admin_page_wrapper_div_id; ?>"> |
8 | 8 | <div id="post-body" class="metabox-holder columns-1"> |
9 | 9 | |
10 | - <?php if (! empty($admin_page_header)) : ?> |
|
10 | + <?php if ( ! empty($admin_page_header)) : ?> |
|
11 | 11 | <div id="admin-page-header"> |
12 | 12 | <?php echo $admin_page_header; ?> |
13 | 13 | </div> |
@@ -15,235 +15,235 @@ discard block |
||
15 | 15 | abstract class EE_Qtip_Config extends EE_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * This will hold the qtips setup array (setup by children) |
|
20 | - * |
|
21 | - * @access protected |
|
22 | - * @var array |
|
23 | - */ |
|
24 | - protected $_qtipsa; |
|
18 | + /** |
|
19 | + * This will hold the qtips setup array (setup by children) |
|
20 | + * |
|
21 | + * @access protected |
|
22 | + * @var array |
|
23 | + */ |
|
24 | + protected $_qtipsa; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * This holds the constructed EE_Qtip objects |
|
29 | - * |
|
30 | - * @access protected |
|
31 | - * @var EE_Qtip |
|
32 | - */ |
|
33 | - protected $_qtips; |
|
27 | + /** |
|
28 | + * This holds the constructed EE_Qtip objects |
|
29 | + * |
|
30 | + * @access protected |
|
31 | + * @var EE_Qtip |
|
32 | + */ |
|
33 | + protected $_qtips; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * an array of default options for instantiated qtip js objects |
|
38 | - * |
|
39 | - * @access protected |
|
40 | - * @var array |
|
41 | - */ |
|
42 | - protected $_default_options; |
|
36 | + /** |
|
37 | + * an array of default options for instantiated qtip js objects |
|
38 | + * |
|
39 | + * @access protected |
|
40 | + * @var array |
|
41 | + */ |
|
42 | + protected $_default_options; |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * constructor |
|
47 | - * |
|
48 | - * @access public |
|
49 | - */ |
|
50 | - public function __construct() |
|
51 | - { |
|
52 | - $this->_qtipsa = $this->_qtips = array(); |
|
53 | - $this->_set_default_options(); |
|
54 | - $this->_set_tips_array(); |
|
55 | - $this->_construct_tips(); |
|
56 | - } |
|
45 | + /** |
|
46 | + * constructor |
|
47 | + * |
|
48 | + * @access public |
|
49 | + */ |
|
50 | + public function __construct() |
|
51 | + { |
|
52 | + $this->_qtipsa = $this->_qtips = array(); |
|
53 | + $this->_set_default_options(); |
|
54 | + $this->_set_tips_array(); |
|
55 | + $this->_construct_tips(); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Children define this method and its purpose is to setup the $_qtipsa property. The format of this property is: |
|
61 | - * |
|
62 | - * $qtipsa = array( |
|
63 | - * 0 => array( |
|
64 | - * 'content_id' => 'some_unique_id_for_referencing_content', //just the string |
|
65 | - * 'content' => 'html/text content for the qtip', |
|
66 | - * 'target' => '#target-element', //use the same schema as jQuery selectors. This will match what the |
|
67 | - * target is for the qTip in the dom (i.e. if class then '.some-class'). |
|
68 | - * 'options' => array() //use this to override any of the default options for this specific qtip. |
|
69 | - * ) |
|
70 | - * ); |
|
71 | - * |
|
72 | - * @abstract |
|
73 | - * @access protected |
|
74 | - * @return void |
|
75 | - */ |
|
76 | - abstract protected function _set_tips_array(); |
|
59 | + /** |
|
60 | + * Children define this method and its purpose is to setup the $_qtipsa property. The format of this property is: |
|
61 | + * |
|
62 | + * $qtipsa = array( |
|
63 | + * 0 => array( |
|
64 | + * 'content_id' => 'some_unique_id_for_referencing_content', //just the string |
|
65 | + * 'content' => 'html/text content for the qtip', |
|
66 | + * 'target' => '#target-element', //use the same schema as jQuery selectors. This will match what the |
|
67 | + * target is for the qTip in the dom (i.e. if class then '.some-class'). |
|
68 | + * 'options' => array() //use this to override any of the default options for this specific qtip. |
|
69 | + * ) |
|
70 | + * ); |
|
71 | + * |
|
72 | + * @abstract |
|
73 | + * @access protected |
|
74 | + * @return void |
|
75 | + */ |
|
76 | + abstract protected function _set_tips_array(); |
|
77 | 77 | |
78 | 78 | |
79 | - /** |
|
80 | - * all the default options for the qtip js are defined here. Children class can override the defaults for all the |
|
81 | - * qtips defined in their config OR just leave it and have the parent default options apply. |
|
82 | - * |
|
83 | - * commented out options are there for reference so you know which can be defined by the child. |
|
84 | - * |
|
85 | - * Note: children do NOT have to define all these options. Just define the ones to override. |
|
86 | - * |
|
87 | - * @link http://qtip2.com/options |
|
88 | - * |
|
89 | - * @access protected |
|
90 | - * @return void |
|
91 | - */ |
|
92 | - protected function _set_default_options() |
|
93 | - { |
|
94 | - $this->_default_options = array( |
|
95 | - // 'id' => 'unique_id_referncing_qtip_instance', |
|
96 | - 'prerender' => false, |
|
97 | - // increases page load if true, |
|
98 | - 'suppress' => true, |
|
99 | - // whether default browser tooltips are suppressed. |
|
100 | - 'content' => array( |
|
101 | - 'button' => false, |
|
102 | - // what you want for the close button text/link. |
|
103 | - 'title' => true, |
|
104 | - // Options: "string", true. If TRUE then the title attribute of the target will be used (if available). If "string" then we'll use that as the title. |
|
105 | - 'clone' => true, |
|
106 | - // Options: true|false. if true then the text will be cloned from the content instead of removed from the dom. |
|
107 | - ), |
|
108 | - 'show_only_once' => false, |
|
109 | - // this is NOT a qtip2 library option, but is something added for EE specific use. If set to true, this means that this particular tooltip will only show ONCE for the user and then a cookie will be saved so that it doesn't show again (after exit). |
|
110 | - 'position' => array( |
|
111 | - 'my' => 'top left', |
|
112 | - // top left || top center || top right || right top || right center || right bottom || bottom right || bottom center || bottom left || left bottom || left center || left top |
|
113 | - 'at' => 'bottom right', |
|
114 | - // same options as above. |
|
115 | - 'target' => 'event', |
|
116 | - // if u use jQuery::#selector, js will parse to a jQuery selector || 'mouse' (at mouse cursor position) || 'event' (position at target that triggered the tooltip), or an array containing an absolute x/y position on page. |
|
117 | - 'container' => false, |
|
118 | - // what HTML element the tooltip is appended to (it's containing element). jquery object. Use 'jQuery::#selector' and js will parse' |
|
119 | - 'viewport' => true, |
|
120 | - // @link http://qtip2.com/plugins#viewport |
|
121 | - 'adjust' => array( |
|
122 | - 'x' => 0, |
|
123 | - // adjust position on x axis by 0 pixels. |
|
124 | - 'y' => 0, |
|
125 | - // adjust position on y axis by 0 pixels. |
|
126 | - 'mouse' => true, |
|
127 | - // when position['target'] is set to 'mouse', tooltip will follow mouse when hovering over the target. False, stops following. |
|
128 | - 'resize' => true, |
|
129 | - // adjust tooltip position when window is resized. |
|
130 | - 'scroll' => true, |
|
131 | - // position of tooltip adjusted when window (or position.container) is scrolled. |
|
132 | - 'method' => 'flipinvert', |
|
133 | - // @link http://qtip2.com/plugins#viewport |
|
134 | - ), |
|
135 | - ), |
|
136 | - 'show' => array( |
|
137 | - 'event' => 'mouseenter', |
|
138 | - // what event triggers tooltip to be shown. Any jQuery standard event or custom events can be used. space separated events provide multiple triggers. |
|
139 | - 'target' => false, |
|
140 | - // options jQuery::#selector|false. Used to indicate which html element will trigger show event. When false, the element the qtip() method was called upon is used. |
|
141 | - 'delay' => 90, |
|
142 | - // time in millisecons by which to delay showing of tooltip. |
|
143 | - 'solo' => false, |
|
144 | - // determines whether tooltip will hid all others when triggered. Options: true (hide all) || false (ignore) || string (parent selector for which qtips get hidden) |
|
145 | - 'modal' => array( |
|
146 | - 'on' => false, // does tooltip trigger modal? |
|
147 | - 'blur' => true, // does clicking on the dimmed background hide the tooltip and remove the dim? |
|
148 | - 'escape' => true, // hitting escape key hide the tooltip and cancel modal |
|
149 | - 'stealfocus' => true, // can users focus on inputs and elelments outside of tooltip when modal on? |
|
150 | - ), |
|
151 | - ), |
|
152 | - 'hide' => array( |
|
153 | - 'event' => 'mouseleave', |
|
154 | - // similar as what you do for show.event. |
|
155 | - 'target' => false, |
|
156 | - // Options jQuery::#selector. which html element will trigger hide event. When false, the element the .qtip() method was called upon is used. |
|
157 | - 'delay' => 0, |
|
158 | - // set time in milliseconds for delaying the hide of the tooltip |
|
159 | - 'inactive' => false, |
|
160 | - // if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with) |
|
161 | - 'fixed' => false, |
|
162 | - // when set to true, the tooltip will not hide if moused over. |
|
163 | - 'leave' => 'window', |
|
164 | - // specify whether the tooltip will hide when leaving the window it's conained within. |
|
165 | - 'distance' => false, |
|
166 | - // if integer, distance in pixels that the tooltip hides when the mouse is moved from the point it triggered the tooltip. |
|
167 | - ), |
|
168 | - 'style' => array( |
|
169 | - 'classes' => 'qtip-tipsy', |
|
170 | - // Options "string", false. A space separated string containing all class names which should be added ot the main qTip element. See options for styles in comment block at end of this class. |
|
171 | - 'def' => true, |
|
172 | - // set to false and the default qtip class does not get applied |
|
173 | - 'widget' => false, |
|
174 | - // whether ui-widget classes of the themeroller UI styles are applied to tooltip. |
|
175 | - 'width' => false, |
|
176 | - // Options: "string", integer, false. with this you can override all applied CSS width styles for tooltip. Can be any valid width CSS value. (does not override min/max width styles) |
|
177 | - 'height' => false, |
|
178 | - // same as above except applies to height. |
|
179 | - 'tip' => array( |
|
180 | - 'corner' => true, |
|
181 | - // where in relation to the tooltip the speech bubble tip is applied. Options: true, "corner string" (see position), false. true inherits |
|
182 | - 'mimic' => false, |
|
183 | - // see documentation @link http://qtip2.com/plugins#tips |
|
184 | - 'border' => true, |
|
185 | - // Options: true, integer. determines the width of the border that surrounds the tip element. True inherits from tooltip. |
|
186 | - 'width' => 6, |
|
187 | - // width of rendered tip in pixels in relation to the side of the tooltip the tip is on. |
|
188 | - 'height' => 6, |
|
189 | - // works the same as tip.width |
|
190 | - 'offset' => 0, |
|
191 | - // use to set the offset of the tip in relation to its corner position. |
|
192 | - ), |
|
193 | - ), |
|
79 | + /** |
|
80 | + * all the default options for the qtip js are defined here. Children class can override the defaults for all the |
|
81 | + * qtips defined in their config OR just leave it and have the parent default options apply. |
|
82 | + * |
|
83 | + * commented out options are there for reference so you know which can be defined by the child. |
|
84 | + * |
|
85 | + * Note: children do NOT have to define all these options. Just define the ones to override. |
|
86 | + * |
|
87 | + * @link http://qtip2.com/options |
|
88 | + * |
|
89 | + * @access protected |
|
90 | + * @return void |
|
91 | + */ |
|
92 | + protected function _set_default_options() |
|
93 | + { |
|
94 | + $this->_default_options = array( |
|
95 | + // 'id' => 'unique_id_referncing_qtip_instance', |
|
96 | + 'prerender' => false, |
|
97 | + // increases page load if true, |
|
98 | + 'suppress' => true, |
|
99 | + // whether default browser tooltips are suppressed. |
|
100 | + 'content' => array( |
|
101 | + 'button' => false, |
|
102 | + // what you want for the close button text/link. |
|
103 | + 'title' => true, |
|
104 | + // Options: "string", true. If TRUE then the title attribute of the target will be used (if available). If "string" then we'll use that as the title. |
|
105 | + 'clone' => true, |
|
106 | + // Options: true|false. if true then the text will be cloned from the content instead of removed from the dom. |
|
107 | + ), |
|
108 | + 'show_only_once' => false, |
|
109 | + // this is NOT a qtip2 library option, but is something added for EE specific use. If set to true, this means that this particular tooltip will only show ONCE for the user and then a cookie will be saved so that it doesn't show again (after exit). |
|
110 | + 'position' => array( |
|
111 | + 'my' => 'top left', |
|
112 | + // top left || top center || top right || right top || right center || right bottom || bottom right || bottom center || bottom left || left bottom || left center || left top |
|
113 | + 'at' => 'bottom right', |
|
114 | + // same options as above. |
|
115 | + 'target' => 'event', |
|
116 | + // if u use jQuery::#selector, js will parse to a jQuery selector || 'mouse' (at mouse cursor position) || 'event' (position at target that triggered the tooltip), or an array containing an absolute x/y position on page. |
|
117 | + 'container' => false, |
|
118 | + // what HTML element the tooltip is appended to (it's containing element). jquery object. Use 'jQuery::#selector' and js will parse' |
|
119 | + 'viewport' => true, |
|
120 | + // @link http://qtip2.com/plugins#viewport |
|
121 | + 'adjust' => array( |
|
122 | + 'x' => 0, |
|
123 | + // adjust position on x axis by 0 pixels. |
|
124 | + 'y' => 0, |
|
125 | + // adjust position on y axis by 0 pixels. |
|
126 | + 'mouse' => true, |
|
127 | + // when position['target'] is set to 'mouse', tooltip will follow mouse when hovering over the target. False, stops following. |
|
128 | + 'resize' => true, |
|
129 | + // adjust tooltip position when window is resized. |
|
130 | + 'scroll' => true, |
|
131 | + // position of tooltip adjusted when window (or position.container) is scrolled. |
|
132 | + 'method' => 'flipinvert', |
|
133 | + // @link http://qtip2.com/plugins#viewport |
|
134 | + ), |
|
135 | + ), |
|
136 | + 'show' => array( |
|
137 | + 'event' => 'mouseenter', |
|
138 | + // what event triggers tooltip to be shown. Any jQuery standard event or custom events can be used. space separated events provide multiple triggers. |
|
139 | + 'target' => false, |
|
140 | + // options jQuery::#selector|false. Used to indicate which html element will trigger show event. When false, the element the qtip() method was called upon is used. |
|
141 | + 'delay' => 90, |
|
142 | + // time in millisecons by which to delay showing of tooltip. |
|
143 | + 'solo' => false, |
|
144 | + // determines whether tooltip will hid all others when triggered. Options: true (hide all) || false (ignore) || string (parent selector for which qtips get hidden) |
|
145 | + 'modal' => array( |
|
146 | + 'on' => false, // does tooltip trigger modal? |
|
147 | + 'blur' => true, // does clicking on the dimmed background hide the tooltip and remove the dim? |
|
148 | + 'escape' => true, // hitting escape key hide the tooltip and cancel modal |
|
149 | + 'stealfocus' => true, // can users focus on inputs and elelments outside of tooltip when modal on? |
|
150 | + ), |
|
151 | + ), |
|
152 | + 'hide' => array( |
|
153 | + 'event' => 'mouseleave', |
|
154 | + // similar as what you do for show.event. |
|
155 | + 'target' => false, |
|
156 | + // Options jQuery::#selector. which html element will trigger hide event. When false, the element the .qtip() method was called upon is used. |
|
157 | + 'delay' => 0, |
|
158 | + // set time in milliseconds for delaying the hide of the tooltip |
|
159 | + 'inactive' => false, |
|
160 | + // if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with) |
|
161 | + 'fixed' => false, |
|
162 | + // when set to true, the tooltip will not hide if moused over. |
|
163 | + 'leave' => 'window', |
|
164 | + // specify whether the tooltip will hide when leaving the window it's conained within. |
|
165 | + 'distance' => false, |
|
166 | + // if integer, distance in pixels that the tooltip hides when the mouse is moved from the point it triggered the tooltip. |
|
167 | + ), |
|
168 | + 'style' => array( |
|
169 | + 'classes' => 'qtip-tipsy', |
|
170 | + // Options "string", false. A space separated string containing all class names which should be added ot the main qTip element. See options for styles in comment block at end of this class. |
|
171 | + 'def' => true, |
|
172 | + // set to false and the default qtip class does not get applied |
|
173 | + 'widget' => false, |
|
174 | + // whether ui-widget classes of the themeroller UI styles are applied to tooltip. |
|
175 | + 'width' => false, |
|
176 | + // Options: "string", integer, false. with this you can override all applied CSS width styles for tooltip. Can be any valid width CSS value. (does not override min/max width styles) |
|
177 | + 'height' => false, |
|
178 | + // same as above except applies to height. |
|
179 | + 'tip' => array( |
|
180 | + 'corner' => true, |
|
181 | + // where in relation to the tooltip the speech bubble tip is applied. Options: true, "corner string" (see position), false. true inherits |
|
182 | + 'mimic' => false, |
|
183 | + // see documentation @link http://qtip2.com/plugins#tips |
|
184 | + 'border' => true, |
|
185 | + // Options: true, integer. determines the width of the border that surrounds the tip element. True inherits from tooltip. |
|
186 | + 'width' => 6, |
|
187 | + // width of rendered tip in pixels in relation to the side of the tooltip the tip is on. |
|
188 | + 'height' => 6, |
|
189 | + // works the same as tip.width |
|
190 | + 'offset' => 0, |
|
191 | + // use to set the offset of the tip in relation to its corner position. |
|
192 | + ), |
|
193 | + ), |
|
194 | 194 | |
195 | - ); |
|
196 | - } |
|
195 | + ); |
|
196 | + } |
|
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * This takes the set $_qtipsa array property and loops through it to set the EE_Qtip objects and assign them to |
|
201 | - * the $_qtips property |
|
202 | - * |
|
203 | - * @access protected |
|
204 | - * @return void |
|
205 | - */ |
|
206 | - protected function _construct_tips() |
|
207 | - { |
|
208 | - foreach ($this->_qtipsa as $qt) { |
|
209 | - // make sure we have what we need. |
|
210 | - if (! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
211 | - throw new EE_Error( |
|
212 | - sprintf( |
|
213 | - __( |
|
214 | - 'There is something wrong with the _qtipsa property setup for the %s qtip config class. The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', |
|
215 | - 'event_espresso' |
|
216 | - ), |
|
217 | - get_class($this), |
|
218 | - var_export($qt, true) |
|
219 | - ) |
|
220 | - ); |
|
221 | - } |
|
199 | + /** |
|
200 | + * This takes the set $_qtipsa array property and loops through it to set the EE_Qtip objects and assign them to |
|
201 | + * the $_qtips property |
|
202 | + * |
|
203 | + * @access protected |
|
204 | + * @return void |
|
205 | + */ |
|
206 | + protected function _construct_tips() |
|
207 | + { |
|
208 | + foreach ($this->_qtipsa as $qt) { |
|
209 | + // make sure we have what we need. |
|
210 | + if (! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
211 | + throw new EE_Error( |
|
212 | + sprintf( |
|
213 | + __( |
|
214 | + 'There is something wrong with the _qtipsa property setup for the %s qtip config class. The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', |
|
215 | + 'event_espresso' |
|
216 | + ), |
|
217 | + get_class($this), |
|
218 | + var_export($qt, true) |
|
219 | + ) |
|
220 | + ); |
|
221 | + } |
|
222 | 222 | |
223 | - // make sure the options include defaults and just override via set config. |
|
224 | - $options_override = isset($qt['options']) ? (array) $qt['options'] : array(); |
|
225 | - $options = array_merge($this->_default_options, $options_override); |
|
226 | - $setup = array( |
|
227 | - 'content_id' => $qt['content_id'], |
|
228 | - 'options' => $options, |
|
229 | - 'target' => $qt['target'], |
|
230 | - 'content' => $qt['content'], |
|
231 | - ); |
|
232 | - $this->_qtips[] = new EE_Qtip($setup); |
|
233 | - } |
|
234 | - } |
|
223 | + // make sure the options include defaults and just override via set config. |
|
224 | + $options_override = isset($qt['options']) ? (array) $qt['options'] : array(); |
|
225 | + $options = array_merge($this->_default_options, $options_override); |
|
226 | + $setup = array( |
|
227 | + 'content_id' => $qt['content_id'], |
|
228 | + 'options' => $options, |
|
229 | + 'target' => $qt['target'], |
|
230 | + 'content' => $qt['content'], |
|
231 | + ); |
|
232 | + $this->_qtips[] = new EE_Qtip($setup); |
|
233 | + } |
|
234 | + } |
|
235 | 235 | |
236 | 236 | |
237 | - /** |
|
238 | - * return the _qtips property contents |
|
239 | - * |
|
240 | - * @access public |
|
241 | - * @return EE_Qtip[] |
|
242 | - */ |
|
243 | - public function get_tips() |
|
244 | - { |
|
245 | - return $this->_qtips; |
|
246 | - } |
|
237 | + /** |
|
238 | + * return the _qtips property contents |
|
239 | + * |
|
240 | + * @access public |
|
241 | + * @return EE_Qtip[] |
|
242 | + */ |
|
243 | + public function get_tips() |
|
244 | + { |
|
245 | + return $this->_qtips; |
|
246 | + } |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // class names you can use for tooltip styles |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | */ |
296 | 296 | class EE_Qtip extends EE_Base |
297 | 297 | { |
298 | - public $content_id; |
|
299 | - public $options; |
|
300 | - public $target; |
|
301 | - public $content; |
|
298 | + public $content_id; |
|
299 | + public $options; |
|
300 | + public $target; |
|
301 | + public $content; |
|
302 | 302 | |
303 | - public function __construct($setup_array) |
|
304 | - { |
|
305 | - foreach ($setup_array as $prop => $value) { |
|
306 | - if (EEH_Class_Tools::has_property($this, $prop)) { |
|
307 | - $this->{$prop} = $value; |
|
308 | - } |
|
309 | - } |
|
310 | - } |
|
303 | + public function __construct($setup_array) |
|
304 | + { |
|
305 | + foreach ($setup_array as $prop => $value) { |
|
306 | + if (EEH_Class_Tools::has_property($this, $prop)) { |
|
307 | + $this->{$prop} = $value; |
|
308 | + } |
|
309 | + } |
|
310 | + } |
|
311 | 311 | } |
@@ -207,7 +207,7 @@ |
||
207 | 207 | { |
208 | 208 | foreach ($this->_qtipsa as $qt) { |
209 | 209 | // make sure we have what we need. |
210 | - if (! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
210 | + if ( ! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
211 | 211 | throw new EE_Error( |
212 | 212 | sprintf( |
213 | 213 | __( |