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