PluginProbe
Event Post / 6.1.2
Event Post v6.1.2
6.1.2 6.1.1 6.1.0 6.0.1 6.0.0 5.12.0 trunk 3.9 4.0 4.2 4.3 4.4 4.5 5.0 5.1 5.10.0 5.10.1 5.10.2 5.10.3 5.10.4 5.11.0 5.11.1 5.2 5.5 5.6 All 47 releases
← All changes | inc/class-shortcodes.php +35 -7 5.10.1 → 6.1.2 View file →
@@ -2,14 +2,16 @@
2 2 /**
3 3 * Implements all shortcodes features
4 4 *
5 5 * @package event-post
6 - * @version 5.10.1
6 + * @version 6.1.2
7 7 * @since 5.0.0
8 8 */
9 9
10 10 namespace EventPost;
11 11
12 +if ( ! defined( 'ABSPATH' ) ) exit;
13 +
12 14 class Shortcodes{
13 15
14 16 function __construct() {
15 17 //Shortcodes
@@ -150,15 +152,22 @@
150 152 'style' => '',
151 153 'pages' => false,
152 154 'container_schema' => EventPost()->list_shema['container'],
153 155 'item_schema' => EventPost()->list_shema['item'],
156 + 'align' => '',
154 157 'className' => '',
155 158 ), 'shortcode_list'), $_atts);
156 -
157 - if ($atts['container_schema'] != EventPost()->list_shema['container'])
159 +
160 + if ($atts['container_schema'] != EventPost()->list_shema['container']){
158 161 $atts['container_schema'] = html_entity_decode($atts['container_schema']);
159 - if ($atts['item_schema'] != EventPost()->list_shema['item'])
162 + $atts['container_schema'] = wp_kses($atts['container_schema'], EventPost()->kses_tags);
163 + }
164 +
165 + if ($atts['item_schema'] != EventPost()->list_shema['item']) {
160 166 $atts['item_schema'] = html_entity_decode($atts['item_schema']);
167 + $atts['item_schema'] = wp_kses($atts['item_schema'], EventPost()->kses_tags);
168 + }
169 +
161 170 return EventPost()->list_events($atts, 'event_list', 'shortcode');
162 171 }
163 172
164 173 /**
@@ -189,12 +198,15 @@
189 198 * @filter eventpost_params
190 199 *
191 200 * @return string
192 201 */
193 - public function shortcode_timeline($_atts) {
202 + public function shortcode_timeline($_atts, $content='', $block=null) {
194 203 $atts = shortcode_atts(apply_filters('eventpost_params', array(
195 204 // Filters
196 - 'nb' => 0,
205 + 'nb' => 3,
206 + 'nb_desktop' => 0,
207 + 'nb_tablet' => 0,
208 + 'nb_mobile' => 0,
197 209 'future' => true,
198 210 'past' => false,
199 211 'geo' => 0,
200 212 'cat' => '',
@@ -202,8 +214,9 @@
202 214 'tax_name' => '',
203 215 'tax_term' => '',
204 216 'title' => '',
205 217 // Display
218 + 'align' => '',
206 219 'type' => 'div',
207 220 'before_title' => '<h3>',
208 221 'after_title' => '</h3>',
209 222 'excerpt' => '',
@@ -212,15 +225,25 @@
212 225 'style' => '',
213 226 'container_schema' => EventPost()->timeline_shema['container'],
214 227 'item_schema' => EventPost()->timeline_shema['item'],
215 228 'className' => '',
229 + 'order' => 'ASC',
230 + 'direction' => 'horizontal',
231 + 'separate_years' => false,
232 + 'separate_months' => false,
233 + 'size' => 2,
234 + 'color' => '#000000',
216 235 ), 'shortcode_list'), $_atts);
217 236
237 + $atts['className'] .= ' direction-'.$atts['direction'];
238 +
239 + wp_enqueue_script('event-post-timeline');
240 +
218 241 if ($atts['container_schema'] != EventPost()->timeline_shema['container'])
219 242 $atts['container_schema'] = html_entity_decode($atts['container_schema']);
220 243 if ($atts['item_schema'] != EventPost()->timeline_shema['item'])
221 244 $atts['item_schema'] = html_entity_decode($atts['item_schema']);
222 - return EventPost()->list_events($atts, 'event_timeline', 'shortcode');
245 + return EventPost()->list_events($atts, 'event_timeline', $block ? 'block' :'shortcode');
223 246 }
224 247
225 248 /**
226 249 * Shortcode to display a map of events
@@ -262,8 +285,9 @@
262 285 'tax_name' => '',
263 286 'tax_term' => '',
264 287 'orderby' => 'meta_value',
265 288 'order' => 'ASC',
289 + 'align' => '',
266 290 'className' => '',
267 291 );
268 292 // UI options
269 293 foreach(EventPost()->map_interactions as $int_key=>$int_name){
@@ -302,11 +326,13 @@
302 326 'cat' => '',
303 327 'mondayfirst' => 0, // 1 : weeks starts on monday
304 328 'display_title' => 0,
305 329 'datepicker' => 1,
330 + 'swipe' => false,
306 331 'tax_name' => '',
307 332 'tax_term' => '',
308 333 'thumbnail' => '',
334 + 'align' => '',
309 335 'className' => '',
310 336 );
311 337 $atts = shortcode_atts(apply_filters('eventpost_params', $defaults, 'shortcode_cal'), $_atts);
312 338 $atts = array(
@@ -314,8 +340,9 @@
314 340 'cat' => sanitize_text_field($atts['cat']),
315 341 'mondayfirst' => intval($atts['mondayfirst']),
316 342 'display_title' => intval($atts['display_title']),
317 343 'datepicker' => intval($atts['datepicker']),
344 + 'swipe' => intval($atts['swipe']),
318 345 'tax_name' => sanitize_text_field($atts['tax_name']),
319 346 'tax_term' => sanitize_text_field($atts['tax_term']),
320 347 'thumbnail' => sanitize_text_field($atts['thumbnail']),
321 348 'className' => esc_attr($atts['className']),
@@ -334,8 +361,9 @@
334 361 data-date="' . esc_attr($date) . '"
335 362 data-mf="' . esc_attr($mondayfirst) . '"
336 363 data-dp="' . esc_attr($datepicker) . '"
337 364 data-title="'. esc_attr($display_title) .'"
365 + data-swipe="'. esc_attr($swipe) .'"
338 366 >'
339 367 . wp_kses_post(EventPost()->calendar($atts))
340 368 . '</div>';
341 369 }