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/wrappers.php +59 -13 4.3 → 6.1.2 View file →
@@ -1,34 +1,66 @@
1 1 <?php
2 +/**
3 + * Shortcuts for useful functions in templates
4 + *
5 + * @package event-post
6 + * @version 6.1.2
7 + * @since 5.0.0
8 + */
2 9
10 + if ( ! defined( 'ABSPATH' ) ) exit;
3 11
4 12 if(!function_exists('get_the_dates')){
5 13 /**
14 + * Returns the HTML string of the given event's date range.
15 + * If no post reference is given, the current post will be used
6 16 *
17 + * @param mixte $post
18 + *
7 19 * @global \EventPost $EventPost
8 - * @param mixte $post
20 + *
9 21 * @return string
22 + *
23 + * @example:
24 + * <pre>
25 + * <div class="event_date" data-start="april 6 2017 12am" data-end="april 6 2017 1pm">
26 + * <time itemprop="dtstart" datetime="2017-04-06T12:08:00+00:00">
27 + * <span class="date date-single">april 6 2017, 8am</span>
28 + * <span class="linking_word linking_word-from">from</span>
29 + * <span class="time time-start">12h am</span>
30 + * <span class="linking_word linking_word-to">to</span>
31 + * <span class="time time-end">1h am</span>
32 + * </time>
33 + * </div>
34 + * </pre>
10 35 */
11 - function get_the_dates($post=null){
12 - global $EventPost;
13 - return $EventPost->print_date($post);
36 + function get_the_dates($_post=null){
37 + global $EventPost, $post;
38 + if(!$_post){
39 + $_post = $post;
40 + }
41 + return $EventPost->print_date($_post);
14 42 }
15 43 }
16 44 if(!function_exists('the_dates')){
17 45 /**
18 - *
46 + * Outputs the HTML generated by `get_the_dates`
47 + *
19 48 * @param mixte $post
20 49 */
21 50 function the_dates($post=null){
22 - echo get_the_dates($post);
51 + echo wp_kses(get_the_dates($post), EventPost()->kses_tags);
23 52 }
24 53 }
25 54
26 55 if(!function_exists('get_the_date_start')){
27 56 /**
57 + * Returns the HTML of the start date of an event
28 58 *
59 + * @param type $post
60 + *
29 61 * @global \EventPost $EventPost
30 - * @param type $post
62 + *
31 63 * @return string
32 64 */
33 65 function get_the_date_start($post=null){
34 66 global $EventPost;
@@ -37,21 +69,25 @@
37 69 }
38 70 }
39 71 if(!function_exists('the_date_start')){
40 72 /**
73 + * Outputs the HTML of the start date of an event
41 74 *
42 75 * @param type $post
43 76 */
44 77 function the_date_start($post=null){
45 - echo get_the_date_start($post);
78 + echo wp_kses(get_the_date_start($post), EventPost()->kses_tags);
46 79 }
47 80 }
48 81
49 82 if(!function_exists('get_the_date_end')){
50 83 /**
84 + * Returns the HTML of the end date of an event
51 85 *
86 + * @param type $post
87 + *
52 88 * @global \EventPost $EventPost
53 - * @param type $post
89 + *
54 90 * @return string
55 91 */
56 92 function get_the_date_end($post=null){
57 93 global $EventPost;
@@ -60,20 +96,29 @@
60 96 }
61 97 }
62 98 if(!function_exists('the_date_end')){
63 99 /**
100 + * Outputs the HTML of the start date of an event
64 101 *
102 + * @param type $post
103 + *
104 + * @global \EventPost $EventPost
105 + *
106 + * @return string
65 107 */
66 108 function the_date_end($post=null){
67 - echo get_the_date_end($post);
109 + echo wp_kses(get_the_date_end($post), EventPost()->kses_tags);
68 110 }
69 111 }
70 112
71 113 if(!function_exists('get_the_location')){
72 114 /**
115 + * Returns the HTML of the location date of an event
73 116 *
117 + * @param type $post
118 + *
74 119 * @global \EventPost $EventPost
75 - * @param type $post
120 + *
76 121 * @return string
77 122 */
78 123 function get_the_location($post=null){
79 124 global $EventPost;
@@ -81,11 +126,12 @@
81 126 }
82 127 }
83 128 if(!function_exists('the_location')){
84 129 /**
130 + * Outputs the HTML of the location date of an event
85 131 *
86 132 * @param type $post
87 133 */
88 134 function the_location($post=null){
89 - echo get_the_location($post);
135 + echo wp_kses(get_the_location($post), EventPost()->kses_tags);
90 136 }
91 -}
137 +}