Version Description
- Changed some SQL that could trigger a MySQL bug involving an infinite loop. See http://bugs.mysql.com/bug.php?id=21262
- Fixed some bugs with View As dropdown in Tribe Bar, including a bug in Firefox where you couldn't change the dropdown
- Removed select2 javascript dependency from front-end
Download this release
Release Info
Developer | jazbek |
Plugin | The Events Calendar |
Version | 3.0.3 |
Comparing to | |
See all releases |
Code changes from version 3.0.2 to 3.0.3
- lib/the-events-calendar.class.php +1 -4
- lib/tribe-events-bar.class.php +0 -1
- lib/tribe-recurring-event-cleanup.php +4 -2
- lib/tribe-template-factory.class.php +2 -2
- lib/tribe-templates.class.php.orig +0 -682
- public/advanced-functions/meta.php +2 -1
- public/template-tags/general.php.orig +0 -1036
- readme.txt +8 -2
- resources/tribe-events-bar.js +18 -65
- resources/tribe-events-bar.min.js +9 -11
- resources/tribe-events.min.js +12 -15
- the-events-calendar.php +1 -1
lib/the-events-calendar.class.php
CHANGED
@@ -22,7 +22,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
22 |
const VENUE_POST_TYPE = 'tribe_venue';
|
23 |
const ORGANIZER_POST_TYPE = 'tribe_organizer';
|
24 |
const PLUGIN_DOMAIN = 'tribe-events-calendar';
|
25 |
-
const VERSION = '3.0.
|
26 |
const FEED_URL = 'http://tri.be/category/products/feed/';
|
27 |
const INFO_API_URL = 'http://wpapi.org/api/plugin/the-events-calendar.php';
|
28 |
const WP_PLUGIN_URL = 'http://wordpress.org/extend/plugins/the-events-calendar/';
|
@@ -2094,9 +2094,6 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
2094 |
// smoothness
|
2095 |
Tribe_Template_Factory::asset_package('smoothness');
|
2096 |
|
2097 |
-
// Select2
|
2098 |
-
Tribe_Template_Factory::asset_package('select2');
|
2099 |
-
|
2100 |
// Tribe Calendar JS
|
2101 |
Tribe_Template_Factory::asset_package('calendar-script');
|
2102 |
|
22 |
const VENUE_POST_TYPE = 'tribe_venue';
|
23 |
const ORGANIZER_POST_TYPE = 'tribe_organizer';
|
24 |
const PLUGIN_DOMAIN = 'tribe-events-calendar';
|
25 |
+
const VERSION = '3.0.3';
|
26 |
const FEED_URL = 'http://tri.be/category/products/feed/';
|
27 |
const INFO_API_URL = 'http://wpapi.org/api/plugin/the-events-calendar.php';
|
28 |
const WP_PLUGIN_URL = 'http://wordpress.org/extend/plugins/the-events-calendar/';
|
2094 |
// smoothness
|
2095 |
Tribe_Template_Factory::asset_package('smoothness');
|
2096 |
|
|
|
|
|
|
|
2097 |
// Tribe Calendar JS
|
2098 |
Tribe_Template_Factory::asset_package('calendar-script');
|
2099 |
|
lib/tribe-events-bar.class.php
CHANGED
@@ -147,7 +147,6 @@ class TribeEventsBar {
|
|
147 |
public function load_script() {
|
148 |
|
149 |
if ($this->should_show()) {
|
150 |
-
Tribe_Template_Factory::asset_package( 'select2' );
|
151 |
Tribe_Template_Factory::asset_package( 'jquery-placeholder' );
|
152 |
Tribe_Template_Factory::asset_package( 'bootstrap-datepicker' );
|
153 |
Tribe_Template_Factory::asset_package( 'tribe-events-bar' );
|
147 |
public function load_script() {
|
148 |
|
149 |
if ($this->should_show()) {
|
|
|
150 |
Tribe_Template_Factory::asset_package( 'jquery-placeholder' );
|
151 |
Tribe_Template_Factory::asset_package( 'bootstrap-datepicker' );
|
152 |
Tribe_Template_Factory::asset_package( 'tribe-events-bar' );
|
lib/tribe-recurring-event-cleanup.php
CHANGED
@@ -40,13 +40,15 @@ class TribeRecurringEventCleanup {
|
|
40 |
/**
|
41 |
* Convert all but the first instance of a recurring event
|
42 |
* to a hidden start date
|
|
|
|
|
43 |
*/
|
44 |
private function hide_recurring_events() {
|
45 |
global $wpdb;
|
46 |
$sql = "SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key='_EventStartDate' AND post_id IN (
|
47 |
-
SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_EventStartDate' GROUP BY post_id HAVING COUNT(meta_key) > 1
|
48 |
) AND meta_id NOT IN (
|
49 |
-
SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key='_EventStartDate' GROUP BY post_id HAVING MIN(CAST(meta_value AS DATETIME))
|
50 |
)";
|
51 |
$ids = $wpdb->get_col($sql);
|
52 |
if ( $ids ) {
|
40 |
/**
|
41 |
* Convert all but the first instance of a recurring event
|
42 |
* to a hidden start date
|
43 |
+
*
|
44 |
+
* Reference for the subqueries: http://bugs.mysql.com/bug.php?id=21262
|
45 |
*/
|
46 |
private function hide_recurring_events() {
|
47 |
global $wpdb;
|
48 |
$sql = "SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key='_EventStartDate' AND post_id IN (
|
49 |
+
SELECT post_id from ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_EventStartDate' GROUP BY post_id HAVING COUNT(meta_key) > 1 ) a
|
50 |
) AND meta_id NOT IN (
|
51 |
+
SELECT meta_id FROM ( SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key='_EventStartDate' GROUP BY post_id HAVING MIN(CAST(meta_value AS DATETIME)) ) b
|
52 |
)";
|
53 |
$ids = $wpdb->get_col($sql);
|
54 |
if ( $ids ) {
|
lib/tribe-template-factory.class.php
CHANGED
@@ -508,7 +508,7 @@ if( !class_exists('Tribe_Template_Factory') ) {
|
|
508 |
wp_enqueue_script( $prefix . '-ecp-plugins', $path, $deps, apply_filters( 'tribe_events_js_version', TribeEvents::VERSION ) );
|
509 |
break;
|
510 |
case 'tribe-events-bar' :
|
511 |
-
$deps = array_merge( $deps, array( 'jquery', $prefix . '-calendar-script', $prefix . '-bootstrap-datepicker', $prefix . '-jquery-resize',
|
512 |
$path = self::getMinFile( $resources_url . 'tribe-events-bar.js', true );
|
513 |
wp_enqueue_script( $prefix . '-bar', $path, $deps, apply_filters( 'tribe_events_js_version', TribeEvents::VERSION ) );
|
514 |
break;
|
@@ -555,7 +555,7 @@ if( !class_exists('Tribe_Template_Factory') ) {
|
|
555 |
$styleUrl = apply_filters( 'tribe_events_stylesheet_url', $styleUrl );
|
556 |
|
557 |
// Is there a core override file in the theme?
|
558 |
-
$styleOverrideUrl = TribeEventsTemplates::locate_stylesheet('tribe-events/'.$event_file
|
559 |
|
560 |
// Load up stylesheet from theme or plugin
|
561 |
if( $styleUrl && $stylesheet_option == 'tribe' ) {
|
508 |
wp_enqueue_script( $prefix . '-ecp-plugins', $path, $deps, apply_filters( 'tribe_events_js_version', TribeEvents::VERSION ) );
|
509 |
break;
|
510 |
case 'tribe-events-bar' :
|
511 |
+
$deps = array_merge( $deps, array( 'jquery', $prefix . '-calendar-script', $prefix . '-bootstrap-datepicker', $prefix . '-jquery-resize', 'tribe-placeholder' ) );
|
512 |
$path = self::getMinFile( $resources_url . 'tribe-events-bar.js', true );
|
513 |
wp_enqueue_script( $prefix . '-bar', $path, $deps, apply_filters( 'tribe_events_js_version', TribeEvents::VERSION ) );
|
514 |
break;
|
555 |
$styleUrl = apply_filters( 'tribe_events_stylesheet_url', $styleUrl );
|
556 |
|
557 |
// Is there a core override file in the theme?
|
558 |
+
$styleOverrideUrl = TribeEventsTemplates::locate_stylesheet('tribe-events/'.$event_file);
|
559 |
|
560 |
// Load up stylesheet from theme or plugin
|
561 |
if( $styleUrl && $stylesheet_option == 'tribe' ) {
|
lib/tribe-templates.class.php.orig
DELETED
@@ -1,682 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Templating functionality for Tribe Events Calendar
|
4 |
-
*/
|
5 |
-
|
6 |
-
// don't load directly
|
7 |
-
if ( !defined('ABSPATH') )
|
8 |
-
die('-1');
|
9 |
-
|
10 |
-
if (!class_exists('TribeEventsTemplates')) {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Handle views and template files.
|
14 |
-
*/
|
15 |
-
class TribeEventsTemplates {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var bool Is wp_head complete?
|
19 |
-
*/
|
20 |
-
public static $wpHeadComplete = false;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var bool Is this the main loop?
|
24 |
-
*/
|
25 |
-
public static $isMainLoop = false;
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Initialize the Template Yumminess!
|
30 |
-
*/
|
31 |
-
public static function init() {
|
32 |
-
|
33 |
-
// choose the wordpress theme template to use
|
34 |
-
add_filter( 'template_include', array( __CLASS__, 'templateChooser') );
|
35 |
-
|
36 |
-
// include our view class
|
37 |
-
add_action( 'template_redirect', 'tribe_initialize_view' );
|
38 |
-
|
39 |
-
// make sure we enter the loop by always having some posts in $wp_query
|
40 |
-
add_action( 'template_redirect', array( __CLASS__, 'maybeSpoofQuery' ) );
|
41 |
-
|
42 |
-
// there's no template redirect on ajax, so we include the template class right before the view is included
|
43 |
-
if (defined('DOING_AJAX') && DOING_AJAX) {
|
44 |
-
add_action( 'tribe_pre_get_view', 'tribe_initialize_view' );
|
45 |
-
}
|
46 |
-
|
47 |
-
add_action( 'wp_head', array( __CLASS__, 'wpHeadFinished'), 999 );
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Pick the correct template to include
|
53 |
-
* @param string $template Path to template
|
54 |
-
*
|
55 |
-
* @return string Path to template
|
56 |
-
*/
|
57 |
-
public static function templateChooser($template) {
|
58 |
-
$events = TribeEvents::instance();
|
59 |
-
do_action('tribe_tec_template_chooser', $template);
|
60 |
-
|
61 |
-
// hijack this method right up front if it's a 404
|
62 |
-
if ( is_404() && $events->displaying == 'single-event' && apply_filters( 'tribe_events_templates_is_404', '__return_true' ) )
|
63 |
-
return get_404_template();
|
64 |
-
|
65 |
-
// no non-events need apply
|
66 |
-
if ( ! in_array( get_query_var( 'post_type' ), array( TribeEvents::POSTTYPE, TribeEvents::VENUE_POST_TYPE, TribeEvents::ORGANIZER_POST_TYPE ) ) && ! is_tax( TribeEvents::TAXONOMY ) ) {
|
67 |
-
return $template;
|
68 |
-
}
|
69 |
-
|
70 |
-
if( tribe_get_option('tribeEventsTemplate', 'default') == '' ) {
|
71 |
-
return self::getTemplateHierarchy('default-template');
|
72 |
-
} else {
|
73 |
-
|
74 |
-
// add_filter( 'wp_title', array(__CLASS__, 'remove_default_title'), 1);
|
75 |
-
|
76 |
-
if ( ! is_single() || ! post_password_required()) {
|
77 |
-
add_action( 'loop_start', array(__CLASS__, 'setup_ecp_template' ) );
|
78 |
-
}
|
79 |
-
|
80 |
-
$template = locate_template( tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default') );
|
81 |
-
if ($template == '') $template = get_index_template();
|
82 |
-
|
83 |
-
// remove singular body class if sidebar-page.php
|
84 |
-
if( $template == get_stylesheet_directory() . '/sidebar-page.php' ) {
|
85 |
-
add_filter( 'body_class', array( __CLASS__, 'remove_singular_body_class' ) );
|
86 |
-
} else {
|
87 |
-
add_filter( 'body_class', array( __CLASS__, 'add_singular_body_class' ) );
|
88 |
-
}
|
89 |
-
return $template;
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Include the class for the current view
|
95 |
-
*
|
96 |
-
* @param bool $class
|
97 |
-
* @return void
|
98 |
-
* @since 3.0
|
99 |
-
**/
|
100 |
-
public static function instantiate_template_class( $class = false ) {
|
101 |
-
|
102 |
-
if ( tribe_is_event_query() ) {
|
103 |
-
if ( ! $class ) {
|
104 |
-
$class = self::get_current_template_class();
|
105 |
-
}
|
106 |
-
if ( class_exists( $class ) ) {
|
107 |
-
new $class;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Remove "singular" from available body class
|
114 |
-
* @param array $classes List of classes to filter
|
115 |
-
*
|
116 |
-
* @return mixed
|
117 |
-
*/
|
118 |
-
public function remove_singular_body_class( $classes ) {
|
119 |
-
$key = array_search('singular', $classes);
|
120 |
-
if( $key ) {
|
121 |
-
unset($classes[ $key ]);
|
122 |
-
}
|
123 |
-
return $classes;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Add the "singular" body class
|
128 |
-
*
|
129 |
-
* @param array $classes List of classes to filter
|
130 |
-
* @return array
|
131 |
-
*/
|
132 |
-
public function add_singular_body_class( $classes ) {
|
133 |
-
$classes[] = 'singular';
|
134 |
-
return $classes;
|
135 |
-
}
|
136 |
-
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Determine when wp_head has been triggered.
|
140 |
-
*/
|
141 |
-
public static function wpHeadFinished() {
|
142 |
-
self::$wpHeadComplete = true;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
<<<<<<< HEAD
|
147 |
-
=======
|
148 |
-
* Add event title where appropriate
|
149 |
-
*
|
150 |
-
* @param string $title
|
151 |
-
* @param string|null $sep
|
152 |
-
* @return mixed|void
|
153 |
-
*/
|
154 |
-
public static function maybeAddEventTitle( $title, $sep = null, $sep_location = '' ){
|
155 |
-
$tribe_ecp = TribeEvents::instance();
|
156 |
-
|
157 |
-
$new_title = '';
|
158 |
-
switch( get_query_var('eventDisplay') ) {
|
159 |
-
case 'upcoming':
|
160 |
-
$new_title = apply_filters( 'tribe_upcoming_events_title', __("Upcoming Events", 'tribe-events-calendar') );
|
161 |
-
break;
|
162 |
-
case 'past':
|
163 |
-
$new_title = apply_filters( 'tribe_past_events_title', __("Past Events", 'tribe-events-calendar'));
|
164 |
-
break;
|
165 |
-
case 'month':
|
166 |
-
if(get_query_var('eventDate')){
|
167 |
-
$title_date = date_i18n("F Y",strtotime(get_query_var('eventDate')));
|
168 |
-
$new_title = apply_filters( 'tribe_month_grid_view_title', sprintf(__("Events for %s", 'tribe-events-calendar'), $title_date ) );
|
169 |
-
}else{
|
170 |
-
$new_title = apply_filters( 'tribe_events_this_month_title', __("Events this month", 'tribe-events-calendar') );
|
171 |
-
}
|
172 |
-
break;
|
173 |
-
case 'day':
|
174 |
-
$title_date = date_i18n("l, F jS Y",strtotime(get_query_var('eventDate')));
|
175 |
-
$new_title = apply_filters( 'tribe_events_day_view_title', sprintf(__("Events for %s", 'tribe-events-calendar'), $title_date) );
|
176 |
-
break;
|
177 |
-
default:
|
178 |
-
global $post;
|
179 |
-
if( get_query_var('post_type') == TribeEvents::POSTTYPE && is_single() && $tribe_ecp->getOption('tribeEventsTemplate') != '' ) {
|
180 |
-
$new_title = $post->post_title;
|
181 |
-
} elseif( get_query_var('post_type') == TribeEvents::VENUE_POST_TYPE && $tribe_ecp->getOption('tribeEventsTemplate') != '' ) {
|
182 |
-
$new_title = apply_filters( 'tribe_events_venue_view_title', sprintf(__("Events at %s", 'tribe-events-calendar'), $post->post_title) );
|
183 |
-
}
|
184 |
-
break;
|
185 |
-
}
|
186 |
-
|
187 |
-
// add the separator
|
188 |
-
if ($new_title != '') {
|
189 |
-
if ( 'right' == $sep_location ) {
|
190 |
-
$new_title = $new_title . " $sep ";
|
191 |
-
} else {
|
192 |
-
$new_title = " $sep " . $new_title;
|
193 |
-
}
|
194 |
-
} else {
|
195 |
-
$new_title = $title;
|
196 |
-
}
|
197 |
-
|
198 |
-
$new_title = apply_filters( 'tribe_events_add_title', $new_title, $title, $sep, $sep_location );
|
199 |
-
|
200 |
-
return $new_title;
|
201 |
-
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
>>>>>>> d2e51457cee98d37d1e0626e7fd494bdbbc5e614
|
206 |
-
* Set up filter to get rid of the repeating title if the page template is not the default events template.
|
207 |
-
*/
|
208 |
-
public function remove_title_from_page() {
|
209 |
-
add_filter( 'the_title', array( __CLASS__, 'remove_default_title' ), 1 );
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Filter to get rid of the repeating title if the page template is not the default events template.
|
215 |
-
*
|
216 |
-
* @param string $title Title
|
217 |
-
* @return string Title
|
218 |
-
*/
|
219 |
-
public function remove_title_filter( $title ) {
|
220 |
-
remove_filter( 'the_title', array( __CLASS__, 'remove_default_title' ), 1 );
|
221 |
-
return $title;
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* This is where the magic happens where we run some ninja code that hooks the query to resolve to an events template.
|
226 |
-
*
|
227 |
-
* @param WP_Query $query
|
228 |
-
*/
|
229 |
-
public static function setup_ecp_template($query) {
|
230 |
-
|
231 |
-
do_action( 'tribe_events_filter_the_page_title' );
|
232 |
-
|
233 |
-
if( self::is_main_loop($query) && self::$wpHeadComplete) {
|
234 |
-
|
235 |
-
// on loop start, unset the global post so that template tags don't work before the_content()
|
236 |
-
add_action('the_post', array(__CLASS__, 'spoof_the_post'));
|
237 |
-
|
238 |
-
// on the_content, load our events template
|
239 |
-
add_filter('the_content', array(__CLASS__, 'load_ecp_into_page_template') );
|
240 |
-
|
241 |
-
// remove the comments template
|
242 |
-
add_filter('comments_template', array(__CLASS__, 'load_ecp_comments_page_template') );
|
243 |
-
|
244 |
-
// only do this once
|
245 |
-
remove_action( 'loop_start', array(__CLASS__, 'setup_ecp_template') );
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Spoof the global post just once
|
251 |
-
*
|
252 |
-
* @return void
|
253 |
-
* @since 3.0
|
254 |
-
**/
|
255 |
-
public static function spoof_the_post() {
|
256 |
-
$GLOBALS['post'] = self::spoofed_post();
|
257 |
-
remove_action('the_post', array(__CLASS__, 'spoof_the_post'));
|
258 |
-
}
|
259 |
-
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Check to see if this is operating in the main loop
|
263 |
-
*
|
264 |
-
* @param WP_Query $query
|
265 |
-
* @return bool
|
266 |
-
*/
|
267 |
-
private static function is_main_loop($query) {
|
268 |
-
if (method_exists($query, 'is_main_query')) // WP 3.3+
|
269 |
-
return $query->is_main_query();
|
270 |
-
|
271 |
-
global $wp_the_query;
|
272 |
-
return $query === $wp_the_query;
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Get the correct internal page template
|
277 |
-
*
|
278 |
-
* @return string Template path
|
279 |
-
*/
|
280 |
-
public static function get_current_page_template() {
|
281 |
-
|
282 |
-
$template = '';
|
283 |
-
|
284 |
-
// list view
|
285 |
-
if ( tribe_is_list_view() ) {
|
286 |
-
$template = self::getTemplateHierarchy( 'list', array('disable_view_check' => true) );
|
287 |
-
}
|
288 |
-
|
289 |
-
// calendar view
|
290 |
-
if ( tribe_is_month() ) {
|
291 |
-
$template = self::getTemplateHierarchy( 'month', array('disable_view_check' => true) );
|
292 |
-
}
|
293 |
-
|
294 |
-
// single event view
|
295 |
-
if ( is_singular( TribeEvents::POSTTYPE ) && !tribe_is_showing_all() ) {
|
296 |
-
$template = self::getTemplateHierarchy( 'single-event', array('disable_view_check' => true) );
|
297 |
-
}
|
298 |
-
|
299 |
-
// apply filters
|
300 |
-
return apply_filters('tribe_current_events_page_template', $template);
|
301 |
-
|
302 |
-
}
|
303 |
-
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Get the correct internal page template
|
307 |
-
*
|
308 |
-
* @return string Template class
|
309 |
-
*/
|
310 |
-
public static function get_current_template_class() {
|
311 |
-
|
312 |
-
$class = '';
|
313 |
-
|
314 |
-
// list view
|
315 |
-
if ( tribe_is_list_view() || tribe_is_showing_all() ) {
|
316 |
-
$class = 'Tribe_Events_List_Template';
|
317 |
-
}
|
318 |
-
|
319 |
-
// calendar view
|
320 |
-
else if ( tribe_is_month() ) {
|
321 |
-
$class = 'Tribe_Events_Month_Template';
|
322 |
-
}
|
323 |
-
|
324 |
-
// single event view
|
325 |
-
else if ( is_singular( TribeEvents::POSTTYPE ) ) {
|
326 |
-
$class = 'Tribe_Events_Single_Event_Template';
|
327 |
-
}
|
328 |
-
|
329 |
-
// apply filters
|
330 |
-
return apply_filters('tribe_current_events_template_class', $class);
|
331 |
-
|
332 |
-
}
|
333 |
-
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Loads the contents into the page template
|
337 |
-
*
|
338 |
-
* @return string Page content
|
339 |
-
*/
|
340 |
-
public static function load_ecp_into_page_template() {
|
341 |
-
// only run once!!!
|
342 |
-
remove_filter('the_content', array(__CLASS__, 'load_ecp_into_page_template') );
|
343 |
-
|
344 |
-
self::restoreQuery();
|
345 |
-
|
346 |
-
ob_start();
|
347 |
-
|
348 |
-
echo tribe_events_before_html();
|
349 |
-
|
350 |
-
tribe_get_view();
|
351 |
-
|
352 |
-
echo tribe_events_after_html();
|
353 |
-
|
354 |
-
$contents = ob_get_contents();
|
355 |
-
|
356 |
-
ob_end_clean();
|
357 |
-
|
358 |
-
// make sure the loop ends after our template is included
|
359 |
-
if ( ! is_404() )
|
360 |
-
self::endQuery();
|
361 |
-
|
362 |
-
return $contents;
|
363 |
-
}
|
364 |
-
|
365 |
-
|
366 |
-
/**
|
367 |
-
* Loads the title into the page template
|
368 |
-
*
|
369 |
-
* @param string $title Title
|
370 |
-
* @param int $post_id Id of the post
|
371 |
-
*
|
372 |
-
* @return string
|
373 |
-
*/
|
374 |
-
public static function load_ecp_title_into_page_template($title, $post_id) {
|
375 |
-
global $post;
|
376 |
-
|
377 |
-
if ( !is_single() )
|
378 |
-
return tribe_get_events_title();
|
379 |
-
|
380 |
-
// if the helper class for single event template hasn't been loaded fix that
|
381 |
-
if( !class_exists('Tribe_Events_Single_Event_Template') )
|
382 |
-
self::getTemplateHierarchy('single-event');
|
383 |
-
|
384 |
-
// single event title
|
385 |
-
$before_title = apply_filters( 'tribe_events_single_event_before_the_title', '', $post_id );
|
386 |
-
$the_title = apply_filters( 'tribe_events_single_event_the_title', $title, $title, $post_id );
|
387 |
-
$after_title = apply_filters( 'tribe_events_single_event_after_the_title', '', $post_id );
|
388 |
-
return $before_title . $the_title . $after_title;
|
389 |
-
}
|
390 |
-
|
391 |
-
public static function load_ecp_comments_page_template($template) {
|
392 |
-
$tribe_ecp = TribeEvents::instance();
|
393 |
-
|
394 |
-
remove_filter('comments_template', array(__CLASS__, 'load_ecp_comments_page_template') );
|
395 |
-
if (!is_single() || tribe_is_showing_all() || (tribe_get_option('showComments',false) === false)) {
|
396 |
-
return $tribe_ecp->pluginPath . 'admin-views/no-comments.php';
|
397 |
-
}
|
398 |
-
return $template;
|
399 |
-
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
* Checks where we are are and determines if we should show events in the main loop
|
403 |
-
*
|
404 |
-
* @param WP_Query $query
|
405 |
-
* @return WP_Query
|
406 |
-
* @since 2.1
|
407 |
-
*/
|
408 |
-
public static function showInLoops($query) {
|
409 |
-
|
410 |
-
if (!is_admin() && tribe_get_option('showInLoops') && ($query->is_home() || $query->is_tag) && empty($query->query_vars['post_type']) && false == $query->query_vars['suppress_filters']) {
|
411 |
-
|
412 |
-
// 3.3 know-how for main query check
|
413 |
-
// if (method_exists($query, 'is_main_query')) {
|
414 |
-
if (self::is_main_loop($query)) {
|
415 |
-
self::$isMainLoop = true;
|
416 |
-
$post_types = array('post', TribeEvents::POSTTYPE);
|
417 |
-
$query->set('post_type', $post_types);
|
418 |
-
}
|
419 |
-
|
420 |
-
}
|
421 |
-
|
422 |
-
return $query;
|
423 |
-
}
|
424 |
-
|
425 |
-
/**
|
426 |
-
* Filters the_content to show the event when we are in the main loop and showing events
|
427 |
-
*
|
428 |
-
* @param string $content
|
429 |
-
* @return string Filtered content
|
430 |
-
* @since 2.1
|
431 |
-
*/
|
432 |
-
public static function hijackContentInMainLoop($content) {
|
433 |
-
|
434 |
-
// only run once!!!
|
435 |
-
remove_filter('the_content', array(__CLASS__, 'hijackContentInMainLoop') );
|
436 |
-
|
437 |
-
global $post;
|
438 |
-
if (tribe_is_in_main_loop() && tribe_is_event($post->ID)) {
|
439 |
-
ob_start();
|
440 |
-
echo stripslashes(tribe_get_option('tribeEventsBeforeHTML'));
|
441 |
-
include_once(self::getTemplateHierarchy('in-loop'));
|
442 |
-
echo stripslashes(tribe_get_option('tribeEventsAfterHTML'));
|
443 |
-
$content = ob_get_contents();
|
444 |
-
ob_end_clean();
|
445 |
-
}
|
446 |
-
|
447 |
-
return $content;
|
448 |
-
}
|
449 |
-
|
450 |
-
/**
|
451 |
-
* Loads theme files in appropriate hierarchy: 1) child theme,
|
452 |
-
* 2) parent template, 3) plugin resources. will look in the events/
|
453 |
-
* directory in a theme and the views/ directory in the plugin
|
454 |
-
*
|
455 |
-
* @param string $template template file to search for
|
456 |
-
* @param array $args additional arguments to affect the template path
|
457 |
-
* - subfolder
|
458 |
-
* - namespace
|
459 |
-
* - plugin_path
|
460 |
-
* - disable_view_check - bypass the check to see if the view is enabled
|
461 |
-
* @return template path
|
462 |
-
* @author Matt Wiebe
|
463 |
-
**/
|
464 |
-
public static function getTemplateHierarchy( $template, $args = array() ) {
|
465 |
-
if ( !is_array( $args ) ) {
|
466 |
-
$args = array();
|
467 |
-
$passed = func_get_args();
|
468 |
-
$backwards_map = array( 'subfolder', 'namespace', 'plugin_path' );
|
469 |
-
if ( count( $passed > 1 ) ) {
|
470 |
-
for ( $i = 1 ; $i < count($passed) ; $i++ ) {
|
471 |
-
$args[$backwards_map[$i-1]] = $passed[$i];
|
472 |
-
}
|
473 |
-
}
|
474 |
-
}
|
475 |
-
|
476 |
-
$args = wp_parse_args( $args, array(
|
477 |
-
'subfolder' => '',
|
478 |
-
'namespace' => '/',
|
479 |
-
'plugin_path' => '',
|
480 |
-
'disable_view_check' => false,
|
481 |
-
));
|
482 |
-
/**
|
483 |
-
* @var string $subfolder
|
484 |
-
* @var string $namespace
|
485 |
-
* @var string $pluginpath
|
486 |
-
* @var bool $disable_view_check
|
487 |
-
*/
|
488 |
-
extract($args);
|
489 |
-
|
490 |
-
$tec = TribeEvents::instance();
|
491 |
-
|
492 |
-
if ( substr($template, -4) != '.php' ) {
|
493 |
-
$template .= '.php';
|
494 |
-
}
|
495 |
-
|
496 |
-
// setup the meta definitions
|
497 |
-
require_once( $tec->pluginPath . 'public/advanced-functions/meta.php' );
|
498 |
-
|
499 |
-
// Allow base path for templates to be filtered
|
500 |
-
$template_base_paths = apply_filters( 'tribe_events_template_paths', (array) TribeEvents::instance()->pluginPath);
|
501 |
-
|
502 |
-
// backwards compatibility if $plugin_path arg is used
|
503 |
-
if ( $plugin_path && ! in_array($plugin_path, $template_base_paths) ) {
|
504 |
-
$template_base_paths[] = $plugin_path;
|
505 |
-
}
|
506 |
-
|
507 |
-
// ensure that addon plugins look in the right override folder in theme
|
508 |
-
$namespace = !empty($namespace) && $namespace[0] != '/' ? '/' . trailingslashit($namespace) : trailingslashit($namespace);
|
509 |
-
|
510 |
-
// setup subfolder options
|
511 |
-
$subfolder = !empty($subfolder) ? trailingslashit($subfolder) : $subfolder;
|
512 |
-
|
513 |
-
$file = '';
|
514 |
-
foreach ( $template_base_paths as $template_base_path ) {
|
515 |
-
|
516 |
-
if ( $theme_file = locate_template( array('tribe-events' . $namespace . $subfolder . $template ), false, false) ) {
|
517 |
-
$file = $theme_file;
|
518 |
-
} else {
|
519 |
-
// protect from concat folder with filename
|
520 |
-
$subfolder = empty($subfolder) ? trailingslashit($subfolder) : $subfolder;
|
521 |
-
$subfolder = $subfolder[0] != '/' ? '/' . $subfolder : $subfolder;
|
522 |
-
|
523 |
-
$file = $template_base_path . 'views' . $subfolder . $template;
|
524 |
-
// echo $file;
|
525 |
-
}
|
526 |
-
|
527 |
-
if ( !$disable_view_check && in_array( $tec->displaying, tribe_events_disabled_views() ) ) {
|
528 |
-
$file = get_404_template();
|
529 |
-
}
|
530 |
-
|
531 |
-
$file = apply_filters( 'tribe_events_template', $file, $template);
|
532 |
-
|
533 |
-
// return the first one found
|
534 |
-
if (file_exists($file))
|
535 |
-
break;
|
536 |
-
}
|
537 |
-
|
538 |
-
return apply_filters( 'tribe_events_template_'.$template, $file);
|
539 |
-
}
|
540 |
-
|
541 |
-
|
542 |
-
/**
|
543 |
-
* Look for the stylesheets. Fall back to $fallback path if the stylesheets can't be located or the array is empty.
|
544 |
-
* @param array|string $stylesheets Path to the stylesheet
|
545 |
-
* @param bool|string $fallback Path to fallback stylesheet
|
546 |
-
*
|
547 |
-
* @return bool|string Path to stylesheet
|
548 |
-
*/
|
549 |
-
public static function locate_stylesheet( $stylesheets, $fallback = false ) {
|
550 |
-
if ( !is_array($stylesheets) ) {
|
551 |
-
$stylesheets = array( $stylesheets );
|
552 |
-
}
|
553 |
-
if ( empty( $stylesheets ) ) {
|
554 |
-
return $fallback;
|
555 |
-
}
|
556 |
-
foreach ( $stylesheets as $filename ) {
|
557 |
-
if ( file_exists(STYLESHEETPATH . '/' . $filename)) {
|
558 |
-
$located = trailingslashit(get_stylesheet_directory_uri()).$filename;
|
559 |
-
break;
|
560 |
-
} else if ( file_exists(TEMPLATEPATH . '/' . $filename) ) {
|
561 |
-
$located = trailingslashit(get_template_directory_uri()).$filename;
|
562 |
-
break;
|
563 |
-
}
|
564 |
-
}
|
565 |
-
if ( empty( $located ) ) {
|
566 |
-
return $fallback;
|
567 |
-
}
|
568 |
-
return $located;
|
569 |
-
}
|
570 |
-
|
571 |
-
|
572 |
-
/**
|
573 |
-
* Query is complete.
|
574 |
-
*/
|
575 |
-
private static function endQuery() {
|
576 |
-
global $wp_query;
|
577 |
-
|
578 |
-
$wp_query->current_post = 0;
|
579 |
-
$wp_query->post_count = 1;
|
580 |
-
}
|
581 |
-
|
582 |
-
|
583 |
-
/**
|
584 |
-
* Spoof the query so that we can operate independently of what has been queried.
|
585 |
-
*
|
586 |
-
* @return object
|
587 |
-
*/
|
588 |
-
private static function spoofed_post() {
|
589 |
-
$spoofed_post = array(
|
590 |
-
'ID' => -9999,
|
591 |
-
'post_status' => 'draft',
|
592 |
-
'post_author' => 0,
|
593 |
-
'post_parent' => 0,
|
594 |
-
'post_type' => 'page',
|
595 |
-
'post_date' => 0,
|
596 |
-
'post_date_gmt' => 0,
|
597 |
-
'post_modified' => 0,
|
598 |
-
'post_modified_gmt' => 0,
|
599 |
-
'post_content' => '',
|
600 |
-
'post_title' => '',
|
601 |
-
'post_excerpt' => '',
|
602 |
-
'post_content_filtered' => '',
|
603 |
-
'post_mime_type' => '',
|
604 |
-
'post_password' => '',
|
605 |
-
'post_name' => '',
|
606 |
-
'guid' => '',
|
607 |
-
'menu_order' => 0,
|
608 |
-
'pinged' => '',
|
609 |
-
'to_ping' => '',
|
610 |
-
'ping_status' => '',
|
611 |
-
'comment_status' => 'closed',
|
612 |
-
'comment_count' => 0,
|
613 |
-
'is_404' => false,
|
614 |
-
'is_page' => false,
|
615 |
-
'is_single' => false,
|
616 |
-
'is_archive' => false,
|
617 |
-
'is_tax' => false,
|
618 |
-
);
|
619 |
-
return (object) $spoofed_post;
|
620 |
-
}
|
621 |
-
|
622 |
-
|
623 |
-
/**
|
624 |
-
* Decide if we need to spoof the query.
|
625 |
-
*/
|
626 |
-
public static function maybeSpoofQuery() {
|
627 |
-
|
628 |
-
// hijack this method right up front if it's a password protected post and the password isn't entered
|
629 |
-
if (is_single() && post_password_required()) {
|
630 |
-
return;
|
631 |
-
}
|
632 |
-
|
633 |
-
global $wp_query;
|
634 |
-
|
635 |
-
if ( $wp_query->is_main_query() && tribe_is_event_query() && tribe_get_option('tribeEventsTemplate', 'default') != '' ) {
|
636 |
-
|
637 |
-
// we need to ensure that we always enter the loop, whether or not there are any events in the actual query
|
638 |
-
|
639 |
-
$spoofed_post = self::spoofed_post();
|
640 |
-
|
641 |
-
$GLOBALS['post'] = $spoofed_post;
|
642 |
-
$wp_query->posts[] = $spoofed_post;
|
643 |
-
$wp_query->post_count = count($wp_query->posts);
|
644 |
-
|
645 |
-
$wp_query->spoofed = true;
|
646 |
-
$wp_query->rewind_posts();
|
647 |
-
|
648 |
-
}
|
649 |
-
}
|
650 |
-
|
651 |
-
|
652 |
-
/**
|
653 |
-
* Restore the original query after spoofing it.
|
654 |
-
*/
|
655 |
-
public static function restoreQuery() {
|
656 |
-
global $wp_query;
|
657 |
-
if ( isset( $wp_query->spoofed ) && $wp_query->spoofed ) {
|
658 |
-
|
659 |
-
// take the spoofed post out of the posts array
|
660 |
-
array_pop( $wp_query->posts );
|
661 |
-
|
662 |
-
// fix the post_count
|
663 |
-
$wp_query->post_count = count( $wp_query->posts );
|
664 |
-
|
665 |
-
// rewind the posts
|
666 |
-
$wp_query->rewind_posts();
|
667 |
-
|
668 |
-
if ( $wp_query->have_posts() ) {
|
669 |
-
wp_reset_postdata();
|
670 |
-
} else {
|
671 |
-
// there are no posts, unset the current post
|
672 |
-
unset ( $wp_query->post );
|
673 |
-
}
|
674 |
-
|
675 |
-
// don't do this again
|
676 |
-
unset( $wp_query->spoofed );
|
677 |
-
}
|
678 |
-
}
|
679 |
-
}
|
680 |
-
|
681 |
-
TribeEventsTemplates::init();
|
682 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/advanced-functions/meta.php
CHANGED
@@ -76,7 +76,7 @@ if ( class_exists( 'Tribe_Meta_Factory' ) ) {
|
|
76 |
'before' => '',
|
77 |
'sep' => ', ',
|
78 |
'after' => '',
|
79 |
-
'label' =>
|
80 |
'label_before' => $template['label_before'],
|
81 |
'label_after' => $template['label_after'],
|
82 |
'wrap_before' => $template['meta_before'],
|
@@ -283,6 +283,7 @@ if ( class_exists( 'Tribe_Meta_Factory' ) ) {
|
|
283 |
'classes' => array( 'meta_before' => array( 'tribe-events-event-categories')),
|
284 |
'filter_callback' => array( 'Tribe_Register_Meta', 'event_category' ),
|
285 |
'priority' => 30,
|
|
|
286 |
'group' => 'tribe_event_details'
|
287 |
) );
|
288 |
|
76 |
'before' => '',
|
77 |
'sep' => ', ',
|
78 |
'after' => '',
|
79 |
+
'label' => $_tribe_meta_factory->meta[$meta_id]['label'],
|
80 |
'label_before' => $template['label_before'],
|
81 |
'label_after' => $template['label_after'],
|
82 |
'wrap_before' => $template['meta_before'],
|
283 |
'classes' => array( 'meta_before' => array( 'tribe-events-event-categories')),
|
284 |
'filter_callback' => array( 'Tribe_Register_Meta', 'event_category' ),
|
285 |
'priority' => 30,
|
286 |
+
'label' => null,
|
287 |
'group' => 'tribe_event_details'
|
288 |
) );
|
289 |
|
public/template-tags/general.php.orig
DELETED
@@ -1,1036 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The Events Calendar Template Tags
|
4 |
-
*
|
5 |
-
* Display functions (template-tags) for use in WordPress templates.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Don't load directly
|
9 |
-
if ( !defined( 'ABSPATH' ) ) { die( '-1' ); }
|
10 |
-
|
11 |
-
if ( class_exists( 'TribeEvents' ) ) {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Instantiate the template class, preparing a view file for use. If no name is passed, defaults to the class for the current view
|
15 |
-
*
|
16 |
-
* @param bool|string $class Classname you want to instantiate
|
17 |
-
* @return void
|
18 |
-
* @author Jessica Yazbek
|
19 |
-
* @uses TribeEventsTemplates::instantiate_template_class()
|
20 |
-
* @since 3.0
|
21 |
-
**/
|
22 |
-
function tribe_initialize_view( $class = false ) {
|
23 |
-
do_action( 'tribe_pre_initialize_view' );
|
24 |
-
TribeEventsTemplates::instantiate_template_class( $class );
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Includes a view file, runs hooks around the view
|
29 |
-
*
|
30 |
-
* @param bool|string $view View slug
|
31 |
-
* @return void
|
32 |
-
* @author Jessica Yazbek
|
33 |
-
* @since 3.0
|
34 |
-
**/
|
35 |
-
function tribe_get_view( $view = false ) {
|
36 |
-
|
37 |
-
do_action( 'tribe_pre_get_view' );
|
38 |
-
|
39 |
-
if ( ! $view ) {
|
40 |
-
$template_file = tribe_get_current_template();
|
41 |
-
} else {
|
42 |
-
$template_file = TribeEventsTemplates::getTemplateHierarchy( $view, array('disable_view_check' => true) );
|
43 |
-
}
|
44 |
-
|
45 |
-
if (file_exists($template_file)) {
|
46 |
-
do_action('tribe_events_before_view', $template_file);
|
47 |
-
include( $template_file );
|
48 |
-
do_action('tribe_events_after_view', $template_file);
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Includes a template part, similar to the WP get template part, but looks
|
54 |
-
* in the correct directories for Tribe Events templates
|
55 |
-
*
|
56 |
-
* @param string $slug
|
57 |
-
* @param null|string $name
|
58 |
-
* @uses TribeEventsTemplates::getTemplateHierarchy
|
59 |
-
* @author Jessica Yazbek
|
60 |
-
* @since 3.0
|
61 |
-
**/
|
62 |
-
function tribe_get_template_part( $slug, $name = null ) {
|
63 |
-
|
64 |
-
// Execute code for this part
|
65 |
-
do_action( 'tribe_pre_get_template_part_' . $slug, $slug, $name );
|
66 |
-
// Setup possible parts
|
67 |
-
$templates = array();
|
68 |
-
if ( isset( $name ) ) {
|
69 |
-
$templates[] = $slug . '-' . $name . '.php';
|
70 |
-
}
|
71 |
-
$templates[] = $slug . '.php';
|
72 |
-
|
73 |
-
// Allow template parts to be filtered
|
74 |
-
$templates = apply_filters( 'tribe_get_template_part_templates', $templates, $slug, $name );
|
75 |
-
|
76 |
-
|
77 |
-
// loop through templates, return first one found.
|
78 |
-
foreach( $templates as $template ) {
|
79 |
-
$file = TribeEventsTemplates::getTemplateHierarchy( $template, array('disable_view_check' => true) );
|
80 |
-
$file = apply_filters( 'tribe_get_template_part_path', $file, $template, $slug, $name );
|
81 |
-
$file = apply_filters( 'tribe_get_template_part_path_'.$template, $file, $slug, $name );
|
82 |
-
if (file_exists($file)) {
|
83 |
-
ob_start();
|
84 |
-
do_action( 'tribe_before_get_template_part', $template, $file, $template, $slug, $name );
|
85 |
-
include($file);
|
86 |
-
do_action( 'tribe_after_get_template_part', $template, $file, $slug, $name );
|
87 |
-
$html = ob_get_clean();
|
88 |
-
echo apply_filters( 'tribe_get_template_part_content', $html, $template, $file, $slug, $name );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
do_action( 'tribe_post_get_template_part_' . $slug, $slug, $name );
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Get Options
|
96 |
-
*
|
97 |
-
* Retrieve specific key from options array, optionally provide a default return value
|
98 |
-
*
|
99 |
-
* @param string $optionName Name of the option to retrieve.
|
100 |
-
* @param string $default Value to return if no such option is found.
|
101 |
-
* @return mixed Value of the option if found.
|
102 |
-
* @todo Abstract this function out of template tags or otherwise secure it from other namespace conflicts.
|
103 |
-
* @since 2.0
|
104 |
-
*/
|
105 |
-
function tribe_get_option( $optionName, $default = '' ) {
|
106 |
-
$tribe_ecp = TribeEvents::instance();
|
107 |
-
return apply_filters( 'tribe_get_option', $tribe_ecp->getOption( $optionName, $default ), $optionName, $default );
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Update Option
|
112 |
-
*
|
113 |
-
* Set specific key from options array, optionally provide a default return value
|
114 |
-
*
|
115 |
-
* @param string $optionName Name of the option to retrieve.
|
116 |
-
* @param string $value Value to save
|
117 |
-
* @return void
|
118 |
-
* @since 2.0.3
|
119 |
-
*/
|
120 |
-
function tribe_update_option( $optionName, $value ) {
|
121 |
-
$tribe_ecp = TribeEvents::instance();
|
122 |
-
$tribe_ecp->setOption( $optionName, $value );
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Get Network Options
|
127 |
-
*
|
128 |
-
* Retrieve specific key from options array, optionally provide a default return value
|
129 |
-
*
|
130 |
-
* @param string $optionName Name of the option to retrieve.
|
131 |
-
* @param string $default Value to return if no such option is found.
|
132 |
-
* @return mixed Value of the option if found.
|
133 |
-
* @todo Abstract this function out of template tags or otherwise secure it from other namespace conflicts.
|
134 |
-
* @since 2.0
|
135 |
-
*/
|
136 |
-
function tribe_get_network_option( $optionName, $default = '' ) {
|
137 |
-
$tribe_ecp = TribeEvents::instance();
|
138 |
-
return $tribe_ecp->getNetworkOption( $optionName, $default );
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Event Type Test
|
143 |
-
*
|
144 |
-
* Checks type of $postId to determine if it is an Event
|
145 |
-
*
|
146 |
-
* @param int $postId (optional)
|
147 |
-
* @return bool true if this post is an Event post type
|
148 |
-
* @since 2.0
|
149 |
-
*/
|
150 |
-
function tribe_is_event( $postId = null ) {
|
151 |
-
return apply_filters( 'tribe_is_event', TribeEvents::instance()->isEvent( $postId ) );
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Get Event
|
156 |
-
*
|
157 |
-
* Queries the events using WordPress get_posts() by setting the post type and sorting by event date.
|
158 |
-
*
|
159 |
-
* @param array $args query vars with added defaults including post_type of events, sorted (orderby) by event date (order) ascending
|
160 |
-
* @return array List of posts.
|
161 |
-
* @link http://codex.wordpress.org/Template_Tags/get_posts
|
162 |
-
* @link http://codex.wordpress.org/Function_Reference/get_post
|
163 |
-
* @uses get_posts()
|
164 |
-
* @see get_posts()
|
165 |
-
* @since 2.0
|
166 |
-
*/
|
167 |
-
function tribe_get_events( $args = array() ) {
|
168 |
-
return apply_filters( 'tribe_get_events', TribeEventsQuery::getEvents( $args ) );
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* All Day Event Test
|
173 |
-
*
|
174 |
-
* Returns true if the event is an all day event
|
175 |
-
*
|
176 |
-
* @param int $postId (optional)
|
177 |
-
* @return bool
|
178 |
-
* @since 2.0
|
179 |
-
*/
|
180 |
-
function tribe_event_is_all_day( $postId = null ) {
|
181 |
-
$postId = TribeEvents::postIdHelper( $postId );
|
182 |
-
$output = !! tribe_get_event_meta( $postId, '_EventAllDay', true );
|
183 |
-
return apply_filters( 'tribe_event_is_all_day', $output );
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Multi-day Event Test
|
188 |
-
*
|
189 |
-
* Returns true if the event spans multiple days
|
190 |
-
*
|
191 |
-
* @param int $postId (optional)
|
192 |
-
* @return bool true if event spans multiple days
|
193 |
-
* @since 2.0
|
194 |
-
*/
|
195 |
-
function tribe_event_is_multiday( $postId = null ) {
|
196 |
-
$postId = TribeEvents::postIdHelper( $postId );
|
197 |
-
$start = (array)tribe_get_event_meta( $postId, '_EventStartDate', false );
|
198 |
-
sort( $start );
|
199 |
-
$start = strtotime( $start[0] );
|
200 |
-
$end = strtotime( tribe_get_event_meta( $postId, '_EventEndDate', true ) );
|
201 |
-
$output = date( 'd-m-Y', $start ) != date( 'd-m-Y', $end );
|
202 |
-
return apply_filters( 'tribe_event_is_multiday', $output );
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Event Category ID's
|
207 |
-
*
|
208 |
-
* Display the event category ID as a class for events wrapper
|
209 |
-
*
|
210 |
-
* @uses wp_get_object_terms()
|
211 |
-
* @since 2.1
|
212 |
-
*/
|
213 |
-
function tribe_get_event_cat_ids( $post_id = 0 ) {
|
214 |
-
$post_id = TribeEvents::postIdHelper( $post_id );
|
215 |
-
return wp_list_pluck( (array) get_the_terms( $post_id, TribeEvents::TAXONOMY ), 'term_id' );
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Event Category slugs
|
220 |
-
*
|
221 |
-
* Display the event category ID as a class for events wrapper
|
222 |
-
*
|
223 |
-
* @uses wp_get_object_terms()
|
224 |
-
* @since 2.1
|
225 |
-
*/
|
226 |
-
function tribe_get_event_cat_slugs( $post_id = 0 ) {
|
227 |
-
$post_id = TribeEvents::postIdHelper( $post_id );
|
228 |
-
return wp_list_pluck( (array) get_the_terms( $post_id, TribeEvents::TAXONOMY ), 'slug' );
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* get the term list by taxonomy (default categories) for a single event
|
233 |
-
* @param int $post_id
|
234 |
-
* @param array $args
|
235 |
-
* @return string HTML string of taxonomy terms
|
236 |
-
*/
|
237 |
-
function tribe_get_event_taxonomy( $post_id = null, $args = array() ) {
|
238 |
-
$post_id = TribeEvents::postIdHelper( $post_id );
|
239 |
-
$tribe_ecp = TribeEvents::instance();
|
240 |
-
$defaults = array(
|
241 |
-
'taxonomy' => $tribe_ecp->get_event_taxonomy(),
|
242 |
-
'before' => '<li>',
|
243 |
-
'sep' => '</li><li>',
|
244 |
-
'after' => '</li>' );
|
245 |
-
$args = wp_parse_args( $args, $defaults );
|
246 |
-
extract( $args, EXTR_SKIP );
|
247 |
-
$taxonomy = get_the_term_list( $post_id, $taxonomy, $before, $sep, $after );
|
248 |
-
return apply_filters( 'tribe_get_event_taxonomy', $taxonomy );
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Event Categories (Display)
|
253 |
-
*
|
254 |
-
* Display the event categories with display param
|
255 |
-
*
|
256 |
-
* @uses tribe_get_event_taxonomy()
|
257 |
-
* @replaces tribe_meta_event_cats()
|
258 |
-
* @param int $post_id
|
259 |
-
* @param array $args
|
260 |
-
* @return string $html (echo if provided in $args)
|
261 |
-
* @since 3.0
|
262 |
-
*/
|
263 |
-
function tribe_get_event_categories( $post_id = null, $args = array() ) {
|
264 |
-
$post_id = is_null( $post_id ) ? get_the_ID() : $post_id;
|
265 |
-
$defaults = array(
|
266 |
-
'echo' => false,
|
267 |
-
'label' => null,
|
268 |
-
'label_before' => '<div>',
|
269 |
-
'label_after' => '</div>',
|
270 |
-
'wrap_before' => '<ul class="tribe-event-categories">',
|
271 |
-
'wrap_after' => '</ul>' );
|
272 |
-
$args = wp_parse_args( $args, $defaults );
|
273 |
-
$categories = tribe_get_event_taxonomy( $post_id, $args );
|
274 |
-
|
275 |
-
// check for the occurances of links in the returned string
|
276 |
-
$label = is_null( $args['label'] ) ? _n( 'Event Category', 'Event Categories', substr_count( $categories, "<a href" ), 'tribe-events-calendar' ) : $args['label'];
|
277 |
-
|
278 |
-
$html = !empty( $categories ) ? sprintf( '%s%s:%s %s%s%s',
|
279 |
-
$args['label_before'],
|
280 |
-
$label,
|
281 |
-
$args['label_after'],
|
282 |
-
$args['wrap_before'],
|
283 |
-
$categories,
|
284 |
-
$args['wrap_after']
|
285 |
-
) : '';
|
286 |
-
if ( $args['echo'] ) {
|
287 |
-
echo apply_filters( 'tribe_get_event_categories', $html );
|
288 |
-
} else {
|
289 |
-
return apply_filters( 'tribe_get_event_categories', $html );
|
290 |
-
}
|
291 |
-
}
|
292 |
-
|
293 |
-
/**
|
294 |
-
* Event Tags (Display)
|
295 |
-
*
|
296 |
-
* Display the event tags
|
297 |
-
*
|
298 |
-
* @param null|string $label
|
299 |
-
* @param string $separator
|
300 |
-
* @param bool $echo
|
301 |
-
* @return array
|
302 |
-
* @uses the_terms()
|
303 |
-
* @since 2.1
|
304 |
-
*/
|
305 |
-
function tribe_meta_event_tags( $label=null, $separator=', ', $echo = true ) {
|
306 |
-
if ( !$label ) { $label = __( 'Tags:', 'tribe-events-calendar' ); }
|
307 |
-
|
308 |
-
$tribe_ecp = TribeEvents::instance();
|
309 |
-
$list = apply_filters( 'tribe_meta_event_tags', get_the_term_list( get_the_ID(), 'post_tag', '<dt>'.$label.'</dt><dd class="tribe-event-tags">', $separator, '</dd>' ) );
|
310 |
-
if ( $echo ) {
|
311 |
-
echo $list;
|
312 |
-
} else {
|
313 |
-
return $list;
|
314 |
-
}
|
315 |
-
}
|
316 |
-
|
317 |
-
/**
|
318 |
-
* Event Post Meta
|
319 |
-
*
|
320 |
-
* Get event post meta.
|
321 |
-
*
|
322 |
-
* @param int|null $postId (optional)
|
323 |
-
* @param string|bool $meta name of the meta_key
|
324 |
-
* @param bool $single determines if the results should be a single item or an array of items.
|
325 |
-
* @return mixed meta value(s)
|
326 |
-
* @since 2.0
|
327 |
-
*/
|
328 |
-
function tribe_get_event_meta( $postId = null, $meta = false, $single = true ) {
|
329 |
-
//$postId = TribeEvents::postIdHelper( $postId );
|
330 |
-
$tribe_ecp = TribeEvents::instance();
|
331 |
-
$output = $tribe_ecp->getEventMeta( $postId, $meta, $single );
|
332 |
-
return apply_filters( 'tribe_get_event_meta', $output );
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Event Category Name
|
337 |
-
*
|
338 |
-
* Return the current event category name based the url.
|
339 |
-
*
|
340 |
-
* @return string Name of the Event Category
|
341 |
-
* @since 2.0
|
342 |
-
*/
|
343 |
-
function tribe_meta_event_category_name() {
|
344 |
-
$tribe_ecp = TribeEvents::instance();
|
345 |
-
$current_cat = get_query_var( 'tribe_events_cat' );
|
346 |
-
if ( $current_cat ) {
|
347 |
-
$term_info = get_term_by( 'slug', $current_cat, $tribe_ecp->get_event_taxonomy() );
|
348 |
-
return apply_filters( 'tribe_meta_event_category_name', $term_info->name );
|
349 |
-
}
|
350 |
-
}
|
351 |
-
|
352 |
-
/**
|
353 |
-
* Current Template
|
354 |
-
*
|
355 |
-
* Get the current page template that we are on
|
356 |
-
*
|
357 |
-
* @todo Update the function name to ensure there are no namespace conflicts.
|
358 |
-
* @return string Page template
|
359 |
-
* @since 2.0
|
360 |
-
*/
|
361 |
-
function tribe_get_current_template() {
|
362 |
-
return apply_filters( 'tribe_get_current_template', TribeEventsTemplates::get_current_page_template() );
|
363 |
-
}
|
364 |
-
|
365 |
-
/**
|
366 |
-
* Venue Type Test
|
367 |
-
*
|
368 |
-
* Checks type of $postId to determine if it is a Venue
|
369 |
-
*
|
370 |
-
* @param int $postId (optional)
|
371 |
-
* @return bool True if post type id Venue
|
372 |
-
* @since 2.0
|
373 |
-
*/
|
374 |
-
function tribe_is_venue( $postId = null ) {
|
375 |
-
$tribe_ecp = TribeEvents::instance();
|
376 |
-
return apply_filters( 'tribe_is_venue', $tribe_ecp->isVenue( $postId ) );
|
377 |
-
}
|
378 |
-
|
379 |
-
/**
|
380 |
-
* HTML Before Event (Display)
|
381 |
-
*
|
382 |
-
* Display HTML to output before the event template
|
383 |
-
*
|
384 |
-
* @since 2.0
|
385 |
-
*/
|
386 |
-
function tribe_events_before_html() {
|
387 |
-
$before = stripslashes( tribe_get_option( 'tribeEventsBeforeHTML', '' ) );
|
388 |
-
$before = wptexturize( $before );
|
389 |
-
$before = convert_chars( $before );
|
390 |
-
$before = wpautop( $before );
|
391 |
-
$before = '<div class="tribe-events-before-html">'. stripslashes( shortcode_unautop( $before ) ) .'</div>';
|
392 |
-
$before = $before.'<span class="tribe-events-ajax-loading"><img class="tribe-events-spinner-medium" src="'.tribe_events_resource_url('images/tribe-loading.gif').'" alt="'.__('Loading Events', 'tribe-events').'" /></span>';
|
393 |
-
$before = apply_filters( 'tribe_events_before_html', $before );
|
394 |
-
|
395 |
-
echo apply_filters( 'tribe_events_before_html', $before );
|
396 |
-
}
|
397 |
-
|
398 |
-
/**
|
399 |
-
* HTML After Event (Display)
|
400 |
-
*
|
401 |
-
* Display HTML to output after the event template
|
402 |
-
*
|
403 |
-
* @since 2.0
|
404 |
-
*/
|
405 |
-
function tribe_events_after_html() {
|
406 |
-
$after = stripslashes( tribe_get_option( 'tribeEventsAfterHTML', '' ) );
|
407 |
-
$after = wptexturize( $after );
|
408 |
-
$after = convert_chars( $after );
|
409 |
-
$after = wpautop( $after );
|
410 |
-
$after = '<div class="tribe-events-after-html">'. stripslashes( shortcode_unautop( $after ) ) .'</div>';
|
411 |
-
|
412 |
-
echo apply_filters( 'tribe_events_after_html', $after );
|
413 |
-
}
|
414 |
-
|
415 |
-
/**
|
416 |
-
* Prints out classes on an event wrapper
|
417 |
-
*
|
418 |
-
* @return void
|
419 |
-
* @since 3.0
|
420 |
-
**/
|
421 |
-
function tribe_events_event_classes() {
|
422 |
-
$classes = apply_filters('tribe_events_event_classes', array());
|
423 |
-
echo implode(' ', $classes);
|
424 |
-
}
|
425 |
-
|
426 |
-
/**
|
427 |
-
* Prints out data attributes used in the template header tags
|
428 |
-
*
|
429 |
-
* @param string|null $current_view
|
430 |
-
* @return void
|
431 |
-
* @since 3.0
|
432 |
-
**/
|
433 |
-
function tribe_events_the_header_attributes( $current_view = null ) {
|
434 |
-
$attrs = array();
|
435 |
-
$current_view = !empty( $current_view ) ? $current_view : basename(tribe_get_current_template());
|
436 |
-
<<<<<<< HEAD
|
437 |
-
$attrs['data-title'] = TribeEventsTemplates::maybeAddEventTitle(wp_title('', false));
|
438 |
-
=======
|
439 |
-
$attrs['data-title'] = wp_title('»', false);
|
440 |
-
>>>>>>> parent of dd42fe2... Fixed problems with title filter
|
441 |
-
switch($current_view) {
|
442 |
-
case 'month.php' :
|
443 |
-
$attrs['data-view'] = 'month';
|
444 |
-
$attrs['data-date'] = date( 'Y-m', strtotime( tribe_get_month_view_date() ) );
|
445 |
-
$attrs['data-baseurl'] = tribe_get_gridview_link(false);
|
446 |
-
break;
|
447 |
-
case 'list.php' :
|
448 |
-
$attrs['data-view']= 'list';
|
449 |
-
if ( tribe_is_upcoming() ) {
|
450 |
-
$attrs['data-baseurl'] = tribe_get_listview_link(false);
|
451 |
-
} elseif( tribe_is_past() ) {
|
452 |
-
$attrs['data-view']= 'past';
|
453 |
-
$attrs['data-baseurl'] = tribe_get_listview_past_link(false);
|
454 |
-
}
|
455 |
-
break;
|
456 |
-
}
|
457 |
-
$attrs = apply_filters('tribe_events_header_attributes', $attrs, $current_view);
|
458 |
-
foreach ($attrs as $attr => $value) {
|
459 |
-
echo " $attr=".'"'.$value.'"';
|
460 |
-
}
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
* Returns or echoes a url to a file in the Events Calendar plugin resources directory
|
465 |
-
*
|
466 |
-
* @param string $resource the filename of the resource
|
467 |
-
* @param bool $echo whether or not to echo the url
|
468 |
-
* @return string
|
469 |
-
* @author Jessica Yazbek
|
470 |
-
* @since 3.0
|
471 |
-
**/
|
472 |
-
function tribe_events_resource_url($resource, $echo = false) {
|
473 |
-
$url = apply_filters('tribe_events_resource_url', trailingslashit( TribeEvents::instance()->pluginUrl ).'resources/'.$resource, $resource);
|
474 |
-
if ($echo) {
|
475 |
-
echo $url;
|
476 |
-
}
|
477 |
-
return $url;
|
478 |
-
}
|
479 |
-
|
480 |
-
/**
|
481 |
-
* Return an array with the days of the week, numbered with respect to the start_of_week WP option
|
482 |
-
* @param string $format the display format for the days of the week
|
483 |
-
* @return array Days of the week.
|
484 |
-
* @since 3.0
|
485 |
-
**/
|
486 |
-
function tribe_events_get_days_of_week( $format = null ) {
|
487 |
-
if ( $format == 'short' ) {
|
488 |
-
$days_of_week = TribeEvents::instance()->daysOfWeekShort;
|
489 |
-
} else {
|
490 |
-
$days_of_week = TribeEvents::instance()->daysOfWeek;
|
491 |
-
}
|
492 |
-
$start_of_week = get_option('start_of_week', 0);
|
493 |
-
for ($i = 0; $i < $start_of_week; $i++) {
|
494 |
-
$day = $days_of_week[$i];
|
495 |
-
unset($days_of_week[$i]);
|
496 |
-
$days_of_week[$i] = $day;
|
497 |
-
}
|
498 |
-
// $days_of_week = array_values($days_of_week);
|
499 |
-
return apply_filters('tribe_events_get_days_of_week', $days_of_week);
|
500 |
-
}
|
501 |
-
|
502 |
-
/**
|
503 |
-
* conditional tag to determine if the cost field should be shown in the admin editors.
|
504 |
-
* @author tim@imaginesimplicity.com
|
505 |
-
* @since 3.0
|
506 |
-
* @return bool
|
507 |
-
*/
|
508 |
-
function tribe_events_admin_show_cost_field(){
|
509 |
-
$modules = apply_filters( 'tribe_events_tickets_modules', NULL );
|
510 |
-
$event_origin = get_post_meta( get_the_ID(), '_EventOrigin', true );
|
511 |
-
$show_cost = empty( $modules ) ||
|
512 |
-
class_exists( 'Event_Tickets_PRO' ) ||
|
513 |
-
in_array( $event_origin, apply_filters( 'tribe_events_admin_show_cost_field_origin', array( 'community-events' ) ) );
|
514 |
-
return apply_filters( 'tribe_events_admin_show_cost_field', $show_cost, $modules );
|
515 |
-
}
|
516 |
-
|
517 |
-
/**
|
518 |
-
* Get an event's cost
|
519 |
-
*
|
520 |
-
*
|
521 |
-
* @param null|int $postId (optional)
|
522 |
-
* @param bool $withCurrencySymbol Include the currency symbol
|
523 |
-
* @return string Cost of the event.
|
524 |
-
*/
|
525 |
-
function tribe_get_cost( $postId = null, $withCurrencySymbol = false ) {
|
526 |
-
$tribe_ecp = TribeEvents::instance();
|
527 |
-
$postId = TribeEvents::postIdHelper( $postId );
|
528 |
-
|
529 |
-
$cost = tribe_get_event_meta( $postId, '_EventCost', true );
|
530 |
-
|
531 |
-
if ( $cost === '' ) {
|
532 |
-
$cost = '';
|
533 |
-
} elseif ( $cost === '0' ) {
|
534 |
-
$cost = __( "Free", 'tribe-events-calendar' );
|
535 |
-
} else {
|
536 |
-
$cost = esc_html( $cost );
|
537 |
-
}
|
538 |
-
|
539 |
-
if ( $withCurrencySymbol && is_numeric( $cost ) ) {
|
540 |
-
$currency = tribe_get_event_meta( $postId, '_EventCurrencySymbol', true );
|
541 |
-
|
542 |
-
if ( !$currency ) {
|
543 |
-
$currency = tribe_get_option( 'defaultCurrencySymbol', '$' );
|
544 |
-
}
|
545 |
-
|
546 |
-
$cost = $currency . $cost;
|
547 |
-
}
|
548 |
-
|
549 |
-
return apply_filters( 'tribe_get_cost', $cost, $postId, $withCurrencySymbol );
|
550 |
-
}
|
551 |
-
|
552 |
-
/**
|
553 |
-
* Get the minimum cost of all events.
|
554 |
-
*
|
555 |
-
* @author PaulHughes01
|
556 |
-
* @since 2.1
|
557 |
-
* @return int the minimum cost.
|
558 |
-
*/
|
559 |
-
function tribe_get_minimum_cost() {
|
560 |
-
global $wpdb;
|
561 |
-
|
562 |
-
$costs = $wpdb->get_col( 'SELECT meta_value FROM ' . $wpdb->postmeta . ' WHERE meta_key = \'_EventCost\';' );
|
563 |
-
|
564 |
-
$costs = array_map( 'tribe_map_cost_array_callback', $costs );
|
565 |
-
foreach ( $costs as $index => $value ) {
|
566 |
-
$costs[$index] = preg_replace( '/^[^\d]+(\d+\.?\d*)?.*$/', '$1', $value );
|
567 |
-
}
|
568 |
-
if ( empty( $costs ) )
|
569 |
-
$costs = array( '0' );
|
570 |
-
|
571 |
-
$min = min( $costs );
|
572 |
-
if ( $min == '' )
|
573 |
-
$min = 0;
|
574 |
-
|
575 |
-
return $min;
|
576 |
-
}
|
577 |
-
|
578 |
-
/**
|
579 |
-
* Get the maximum cost of all events.
|
580 |
-
*
|
581 |
-
* @author PaulHughes01
|
582 |
-
* @since 2.1
|
583 |
-
* @return int the maximum cost.
|
584 |
-
*/
|
585 |
-
function tribe_get_maximum_cost() {
|
586 |
-
global $wpdb;
|
587 |
-
|
588 |
-
$costs = $wpdb->get_col( 'SELECT meta_value FROM ' . $wpdb->postmeta . ' WHERE meta_key = \'_EventCost\';' );
|
589 |
-
|
590 |
-
$costs = array_map( 'tribe_map_cost_array_callback', $costs );
|
591 |
-
foreach ( $costs as $index => $value ) {
|
592 |
-
$costs[$index] = preg_replace( '/^[^\d]+(\d+\.?\d*)?.*$/', '$1', $value );
|
593 |
-
}
|
594 |
-
|
595 |
-
if ( empty( $costs ) )
|
596 |
-
$costs = array( '0' );
|
597 |
-
|
598 |
-
$max = max( $costs );
|
599 |
-
if ( $max == '' )
|
600 |
-
$max = 0;
|
601 |
-
|
602 |
-
return $max;
|
603 |
-
}
|
604 |
-
|
605 |
-
/**
|
606 |
-
* Maps the cost array to make finding the minimum and maximum costs possible.
|
607 |
-
*
|
608 |
-
* @param array $costs
|
609 |
-
* @return array $costs
|
610 |
-
*/
|
611 |
-
function tribe_map_cost_array_callback( $costs ) {
|
612 |
-
return $costs;
|
613 |
-
}
|
614 |
-
|
615 |
-
/**
|
616 |
-
* Event in Category Conditional
|
617 |
-
*
|
618 |
-
* Returns true if the event is in the specified catagory slug
|
619 |
-
*
|
620 |
-
* @param string $event_cat_slug
|
621 |
-
* @param int $event_id
|
622 |
-
* @return boolean
|
623 |
-
* @since 2.0.2
|
624 |
-
*/
|
625 |
-
function tribe_event_in_category( $event_cat_slug, $event_id = null ) {
|
626 |
-
|
627 |
-
if ( empty( $event_id ) )
|
628 |
-
$event_id = get_the_ID();
|
629 |
-
|
630 |
-
$term = term_exists( $event_cat_slug, TribeEvents::TAXONOMY );
|
631 |
-
|
632 |
-
if ( tribe_is_event( $event_id ) && is_object_in_term( $event_id, TribeEvents::TAXONOMY, array( $term['term_id'] ) ) ) {
|
633 |
-
$return = true;
|
634 |
-
}else {
|
635 |
-
$return = false;
|
636 |
-
}
|
637 |
-
return apply_filters( 'tribe_event_in_category', $return );
|
638 |
-
}
|
639 |
-
|
640 |
-
/**
|
641 |
-
* Placeholder function that is used for ticketing plugins meant to be filtered by such plugins
|
642 |
-
*
|
643 |
-
* @author jkudish
|
644 |
-
* @since 2.1
|
645 |
-
* @return void
|
646 |
-
*/
|
647 |
-
function tribe_get_ticket_form() {
|
648 |
-
$ticket_form = apply_filters( 'tribe_get_ticket_form', false );
|
649 |
-
if ( $ticket_form && is_string( $ticket_form ) ) {
|
650 |
-
echo $ticket_form;
|
651 |
-
} else {
|
652 |
-
return $ticket_form;
|
653 |
-
}
|
654 |
-
}
|
655 |
-
|
656 |
-
/**
|
657 |
-
* helper function to remove empty lines from multi-line strings
|
658 |
-
*
|
659 |
-
* @since 2.0.5
|
660 |
-
* @author jkudish
|
661 |
-
* @link http://stackoverflow.com/questions/709669/how-do-i-remove-blank-lines-from-text-in-php
|
662 |
-
* @param string $multi_line_string a multiline string
|
663 |
-
* @return string the same string without empty lines
|
664 |
-
*/
|
665 |
-
function tribe_multi_line_remove_empty_lines( $multi_line_string ) {
|
666 |
-
return preg_replace( "/^\n+|^[\t\s]*\n+/m", '', $multi_line_string );
|
667 |
-
}
|
668 |
-
|
669 |
-
/**
|
670 |
-
* return the featured image html to an event (within the loop automatically will get event ID)
|
671 |
-
*
|
672 |
-
* @since 3.0
|
673 |
-
* @param int $post_id
|
674 |
-
* @param string $size
|
675 |
-
* @return string
|
676 |
-
*/
|
677 |
-
function tribe_event_featured_image( $post_id = null, $size = 'full' ) {
|
678 |
-
if ( is_null( $post_id ) )
|
679 |
-
$post_id = get_the_ID();
|
680 |
-
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size );
|
681 |
-
$featured_image = '';
|
682 |
-
if ( !empty( $image_src ) ) {
|
683 |
-
$featured_image .= '<div class="tribe-events-event-image"><a href="'. tribe_get_event_link() .'" title="'. get_the_title( $post_id ) .'"><img src="'. $image_src[0] .'" title="'. get_the_title( $post_id ) .'" /></a></div>';
|
684 |
-
}
|
685 |
-
return apply_filters( 'tribe_event_featured_image', $featured_image, $post_id, $size, $image_src );
|
686 |
-
}
|
687 |
-
|
688 |
-
/**
|
689 |
-
* show the recurring event info in a tooltip
|
690 |
-
*
|
691 |
-
* return the details of the start/end date/time
|
692 |
-
*
|
693 |
-
* @since 3.0
|
694 |
-
* @param int $post_id
|
695 |
-
* @return string
|
696 |
-
*/
|
697 |
-
function tribe_events_event_recurring_info_tooltip( $post_id = null ) {
|
698 |
-
if ( is_null( $post_id ) )
|
699 |
-
$post_id = get_the_ID();
|
700 |
-
$tooltip = '';
|
701 |
-
if ( class_exists( 'TribeEventsPro' ) ) { // should this be a template tag?
|
702 |
-
if ( tribe_is_recurring_event( $post_id ) ) {
|
703 |
-
$tooltip .= '<div class="recurringinfo">';
|
704 |
-
$tooltip .= '<div class="event-is-recurring">';
|
705 |
-
$tooltip .= '<span class="tribe-events-divider">|</span>';
|
706 |
-
$tooltip .= __( 'Recurring Event', 'tribe-events-calendar' );
|
707 |
-
$tooltip .= sprintf(' <a href="%s">%s</a>',
|
708 |
-
tribe_all_occurences_link( $post_id, false ),
|
709 |
-
__( '(See all)', 'tribe-events-calendar' )
|
710 |
-
);
|
711 |
-
$tooltip .= '<div id="tribe-events-tooltip-'. $post_id .'" class="tribe-events-tooltip recurring-info-tooltip">';
|
712 |
-
$tooltip .= '<div class="tribe-events-event-body">';
|
713 |
-
$tooltip .= tribe_get_recurrence_text( $post_id );
|
714 |
-
$tooltip .= '</div>';
|
715 |
-
$tooltip .= '<span class="tribe-events-arrow"></span>';
|
716 |
-
$tooltip .= '</div>';
|
717 |
-
$tooltip .= '</div>';
|
718 |
-
$tooltip .= '</div>';
|
719 |
-
}
|
720 |
-
}
|
721 |
-
return apply_filters( 'tribe_events_event_recurring_info_tooltip', $tooltip );
|
722 |
-
}
|
723 |
-
|
724 |
-
/**
|
725 |
-
* Return the details of the start/end date/time
|
726 |
-
*
|
727 |
-
* @since 3.0
|
728 |
-
* @param int|null $event
|
729 |
-
* @return string
|
730 |
-
*/
|
731 |
-
function tribe_events_event_schedule_details( $event = null ) {
|
732 |
-
if ( is_null( $event ) ) {
|
733 |
-
global $post;
|
734 |
-
$event = $post;
|
735 |
-
}
|
736 |
-
if ( is_numeric( $event ) )
|
737 |
-
$event = get_post( $event );
|
738 |
-
|
739 |
-
$format = '';
|
740 |
-
$timeFormat = get_option( 'time_format' );
|
741 |
-
$microformatStartFormat = tribe_get_start_date( $event, false, 'Y-m-dTh:i' );
|
742 |
-
$microformatEndFormat = tribe_get_end_date( $event, false, 'Y-m-dTh:i' );
|
743 |
-
|
744 |
-
// If the WordPress date setting matches DATEONLYFORMAT, make the string more readable
|
745 |
-
if ( get_option( 'date_format' ) == TribeDateUtils::DATEONLYFORMAT ) {
|
746 |
-
/* If the event happens this year, no need to show the year, unless it ends on another year (multi-day) */
|
747 |
-
if ( tribe_get_start_date( $event, false, 'Y' ) === date( 'Y' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) {
|
748 |
-
$format = 'F j';
|
749 |
-
}
|
750 |
-
}
|
751 |
-
|
752 |
-
$schedule = '';
|
753 |
-
|
754 |
-
if ( tribe_event_is_multiday( $event ) ) { // multi-date event
|
755 |
-
|
756 |
-
$format2ndday = $format;
|
757 |
-
|
758 |
-
// If the WordPress date setting matches DATEONLYFORMAT, make the string more readable
|
759 |
-
if ( get_option( 'date_format' ) == TribeDateUtils::DATEONLYFORMAT ) {
|
760 |
-
//If it's all day and the end date is in the same month and year, just show the day.
|
761 |
-
if ( tribe_event_is_all_day( $event ) && tribe_get_end_date( $event, false, 'm' ) === tribe_get_start_date( $event, false, 'm' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) {
|
762 |
-
$format2ndday = 'j';
|
763 |
-
}
|
764 |
-
}
|
765 |
-
|
766 |
-
if ( tribe_event_is_all_day( $event ) ) {
|
767 |
-
// If the multi-day event begins and ends in the same month, just show the month once.
|
768 |
-
if ( tribe_get_end_date( $event, false, 'm' ) === tribe_get_start_date( $event, false, 'm' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) {
|
769 |
-
$schedule .= '<span class="date-start dtstart">';
|
770 |
-
$schedule .= tribe_get_start_date( $event, true, $format );
|
771 |
-
$schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
|
772 |
-
$schedule .= '</span> - ';
|
773 |
-
$schedule .= '<span class="date-end dtend">';
|
774 |
-
$schedule .= tribe_get_end_date( $event, true, $format2ndday );
|
775 |
-
$schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
|
776 |
-
$schedule .= '</span>';
|
777 |
-
} else {
|
778 |
-
$schedule .= '<span class="date-start dtstart">';
|
779 |
-
$schedule .= tribe_get_start_date( $event, true, $format );
|
780 |
-
$schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
|
781 |
-
$schedule .= '</span> - ';
|
782 |
-
$schedule .= '<span class="date-end dtend">';
|
783 |
-
$schedule .= tribe_get_end_date( $event, true, $format2ndday );
|
784 |
-
$schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
|
785 |
-
$schedule .= '</span>';
|
786 |
-
}
|
787 |
-
} else {
|
788 |
-
$schedule .= '<span class="date-start dtstart">';
|
789 |
-
$schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
|
790 |
-
$schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
|
791 |
-
$schedule .= '</span> - ';
|
792 |
-
$schedule .= '<span class="date-end dtend">';
|
793 |
-
$schedule .= tribe_get_end_date( $event, false, $format2ndday ) . ' @ ' . tribe_get_end_date( $event, false, $timeFormat );
|
794 |
-
$schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
|
795 |
-
$schedule .= '</span>';
|
796 |
-
}
|
797 |
-
|
798 |
-
|
799 |
-
} elseif ( tribe_event_is_all_day( $event ) ) { // all day event
|
800 |
-
$schedule .= '<span class="date-start dtstart">';
|
801 |
-
$schedule .= tribe_get_start_date( $event, true, $format );
|
802 |
-
$schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
|
803 |
-
$schedule .= '</span>';
|
804 |
-
} else { // single day event
|
805 |
-
if ( tribe_get_start_date( $event, false, 'g:i A' ) === tribe_get_end_date( $event, false, 'g:i A' ) ) { // Same start/end time
|
806 |
-
$schedule .= '<span class="date-start dtstart">';
|
807 |
-
$schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
|
808 |
-
$schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
|
809 |
-
$schedule .= '</span>';
|
810 |
-
} else { // defined start/end time
|
811 |
-
$schedule .= '<span class="date-start dtstart">';
|
812 |
-
$schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
|
813 |
-
$schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
|
814 |
-
$schedule .= '</span> - ';
|
815 |
-
$schedule .= '<span class="end-time dtend">';
|
816 |
-
$schedule .= tribe_get_end_date( $event, false, $timeFormat ) . '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
|
817 |
-
$schedule .= '</span>';
|
818 |
-
}
|
819 |
-
}
|
820 |
-
|
821 |
-
return apply_filters( 'tribe_events_event_schedule_details', $schedule );
|
822 |
-
}
|
823 |
-
|
824 |
-
/**
|
825 |
-
* Accepts two dates and returns the number of days between them
|
826 |
-
*
|
827 |
-
* @param string $start_date
|
828 |
-
* @param string $end_date
|
829 |
-
* @return int
|
830 |
-
* @author Modern Tribe
|
831 |
-
* @see TribeEventsQuery::dateDiff()
|
832 |
-
**/
|
833 |
-
function tribe_get_days_between( $start_date, $end_date ) {
|
834 |
-
|
835 |
-
$start_date = new DateTime( $start_date );
|
836 |
-
$end_date = new DateTime( $end_date );
|
837 |
-
// This doesn't work on php 5.2
|
838 |
-
// $interval = $start_date->diff($end_date);
|
839 |
-
|
840 |
-
return TribeEventsQuery::dateDiff( $start_date->format( 'Y-m-d' ), $end_date->format( 'Y-m-d' ) );
|
841 |
-
}
|
842 |
-
|
843 |
-
/**
|
844 |
-
* Accepts an array of query arguments, retrieves them, and returns the html for those events in list view
|
845 |
-
*
|
846 |
-
* Optional inline example:
|
847 |
-
* < code >
|
848 |
-
* <?php
|
849 |
-
* echo myfunction();
|
850 |
-
* ?>
|
851 |
-
* </ code >
|
852 |
-
*
|
853 |
-
* @param array $args Args to be passed to TribeEventsQuery::getEvents()
|
854 |
-
* @param bool $initialize Whether the list view template class needs to be included and initialized
|
855 |
-
* @return string
|
856 |
-
* @author Modern Tribe
|
857 |
-
**/
|
858 |
-
function tribe_include_view_list( $args = null, $initialize = true ) {
|
859 |
-
global $wp_query;
|
860 |
-
|
861 |
-
// hijack the main query to load the events via provided $args
|
862 |
-
if ( !is_null( $args ) || ! ( $wp_query->tribe_is_event || $wp_query->tribe_is_event_category ) ) {
|
863 |
-
$reset_q = $wp_query;
|
864 |
-
$wp_query = TribeEventsQuery::getEvents( $args, true );
|
865 |
-
}
|
866 |
-
|
867 |
-
// single-event notices are jumping in on this init when loading as a module
|
868 |
-
TribeEvents::removeNotice( 'event-past' );
|
869 |
-
|
870 |
-
// get the list view template
|
871 |
-
ob_start();
|
872 |
-
if ( $initialize ) {
|
873 |
-
tribe_initialize_view('Tribe_Events_List_Template');
|
874 |
-
}
|
875 |
-
tribe_get_view('list/content');
|
876 |
-
$list_view_html = ob_get_clean();
|
877 |
-
|
878 |
-
// fix the error of our ways
|
879 |
-
if ( !empty( $reset_q ) ) {
|
880 |
-
$wp_query = $reset_q;
|
881 |
-
}
|
882 |
-
|
883 |
-
// return the parsed template
|
884 |
-
return $list_view_html;
|
885 |
-
}
|
886 |
-
|
887 |
-
/**
|
888 |
-
* Generates html for any notices that have been queued on the current view
|
889 |
-
*
|
890 |
-
* @param bool $echo Whether or not to echo the notices html
|
891 |
-
* @return void | string
|
892 |
-
* @author Modern Tribe
|
893 |
-
* @see TribeEvents::getNotices()
|
894 |
-
**/
|
895 |
-
function tribe_events_the_notices( $echo = true ) {
|
896 |
-
$notices = TribeEvents::getNotices();
|
897 |
-
|
898 |
-
$html = !empty( $notices ) ? '<div class="tribe-events-notices"><ul><li>' . implode( '</li><li>', $notices ) . '</li></ul></div>' : '';
|
899 |
-
$the_notices = apply_filters( 'tribe_events_the_notices', $html, $notices );
|
900 |
-
if ( $echo ) {
|
901 |
-
echo $the_notices;
|
902 |
-
} else {
|
903 |
-
return $the_notices;
|
904 |
-
}
|
905 |
-
}
|
906 |
-
|
907 |
-
/**
|
908 |
-
* Get a list of the views that are enabled
|
909 |
-
*
|
910 |
-
* @param array $views Default list of views
|
911 |
-
* @return array
|
912 |
-
* @author Modern Tribe
|
913 |
-
* @see tribeEnableViews option
|
914 |
-
**/
|
915 |
-
function tribe_events_enabled_views( $views ) {
|
916 |
-
$enabled_views_defaults = array();
|
917 |
-
foreach ( $views as $view ) {
|
918 |
-
$enabled_views_defaults[] = $view['displaying'];
|
919 |
-
}
|
920 |
-
return tribe_get_option( 'tribeEnableViews', $enabled_views_defaults );
|
921 |
-
}
|
922 |
-
|
923 |
-
/**
|
924 |
-
* Get a list of the views that are disabled
|
925 |
-
*
|
926 |
-
* @return array
|
927 |
-
* @author Modern Tribe
|
928 |
-
**/
|
929 |
-
function tribe_events_disabled_views() {
|
930 |
-
static $disabled;
|
931 |
-
if ( isset( $disabled ) ) {
|
932 |
-
return $disabled;
|
933 |
-
}
|
934 |
-
$views = apply_filters( 'tribe-events-bar-views', array(), false );
|
935 |
-
$enabled = tribe_events_enabled_views( $views );
|
936 |
-
$disabled = array();
|
937 |
-
foreach ( $views as $view ) {
|
938 |
-
if ( !in_array( $view['displaying'], $enabled ) ) {
|
939 |
-
if ( $view['displaying'] == 'upcoming' )
|
940 |
-
$disabled[] = 'past';
|
941 |
-
$disabled[] = $view['displaying'];
|
942 |
-
}
|
943 |
-
}
|
944 |
-
return $disabled;
|
945 |
-
}
|
946 |
-
|
947 |
-
/**
|
948 |
-
* tribe_is_bot checks if the visitor is a bot and returns status
|
949 |
-
*
|
950 |
-
* @return bool
|
951 |
-
*/
|
952 |
-
function tribe_is_bot() {
|
953 |
-
// get the current user agent
|
954 |
-
$user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
|
955 |
-
|
956 |
-
// check if the user agent is empty since most browsers identify themselves, so possibly a bot
|
957 |
-
if ( empty( $user_agent ) )
|
958 |
-
return apply_filters( 'tribe_is_bot_status', true, $user_agent, null );
|
959 |
-
|
960 |
-
// declare known bot user agents (lowercase)
|
961 |
-
$user_agent_bots = (array) apply_filters( 'tribe_is_bot_list', array( 'bot', 'slurp', 'spider', 'crawler', 'yandex' ) );
|
962 |
-
|
963 |
-
foreach( $user_agent_bots as $bot ){
|
964 |
-
if( stripos($user_agent, $bot) !== false )
|
965 |
-
return apply_filters( 'tribe_is_bot_status', true, $user_agent, $bot );
|
966 |
-
}
|
967 |
-
|
968 |
-
// we think this is probably a real human
|
969 |
-
return apply_filters( 'tribe_is_bot_status', false, $user_agent, null );
|
970 |
-
}
|
971 |
-
|
972 |
-
/**
|
973 |
-
* Display the Events Calendar promo banner
|
974 |
-
*
|
975 |
-
* @param bool $echo Whether or not to echo the banner, if false, it's returned
|
976 |
-
* @return void|string
|
977 |
-
**/
|
978 |
-
function tribe_events_promo_banner( $echo = true ){
|
979 |
-
if ( tribe_get_option( 'donate-link', false ) == true && !tribe_is_bot() ) {
|
980 |
-
$promo = apply_filters( 'tribe_events_promo_banner_message', sprintf( __( 'Calendar powered by %sThe Events Calendar%s', 'tribe-events-calendar' ), '<a class="vcard url org fn" href="' . TribeEvents::$tribeUrl . 'wordpress-events-calendar/?utm_medium=plugin-tec&utm_source=banner&utm_campaign=in-app">', '</a>' ) );
|
981 |
-
$html = apply_filters( 'tribe_events_promo_banner', sprintf( '<p class="tribe-events-promo">%s</p>', $promo ), $promo );
|
982 |
-
if( $echo ) {
|
983 |
-
echo $html;
|
984 |
-
} else {
|
985 |
-
return $html;
|
986 |
-
}
|
987 |
-
}
|
988 |
-
}
|
989 |
-
|
990 |
-
/**
|
991 |
-
* Return the filters registered in the tribe bar
|
992 |
-
*
|
993 |
-
* @return array
|
994 |
-
* @author Jessica Yazbek
|
995 |
-
* @since 3.0
|
996 |
-
**/
|
997 |
-
function tribe_events_get_filters() {
|
998 |
-
return apply_filters('tribe-events-bar-filters', array());
|
999 |
-
}
|
1000 |
-
|
1001 |
-
/**
|
1002 |
-
* Return the views registered in the tribe bar
|
1003 |
-
*
|
1004 |
-
* @return array
|
1005 |
-
* @author Jessica Yazbek
|
1006 |
-
* @since 3.0
|
1007 |
-
**/
|
1008 |
-
function tribe_events_get_views() {
|
1009 |
-
return apply_filters('tribe-events-bar-views', array());
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
/**
|
1013 |
-
* Count keys in a hierarchical array
|
1014 |
-
*
|
1015 |
-
* @param $value
|
1016 |
-
* @param $key
|
1017 |
-
*/
|
1018 |
-
function tribe_count_hierarchical_keys( $value, $key ) {
|
1019 |
-
global $tribe_count_hierarchical_increment;
|
1020 |
-
$tribe_count_hierarchical_increment++;
|
1021 |
-
}
|
1022 |
-
|
1023 |
-
/**
|
1024 |
-
* Count items in a hierarchical array
|
1025 |
-
*
|
1026 |
-
* @param array $walk
|
1027 |
-
* @return int
|
1028 |
-
*/
|
1029 |
-
function tribe_count_hierarchical( array $walk ) {
|
1030 |
-
global $tribe_count_hierarchical_increment;
|
1031 |
-
$tribe_count_hierarchical_increment = 0;
|
1032 |
-
array_walk_recursive( $walk, 'tribe_count_hierarchical_keys' );
|
1033 |
-
return $tribe_count_hierarchical_increment;
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== The Events Calendar ===
|
2 |
|
3 |
-
Contributors: ModernTribe, PaulHughes01, roblagatta, jonahcoyote, MZAWeb, codearachnid, ryancurban, faction23, jazbek, kyleunzicker, leahkoerper,
|
4 |
Tags: events, calendar, event, venue, organizer, dates, date, google maps, conference, workshop, concert, meeting, seminar, summit, class, modern tribe, tribe, widget
|
5 |
Donate link: http://m.tri.be/29
|
6 |
Requires at least: 3.5
|
7 |
Tested up to: 3.6
|
8 |
-
Stable tag: 3.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -259,6 +259,12 @@ Our Premium Plugins:
|
|
259 |
|
260 |
3.0 is a complete overhaul of the plugin, and as a result we're starting the changelog fresh. For release notes from the 2.x lifecycle, see <a href="http://m.tri.be/k">our 2.x release notes.</a>
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
= 3.0.2 =
|
263 |
|
264 |
* Fixed bug with queries that included more than one post type. This should resolve issues with "Link to Existing Content" in the WordPress editor, attaching media to posts from the Media Library, and relationship fields in the Advanced Custom Fields plugin (thanks to users KARKS88 and ANDYWILMOT for catching this!)
|
1 |
=== The Events Calendar ===
|
2 |
|
3 |
+
Contributors: ModernTribe, PaulHughes01, roblagatta, jonahcoyote, MZAWeb, codearachnid, ryancurban, faction23, jazbek, kyleunzicker, leahkoerper, WebsiteBakery, peterchester, reid.peifer, shane.pearlman
|
4 |
Tags: events, calendar, event, venue, organizer, dates, date, google maps, conference, workshop, concert, meeting, seminar, summit, class, modern tribe, tribe, widget
|
5 |
Donate link: http://m.tri.be/29
|
6 |
Requires at least: 3.5
|
7 |
Tested up to: 3.6
|
8 |
+
Stable tag: 3.0.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
259 |
|
260 |
3.0 is a complete overhaul of the plugin, and as a result we're starting the changelog fresh. For release notes from the 2.x lifecycle, see <a href="http://m.tri.be/k">our 2.x release notes.</a>
|
261 |
|
262 |
+
= 3.0.3 =
|
263 |
+
|
264 |
+
* Changed some SQL that could trigger a MySQL bug involving an infinite loop. See http://bugs.mysql.com/bug.php?id=21262
|
265 |
+
* Fixed some bugs with View As dropdown in Tribe Bar, including a bug in Firefox where you couldn't change the dropdown
|
266 |
+
* Removed select2 javascript dependency from front-end
|
267 |
+
|
268 |
= 3.0.2 =
|
269 |
|
270 |
* Fixed bug with queries that included more than one post type. This should resolve issues with "Link to Existing Content" in the WordPress editor, attaching media to posts from the Media Library, and relationship fields in the Advanced Custom Fields plugin (thanks to users KARKS88 and ANDYWILMOT for catching this!)
|
resources/tribe-events-bar.js
CHANGED
@@ -30,14 +30,11 @@ var tribe_events_bar_action;
|
|
30 |
if(!$().placeholder){
|
31 |
debug.warn('TEC Debug: vendor placeholder was not loaded before its dependant file tribe-events-bar.js');
|
32 |
}
|
33 |
-
if(!$().select2){
|
34 |
-
debug.warn('TEC Debug: vendor select2 was not loaded before its dependant file tribe-events-bar.js');
|
35 |
-
}
|
36 |
}
|
37 |
|
38 |
$(document).ready(function () {
|
39 |
var $tribebar = $('#tribe-bar-form'),
|
40 |
-
$tribedate = $('#tribe-bar-date')
|
41 |
$tribebarselect = $('select[name=tribe-bar-view]');
|
42 |
|
43 |
/**
|
@@ -103,7 +100,7 @@ var tribe_events_bar_action;
|
|
103 |
$('#tribe-events-bar').addClass('tribe-has-datepicker');
|
104 |
}
|
105 |
|
106 |
-
// Implement
|
107 |
function format(view) {
|
108 |
return '<span class="tribe-icon-' + $.trim(view.text.toLowerCase()) + '">' + view.text + '</span>';
|
109 |
}
|
@@ -117,24 +114,26 @@ var tribe_events_bar_action;
|
|
117 |
|
118 |
// Create list from select options
|
119 |
$tribebarselect.find('option').each(function(i){
|
120 |
-
view = this;
|
121 |
// build list items and append them
|
|
|
122 |
$('<li></li>', {
|
123 |
-
'class': 'tribe-bar-views-option',
|
124 |
'data-tribe-bar-order': i,
|
125 |
-
'data-view': $
|
126 |
}).html([
|
127 |
-
' <a href="#"
|
128 |
-
' <span class="tribe-icon-' + $.trim(view.text.toLowerCase()) + '">' + view.text + '</span>',
|
129 |
'</a>'].join("")
|
130 |
).appendTo( '.tribe-bar-views-list' );
|
131 |
|
132 |
});
|
133 |
|
134 |
//find the current view and select it in the bar
|
135 |
-
var
|
136 |
-
$
|
137 |
-
|
|
|
138 |
|
139 |
// toggle the views dropdown
|
140 |
$tribebar.on('click', '#tribe-bar-views', function (e) {
|
@@ -145,49 +144,20 @@ var tribe_events_bar_action;
|
|
145 |
|
146 |
// change views
|
147 |
$tribebar.on('click', '.tribe-bar-views-option', function(e) {
|
|
|
148 |
var $this = $(this);
|
149 |
if ( !$this.is('.tribe-bar-active') ) {
|
150 |
-
|
151 |
-
//when selecting a new view, move the current view back to it's original spot
|
152 |
-
$currentView = $('.tribe-bar-active');
|
153 |
-
currentViewOrder = $currentView.data('tribe-bar-order');
|
154 |
-
moveCurrentTo = currentViewOrder - 1;
|
155 |
|
156 |
-
$
|
157 |
-
$this.prependTo('ul.tribe-bar-views-list').addClass('tribe-bar-active');
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
$tribebarselect.change();
|
164 |
|
165 |
}
|
166 |
});
|
167 |
|
168 |
-
|
169 |
-
// trying to add a unique class to the select2 dropdown if the tribe bar is mini
|
170 |
-
|
171 |
-
var select2_opts = {}
|
172 |
-
|
173 |
-
if ($tribebar.is('.tribe-bar-mini')) {
|
174 |
-
select2_opts = {
|
175 |
-
placeholder: "Views",
|
176 |
-
dropdownCssClass: "tribe-select2-results-views tribe-bar-mini-select2-results",
|
177 |
-
minimumResultsForSearch: 9999,
|
178 |
-
formatResult: format,
|
179 |
-
formatSelection: format
|
180 |
-
}
|
181 |
-
} else {
|
182 |
-
select2_opts = {
|
183 |
-
placeholder: "Views",
|
184 |
-
dropdownCssClass: "tribe-select2-results-views",
|
185 |
-
minimumResultsForSearch: 9999,
|
186 |
-
formatResult: format,
|
187 |
-
formatSelection: format
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
$tribebar.on('click', '#tribe-bar-collapse-toggle', function () {
|
192 |
$(this).toggleClass('tribe-bar-filters-open');
|
193 |
$('.tribe-bar-filters').slideToggle('fast');
|
@@ -203,23 +173,6 @@ var tribe_events_bar_action;
|
|
203 |
// Add our date bits outside of our filter container
|
204 |
$('#tribe-bar-filters').before($('#tribe-bar-dates'));
|
205 |
|
206 |
-
|
207 |
-
// Implement our views bit
|
208 |
-
$tribebarselect.change(function () {
|
209 |
-
ts.cur_url = $(this).val();
|
210 |
-
ts.view_target = $('select[name=tribe-bar-view] option[value="' + ts.cur_url + '"]').data('view');
|
211 |
-
tribe_events_bar_action = 'change_view';
|
212 |
-
tribe_events_bar_change_view();
|
213 |
-
});
|
214 |
-
|
215 |
-
$('a.tribe-bar-view').on('click', function (e) {
|
216 |
-
e.preventDefault();
|
217 |
-
var el = $(this);
|
218 |
-
var name = el.data('view');
|
219 |
-
tribe_events_bar_change_view(el.attr('href'), name);
|
220 |
-
|
221 |
-
});
|
222 |
-
|
223 |
$(te).on("tribe_ev_serializeBar", function () {
|
224 |
$('form#tribe-bar-form input, #tribeHideRecurrence').each(function () {
|
225 |
var $this = $(this);
|
30 |
if(!$().placeholder){
|
31 |
debug.warn('TEC Debug: vendor placeholder was not loaded before its dependant file tribe-events-bar.js');
|
32 |
}
|
|
|
|
|
|
|
33 |
}
|
34 |
|
35 |
$(document).ready(function () {
|
36 |
var $tribebar = $('#tribe-bar-form'),
|
37 |
+
$tribedate = $('#tribe-bar-date'),
|
38 |
$tribebarselect = $('select[name=tribe-bar-view]');
|
39 |
|
40 |
/**
|
100 |
$('#tribe-events-bar').addClass('tribe-has-datepicker');
|
101 |
}
|
102 |
|
103 |
+
// Implement views links
|
104 |
function format(view) {
|
105 |
return '<span class="tribe-icon-' + $.trim(view.text.toLowerCase()) + '">' + view.text + '</span>';
|
106 |
}
|
114 |
|
115 |
// Create list from select options
|
116 |
$tribebarselect.find('option').each(function(i){
|
117 |
+
var $view = $(this);
|
118 |
// build list items and append them
|
119 |
+
var unique_c = 'tribe-bar-views-option-' + $view.data('view');
|
120 |
$('<li></li>', {
|
121 |
+
'class': 'tribe-bar-views-option ' + unique_c,
|
122 |
'data-tribe-bar-order': i,
|
123 |
+
'data-view': $view.data('view')
|
124 |
}).html([
|
125 |
+
' <a href="#">',
|
126 |
+
' <span class="tribe-icon-' + $.trim($view.text().toLowerCase()) + '">' + $view.text() + '</span>',
|
127 |
'</a>'].join("")
|
128 |
).appendTo( '.tribe-bar-views-list' );
|
129 |
|
130 |
});
|
131 |
|
132 |
//find the current view and select it in the bar
|
133 |
+
var currentview = $tribebarselect.find(':selected').data('view'),
|
134 |
+
$currentli = $tribebarviews.find('li[data-view='+ currentview +']');
|
135 |
+
|
136 |
+
$currentli.prependTo($tribebarviews).addClass('tribe-bar-active');
|
137 |
|
138 |
// toggle the views dropdown
|
139 |
$tribebar.on('click', '#tribe-bar-views', function (e) {
|
144 |
|
145 |
// change views
|
146 |
$tribebar.on('click', '.tribe-bar-views-option', function(e) {
|
147 |
+
e.preventDefault();
|
148 |
var $this = $(this);
|
149 |
if ( !$this.is('.tribe-bar-active') ) {
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
+
var target = $this.data('view');
|
|
|
152 |
|
153 |
+
ts.cur_url = $('option[data-view='+ target +']').val();
|
154 |
+
ts.view_target = $('select[name=tribe-bar-view] option[value="' + ts.cur_url + '"]').data('view');
|
155 |
+
tribe_events_bar_action = 'change_view';
|
156 |
+
tribe_events_bar_change_view();
|
|
|
157 |
|
158 |
}
|
159 |
});
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
$tribebar.on('click', '#tribe-bar-collapse-toggle', function () {
|
162 |
$(this).toggleClass('tribe-bar-filters-open');
|
163 |
$('.tribe-bar-filters').slideToggle('fast');
|
173 |
// Add our date bits outside of our filter container
|
174 |
$('#tribe-bar-filters').before($('#tribe-bar-dates'));
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
$(te).on("tribe_ev_serializeBar", function () {
|
177 |
$('form#tribe-bar-form input, #tribeHideRecurrence').each(function () {
|
178 |
var $this = $(this);
|
resources/tribe-events-bar.min.js
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
var tribe_events_bar_action;
|
2 |
-
(function(s,
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
a(
|
10 |
-
|
11 |
-
b.val()),("month"===c.view||"day"===c.view||"week"===c.view||c.recurrence)&&c.pushcount++):(c.params[b.attr("name")]=b.val(),"map"!==c.view&&(c.url_params[b.attr("name")]=b.val()),"month"!==c.view&&"day"!==c.view&&"week"!==c.view||c.pushcount++))})});var k=a('#tribe-events-bar [class^="tribe-bar-button-"]'),r=k.next(".tribe-bar-drop-content");k.click(function(){var b=a(this);b.toggleClass("open");b.next(".tribe-bar-drop-content").toggle();return!1});a(m).click(function(){k.hasClass("open")&&(k.removeClass("open"),
|
12 |
-
r.hide())});r.click(function(a){a.stopPropagation()});l&&debug.info("TEC Debug: tribe-events-bar.js successfully loaded")})})(window,document,jQuery,tribe_ev.data,tribe_ev.events,tribe_ev.fn,tribe_ev.state,tribe_ev.tests,tribe_debug);
|
1 |
var tribe_events_bar_action;
|
2 |
+
(function(s,n,b,g,h,t,c,k,m){m&&(b().bootstrapDatepicker||debug.warn("TEC Debug: vendor bootstrapDatepicker was not loaded before its dependant file tribe-events-bar.js"),b().placeholder||debug.warn("TEC Debug: vendor placeholder was not loaded before its dependant file tribe-events-bar.js"));b(n).ready(function(){function p(a){if(!a.parents(".tribe-bar-disabled").length){var b=a.width();800<b?a.removeClass("tribe-bar-mini tribe-bar-collapse").addClass("tribe-bar-full"):a.removeClass("tribe-bar-full").addClass("tribe-bar-mini");
|
3 |
+
670>b?a.removeClass("tribe-bar-mini").addClass("tribe-bar-collapse"):a.removeClass("tribe-bar-collapse")}}function u(){tribe_events_bar_action="change_view";if("month"===c.view&&d.length){var a=d.val();7===a.length&&d.val(a+t.get_day())}c.url_params={};b(h).trigger("tribe_ev_preCollectBarParams");b("#tribe-bar-form input").each(function(){var a=b(this);a.val().length&&!a.hasClass("tribe-no-param")&&(a.is(":checkbox")?a.is(":checked")&&(c.url_params[a.attr("name")]=a.val()):c.url_params[a.attr("name")]=
|
4 |
+
a.val())});c.url_params=b.param(c.url_params);b(h).trigger("tribe_ev_postCollectBarParams");c.url_params.length&&(c.cur_url+=k.starting_delim()+c.url_params);s.location.href=c.cur_url}var e=b("#tribe-bar-form"),d=b("#tribe-bar-date"),f=b("select[name=tribe-bar-view]");p(e);e.resize(function(){p(e)});if(!b(".tribe-events-week-grid").length&&(!b(".events-gridview").length||k.map_view())){m&&debug.info('TEC Debug: bootstrapDatepicker was just initialized in "tribe-events-bar.js" on:',d);var v=d.bootstrapDatepicker({format:"yyyy-mm-dd",
|
5 |
+
showAnim:"fadeIn"}).on("changeDate",function(){v.hide()}).data("datepicker")}d.blur(function(){""===d.val()&&(b(".datepicker.dropdown-menu").is(":hidden")&&k.live_ajax()&&k.pushstate)&&(c.date=g.cur_date,g.cur_url=g.base_url,b(h).trigger("tribe_ev_runAjax"))});b(".tribe-bar-settings").length&&b("#tribe-events-bar").addClass("tribe-has-settings");b("#tribe-events-bar .hasDatepicker").length&&b("#tribe-events-bar").addClass("tribe-has-datepicker");b('input[name*="tribe-bar-"]').placeholder();b('<ul class="tribe-bar-views-list" />').insertAfter(f);
|
6 |
+
var q=b(".tribe-bar-views-list");f.find("option").each(function(a){var c=b(this),d="tribe-bar-views-option-"+c.data("view");b("<li></li>",{"class":"tribe-bar-views-option "+d,"data-tribe-bar-order":a,"data-view":c.data("view")}).html([' <a href="#">',' <span class="tribe-icon-'+b.trim(c.text().toLowerCase())+'">'+c.text()+"</span>","</a>"].join("")).appendTo(".tribe-bar-views-list")});f=f.find(":selected").data("view");q.find("li[data-view="+f+"]").prependTo(q).addClass("tribe-bar-active");e.on("click",
|
7 |
+
"#tribe-bar-views",function(a){a.stopPropagation();b(this).toggleClass("tribe-bar-views-open")});e.on("click",".tribe-bar-views-option",function(a){a.preventDefault();a=b(this);a.is(".tribe-bar-active")||(a=a.data("view"),c.cur_url=b("option[data-view="+a+"]").val(),c.view_target=b('select[name=tribe-bar-view] option[value="'+c.cur_url+'"]').data("view"),tribe_events_bar_action="change_view",u())});e.on("click","#tribe-bar-collapse-toggle",function(){b(this).toggleClass("tribe-bar-filters-open");
|
8 |
+
b(".tribe-bar-filters").slideToggle("fast")});b("body").on("click",function(){b("#tribe-bar-views").removeClass("tribe-bar-views-closed")});b('label[for="tribe-bar-date"], input[name="tribe-bar-date"]').wrapAll('<div id="tribe-bar-dates" />');b("#tribe-bar-filters").before(b("#tribe-bar-dates"));b(h).on("tribe_ev_serializeBar",function(){b("form#tribe-bar-form input, #tribeHideRecurrence").each(function(){var a=b(this);a.is("#tribe-bar-date")&&(a.val().length?(c.params[a.attr("name")]=a.val(),c.url_params[a.attr("name")]=
|
9 |
+
a.val()):c.date=g.cur_date);a.val().length&&(!a.hasClass("tribe-no-param")&&!a.is("#tribe-bar-date"))&&(a.is(":checkbox")?a.is(":checked")&&(c.params[a.attr("name")]=a.val(),"map"!==c.view&&(c.url_params[a.attr("name")]=a.val()),("month"===c.view||"day"===c.view||"week"===c.view||c.recurrence)&&c.pushcount++):(c.params[a.attr("name")]=a.val(),"map"!==c.view&&(c.url_params[a.attr("name")]=a.val()),("month"===c.view||"day"===c.view||"week"===c.view)&&c.pushcount++))})});var l=b('#tribe-events-bar [class^="tribe-bar-button-"]'),
|
10 |
+
r=l.next(".tribe-bar-drop-content");l.click(function(){var a=b(this);a.toggleClass("open");a.next(".tribe-bar-drop-content").toggle();return!1});b(n).click(function(){l.hasClass("open")&&(l.removeClass("open"),r.hide())});r.click(function(a){a.stopPropagation()});m&&debug.info("TEC Debug: tribe-events-bar.js successfully loaded")})})(window,document,jQuery,tribe_ev.data,tribe_ev.events,tribe_ev.fn,tribe_ev.state,tribe_ev.tests,tribe_debug);
|
|
|
|
resources/tribe-events.min.js
CHANGED
@@ -1,20 +1,17 @@
|
|
1 |
-
var tribe_ev=window.tribe_ev||{},tribe_debug=!
|
2 |
-
|
3 |
-
f(m);d&&(0<e?e>a:l.length+e<=a)&&(d.firebug?d[c].apply(h,g):d[c]?d[c](g):d.log(g))}})(g,l[g]);k.setLevel=function(a){e="number"===typeof a?a:9};k.setCallback=function(){var e=b.call(arguments),d=n.length,g=d;a=e.shift()||null;c="boolean"===typeof e[0]?e.shift():!1;for(g-="number"===typeof e[0]?e.shift():d;g<d;)f(n[g++])};return k}();Object.prototype.hasOwnProperty.call(window,"tribe_ev")&&(tribe_ev.diagnostics={init:[]});var tribe_storage,t_fail,t_uid;
|
4 |
-
try{t_uid=new Date,(tribe_storage=window.localStorage).setItem(t_uid,t_uid),t_fail=tribe_storage.getItem(t_uid)!=t_uid,tribe_storage.removeItem(t_uid),t_fail&&(tribe_storage=!1)}catch(e$$12){}
|
5 |
-
(function(f,h){f.fn.tribe_clear_form=function(){return this.each(function(){var b=this.type,d=this.tagName.toLowerCase();if("form"==d)return f(":input",this).tribe_clear_form();"text"==b||"password"==b||"textarea"==d?this.value="":"checkbox"==b||"radio"==b?this.checked=!1:"select"==d&&(this.selectedIndex=0)})};f.fn.tribe_has_attr=function(b){return this.attr(b)!==h};f.fn.tribe_spin=function(){f(".tribe-events-ajax-loading:first").clone().addClass("tribe-events-active-spinner").prependTo("#tribe-events-content");
|
6 |
f(this).addClass("tribe-events-loading").css("opacity",0.25)}})(jQuery);
|
7 |
-
(function(f,
|
8 |
-
c){b(a).find(c).prop("disabled",!1);b(a).find(".select2-container").length&&b(a).find(".select2-container").each(function(){var a=b(this).attr("id");b("#"+a).select2("enable")})},get_base_url:function(){var a="",c=b("#tribe-events-header");c.length&&(a=c.data("baseurl"));return a},get_category:function(){return tribe_ev.fn.is_category()?b("#tribe-events").data("category"):""},get_day:function(){var a="";b("#tribe-bar-date").length&&(a=b("#tribe-bar-date-day").val());
|
9 |
a+'".');return a},get_params:function(){return location.search.substr(1)},get_url_param:function(a){return decodeURIComponent((RegExp("[?|&]"+a+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null},in_params:function(a,b){return a.toLowerCase().indexOf(b)},is_category:function(){var a=b("#tribe-events");return a.length&&a.tribe_has_attr("data-category")&&""!==a.data("category")?!0:!1},parse_string:function(a){var b={};a.replace(/([^&=]+)=?([^&]*)(?:&+|$)/g,function(a,
|
10 |
-
|
11 |
a=tribe_ev.fn.parse_string(a);b.each(a,function(a,c){if("action"!==a){var d=decodeURI(a),e="";if(1===c.length)b('[name="'+d+'"]').is('input[type="text"], input[type="hidden"]')?b('[name="'+d+'"]').val(c):b('[name="'+d+'"][value="'+c+'"]').is(":checkbox, :radio")?b('[name="'+d+'"][value="'+c+'"]').prop("checked",!0):b('[name="'+d+'"]').is("select")&&b('select[name="'+d+'"] option[value="'+c+'"]').attr("selected",!0);else for(var f=0;f<c.length;f++)e=b('[name="'+d+'"][value="'+c[f]+'"]'),e.is(":checkbox, :radio")?
|
12 |
-
e.prop("checked",!0):b('select[name="'+d+'"] option[value="'+c[f]+'"]').attr("selected",!0)}});c.removeClass("tribe-reset-on");
|
13 |
b("html, body").animate({scrollTop:b(a).offset().top-120},{duration:0})})},tooltips:function(){b("#tribe-events").on("mouseenter",'div[id*="tribe-events-event-"], div[id*="tribe-events-daynum-"]:has(a), div.event-is-recurring',function(){var a=0,c=b(this),d=b("body");d.hasClass("events-gridview")?a=c.find("a").outerHeight()+18:d.is(".single-tribe_events, .events-list, .tribe-events-day")?a=c.outerHeight()+12:d.is(".tribe-events-photo")&&(a=c.outerHeight()+10);c.parents(".tribe-events-calendar-widget").length&&
|
14 |
-
(a=c.outerHeight()-6);d.hasClass("tribe-events-week")||c.find(".tribe-events-tooltip").css("bottom",a).show()}).on("mouseleave",'div[id*="tribe-events-event-"], div[id*="tribe-events-daynum-"]:has(a), div.event-is-recurring',function(){b(this).find(".tribe-events-tooltip").stop(!0,!1).fadeOut(200)})},update_picker:function(a){var c=b("#tribe-bar-date");b().bootstrapDatepicker&&c.length?(c.bootstrapDatepicker("setValue",a),
|
15 |
-
c.length?(c.val(a),
|
16 |
-
starting_delim:function(){return-1!=tribe_ev.state.cur_url.indexOf("?")?"&":"?"}};tribe_ev.data={ajax_response:{},base_url:"",cur_url:tribe_ev.fn.url_path(
|
17 |
view:"",view_target:""}})(window,document,jQuery,tribe_debug);
|
18 |
-
(function(f,
|
19 |
-
a.tooltips();b(".tribe-events-list .tribe-events-notices").length&&b("#tribe-events-header .tribe-events-sub-nav").empty();b(".tribe-events-list").length&&b(".tribe-events-list-separator-month").prev(".vevent").addClass("tribe-event-end-month");b(
|
20 |
-
|
1 |
+
var tribe_ev=window.tribe_ev||{},tribe_debug=!1,tribe_storage,t_fail,t_uid;try{t_uid=new Date,(tribe_storage=window.localStorage).setItem(t_uid,t_uid),t_fail=tribe_storage.getItem(t_uid)!=t_uid,tribe_storage.removeItem(t_uid),t_fail&&(tribe_storage=!1)}catch(e$$12){}
|
2 |
+
(function(f,g){f.fn.tribe_clear_form=function(){return this.each(function(){var b=this.type,e=this.tagName.toLowerCase();if("form"==e)return f(":input",this).tribe_clear_form();"text"==b||"password"==b||"textarea"==e?this.value="":"checkbox"==b||"radio"==b?this.checked=!1:"select"==e&&(this.selectedIndex=0)})};f.fn.tribe_has_attr=function(b){return this.attr(b)!==g};f.fn.tribe_spin=function(){f(".tribe-events-ajax-loading:first").clone().addClass("tribe-events-active-spinner").prependTo("#tribe-events-content");
|
|
|
|
|
|
|
3 |
f(this).addClass("tribe-events-loading").css("opacity",0.25)}})(jQuery);
|
4 |
+
(function(f,g,b,e,l){tribe_ev.fn={current_date:function(){var a=new Date,b=a.getDate(),d=a.getMonth()+1,a=a.getFullYear();10>b&&(b="0"+b);10>d&&(d="0"+d);return a+"-"+d+"-"+b},disable_inputs:function(a,c){b(a).find(c).prop("disabled",!0);b(a).find(".select2-container").length&&b(a).find(".select2-container").each(function(){var a=b(this).attr("id");b("#"+a).select2("disable")})},disable_empty:function(a,c){b(a).find(c).each(function(){""===b(this).val()&&b(this).prop("disabled",!0)})},enable_inputs:function(a,
|
5 |
+
c){b(a).find(c).prop("disabled",!1);b(a).find(".select2-container").length&&b(a).find(".select2-container").each(function(){var a=b(this).attr("id");b("#"+a).select2("enable")})},get_base_url:function(){var a="",c=b("#tribe-events-header");c.length&&(a=c.data("baseurl"));return a},get_category:function(){return tribe_ev.fn.is_category()?b("#tribe-events").data("category"):""},get_day:function(){var a="";b("#tribe-bar-date").length&&(a=b("#tribe-bar-date-day").val());e&&debug.info('TEC Debug: tribe_ev.fn.get_day returned this date: "'+
|
6 |
a+'".');return a},get_params:function(){return location.search.substr(1)},get_url_param:function(a){return decodeURIComponent((RegExp("[?|&]"+a+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null},in_params:function(a,b){return a.toLowerCase().indexOf(b)},is_category:function(){var a=b("#tribe-events");return a.length&&a.tribe_has_attr("data-category")&&""!==a.data("category")?!0:!1},parse_string:function(a){var b={};a.replace(/([^&=]+)=?([^&]*)(?:&+|$)/g,function(a,
|
7 |
+
e,m){(b[e]=b[e]||[]).push(m)});e&&debug.info("TEC Debug: tribe_ev.fn.parse_string returned this map:",b);return b},pre_ajax:function(a){a&&"function"===typeof a&&a()},serialize:function(a,c){tribe_ev.fn.enable_inputs(a,c);tribe_ev.fn.disable_empty(a,c);var d=b(a).serialize();tribe_ev.fn.disable_inputs(a,c);e&&d&&debug.info('TEC Debug: tribe_ev.fn.serialize returned these params: "'+d);return d},set_form:function(a){var c=b("body"),d=b("#tribe-bar-form");c.addClass("tribe-reset-on");d.length&&d.tribe_clear_form();
|
8 |
a=tribe_ev.fn.parse_string(a);b.each(a,function(a,c){if("action"!==a){var d=decodeURI(a),e="";if(1===c.length)b('[name="'+d+'"]').is('input[type="text"], input[type="hidden"]')?b('[name="'+d+'"]').val(c):b('[name="'+d+'"][value="'+c+'"]').is(":checkbox, :radio")?b('[name="'+d+'"][value="'+c+'"]').prop("checked",!0):b('[name="'+d+'"]').is("select")&&b('select[name="'+d+'"] option[value="'+c+'"]').attr("selected",!0);else for(var f=0;f<c.length;f++)e=b('[name="'+d+'"][value="'+c[f]+'"]'),e.is(":checkbox, :radio")?
|
9 |
+
e.prop("checked",!0):b('select[name="'+d+'"] option[value="'+c[f]+'"]').attr("selected",!0)}});c.removeClass("tribe-reset-on");e&&debug.info('TEC Debug: tribe_ev.fn.set_form fired these params: "'+a)},setup_ajax_timer:function(a){clearTimeout(tribe_ev.state.ajax_timer);tribe_ev.tests.reset_on()||(tribe_ev.state.ajax_timer=setTimeout(function(){a()},500),e&&debug.info('TEC Debug: tribe_ev.fn.setup_ajax_timer fired with a timeout of "500" ms'))},snap:function(a,c,d){b(c).on("click",d,function(c){c.preventDefault();
|
10 |
b("html, body").animate({scrollTop:b(a).offset().top-120},{duration:0})})},tooltips:function(){b("#tribe-events").on("mouseenter",'div[id*="tribe-events-event-"], div[id*="tribe-events-daynum-"]:has(a), div.event-is-recurring',function(){var a=0,c=b(this),d=b("body");d.hasClass("events-gridview")?a=c.find("a").outerHeight()+18:d.is(".single-tribe_events, .events-list, .tribe-events-day")?a=c.outerHeight()+12:d.is(".tribe-events-photo")&&(a=c.outerHeight()+10);c.parents(".tribe-events-calendar-widget").length&&
|
11 |
+
(a=c.outerHeight()-6);d.hasClass("tribe-events-week")||c.find(".tribe-events-tooltip").css("bottom",a).show()}).on("mouseleave",'div[id*="tribe-events-event-"], div[id*="tribe-events-daynum-"]:has(a), div.event-is-recurring',function(){b(this).find(".tribe-events-tooltip").stop(!0,!1).fadeOut(200)})},update_picker:function(a){var c=b("#tribe-bar-date");b().bootstrapDatepicker&&c.length?(c.bootstrapDatepicker("setValue",a),e&&debug.info('TEC Debug: tribe_ev.fn.update_picker sent "'+a+'" to the boostrapDatepicker')):
|
12 |
+
c.length?(c.val(a),e&&debug.warn('TEC Debug: tribe_ev.fn.update_picker sent "'+a+'" to '+c)):e&&debug.warn('TEC Debug: tribe_ev.fn.update_picker couldnt send "'+a+'" to any object.')},url_path:function(a){return a.split("?")[0]}};tribe_ev.tests={live_ajax:function(){var a=b("#tribe-events");return a.length&&a.tribe_has_attr("data-live_ajax")&&"1"==a.data("live_ajax")?!0:!1},map_view:function(){return"undefined"!==typeof GeoLoc&&GeoLoc.map_view?!0:!1},pushstate:!(!f.history||!history.pushState),reset_on:function(){return b("body").is(".tribe-reset-on")},
|
13 |
+
starting_delim:function(){return-1!=tribe_ev.state.cur_url.indexOf("?")?"&":"?"}};tribe_ev.data={ajax_response:{},base_url:"",cur_url:tribe_ev.fn.url_path(g.URL),cur_date:tribe_ev.fn.current_date(),initial_url:tribe_ev.fn.url_path(g.URL),params:tribe_ev.fn.get_params()};tribe_ev.events={};tribe_ev.state={ajax_running:!1,ajax_timer:0,category:"",date:"",do_string:!1,filters:!1,filter_cats:!1,initial_load:!0,paged:1,page_title:"",params:{},popping:!1,pushstate:!0,pushcount:0,recurrence:!1,url_params:{},
|
14 |
view:"",view_target:""}})(window,document,jQuery,tribe_debug);
|
15 |
+
(function(f,g,b,e,l,a,c,d,h){b(g).ready(function(){h&&debug.info("TEC Debug: Tribe Events JS init, Init Timer started from tribe-events.js.");var f=b("#tribe-events"),k=b("#tribe-events-header");f.removeClass("tribe-no-js");c.category=a.get_category();e.base_url=a.get_base_url();c.page_title=g.title;(f=a.get_url_param("tribe_event_display"))?c.view=f:k.length&&k.tribe_has_attr("data-view")&&(c.view=k.data("view"));c.view&&h&&debug.time("Tribe JS Init Timer");b(".tribe-events-calendar-widget").not(":eq(0)").hide();
|
16 |
+
a.tooltips();b(".tribe-events-list .tribe-events-notices").length&&b("#tribe-events-header .tribe-events-sub-nav").empty();b(".tribe-events-list").length&&b(".tribe-events-list-separator-month").prev(".vevent").addClass("tribe-event-end-month");b(l).on("tribe_ev_ajaxSuccess",function(){b(".tribe-events-active-spinner").remove()});h&&(debug.groupCollapsed("TEC Debug: Browser and events settings information:"),debug.log('User agent reported as: "'+navigator.userAgent),debug.log('Live ajax returned its state as: "'+
|
17 |
+
d.live_ajax()),c.view&&debug.log('Tribe js detected the view to be: "'+c.view),debug.log('Supports pushstate: "'+d.pushstate),debug.groupEnd(),debug.info("TEC Debug: tribe-events.js successfully loaded"))})})(window,document,jQuery,tribe_ev.data,tribe_ev.events,tribe_ev.fn,tribe_ev.state,tribe_ev.tests,tribe_debug);
|
the-events-calendar.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: The Events Calendar
|
4 |
Description: The Events Calendar is a carefully crafted, extensible plugin that lets you easily share your events. Beautiful. Solid. Awesome.
|
5 |
-
Version: 3.0.
|
6 |
Author: Modern Tribe, Inc.
|
7 |
Author URI: http://m.tri.be/1x
|
8 |
Text Domain: tribe-events-calendar
|
2 |
/*
|
3 |
Plugin Name: The Events Calendar
|
4 |
Description: The Events Calendar is a carefully crafted, extensible plugin that lets you easily share your events. Beautiful. Solid. Awesome.
|
5 |
+
Version: 3.0.3
|
6 |
Author: Modern Tribe, Inc.
|
7 |
Author URI: http://m.tri.be/1x
|
8 |
Text Domain: tribe-events-calendar
|