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 +28 -5 5.10.2 → 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.2
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,14 +152,16 @@
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 159
157 - if ($atts['container_schema'] != EventPost()->list_shema['container'])
160 + if ($atts['container_schema'] != EventPost()->list_shema['container']){
158 161 $atts['container_schema'] = html_entity_decode($atts['container_schema']);
159 162 $atts['container_schema'] = wp_kses($atts['container_schema'], EventPost()->kses_tags);
163 + }
160 164
161 165 if ($atts['item_schema'] != EventPost()->list_shema['item']) {
162 166 $atts['item_schema'] = html_entity_decode($atts['item_schema']);
163 167 $atts['item_schema'] = wp_kses($atts['item_schema'], EventPost()->kses_tags);
@@ -194,12 +198,15 @@
194 198 * @filter eventpost_params
195 199 *
196 200 * @return string
197 201 */
198 - public function shortcode_timeline($_atts) {
202 + public function shortcode_timeline($_atts, $content='', $block=null) {
199 203 $atts = shortcode_atts(apply_filters('eventpost_params', array(
200 204 // Filters
201 - 'nb' => 0,
205 + 'nb' => 3,
206 + 'nb_desktop' => 0,
207 + 'nb_tablet' => 0,
208 + 'nb_mobile' => 0,
202 209 'future' => true,
203 210 'past' => false,
204 211 'geo' => 0,
205 212 'cat' => '',
@@ -207,8 +214,9 @@
207 214 'tax_name' => '',
208 215 'tax_term' => '',
209 216 'title' => '',
210 217 // Display
218 + 'align' => '',
211 219 'type' => 'div',
212 220 'before_title' => '<h3>',
213 221 'after_title' => '</h3>',
214 222 'excerpt' => '',
@@ -217,15 +225,25 @@
217 225 'style' => '',
218 226 'container_schema' => EventPost()->timeline_shema['container'],
219 227 'item_schema' => EventPost()->timeline_shema['item'],
220 228 'className' => '',
229 + 'order' => 'ASC',
230 + 'direction' => 'horizontal',
231 + 'separate_years' => false,
232 + 'separate_months' => false,
233 + 'size' => 2,
234 + 'color' => '#000000',
221 235 ), 'shortcode_list'), $_atts);
222 236
237 + $atts['className'] .= ' direction-'.$atts['direction'];
238 +
239 + wp_enqueue_script('event-post-timeline');
240 +
223 241 if ($atts['container_schema'] != EventPost()->timeline_shema['container'])
224 242 $atts['container_schema'] = html_entity_decode($atts['container_schema']);
225 243 if ($atts['item_schema'] != EventPost()->timeline_shema['item'])
226 244 $atts['item_schema'] = html_entity_decode($atts['item_schema']);
227 - return EventPost()->list_events($atts, 'event_timeline', 'shortcode');
245 + return EventPost()->list_events($atts, 'event_timeline', $block ? 'block' :'shortcode');
228 246 }
229 247
230 248 /**
231 249 * Shortcode to display a map of events
@@ -267,8 +285,9 @@
267 285 'tax_name' => '',
268 286 'tax_term' => '',
269 287 'orderby' => 'meta_value',
270 288 'order' => 'ASC',
289 + 'align' => '',
271 290 'className' => '',
272 291 );
273 292 // UI options
274 293 foreach(EventPost()->map_interactions as $int_key=>$int_name){
@@ -307,11 +326,13 @@
307 326 'cat' => '',
308 327 'mondayfirst' => 0, // 1 : weeks starts on monday
309 328 'display_title' => 0,
310 329 'datepicker' => 1,
330 + 'swipe' => false,
311 331 'tax_name' => '',
312 332 'tax_term' => '',
313 333 'thumbnail' => '',
334 + 'align' => '',
314 335 'className' => '',
315 336 );
316 337 $atts = shortcode_atts(apply_filters('eventpost_params', $defaults, 'shortcode_cal'), $_atts);
317 338 $atts = array(
@@ -319,8 +340,9 @@
319 340 'cat' => sanitize_text_field($atts['cat']),
320 341 'mondayfirst' => intval($atts['mondayfirst']),
321 342 'display_title' => intval($atts['display_title']),
322 343 'datepicker' => intval($atts['datepicker']),
344 + 'swipe' => intval($atts['swipe']),
323 345 'tax_name' => sanitize_text_field($atts['tax_name']),
324 346 'tax_term' => sanitize_text_field($atts['tax_term']),
325 347 'thumbnail' => sanitize_text_field($atts['thumbnail']),
326 348 'className' => esc_attr($atts['className']),
@@ -339,8 +361,9 @@
339 361 data-date="' . esc_attr($date) . '"
340 362 data-mf="' . esc_attr($mondayfirst) . '"
341 363 data-dp="' . esc_attr($datepicker) . '"
342 364 data-title="'. esc_attr($display_title) .'"
365 + data-swipe="'. esc_attr($swipe) .'"
343 366 >'
344 367 . wp_kses_post(EventPost()->calendar($atts))
345 368 . '</div>';
346 369 }