The Events Calendar - Version 3.0.1

Version Description

  • Added setting for number of events per day on month view (under Events > Settings > Display)
  • Fixed an issue with the venue migration tool (thanks to ADAM for the heads up!)
  • Fixed bug with events not showing up on past view & related duration issues (thanks to MY-WEB and GOLFDAWGG for the heads up!)
  • Fixed bug where subscribers could add events
  • Fixed bug when WordPress is installed in a subdirectory (thanks to DAVID for catching this!)
  • Fixed display issues with Events Calendar sidebar (thanks to JNORRIS235 for catching this!)
  • Miscellaneous widget enhancements
  • Miscellaneous bug fixes
  • Various security fixes (thanks to HARRY METCALFE for his helpful feedback)
Download this release

Release Info

Developer jazbek
Plugin Icon The Events Calendar
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

Files changed (55) hide show
  1. admin-views/no-comments.php +0 -0
  2. admin-views/tickets/meta-box.php +1 -1
  3. admin-views/tribe-options-display.php +10 -1
  4. lib/template-classes/month.php +2 -1
  5. lib/the-events-calendar.class.php +56 -42
  6. lib/tickets/tribe-tickets-attendees.php +10 -4
  7. lib/tickets/tribe-tickets.php +7 -1
  8. lib/tribe-app-shop.class.php +9 -7
  9. lib/tribe-event-api.class.php +2 -0
  10. lib/tribe-event-exception.class.php +0 -0
  11. lib/tribe-event-query.class.php +54 -28
  12. lib/tribe-template-factory.class.php +3 -3
  13. lib/tribe-templates.class.php +0 -7
  14. license.txt +0 -0
  15. public/advanced-functions/event.php +0 -0
  16. public/advanced-functions/organizer.php +0 -0
  17. public/advanced-functions/venue.php +0 -0
  18. public/template-tags/general.php +20 -26
  19. public/template-tags/meta.php +6 -3
  20. public/template-tags/options.php +0 -0
  21. readme.txt +33 -13
  22. resources/app-shop.js +0 -0
  23. resources/debugger.css +0 -0
  24. resources/events-admin.js +1 -1
  25. resources/events-admin.min.js +6 -6
  26. resources/jquery-ecp-plugins.js +0 -0
  27. resources/tickets.js +266 -258
  28. resources/tickets.min.js +12 -10
  29. resources/tribe-settings.js +0 -0
  30. resources/warning.png +0 -0
  31. screenshot-10.png +0 -0
  32. screenshot-11.png +0 -0
  33. screenshot-12.png +0 -0
  34. screenshot-13.png +0 -0
  35. screenshot-14.png +0 -0
  36. screenshot-6.png +0 -0
  37. screenshot-7.png +0 -0
  38. screenshot-8.png +0 -0
  39. screenshot-9.png +0 -0
  40. tests/PHPUnit/bootstrap.php +8 -0
  41. tests/PHPUnit/phpunit-test.Test.php +23 -0
  42. tests/PHPUnit/phpunit.xml +19 -0
  43. tests/PHPUnit/tribe-capabilities.Test.php +299 -0
  44. tests/PHPUnit/tribe-event-creation.Test.php +118 -0
  45. tests/PHPUnit/tribe-events-class.Test.php +23 -0
  46. tests/PHPUnit/tribe-previous-ecp-versions.Test.php +39 -0
  47. tests/PHPUnit/wordpress-tests/bin/install.php +49 -0
  48. tests/PHPUnit/wordpress-tests/init.php +32 -0
  49. tests/PHPUnit/wordpress-tests/lib/exceptions.php +5 -0
  50. tests/PHPUnit/wordpress-tests/lib/testcase.php +127 -0
  51. tests/PHPUnit/wordpress-tests/lib/tribe-testcase.php +29 -0
  52. tests/PHPUnit/wordpress-tests/phpunit.xml +1 -0
  53. tests/PHPUnit/wordpress-tests/unittests-config-sample.php +46 -0
  54. the-events-calendar.php +1 -1
  55. views/modules/bar.php +1 -1
admin-views/no-comments.php CHANGED
File without changes
admin-views/tickets/meta-box.php CHANGED
@@ -33,7 +33,7 @@ $modules = TribeEventsTickets::modules();
33
  <p class="description"><?php _e( 'The maximum image size in the email will be 580px wide by any height, and then scaled for mobile. If you would like "retina" support use an image sized to 1160px wide.', 'tribe-events-calendar' ); ?></p>
34
  </td>
35
  <td>
36
- <input type="button" class="button" name="tribe_ticket_header_image" id="tribe_ticket_header_image" value="<?php _e( 'Select an Image', 'tribe-events-calendar' ); ?>" onclick="ticketHeaderImage.uploader( '', '' ); return false;" />
37
  </td>
38
  </tr>
39
  <tr>
33
  <p class="description"><?php _e( 'The maximum image size in the email will be 580px wide by any height, and then scaled for mobile. If you would like "retina" support use an image sized to 1160px wide.', 'tribe-events-calendar' ); ?></p>
34
  </td>
35
  <td>
36
+ <input type="button" class="button" name="tribe_ticket_header_image" id="tribe_ticket_header_image" value="<?php _e( 'Select an Image', 'tribe-events-calendar' ); ?>" />
37
  </td>
38
  </tr>
39
  <tr>
admin-views/tribe-options-display.php CHANGED
@@ -19,7 +19,7 @@ foreach( $views as $view ) {
19
 
20
  $displayTab = array(
21
  'priority' => 20,
22
- 'fields' => array(
23
  'info-start' => array(
24
  'type' => 'html',
25
  'html' => '<div id="modern-tribe-info">'
@@ -100,6 +100,14 @@ $displayTab = array(
100
  'default' => false,
101
  'validation_type' => 'boolean',
102
  ),
 
 
 
 
 
 
 
 
103
  'tribeEventsAdvancedSettingsTitle' => array(
104
  'type' => 'html',
105
  'html' => '<h3>' . __( 'Advanced Template Settings', 'tribe-events-calendar' ) . '</h3>',
@@ -120,5 +128,6 @@ $displayTab = array(
120
  'type' => 'html',
121
  'html' => '</div>',
122
  ),
 
123
  )
124
  );
19
 
20
  $displayTab = array(
21
  'priority' => 20,
22
+ 'fields' => apply_filters( 'tribe_display_settings_tab_fields', array(
23
  'info-start' => array(
24
  'type' => 'html',
25
  'html' => '<div id="modern-tribe-info">'
100
  'default' => false,
101
  'validation_type' => 'boolean',
102
  ),
103
+ 'monthEventAmount' => array(
104
+ 'type' => 'text',
105
+ 'label' => __( 'Month view events per day', 'tribe-events-calendar' ),
106
+ 'tooltip' => __( 'Allow more than the default 3 events per day in month view.', 'tribe-events-calendar' ),
107
+ 'validation_type' => 'positive_int',
108
+ 'size' => 'small',
109
+ 'default' => '3'
110
+ ),
111
  'tribeEventsAdvancedSettingsTitle' => array(
112
  'type' => 'html',
113
  'html' => '<h3>' . __( 'Advanced Template Settings', 'tribe-events-calendar' ) . '</h3>',
128
  'type' => 'html',
129
  'html' => '</div>',
130
  ),
131
+ )
132
  )
133
  );
lib/template-classes/month.php CHANGED
@@ -46,6 +46,7 @@ if( !class_exists('Tribe_Events_Month_Template')){
46
  }
47
 
48
  self::$args = $args;
 
49
 
50
  if ( ! tribe_is_month() ) {
51
  $this->asset_packages = array();
@@ -72,7 +73,7 @@ if( !class_exists('Tribe_Events_Month_Template')){
72
  $total_counts = array_unique(self::$event_daily_counts);
73
 
74
  if( count($total_counts) < 2 && !empty($search_term)) {
75
- TribeEvents::setNotice( 'event-search-no-results', sprintf( __( 'There were no results found for <strong>"%s"</strong> this month. Try searching next month.', 'tribe-events-calendar' ), $search_term ) );
76
  }
77
  }
78
 
46
  }
47
 
48
  self::$args = $args;
49
+ self::$posts_per_page_limit = apply_filters( 'tribe_events_month_day_limit', tribe_get_option( 'monthEventAmount', '3' ) );
50
 
51
  if ( ! tribe_is_month() ) {
52
  $this->asset_packages = array();
73
  $total_counts = array_unique(self::$event_daily_counts);
74
 
75
  if( count($total_counts) < 2 && !empty($search_term)) {
76
+ TribeEvents::setNotice( 'event-search-no-results', sprintf( __( 'There were no results found for <strong>"%s"</strong> this month. Try searching next month.', 'tribe-events-calendar' ), esc_html( $search_term ) ) );
77
  }
78
  }
79
 
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/';
@@ -118,6 +118,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
118
  '_EventAllDay',
119
  '_EventStartDate',
120
  '_EventEndDate',
 
121
  '_EventVenueID',
122
  '_EventShowMapLink',
123
  '_EventShowMap',
@@ -313,7 +314,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
313
  if( !$this->show_data_wrapper['after'] )
314
  return $html;
315
 
316
- $html .= '</div>';
317
  $html .= tribe_events_promo_banner( false );
318
  $this->show_data_wrapper['after'] = false;
319
  return apply_filters( 'tribe_events_view_after_html_data_wrapper', $html );
@@ -2389,42 +2390,48 @@ if ( !class_exists( 'TribeEvents' ) ) {
2389
 
2390
  switch( $type ) {
2391
  case 'home':
2392
- return trailingslashit( esc_url($eventUrl) );
 
2393
  case 'month':
2394
  if ( $secondary ) {
2395
- return trailingslashit( esc_url($eventUrl . $secondary) );
2396
- }
2397
- return trailingslashit( esc_url($eventUrl . $this->monthSlug) );
2398
- case 'week':
2399
- if ( $secondary ) {
2400
- return trailingslashit( esc_url($eventUrl . $secondary) );
2401
  }
2402
- return trailingslashit( esc_url($eventUrl . $this->weekSlug) );
2403
  case 'upcoming':
2404
- return trailingslashit( esc_url($eventUrl . $this->upcomingSlug) );
 
2405
  case 'past':
2406
- return trailingslashit( esc_url($eventUrl . $this->pastSlug) );
 
2407
  case 'dropdown':
2408
- return esc_url($eventUrl);
 
2409
  case 'single':
2410
  global $post;
2411
  $p = $secondary ? $secondary : $post;
2412
  remove_filter( 'post_type_link', array($this, 'addDateToRecurringEvents') );
2413
  $link = trailingslashit(get_permalink($p));
2414
  add_filter( 'post_type_link', array($this, 'addDateToRecurringEvents'), 10, 2 );
2415
- return trailingslashit( esc_url($link) );
 
2416
  case 'day':
2417
  $date = strtotime($secondary);
2418
  $secondary = date('Y-m-d', $date);
2419
- return trailingslashit( esc_url($eventUrl . $secondary) );
 
2420
  case 'all':
2421
  remove_filter( 'post_type_link', array($this, 'addDateToRecurringEvents') );
2422
  $eventUrl = trailingslashit(get_permalink());
2423
  add_filter( 'post_type_link', array($this, 'addDateToRecurringEvents'), 10, 2 );
2424
- return trailingslashit( esc_url($eventUrl . 'all') );
 
2425
  default:
2426
- return esc_url($eventUrl);
 
2427
  }
 
2428
  }
2429
 
2430
  /**
@@ -3215,15 +3222,16 @@ if ( !class_exists( 'TribeEvents' ) ) {
3215
 
3216
  $EventStartDate = ( isset($start) && $start ) ? $start : date('Y-m-d');
3217
 
3218
- if ( !empty($_REQUEST['eventDate']) )
3219
- $EventStartDate = $_REQUEST['eventDate'];
3220
 
3221
  if( $_EventEndDate )
3222
  $end = TribeDateUtils::dateOnly($_EventEndDate);
3223
 
3224
- $EventEndDate = ( isset($end) && $end ) ? $end : date('Y-m-d');
3225
- $recStart = isset($_REQUEST['event_start']) ? $_REQUEST['event_start'] : null;
3226
- $recPost = isset($_REQUEST['post']) ? $_REQUEST['post'] : null;
 
3227
 
3228
  if ( !empty($_REQUEST['eventDate']) ) {
3229
  $duration = get_post_meta( $postId, '_EventDuration', true );
@@ -3261,6 +3269,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
3261
  }
3262
  }
3263
  }
 
3264
  ?>
3265
  <style type="text/css">
3266
  #EventInfo {border:none;}
@@ -3603,29 +3612,30 @@ if ( !class_exists( 'TribeEvents' ) ) {
3603
  public function get_event_link($post, $mode = 'next',$anchor = false){
3604
  global $wpdb;
3605
 
3606
- if($mode == 'previous'){
3607
  $order = 'DESC';
3608
- $sign = '<';
3609
- }else{
3610
  $order = 'ASC';
3611
- $sign = '>';
3612
  }
3613
 
3614
  $date = $post->EventStartDate;
3615
  $id = $post->ID;
3616
 
3617
- $eventsQuery = "
3618
  SELECT $wpdb->posts.*, d1.meta_value as EventStartDate
3619
  FROM $wpdb->posts
3620
  LEFT JOIN $wpdb->postmeta as d1 ON($wpdb->posts.ID = d1.post_id)
3621
- WHERE $wpdb->posts.post_type = '".self::POSTTYPE."'
3622
  AND d1.meta_key = '_EventStartDate'
3623
- AND ((d1.meta_value = '" .$date . "' AND ID $sign ".$id.") OR
3624
- d1.meta_value $sign '" .$date . "')
3625
  AND $wpdb->posts.post_status = 'publish'
3626
- AND ($wpdb->posts.ID != $id OR d1.meta_value != '$date')
3627
  ORDER BY TIMESTAMP(d1.meta_value) $order, ID $order
3628
- LIMIT 1";
 
3629
  $args = array(
3630
  'post_type' => self::POSTTYPE,
3631
  'post_status' => 'publish',
@@ -3835,11 +3845,12 @@ if ( !class_exists( 'TribeEvents' ) ) {
3835
  'id' => 'tribe-events-settings-group',
3836
  'parent' => 'tribe-events'
3837
  ) );
3838
-
3839
- $wp_admin_bar->add_group( array(
3840
- 'id' => 'tribe-events-import-group',
3841
- 'parent' => 'tribe-events-add-ons-group'
3842
- ) );
 
3843
 
3844
  $wp_admin_bar->add_menu( array(
3845
  'id' => 'tribe-events-view-calendar',
@@ -3976,8 +3987,11 @@ if ( !class_exists( 'TribeEvents' ) ) {
3976
  }
3977
 
3978
  public function addHelpAdminMenuItem() {
3979
- global $submenu;
3980
- $submenu['edit.php?post_type=' . self::POSTTYPE][500] = array( __('Help', 'tribe-events-calendar'), 'manage_options' , add_query_arg( array( 'post_type' => self::POSTTYPE, 'page' => 'tribe-events-calendar', 'tab' => 'help' ), admin_url( 'edit.php' ) ) );
 
 
 
3981
  }
3982
 
3983
  /**
@@ -4059,13 +4073,13 @@ if ( !class_exists( 'TribeEvents' ) ) {
4059
 
4060
  $value = "";
4061
  if ( !empty( $_REQUEST['tribe-bar-search'] ) ) {
4062
- $value = $_REQUEST['tribe-bar-search'];
4063
  }
4064
 
4065
  if ( tribe_get_option( 'tribeDisableTribeBar', false ) == false ) {
4066
  $filters['tribe-bar-search'] = array( 'name' => 'tribe-bar-search',
4067
  'caption' => 'Search',
4068
- 'html' => '<input type="text" name="tribe-bar-search" id="tribe-bar-search" value="' . esc_attr( $value ) . '" placeholder="Search">' );
4069
 
4070
  }
4071
  return $filters;
@@ -4374,4 +4388,4 @@ if ( !class_exists( 'TribeEvents' ) ) {
4374
 
4375
  } // end TribeEvents class
4376
 
4377
- } // end 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.1';
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/';
118
  '_EventAllDay',
119
  '_EventStartDate',
120
  '_EventEndDate',
121
+ '_EventDuration',
122
  '_EventVenueID',
123
  '_EventShowMapLink',
124
  '_EventShowMap',
314
  if( !$this->show_data_wrapper['after'] )
315
  return $html;
316
 
317
+ $html .= '</div><!-- #tribe-events -->';
318
  $html .= tribe_events_promo_banner( false );
319
  $this->show_data_wrapper['after'] = false;
320
  return apply_filters( 'tribe_events_view_after_html_data_wrapper', $html );
2390
 
2391
  switch( $type ) {
2392
  case 'home':
2393
+ $eventUrl = trailingslashit( esc_url($eventUrl) );
2394
+ break;
2395
  case 'month':
2396
  if ( $secondary ) {
2397
+ $eventUrl = trailingslashit( esc_url($eventUrl . $secondary) );
2398
+ } else {
2399
+ $eventUrl = trailingslashit( esc_url($eventUrl . $this->monthSlug) );
 
 
 
2400
  }
2401
+ break;
2402
  case 'upcoming':
2403
+ $eventUrl = trailingslashit( esc_url($eventUrl . $this->upcomingSlug) );
2404
+ break;
2405
  case 'past':
2406
+ $eventUrl = trailingslashit( esc_url($eventUrl . $this->pastSlug) );
2407
+ break;
2408
  case 'dropdown':
2409
+ $eventUrl = esc_url($eventUrl);
2410
+ break;
2411
  case 'single':
2412
  global $post;
2413
  $p = $secondary ? $secondary : $post;
2414
  remove_filter( 'post_type_link', array($this, 'addDateToRecurringEvents') );
2415
  $link = trailingslashit(get_permalink($p));
2416
  add_filter( 'post_type_link', array($this, 'addDateToRecurringEvents'), 10, 2 );
2417
+ $eventUrl = trailingslashit( esc_url($link) );
2418
+ break;
2419
  case 'day':
2420
  $date = strtotime($secondary);
2421
  $secondary = date('Y-m-d', $date);
2422
+ $eventUrl = trailingslashit( esc_url($eventUrl . $secondary) );
2423
+ break;
2424
  case 'all':
2425
  remove_filter( 'post_type_link', array($this, 'addDateToRecurringEvents') );
2426
  $eventUrl = trailingslashit(get_permalink());
2427
  add_filter( 'post_type_link', array($this, 'addDateToRecurringEvents'), 10, 2 );
2428
+ $eventUrl = trailingslashit( esc_url($eventUrl . 'all') );
2429
+ break;
2430
  default:
2431
+ $eventUrl = esc_url($eventUrl);
2432
+ break;
2433
  }
2434
+ return apply_filters( 'tribe_events_getLink', $eventUrl, $type, $secondary, $term );
2435
  }
2436
 
2437
  /**
3222
 
3223
  $EventStartDate = ( isset($start) && $start ) ? $start : date('Y-m-d');
3224
 
3225
+ if ( ! empty( $_REQUEST['eventDate'] ) )
3226
+ $EventStartDate = esc_attr( $_REQUEST['eventDate'] );
3227
 
3228
  if( $_EventEndDate )
3229
  $end = TribeDateUtils::dateOnly($_EventEndDate);
3230
 
3231
+ $EventEndDate = ( isset( $end ) && $end ) ? $end : date( 'Y-m-d' );
3232
+ $recStart = isset( $_REQUEST['event_start'] ) ? esc_attr( $_REQUEST['event_start'] ) : null;
3233
+ $recPost = isset( $_REQUEST['post'] ) ? absint( $_REQUEST['post'] ) : null;
3234
+
3235
 
3236
  if ( !empty($_REQUEST['eventDate']) ) {
3237
  $duration = get_post_meta( $postId, '_EventDuration', true );
3269
  }
3270
  }
3271
  }
3272
+
3273
  ?>
3274
  <style type="text/css">
3275
  #EventInfo {border:none;}
3612
  public function get_event_link($post, $mode = 'next',$anchor = false){
3613
  global $wpdb;
3614
 
3615
+ if ( $mode == 'previous' ) {
3616
  $order = 'DESC';
3617
+ $sign = '<';
3618
+ } else {
3619
  $order = 'ASC';
3620
+ $sign = '>';
3621
  }
3622
 
3623
  $date = $post->EventStartDate;
3624
  $id = $post->ID;
3625
 
3626
+ $eventsQuery = $wpdb->prepare( "
3627
  SELECT $wpdb->posts.*, d1.meta_value as EventStartDate
3628
  FROM $wpdb->posts
3629
  LEFT JOIN $wpdb->postmeta as d1 ON($wpdb->posts.ID = d1.post_id)
3630
+ WHERE $wpdb->posts.post_type = '%s'
3631
  AND d1.meta_key = '_EventStartDate'
3632
+ AND ((d1.meta_value = '%s' AND ID $sign %d) OR
3633
+ d1.meta_value $sign '%s')
3634
  AND $wpdb->posts.post_status = 'publish'
3635
+ AND ($wpdb->posts.ID != %d OR d1.meta_value != '%s')
3636
  ORDER BY TIMESTAMP(d1.meta_value) $order, ID $order
3637
+ LIMIT 1", self::POSTTYPE, $date, $id, $date, $id, $date );
3638
+
3639
  $args = array(
3640
  'post_type' => self::POSTTYPE,
3641
  'post_status' => 'publish',
3845
  'id' => 'tribe-events-settings-group',
3846
  'parent' => 'tribe-events'
3847
  ) );
3848
+ if( current_user_can( 'edit_tribe_events' ) ) {
3849
+ $wp_admin_bar->add_group( array(
3850
+ 'id' => 'tribe-events-import-group',
3851
+ 'parent' => 'tribe-events-add-ons-group'
3852
+ ) );
3853
+ }
3854
 
3855
  $wp_admin_bar->add_menu( array(
3856
  'id' => 'tribe-events-view-calendar',
3987
  }
3988
 
3989
  public function addHelpAdminMenuItem() {
3990
+ // prevent users who cannot manage the plugin to see addons link
3991
+ if( current_user_can( 'edit_tribe_events' ) ) {
3992
+ global $submenu;
3993
+ $submenu['edit.php?post_type=' . self::POSTTYPE][500] = array( __('Help', 'tribe-events-calendar'), 'manage_options' , add_query_arg( array( 'post_type' => self::POSTTYPE, 'page' => 'tribe-events-calendar', 'tab' => 'help' ), admin_url( 'edit.php' ) ) );
3994
+ }
3995
  }
3996
 
3997
  /**
4073
 
4074
  $value = "";
4075
  if ( !empty( $_REQUEST['tribe-bar-search'] ) ) {
4076
+ $value = esc_attr( $_REQUEST['tribe-bar-search'] );
4077
  }
4078
 
4079
  if ( tribe_get_option( 'tribeDisableTribeBar', false ) == false ) {
4080
  $filters['tribe-bar-search'] = array( 'name' => 'tribe-bar-search',
4081
  'caption' => 'Search',
4082
+ 'html' => '<input type="text" name="tribe-bar-search" id="tribe-bar-search" value="' . $value . '" placeholder="Search">' );
4083
 
4084
  }
4085
  return $filters;
4388
 
4389
  } // end TribeEvents class
4390
 
4391
+ } // end if !class_exists TribeEvents
lib/tickets/tribe-tickets-attendees.php CHANGED
@@ -213,13 +213,15 @@ class TribeEventsTicketsAttendeesTable extends WP_List_Table {
213
 
214
  foreach ( $_GET['attendee'] as $attendee_provider ) {
215
  $vars = explode( "|", $attendee_provider );
216
- if ( isset( $vars[1] ) ) {
217
  $obj = call_user_func( array( $vars[1], 'get_instance' ) );
 
 
 
 
218
  $obj->checkin( $vars[0] );
219
  }
220
-
221
  }
222
-
223
  }
224
  }
225
 
@@ -229,8 +231,12 @@ class TribeEventsTicketsAttendeesTable extends WP_List_Table {
229
 
230
  foreach ( $_GET['attendee'] as $attendee_provider ) {
231
  $vars = explode( "|", $attendee_provider );
232
- if ( isset( $vars[1] ) ) {
233
  $obj = call_user_func( array( $vars[1], 'get_instance' ) );
 
 
 
 
234
  $obj->uncheckin( $vars[0] );
235
  }
236
 
213
 
214
  foreach ( $_GET['attendee'] as $attendee_provider ) {
215
  $vars = explode( "|", $attendee_provider );
216
+ if ( isset( $vars[1] ) && is_callable( array( $vars[1], 'get_instance' ) ) ) {
217
  $obj = call_user_func( array( $vars[1], 'get_instance' ) );
218
+
219
+ if ( ! is_subclass_of( $obj, 'TribeEventsTickets' ) )
220
+ return;
221
+
222
  $obj->checkin( $vars[0] );
223
  }
 
224
  }
 
225
  }
226
  }
227
 
231
 
232
  foreach ( $_GET['attendee'] as $attendee_provider ) {
233
  $vars = explode( "|", $attendee_provider );
234
+ if ( isset( $vars[1] ) && is_callable( array( $vars[1], 'get_instance' ) ) ) {
235
  $obj = call_user_func( array( $vars[1], 'get_instance' ) );
236
+
237
+ if ( ! is_subclass_of( $obj, 'TribeEventsTickets' ) )
238
+ return;
239
+
240
  $obj->uncheckin( $vars[0] );
241
  }
242
 
lib/tickets/tribe-tickets.php CHANGED
@@ -249,7 +249,13 @@ if ( ! class_exists( 'TribeEventsTickets' ) ) {
249
  if ( ! isset( $_POST["formdata"] ) ) $this->ajax_error( 'Bad post' );
250
  if ( ! isset( $_POST["post_ID"] ) ) $this->ajax_error( 'Bad post' );
251
 
252
- $data = wp_parse_args( $_POST["formdata"] );
 
 
 
 
 
 
253
  $post_id = $_POST["post_ID"];
254
 
255
  if ( empty( $_POST["nonce"] ) || ! wp_verify_nonce( $_POST["nonce"], 'add_ticket_nonce' ) || ! current_user_can( 'edit_tribe_events' ) )
249
  if ( ! isset( $_POST["formdata"] ) ) $this->ajax_error( 'Bad post' );
250
  if ( ! isset( $_POST["post_ID"] ) ) $this->ajax_error( 'Bad post' );
251
 
252
+ /*
253
+ This is needed because a provider can implement a dynamic set of fields.
254
+ Each provider is responsible for sanitizing these values.
255
+ */
256
+ $data = wp_parse_args( $_POST["formdata"] );
257
+
258
+
259
  $post_id = $_POST["post_ID"];
260
 
261
  if ( empty( $_POST["nonce"] ) || ! wp_verify_nonce( $_POST["nonce"], 'add_ticket_nonce' ) || ! current_user_can( 'edit_tribe_events' ) )
lib/tribe-app-shop.class.php CHANGED
@@ -76,16 +76,18 @@ if ( ! class_exists( 'TribeAppShop' ) ) {
76
  * Adds a link to the shop app to the WP admin bar
77
  */
78
  public function add_toolbar_item() {
79
- global $wp_admin_bar;
80
 
81
- $where = 'edit.php?post_type=' . TribeEvents::POSTTYPE;
82
-
83
- $wp_admin_bar->add_menu( array( 'id' => 'tribe-events-app-shop',
84
- 'title' => __( 'Event Add-Ons', 'tribe-events-calendar' ),
85
- 'href' => admin_url( untrailingslashit( $where ) . "&page=" . self::MENU_SLUG ),
86
- 'parent' => 'tribe-events-settings-group' ) );
87
 
 
88
 
 
 
 
 
 
89
  }
90
 
91
  /**
76
  * Adds a link to the shop app to the WP admin bar
77
  */
78
  public function add_toolbar_item() {
 
79
 
80
+ // prevent users who cannot manage the plugin to see addons link
81
+ if( current_user_can( 'edit_tribe_events' ) ) {
82
+ global $wp_admin_bar;
 
 
 
83
 
84
+ $where = 'edit.php?post_type=' . TribeEvents::POSTTYPE;
85
 
86
+ $wp_admin_bar->add_menu( array( 'id' => 'tribe-events-app-shop',
87
+ 'title' => __( 'Event Add-Ons', 'tribe-events-calendar' ),
88
+ 'href' => admin_url( untrailingslashit( $where ) . "&page=" . self::MENU_SLUG ),
89
+ 'parent' => 'tribe-events-settings-group' ) );
90
+ }
91
  }
92
 
93
  /**
lib/tribe-event-api.class.php CHANGED
@@ -99,6 +99,8 @@ if (!class_exists('TribeEventsAPI')) {
99
  $data['EventEndDate'] = $data['EventStartDate'];
100
  }
101
 
 
 
102
  $old_data['EventStartDate'] = get_post_meta( $event_id, '_EventStartDate', true );
103
 
104
  update_post_meta( $event_id, '_EventShowMapLink', isset( $data['venue']['EventShowMapLink'] ) );
99
  $data['EventEndDate'] = $data['EventStartDate'];
100
  }
101
 
102
+ $data['EventDuration'] = strtotime($data['EventEndDate']) - $startTimestamp;
103
+
104
  $old_data['EventStartDate'] = get_post_meta( $event_id, '_EventStartDate', true );
105
 
106
  update_post_meta( $event_id, '_EventShowMapLink', isset( $data['venue']['EventShowMapLink'] ) );
lib/tribe-event-exception.class.php CHANGED
File without changes
lib/tribe-event-query.class.php CHANGED
@@ -102,6 +102,7 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
102
  self::$end_date = null;
103
 
104
  add_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );
 
105
  add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
106
  add_filter( 'posts_fields', array( __CLASS__, 'posts_fields' ), 10, 2 );
107
  add_filter( 'posts_distinct', array( __CLASS__, 'posts_distinct' ) );
@@ -137,7 +138,8 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
137
  break;
138
  case 'month':
139
  $start_date = substr_replace( date_i18n( TribeDateUtils::DBDATEFORMAT ), '01', -2 );
140
- $start_date = ( $query->get( 'eventDate' ) != '' ) ? $query->get( 'eventDate' ) . '-01' : $start_date;
 
141
  $query->set( 'start_date', $start_date );
142
  $query->set( 'eventDate', $start_date );
143
  $query->set( 'end_date', date( 'Y-m-d', strtotime( TribeEvents::instance()->nextMonth( $start_date ) ) -( 24*3600 ) ) );
@@ -162,7 +164,7 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
162
  case 'upcoming':
163
  default: // default display query
164
  $start_date = date_i18n( TribeDateUtils::DBDATETIMEFORMAT );
165
- $start_date = ( $query->get( 'eventDate' ) != '' ) ? $query->get( 'eventDate' ) . '-01' : $start_date;
166
  $query->set( 'hide_upcoming', true );
167
  $query->set( 'start_date', $start_date );
168
  $query->set( 'orderby', self::set_orderby() );
@@ -314,18 +316,21 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
314
  * @param WP_Query $query The current query object.
315
  * @return string The modified FIELDS statement.
316
  */
317
- public static function posts_fields( $fields, $query ) {
318
  if ( self::$is_event ) {
319
  global $wpdb;
320
- $fields .= ", {$wpdb->postmeta}.meta_value as EventStartDate, tribe_event_duration.meta_value as EventDuration, DATE_ADD(CAST({$wpdb->postmeta}.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND) as EventEndDate ";
321
- return apply_filters( 'tribe_events_query_posts_fields', $fields );
 
 
 
322
  } else {
323
- return $fields;
324
  }
325
  }
326
 
327
  /**
328
- * Custom SQL join for event duration meta field
329
  *
330
  * @param string $join_sql
331
  * @param wp_query $query
@@ -333,24 +338,39 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
333
  */
334
  public static function posts_join( $join_sql, $query ) {
335
  global $wpdb;
 
336
 
337
  // if it's a true event query then we want create a join for where conditions
338
  if ( $query->tribe_is_event || $query->tribe_is_event_category ) {
339
- $join_sql .= " LEFT JOIN {$wpdb->postmeta} as tribe_event_duration ON ( {$wpdb->posts}.ID = tribe_event_duration.post_id AND tribe_event_duration.meta_key = '_EventDuration' ) ";
340
- switch ($query->get( 'orderby' )) {
341
- case 'venue':
342
- $join_sql .= "LEFT JOIN {$wpdb->postmeta} tribe_order_by_venue_meta ON {$wpdb->posts}.ID = tribe_order_by_venue_meta.post_id AND tribe_order_by_venue_meta.meta_key='_EventVenueID' LEFT JOIN {$wpdb->posts} tribe_order_by_venue ON tribe_order_by_venue_meta.meta_value = tribe_order_by_venue.ID ";
343
- break;
344
- case 'organizer':
345
- $join_sql .= "LEFT JOIN {$wpdb->postmeta} tribe_order_by_organizer_meta ON {$wpdb->posts}.ID = tribe_order_by_organizer_meta.post_id AND tribe_order_by_organizer_meta.meta_key='_EventOrganizerID' LEFT JOIN {$wpdb->posts} tribe_order_by_organizer ON tribe_order_by_organizer_meta.meta_value = tribe_order_by_organizer.ID ";
346
- break;
347
- default: break;
348
- }
349
  }
350
-
351
  return $join_sql;
352
  }
353
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  /**
355
  * Custom SQL conditional for event duration meta field
356
  *
@@ -368,17 +388,20 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
368
  $end_date = !empty( $query->end_date ) ? $query->end_date : $query->get( 'end_date' );
369
 
370
  // we can't store end date directly because it messes up the distinc clause
371
- $duration_filter = " DATE_ADD(CAST({$wpdb->postmeta}.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND) ";
 
 
 
372
 
373
  // build where conditionals for events if date range params are set
374
  if ( $start_date != '' && $end_date != '' ) {
375
- $start_clause = $wpdb->prepare( "({$wpdb->postmeta}.meta_value >= %s AND {$wpdb->postmeta}.meta_value <= %s)", $start_date, $end_date );
376
- $end_clause = $wpdb->prepare( "($duration_filter >= %s AND {$wpdb->postmeta}.meta_value <= %s )", $start_date, $end_date );
377
- $within_clause = $wpdb->prepare( "({$wpdb->postmeta}.meta_value < %s AND $duration_filter >= %s )", $start_date, $end_date );
378
  $where_sql .= " AND ($start_clause OR $end_clause OR $within_clause)";
379
  } else if ( $start_date != '' ) {
380
  $start_clause = $wpdb->prepare( "{$wpdb->postmeta}.meta_value >= %s", $start_date );
381
- $within_clause = $wpdb->prepare( "({$wpdb->postmeta}.meta_value <= %s AND $duration_filter >= %s )", $start_date, $start_date );
382
  $where_sql .= " AND ($start_clause OR $within_clause)";
383
  if ( $query->is_singular() && $query->get( 'eventDate' ) ) {
384
  $tomorrow = date( 'Y-m-d', strtotime( $query->get( 'eventDate' ).' +1 day' ) );
@@ -386,7 +409,7 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
386
  $where_sql .= " AND $tomorrow_clause";
387
  }
388
  } else if ( $end_date != '' ) {
389
- $where_sql .= " AND " . $wpdb->prepare( "$duration_filter < %s", $end_date );
390
  }
391
  }
392
 
@@ -509,6 +532,7 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
509
  'hide_upcoming_ids' => null
510
  );
511
  $args = wp_parse_args( $args, $defaults );
 
512
  $args['posts_per_page'] = -1;
513
  $args['fields'] = 'ids';
514
  $post_id_query = new WP_Query();
@@ -524,13 +548,18 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
524
  global $wp_query;
525
 
526
  $output_date_format = '%Y-%m-%d';
527
- $raw_counts = $wpdb->get_results( sprintf( "SELECT tribe_event_start.post_id as ID, DATE_FORMAT( tribe_event_start.meta_value, '%1\$s') as EventStartDate, DATE_FORMAT( DATE_ADD(CAST(tribe_event_start.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND), '%2\$s') as EventEndDate
 
 
 
528
  FROM $wpdb->postmeta AS tribe_event_start
529
  LEFT JOIN $wpdb->postmeta as tribe_event_duration ON ( tribe_event_start.post_id = tribe_event_duration.post_id AND tribe_event_duration.meta_key = '_EventDuration' )
 
530
  WHERE tribe_event_start.meta_key = '_EventStartDate'
531
  AND tribe_event_start.post_id IN ( %5\$s )
532
  AND ( (tribe_event_start.meta_value >= '%3\$s' AND tribe_event_start.meta_value <= '%4\$s')
533
  OR (tribe_event_start.meta_value <= '%3\$s' AND DATE_ADD(CAST( tribe_event_start.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND) >= '%3\$s')
 
534
  OR ( tribe_event_start.meta_value >= '%3\$s' AND tribe_event_start.meta_value <= '%4\$s')
535
  )
536
  ORDER BY DATE(tribe_event_start.meta_value) ASC, TIME(tribe_event_start.meta_value) ASC;",
@@ -570,9 +599,6 @@ if ( !class_exists( 'TribeEventsQuery' ) ) {
570
  }
571
  break;
572
  }
573
- // echo '<pre>';
574
- //print_r($counts);
575
- // echo '</pre>';
576
  return $counts;
577
  }
578
 
102
  self::$end_date = null;
103
 
104
  add_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );
105
+ add_filter( 'posts_join', array( __CLASS__, 'posts_join_orderby' ), 10, 2 );
106
  add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
107
  add_filter( 'posts_fields', array( __CLASS__, 'posts_fields' ), 10, 2 );
108
  add_filter( 'posts_distinct', array( __CLASS__, 'posts_distinct' ) );
138
  break;
139
  case 'month':
140
  $start_date = substr_replace( date_i18n( TribeDateUtils::DBDATEFORMAT ), '01', -2 );
141
+ $passed_date = $query->get( 'eventDate' ) ? substr_replace( date_i18n( TribeDateUtils::DBDATEFORMAT, strtotime( $query->get( 'eventDate' ) ) ), '01', -2 ) : false;
142
+ $start_date = $passed_date ? $passed_date : $start_date;
143
  $query->set( 'start_date', $start_date );
144
  $query->set( 'eventDate', $start_date );
145
  $query->set( 'end_date', date( 'Y-m-d', strtotime( TribeEvents::instance()->nextMonth( $start_date ) ) -( 24*3600 ) ) );
164
  case 'upcoming':
165
  default: // default display query
166
  $start_date = date_i18n( TribeDateUtils::DBDATETIMEFORMAT );
167
+ $start_date = ( $query->get( 'eventDate' ) != '' ) ? $query->get( 'eventDate' ) : $start_date;
168
  $query->set( 'hide_upcoming', true );
169
  $query->set( 'start_date', $start_date );
170
  $query->set( 'orderby', self::set_orderby() );
316
  * @param WP_Query $query The current query object.
317
  * @return string The modified FIELDS statement.
318
  */
319
+ public static function posts_fields( $field_sql, $query ) {
320
  if ( self::$is_event ) {
321
  global $wpdb;
322
+ $fields = array();
323
+ $fields['event_start_date'] = "{$wpdb->postmeta}.meta_value as EventStartDate";
324
+ $fields['event_end_date'] ="tribe_event_end_date.meta_value as EventEndDate";
325
+ $fields = apply_filters( 'tribe_events_query_posts_fields', $fields );
326
+ return $field_sql . ', '.implode(', ', $fields);
327
  } else {
328
+ return $field_sql;
329
  }
330
  }
331
 
332
  /**
333
+ * Custom SQL join for event end date
334
  *
335
  * @param string $join_sql
336
  * @param wp_query $query
338
  */
339
  public static function posts_join( $join_sql, $query ) {
340
  global $wpdb;
341
+ $joins = array();
342
 
343
  // if it's a true event query then we want create a join for where conditions
344
  if ( $query->tribe_is_event || $query->tribe_is_event_category ) {
345
+ $joins['event_start_date'] = " AND {$wpdb->postmeta}.meta_key = '_EventStartDate'";
346
+ $joins['event_end_date'] = " LEFT JOIN {$wpdb->postmeta} as tribe_event_end_date ON ( {$wpdb->posts}.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' ) ";
347
+ $joins = apply_filters( 'tribe_events_query_posts_joins', $joins );
348
+ return $join_sql . implode('', $joins);
 
 
 
 
 
 
349
  }
 
350
  return $join_sql;
351
  }
352
 
353
+ /**
354
+ * Custom SQL join for orderby
355
+ *
356
+ * @param string $join_sql
357
+ * @param wp_query $query
358
+ * @return string
359
+ */
360
+ public static function posts_join_orderby( $join_sql, $query ) {
361
+ switch ($query->get( 'orderby' )) {
362
+ case 'venue':
363
+ $join_sql .= " LEFT JOIN {$wpdb->postmeta} tribe_order_by_venue_meta ON {$wpdb->posts}.ID = tribe_order_by_venue_meta.post_id AND tribe_order_by_venue_meta.meta_key='_EventVenueID' LEFT JOIN {$wpdb->posts} tribe_order_by_venue ON tribe_order_by_venue_meta.meta_value = tribe_order_by_venue.ID ";
364
+ break;
365
+ case 'organizer':
366
+ $join_sql .= " LEFT JOIN {$wpdb->postmeta} tribe_order_by_organizer_meta ON {$wpdb->posts}.ID = tribe_order_by_organizer_meta.post_id AND tribe_order_by_organizer_meta.meta_key='_EventOrganizerID' LEFT JOIN {$wpdb->posts} tribe_order_by_organizer ON tribe_order_by_organizer_meta.meta_value = tribe_order_by_organizer.ID ";
367
+ break;
368
+ default: break;
369
+ }
370
+
371
+ return apply_filters( 'tribe_events_query_posts_join_orderby', $join_sql);
372
+ }
373
+
374
  /**
375
  * Custom SQL conditional for event duration meta field
376
  *
388
  $end_date = !empty( $query->end_date ) ? $query->end_date : $query->get( 'end_date' );
389
 
390
  // we can't store end date directly because it messes up the distinc clause
391
+ $event_end_date = apply_filters('tribe_events_query_end_date_column', 'tribe_event_end_date.meta_value');
392
+
393
+ // event start date
394
+ $event_start_date = "{$wpdb->postmeta}.meta_value";
395
 
396
  // build where conditionals for events if date range params are set
397
  if ( $start_date != '' && $end_date != '' ) {
398
+ $start_clause = $wpdb->prepare( "($event_start_date >= %s AND $event_start_date <= %s)", $start_date, $end_date );
399
+ $end_clause = $wpdb->prepare( "($event_end_date >= %s AND $event_start_date <= %s )", $start_date, $end_date );
400
+ $within_clause = $wpdb->prepare( "($event_start_date < %s AND $event_end_date >= %s )", $start_date, $end_date );
401
  $where_sql .= " AND ($start_clause OR $end_clause OR $within_clause)";
402
  } else if ( $start_date != '' ) {
403
  $start_clause = $wpdb->prepare( "{$wpdb->postmeta}.meta_value >= %s", $start_date );
404
+ $within_clause = $wpdb->prepare( "({$wpdb->postmeta}.meta_value <= %s AND $event_end_date >= %s )", $start_date, $start_date );
405
  $where_sql .= " AND ($start_clause OR $within_clause)";
406
  if ( $query->is_singular() && $query->get( 'eventDate' ) ) {
407
  $tomorrow = date( 'Y-m-d', strtotime( $query->get( 'eventDate' ).' +1 day' ) );
409
  $where_sql .= " AND $tomorrow_clause";
410
  }
411
  } else if ( $end_date != '' ) {
412
+ $where_sql .= " AND " . $wpdb->prepare( "$event_end_date < %s", $end_date );
413
  }
414
  }
415
 
532
  'hide_upcoming_ids' => null
533
  );
534
  $args = wp_parse_args( $args, $defaults );
535
+
536
  $args['posts_per_page'] = -1;
537
  $args['fields'] = 'ids';
538
  $post_id_query = new WP_Query();
548
  global $wp_query;
549
 
550
  $output_date_format = '%Y-%m-%d';
551
+ $raw_counts = $wpdb->get_results( sprintf( "
552
+ SELECT tribe_event_start.post_id as ID,
553
+ DATE_FORMAT( tribe_event_start.meta_value, '%1\$s') as EventStartDate,
554
+ IF (tribe_event_duration.meta_value IS NULL, DATE_FORMAT( tribe_event_end_date.meta_value, '%1\$s'), DATE_FORMAT(DATE_ADD(CAST(tribe_event_start.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND), '%1\$s')) as EventEndDate
555
  FROM $wpdb->postmeta AS tribe_event_start
556
  LEFT JOIN $wpdb->postmeta as tribe_event_duration ON ( tribe_event_start.post_id = tribe_event_duration.post_id AND tribe_event_duration.meta_key = '_EventDuration' )
557
+ LEFT JOIN $wpdb->postmeta as tribe_event_end_date ON ( tribe_event_start.post_id = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' )
558
  WHERE tribe_event_start.meta_key = '_EventStartDate'
559
  AND tribe_event_start.post_id IN ( %5\$s )
560
  AND ( (tribe_event_start.meta_value >= '%3\$s' AND tribe_event_start.meta_value <= '%4\$s')
561
  OR (tribe_event_start.meta_value <= '%3\$s' AND DATE_ADD(CAST( tribe_event_start.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND) >= '%3\$s')
562
+ OR (tribe_event_start.meta_value <= '%3\$s' AND tribe_event_end_date.meta_value >= '%3\$s')
563
  OR ( tribe_event_start.meta_value >= '%3\$s' AND tribe_event_start.meta_value <= '%4\$s')
564
  )
565
  ORDER BY DATE(tribe_event_start.meta_value) ASC, TIME(tribe_event_start.meta_value) ASC;",
599
  }
600
  break;
601
  }
 
 
 
602
  return $counts;
603
  }
604
 
lib/tribe-template-factory.class.php CHANGED
@@ -222,7 +222,7 @@ if( !class_exists('Tribe_Template_Factory') ) {
222
 
223
  // Search term based notices
224
  if ( ! empty($search_term) && ! have_posts() ) {
225
- TribeEvents::setNotice( 'event-search-no-results', sprintf( __( 'There were no results found for <strong>"%s"</strong>.', 'tribe-events-calendar' ), $search_term ) );
226
  }
227
 
228
  // Our various messages if there are no events for the query
@@ -232,9 +232,9 @@ if( !class_exists('Tribe_Template_Factory') ) {
232
  if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
233
  $cat = get_term_by( 'slug', get_query_var( 'term' ), $tribe_ecp->get_event_taxonomy() );
234
  if( tribe_is_upcoming() ) {
235
- $is_cat_message = sprintf( __( 'listed under %s. Check out past events for this category or view the full calendar.', 'tribe-events-calendar' ), $cat->name );
236
  } else if( tribe_is_past() ) {
237
- $is_cat_message = sprintf( __( 'listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar' ), $cat->name );
238
  }
239
  }
240
  if( tribe_is_day() ) {
222
 
223
  // Search term based notices
224
  if ( ! empty($search_term) && ! have_posts() ) {
225
+ TribeEvents::setNotice( 'event-search-no-results', sprintf( __( 'There were no results found for <strong>"%s"</strong>.', 'tribe-events-calendar' ), esc_html($search_term) ) );
226
  }
227
 
228
  // Our various messages if there are no events for the query
232
  if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
233
  $cat = get_term_by( 'slug', get_query_var( 'term' ), $tribe_ecp->get_event_taxonomy() );
234
  if( tribe_is_upcoming() ) {
235
+ $is_cat_message = sprintf( __( 'listed under %s. Check out past events for this category or view the full calendar.', 'tribe-events-calendar' ), esc_html($cat->name) );
236
  } else if( tribe_is_past() ) {
237
+ $is_cat_message = sprintf( __( 'listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar' ), esc_html($cat->name) );
238
  }
239
  }
240
  if( tribe_is_day() ) {
lib/tribe-templates.class.php CHANGED
@@ -289,13 +289,6 @@ if (!class_exists('TribeEventsTemplates')) {
289
 
290
  tribe_get_view();
291
 
292
- $after = tribe_get_option( 'tribeEventsAfterHTML' );
293
- $after = wptexturize( $after );
294
- $after = convert_chars( $after );
295
- $after = wpautop( $after );
296
- $after = shortcode_unautop( $after );
297
- $after = apply_filters( 'tribe_events_after_html', $after );
298
-
299
  echo tribe_events_after_html();
300
 
301
  $contents = ob_get_contents();
289
 
290
  tribe_get_view();
291
 
 
 
 
 
 
 
 
292
  echo tribe_events_after_html();
293
 
294
  $contents = ob_get_contents();
license.txt CHANGED
File without changes
public/advanced-functions/event.php CHANGED
File without changes
public/advanced-functions/organizer.php CHANGED
File without changes
public/advanced-functions/venue.php CHANGED
File without changes
public/template-tags/general.php CHANGED
@@ -408,7 +408,6 @@ if ( class_exists( 'TribeEvents' ) ) {
408
  $after = convert_chars( $after );
409
  $after = wpautop( $after );
410
  $after = '<div class="tribe-events-after-html">'. stripslashes( shortcode_unautop( $after ) ) .'</div>';
411
- $after = apply_filters( 'tribe_events_after_html', $after );
412
 
413
  echo apply_filters( 'tribe_events_after_html', $after );
414
  }
@@ -733,12 +732,6 @@ if ( class_exists( 'TribeEvents' ) ) {
733
  if ( is_numeric( $event ) )
734
  $event = get_post( $event );
735
 
736
- if ( !isset( $event->EventStartDate ) )
737
- $event->EventStartDate = tribe_get_start_date( $event );
738
-
739
- if ( !isset( $event->EventEndDate ) )
740
- $event->EventEndDate = tribe_get_end_date( $event );
741
-
742
  $format = '';
743
  $timeFormat = get_option( 'time_format' );
744
  $microformatStartFormat = tribe_get_start_date( $event, false, 'Y-m-dTh:i' );
@@ -770,53 +763,53 @@ if ( class_exists( 'TribeEvents' ) ) {
770
  // If the multi-day event begins and ends in the same month, just show the month once.
771
  if ( tribe_get_end_date( $event, false, 'm' ) === tribe_get_start_date( $event, false, 'm' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) {
772
  $schedule .= '<span class="date-start dtstart">';
773
- $schedule .= tribe_get_start_date( $event, true, $format );
774
- $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
775
  $schedule .= '</span> - ';
776
  $schedule .= '<span class="date-end dtend">';
777
- $schedule .= tribe_get_end_date( $event, true, $format2ndday );
778
- $schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
779
  $schedule .= '</span>';
780
  } else {
781
  $schedule .= '<span class="date-start dtstart">';
782
- $schedule .= tribe_get_start_date( $event, true, $format );
783
- $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
784
  $schedule .= '</span> - ';
785
  $schedule .= '<span class="date-end dtend">';
786
- $schedule .= tribe_get_end_date( $event, true, $format2ndday );
787
- $schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
788
  $schedule .= '</span>';
789
  }
790
  } else {
791
  $schedule .= '<span class="date-start dtstart">';
792
- $schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
793
- $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
794
  $schedule .= '</span> - ';
795
  $schedule .= '<span class="date-end dtend">';
796
- $schedule .= tribe_get_end_date( $event, false, $format2ndday ) . ' @ ' . tribe_get_end_date( $event, false, $timeFormat );
797
- $schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
798
  $schedule .= '</span>';
799
  }
800
 
801
 
802
  } elseif ( tribe_event_is_all_day( $event ) ) { // all day event
803
  $schedule .= '<span class="date-start dtstart">';
804
- $schedule .= tribe_get_start_date( $event, true, $format );
805
- $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
806
  $schedule .= '</span>';
807
  } else { // single day event
808
  if ( tribe_get_start_date( $event, false, 'g:i A' ) === tribe_get_end_date( $event, false, 'g:i A' ) ) { // Same start/end time
809
  $schedule .= '<span class="date-start dtstart">';
810
- $schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
811
- $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
812
  $schedule .= '</span>';
813
  } else { // defined start/end time
814
  $schedule .= '<span class="date-start dtstart">';
815
- $schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
816
- $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
817
  $schedule .= '</span> - ';
818
  $schedule .= '<span class="end-time dtend">';
819
- $schedule .= tribe_get_end_date( $event, false, $timeFormat ) . '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
820
  $schedule .= '</span>';
821
  }
822
  }
@@ -897,6 +890,7 @@ if ( class_exists( 'TribeEvents' ) ) {
897
  **/
898
  function tribe_events_the_notices( $echo = true ) {
899
  $notices = TribeEvents::getNotices();
 
900
  $html = !empty( $notices ) ? '<div class="tribe-events-notices"><ul><li>' . implode( '</li><li>', $notices ) . '</li></ul></div>' : '';
901
  $the_notices = apply_filters( 'tribe_events_the_notices', $html, $notices );
902
  if ( $echo ) {
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
  }
732
  if ( is_numeric( $event ) )
733
  $event = get_post( $event );
734
 
 
 
 
 
 
 
735
  $format = '';
736
  $timeFormat = get_option( 'time_format' );
737
  $microformatStartFormat = tribe_get_start_date( $event, false, 'Y-m-dTh:i' );
763
  // If the multi-day event begins and ends in the same month, just show the month once.
764
  if ( tribe_get_end_date( $event, false, 'm' ) === tribe_get_start_date( $event, false, 'm' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) {
765
  $schedule .= '<span class="date-start dtstart">';
766
+ $schedule .= tribe_get_start_date( $event, true, $format );
767
+ $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
768
  $schedule .= '</span> - ';
769
  $schedule .= '<span class="date-end dtend">';
770
+ $schedule .= tribe_get_end_date( $event, true, $format2ndday );
771
+ $schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
772
  $schedule .= '</span>';
773
  } else {
774
  $schedule .= '<span class="date-start dtstart">';
775
+ $schedule .= tribe_get_start_date( $event, true, $format );
776
+ $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
777
  $schedule .= '</span> - ';
778
  $schedule .= '<span class="date-end dtend">';
779
+ $schedule .= tribe_get_end_date( $event, true, $format2ndday );
780
+ $schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
781
  $schedule .= '</span>';
782
  }
783
  } else {
784
  $schedule .= '<span class="date-start dtstart">';
785
+ $schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
786
+ $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
787
  $schedule .= '</span> - ';
788
  $schedule .= '<span class="date-end dtend">';
789
+ $schedule .= tribe_get_end_date( $event, false, $format2ndday ) . ' @ ' . tribe_get_end_date( $event, false, $timeFormat );
790
+ $schedule .= '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
791
  $schedule .= '</span>';
792
  }
793
 
794
 
795
  } elseif ( tribe_event_is_all_day( $event ) ) { // all day event
796
  $schedule .= '<span class="date-start dtstart">';
797
+ $schedule .= tribe_get_start_date( $event, true, $format );
798
+ $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
799
  $schedule .= '</span>';
800
  } else { // single day event
801
  if ( tribe_get_start_date( $event, false, 'g:i A' ) === tribe_get_end_date( $event, false, 'g:i A' ) ) { // Same start/end time
802
  $schedule .= '<span class="date-start dtstart">';
803
+ $schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
804
+ $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
805
  $schedule .= '</span>';
806
  } else { // defined start/end time
807
  $schedule .= '<span class="date-start dtstart">';
808
+ $schedule .= tribe_get_start_date( $event, false, $format ) . ' @ ' . tribe_get_start_date( $event, false, $timeFormat );
809
+ $schedule .= '<span class="value-title" title="'. $microformatStartFormat .'"></span>';
810
  $schedule .= '</span> - ';
811
  $schedule .= '<span class="end-time dtend">';
812
+ $schedule .= tribe_get_end_date( $event, false, $timeFormat ) . '<span class="value-title" title="'. $microformatEndFormat .'"></span>';
813
  $schedule .= '</span>';
814
  }
815
  }
890
  **/
891
  function tribe_events_the_notices( $echo = true ) {
892
  $notices = TribeEvents::getNotices();
893
+
894
  $html = !empty( $notices ) ? '<div class="tribe-events-notices"><ul><li>' . implode( '</li><li>', $notices ) . '</li></ul></div>' : '';
895
  $the_notices = apply_filters( 'tribe_events_the_notices', $html, $notices );
896
  if ( $echo ) {
public/template-tags/meta.php CHANGED
@@ -408,11 +408,14 @@ if ( class_exists('TribeEvents') ) {
408
 
409
  if ( ! $skeleton_mode && $group_venue ) {
410
  // If there's a venue map and custom fields or organizer, show venue details in this seperate section
 
 
411
 
412
- $html .= apply_filters( 'tribe_events_single_event_the_meta_venue_row', sprintf( '<div class="tribe-events-single-section tribe-events-event-meta tribe-clearfix">%s%s</div>',
413
- tribe_get_meta_group( 'tribe_event_venue' ),
414
- tribe_get_meta( 'tribe_venue_map' )
415
  ) );
 
416
  }
417
  return apply_filters( 'tribe_events_single_event_meta', $html );
418
  }
408
 
409
  if ( ! $skeleton_mode && $group_venue ) {
410
  // If there's a venue map and custom fields or organizer, show venue details in this seperate section
411
+ $venue_details = tribe_get_meta_group( 'tribe_event_venue' ) .
412
+ tribe_get_meta( 'tribe_venue_map' );
413
 
414
+ if ( !empty($venue_details) ) {
415
+ $html .= apply_filters( 'tribe_events_single_event_the_meta_venue_row', sprintf( '<div class="tribe-events-single-section tribe-events-event-meta tribe-clearfix">%s</div>',
416
+ $venue_details
417
  ) );
418
+ }
419
  }
420
  return apply_filters( 'tribe_events_single_event_meta', $html );
421
  }
public/template-tags/options.php CHANGED
File without changes
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === The Events Calendar ===
2
 
3
- Contributors: ModernTribe, PaulHughes01, roblagatta, jonahcoyote, MZAWeb, codearachnid, ryancurban, leahkoerper, barryhughes, 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
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -105,16 +105,15 @@ If you're unclear about the installation process or get stuck, check out our <a
105
  2. List View
106
  3. Single Event
107
  4. Event Category
108
- 5. Event Venue and Organizer Editor
109
- 6. Event Website and Cost Fields
110
- 7. Events Admin Listing
111
- 8. General Settings
112
- 9. Map and Miscellaneous Settings
113
- 10. Display Settings
114
- 11. Event Menu Items
115
- 12. Events Widget
116
- 13. Month View with Classic Header
117
- 14. Month View with Full Styles
118
 
119
 
120
  == Frequently Asked Questions ==
@@ -194,6 +193,7 @@ The plugin is produced by <a href="http://m.tri.be/2s">Modern Tribe Inc</a>.
194
  * <a href="http://profiles.wordpress.org/users/kyleunzicker">Kyle Unzicker</a>
195
  * <a href="http://profiles.wordpress.org/users/jazbek">Jessica Yazbek</a>
196
  * <a href="http://profiles.wordpress.org/users/jbrinley">Jonathan Brinley</a>
 
197
  * <a href="http://profiles.wordpress.org/users/leahkoerper">Leah Koerper</a>
198
  * <a href="http://profiles.wordpress.org/users/peterchester">Peter Chester</a>
199
  * <a href="http://profiles.wordpress.org/users/reid.peifer">Reid Peifer</a>
@@ -255,6 +255,22 @@ Our Premium Plugins:
255
 
256
  == Changelog ==
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  = 3.0 =
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>
@@ -288,7 +304,11 @@ Still not happy? Shoot us an email to pro@tri.be or tweet to @moderntribeinc and
288
 
289
  = 3.0 =
290
 
291
- 3.0 is a HUGE upgrade from The Events Calendar 2.0.x. If you're upgrading from 1.6.5 or any release between 2.0 and 2.0.10, make sure to upgrade to The Events Calendar 2.0.11 first. If you're upgrading from The Events Calendar 2.0.11, please back up your data BEFORE initiating, and be prepared to manually update your customizations based on changes to the plugin's tempting structure.
 
 
 
 
292
 
293
  = 2.0.9 =
294
 
1
  === The Events Calendar ===
2
 
3
+ Contributors: ModernTribe, PaulHughes01, roblagatta, jonahcoyote, MZAWeb, codearachnid, ryancurban, faction23, jazbek, kyleunzicker, leahkoerper, barryhughes, 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.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
105
  2. List View
106
  3. Single Event
107
  4. Event Category
108
+ 5. Event Editor
109
+ 6. Events Admin Listing
110
+ 7. General Settings
111
+ 8. Map and Miscellaneous Settings
112
+ 9. Display Settings
113
+ 10. Event Menu Items
114
+ 11. Events Widget
115
+ 12. Month View with Classic Header
116
+ 13. Month View with Full Styles
 
117
 
118
 
119
  == Frequently Asked Questions ==
193
  * <a href="http://profiles.wordpress.org/users/kyleunzicker">Kyle Unzicker</a>
194
  * <a href="http://profiles.wordpress.org/users/jazbek">Jessica Yazbek</a>
195
  * <a href="http://profiles.wordpress.org/users/jbrinley">Jonathan Brinley</a>
196
+ * <a href="http://profiles.wordpress.org/users/faction23">Samuel Estok</a>
197
  * <a href="http://profiles.wordpress.org/users/leahkoerper">Leah Koerper</a>
198
  * <a href="http://profiles.wordpress.org/users/peterchester">Peter Chester</a>
199
  * <a href="http://profiles.wordpress.org/users/reid.peifer">Reid Peifer</a>
255
 
256
  == Changelog ==
257
 
258
+ = IMPORTANT NOTICE =
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.1 =
263
+
264
+ * Added setting for number of events per day on month view (under Events > Settings > Display)
265
+ * Fixed an issue with the venue migration tool (thanks to ADAM for the heads up!)
266
+ * Fixed bug with events not showing up on past view & related duration issues (thanks to MY-WEB and GOLFDAWGG for the heads up!)
267
+ * Fixed bug where subscribers could add events
268
+ * Fixed bug when WordPress is installed in a subdirectory (thanks to DAVID for catching this!)
269
+ * Fixed display issues with Events Calendar sidebar (thanks to JNORRIS235 for catching this!)
270
+ * Miscellaneous widget enhancements
271
+ * Miscellaneous bug fixes
272
+ * Various security fixes (thanks to HARRY METCALFE for his helpful feedback)
273
+
274
  = 3.0 =
275
 
276
  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>
304
 
305
  = 3.0 =
306
 
307
+ 1. Version 3.0 is a HUGE upgrade from The Events Calendar 2.0.x! Please back up your data BEFORE upgrading!
308
+
309
+ 2. If you have any Events theme customizations, you should test this upgrade on a development server before updating your live site.
310
+
311
+ 3. If you're upgrading from 1.6.5 or any release between 2.0 and 2.0.10, make sure to upgrade to The Events Calendar 2.0.11 first.
312
 
313
  = 2.0.9 =
314
 
resources/app-shop.js CHANGED
File without changes
resources/debugger.css CHANGED
File without changes
resources/events-admin.js CHANGED
@@ -400,7 +400,7 @@ jQuery(document).ready(function($) {
400
  * credits: http://www.johngadbois.com/adding-your-own-callbacks-to-wordpress-ajax-requests/
401
  */
402
  jQuery(document).ajaxSuccess(function(e, xhr, settings) {
403
- if(settings.data.search('action=save-widget') != -1) {
404
  jQuery("#widgets-right .chosen").chosen();
405
  }
406
  });
400
  * credits: http://www.johngadbois.com/adding-your-own-callbacks-to-wordpress-ajax-requests/
401
  */
402
  jQuery(document).ajaxSuccess(function(e, xhr, settings) {
403
+ if(typeof settings !== 'undefined' && typeof settings.data !== 'undefined' && settings.data.search('action=save-widget') != -1) {
404
  jQuery("#widgets-right .chosen").chosen();
405
  }
406
  });
resources/events-admin.min.js CHANGED
@@ -1,17 +1,17 @@
1
- jQuery(document).ready(function(a){function f(b){"US"==b||"United States"==b?(a("#StateProvinceSelect_chzn").show(),a("#StateProvinceText").hide()):(""!=b?a("#StateProvinceText").show():a("#StateProvinceText").hide(),a("#StateProvinceSelect_chzn").hide())}function g(){return"true"==a('[name="is_recurring"]').val()&&!a('[name="recurrence_action"]').val()&&!a('[name="recurrence_action"]').val()}a(".chosen, .tribe-field-dropdown_chosen select").chosen();a(".select2, .tribe-field-dropdown_select2 select").select2({width:"250px"});
2
  if(a('select[name="tribeEventsTemplate"]').length&&""===a('select[name="tribeEventsTemplate"]').val()){$templates=a('select[name="tribeEventsTemplate"]');var d=$templates.find("option:selected").text();$templates.prev(".select2-container").children().children("span").text(d)}a(".hide-if-js").hide();if("undefined"!=typeof TEC){d={dateFormat:"yy-mm-dd",showAnim:"fadeIn",changeMonth:!0,changeYear:!0,numberOfMonths:3,showButtonPanel:!0,onSelect:function(b){var c="EventStartDate"==this.id?"minDate":"maxDate",
3
  d=a(this).data("datepicker");b=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);n.not(this).not("#recurrence_end").datepicker("option",c,b)}};a.extend(d,TEC);var n=a("#EventStartDate, #EventEndDate, .datepicker").datepicker(d),l=function(){!0===a("#allDayCheckbox").prop("checked")?(a(".timeofdayoptions").hide(),a("#EventTimeFormatDiv").hide()):(a(".timeofdayoptions").show(),a("#EventTimeFormatDiv").show())};a("#allDayCheckbox").click(function(){l()});l();
4
  var m=[29,31,28,31,30,31,30,31,31,30,31,30,31],p=[a("#28StartDays"),a("#29StartDays"),a("#30StartDays"),a("#31StartDays")],q=[a("#28EndDays"),a("#29EndDays"),a("#30EndDays"),a("#31EndDays")];a("select[name='EventStartMonth'], select[name='EventEndMonth']").change(function(){var b=a(this),c=b.attr("name"),c="EventStartMonth"==c?"Start":"End",b=b.attr("value");"0"==b.charAt(0)&&(b=b.replace("0",""));var d=a("select[name='Event"+c+"Year']").attr("value")%4;2==b&&0==d&&(b=0);d=a("select[name='Event"+
5
  c+"Day']");a(".event"+c+"DateField").remove();"Start"==c?(c=p[m[b]-28],c.val(d.val()),a("select[name='EventStartMonth']").after(c)):(c=q[m[b]-28],c.val(d.val()),a('select[name="EventEndMonth"]').after(c))});a("select[name='EventStartMonth'], select[name='EventEndMonth']").change();a("select[name='EventStartYear']").change(function(){a("select[name='EventStartMonth']").change()});a("select[name='EventEndYear']").change(function(){a("select[name='EventEndMonth']").change()});a("form[name='post']").submit(function(){!0===
6
- a("#isEventNo").attr("checked")||a("#isEventNo").attr("checked");return!0});var k=a(".venue"),d=a("#saved_venue");0<d.size()&&("0"!=d.val()&&!a(".nosaved").get(0))&&(k.hide(),a('[name="venue[Venue]"]').val(""));d.change(function(){"0"==a(this).val()?(k.fadeIn(),a("#EventCountry").val(0).trigger("liszt:updated"),a("#StateProvinceSelect").val(0).trigger("liszt:updated"),f("")):k.fadeOut()});var h=a(".organizer"),d=a("#saved_organizer");0<d.size()&&("0"!=d.val()&&!a(".nosaved_organizer").get(0))&&(h.hide(),
7
- a("input",h).val(""));d.change(function(){"0"==a(this).val()?h.fadeIn():h.fadeOut()})}f(a("#EventCountry > option:selected").val());a("#EventCountry").change(function(){var b=a(this).find("option:selected").val();f(b)});"true"==a('[name="is_recurring"]').val()&&!a('[name="recurrence_action"]').val()&&(d=function(){a("#recurrence-changed-row").show();a('[name="recurrence_action"]').val(2)},a(".recurrence-row input, .custom-recurrence-row input,.recurrence-row select, .custom-recurrence-row select").change(d),
8
  a('[name="recurrence[end]"]').datepicker("option","onSelect",d));a('[name="recurrence[end]"]').datepicker("option","onSelect",function(){a('[name="recurrence[end]"]').removeClass("placeholder")});a(".wp-admin.events-cal.edit-php #doaction").click(function(b){if("trash"==a("[name='action'] option:selected").val())if(confirm("Are you sure you want to trash all occurrences of these events? All recurrence data will be lost.")){var c=[];a('[name="post[]"]:checked').each(function(){var b=a(this).val();
9
- c[b]&&a(this).prop("checked",!1);c[b]=!0})}else b.preventDefault()});a("#EventInfo input, #EventInfo select").change(function(){a(".rec-error").hide()});var e=a('.wp-admin.events-cal #post #publishing-action input[type="submit"]');e.click(function(b){a(this).data("clicked",!0)});a(".wp-admin.events-cal #post").submit(function(b){var c=a(this);g()&&(b.preventDefault(),a("#recurring-dialog").dialog({modal:!0,buttons:[{text:"Only This Event",click:function(){a('[name="recurrence_action"]').val(3);e.data("clicked")&&
10
- a('<input type="hidden" name="'+e.attr("name")+'" value="'+e.val()+'"/>').appendTo(c);a(this).dialog("close");c.submit()}},{text:"All Events",click:function(){a('[name="recurrence_action"]').val(2);e.data("clicked")&&a('<input type="hidden" name="'+e.attr("name")+'" value="'+e.val()+'"/>').appendTo(c);a(this).dialog("close");c.submit()}}],close:function(){e.data("clicked",null)}}))});a(".wp-admin.events-cal .submitdelete").click(function(b){var c=a(this);g()&&(b.preventDefault(),a("#deletion-dialog").dialog({modal:!0,
11
  buttons:[{text:"Only This Event",click:function(){document.location=c.attr("href")+"&event_start="+a(this).data("start")}},{text:"All Events",click:function(){document.location=c.attr("href")+"&deleteAll"}}]}))});a('[name="recurrence[type]"]').change(function(){var b=a(this).find("option:selected").val();a(".custom-recurrence-row").hide();"Custom"==b?(a("#recurrence-end").show(),a("#custom-recurrence-frequency").show(),a('[name="recurrence[custom-type]"]').change()):("None"==b?a("#recurrence-end").hide():
12
  a("#recurrence-end").show(),a("#custom-recurrence-frequency").hide())});a('[name="recurrence[end-type]"]').change(function(){"On"==a(this).find("option:selected").val()?(a("#rec-count").hide(),a("#recurrence_end").show()):(a("#recurrence_end").hide(),a("#rec-count").show())});a('[name="recurrence[custom-type]"]').change(function(){a(".custom-recurrence-row").hide();var b=a(this).find("option:selected"),c=b.data("tablerow");a(c).show();a("#recurrence-interval-type").text(b.data("plural"));a('[name="recurrence[custom-type-text]"]').val(b.data("plural"))});
13
  a("#recurrence_end_count").change(function(){a('[name="recurrence[type]"]').change()});a('[name="recurrence[type]"]').change(function(){var b=a(this).find("option:selected"),c=a("#recurrence_end_count").val();a("#occurence-count-text").text(1==c?b.data("single"):b.data("plural"));a('[name="recurrence[occurrence-count-text]"]').val(a("#occurence-count-text").text())});a('[name="recurrence[custom-month-number]"]').change(function(){var b=a(this).find("option:selected"),c=a('[name="recurrence[custom-month-day]"]');
14
  isNaN(b.val())?c.show():c.hide()});a("#icon-edit").hasClass("icon32-posts-tribe_venue")&&a("#menu-posts-tribe_events, #menu-posts-tribe_events a.wp-has-submenu").addClass("wp-menu-open wp-has-current-submenu").removeClass("wp-not-current-submenu").find("li:contains('Venues')").addClass("current");a("#icon-edit").hasClass("icon32-posts-tribe_organizer")&&a("#menu-posts-tribe_events, #menu-posts-tribe_events a.wp-has-submenu").addClass("wp-menu-open wp-has-current-submenu").removeClass("wp-not-current-submenu").find("li:contains('Organizers')").addClass("current");
15
  if(a("#tribe-field-tribeEnableViews").length)a("#tribe-field-tribeEnableViews").on("change","input:checkbox",function(){reset_val=!1;1>jQuery('[name="tribeEnableViews[]"]:checked').size()?(a(this).attr("checked",!0),a("#tribe-field-tribeEnableViews .tribe-field-wrap p.description").css("color","red")):a("#tribe-field-tribeEnableViews .tribe-field-wrap p.description").removeAttr("style");a('select[name="viewOption"] option').each(function(b,c){option_val=a(this).val();a("#tribe-field-tribeEnableViews input[value="+
16
  option_val+"]").is(":checked")?a(this).prop("disabled",!1):(a(this).removeProp("selected"),a(this).prop("disabled",!0))});views=[];a('[name="tribeEnableViews[]"]:checked').each(function(){views.push(a(this).val())});("undefined"==typeof a('select[name="viewOption"] option:selected').first().val()||!a.inArray(a('select[name="viewOption"] option:selected').first().val(),views))&&a('select[name="viewOption"] option').not(":disabled").first().attr("selected","selected");a('select[name="viewOption"]').trigger("change")})});
17
- jQuery(document).ajaxSuccess(function(a,f,g){-1!=g.data.search("action=save-widget")&&jQuery("#widgets-right .chosen").chosen()});
1
+ jQuery(document).ready(function(a){function g(b){"US"==b||"United States"==b?(a("#StateProvinceSelect_chzn").show(),a("#StateProvinceText").hide()):(""!=b?a("#StateProvinceText").show():a("#StateProvinceText").hide(),a("#StateProvinceSelect_chzn").hide())}function f(){return"true"==a('[name="is_recurring"]').val()&&!a('[name="recurrence_action"]').val()&&!a('[name="recurrence_action"]').val()}a(".chosen, .tribe-field-dropdown_chosen select").chosen();a(".select2, .tribe-field-dropdown_select2 select").select2({width:"250px"});
2
  if(a('select[name="tribeEventsTemplate"]').length&&""===a('select[name="tribeEventsTemplate"]').val()){$templates=a('select[name="tribeEventsTemplate"]');var d=$templates.find("option:selected").text();$templates.prev(".select2-container").children().children("span").text(d)}a(".hide-if-js").hide();if("undefined"!=typeof TEC){d={dateFormat:"yy-mm-dd",showAnim:"fadeIn",changeMonth:!0,changeYear:!0,numberOfMonths:3,showButtonPanel:!0,onSelect:function(b){var c="EventStartDate"==this.id?"minDate":"maxDate",
3
  d=a(this).data("datepicker");b=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);n.not(this).not("#recurrence_end").datepicker("option",c,b)}};a.extend(d,TEC);var n=a("#EventStartDate, #EventEndDate, .datepicker").datepicker(d),l=function(){!0===a("#allDayCheckbox").prop("checked")?(a(".timeofdayoptions").hide(),a("#EventTimeFormatDiv").hide()):(a(".timeofdayoptions").show(),a("#EventTimeFormatDiv").show())};a("#allDayCheckbox").click(function(){l()});l();
4
  var m=[29,31,28,31,30,31,30,31,31,30,31,30,31],p=[a("#28StartDays"),a("#29StartDays"),a("#30StartDays"),a("#31StartDays")],q=[a("#28EndDays"),a("#29EndDays"),a("#30EndDays"),a("#31EndDays")];a("select[name='EventStartMonth'], select[name='EventEndMonth']").change(function(){var b=a(this),c=b.attr("name"),c="EventStartMonth"==c?"Start":"End",b=b.attr("value");"0"==b.charAt(0)&&(b=b.replace("0",""));var d=a("select[name='Event"+c+"Year']").attr("value")%4;2==b&&0==d&&(b=0);d=a("select[name='Event"+
5
  c+"Day']");a(".event"+c+"DateField").remove();"Start"==c?(c=p[m[b]-28],c.val(d.val()),a("select[name='EventStartMonth']").after(c)):(c=q[m[b]-28],c.val(d.val()),a('select[name="EventEndMonth"]').after(c))});a("select[name='EventStartMonth'], select[name='EventEndMonth']").change();a("select[name='EventStartYear']").change(function(){a("select[name='EventStartMonth']").change()});a("select[name='EventEndYear']").change(function(){a("select[name='EventEndMonth']").change()});a("form[name='post']").submit(function(){!0===
6
+ a("#isEventNo").attr("checked")||a("#isEventNo").attr("checked");return!0});var k=a(".venue"),d=a("#saved_venue");0<d.size()&&("0"!=d.val()&&!a(".nosaved").get(0))&&(k.hide(),a('[name="venue[Venue]"]').val(""));d.change(function(){"0"==a(this).val()?(k.fadeIn(),a("#EventCountry").val(0).trigger("liszt:updated"),a("#StateProvinceSelect").val(0).trigger("liszt:updated"),g("")):k.fadeOut()});var h=a(".organizer"),d=a("#saved_organizer");0<d.size()&&("0"!=d.val()&&!a(".nosaved_organizer").get(0))&&(h.hide(),
7
+ a("input",h).val(""));d.change(function(){"0"==a(this).val()?h.fadeIn():h.fadeOut()})}g(a("#EventCountry > option:selected").val());a("#EventCountry").change(function(){var b=a(this).find("option:selected").val();g(b)});"true"==a('[name="is_recurring"]').val()&&!a('[name="recurrence_action"]').val()&&(d=function(){a("#recurrence-changed-row").show();a('[name="recurrence_action"]').val(2)},a(".recurrence-row input, .custom-recurrence-row input,.recurrence-row select, .custom-recurrence-row select").change(d),
8
  a('[name="recurrence[end]"]').datepicker("option","onSelect",d));a('[name="recurrence[end]"]').datepicker("option","onSelect",function(){a('[name="recurrence[end]"]').removeClass("placeholder")});a(".wp-admin.events-cal.edit-php #doaction").click(function(b){if("trash"==a("[name='action'] option:selected").val())if(confirm("Are you sure you want to trash all occurrences of these events? All recurrence data will be lost.")){var c=[];a('[name="post[]"]:checked').each(function(){var b=a(this).val();
9
+ c[b]&&a(this).prop("checked",!1);c[b]=!0})}else b.preventDefault()});a("#EventInfo input, #EventInfo select").change(function(){a(".rec-error").hide()});var e=a('.wp-admin.events-cal #post #publishing-action input[type="submit"]');e.click(function(b){a(this).data("clicked",!0)});a(".wp-admin.events-cal #post").submit(function(b){var c=a(this);f()&&(b.preventDefault(),a("#recurring-dialog").dialog({modal:!0,buttons:[{text:"Only This Event",click:function(){a('[name="recurrence_action"]').val(3);e.data("clicked")&&
10
+ a('<input type="hidden" name="'+e.attr("name")+'" value="'+e.val()+'"/>').appendTo(c);a(this).dialog("close");c.submit()}},{text:"All Events",click:function(){a('[name="recurrence_action"]').val(2);e.data("clicked")&&a('<input type="hidden" name="'+e.attr("name")+'" value="'+e.val()+'"/>').appendTo(c);a(this).dialog("close");c.submit()}}],close:function(){e.data("clicked",null)}}))});a(".wp-admin.events-cal .submitdelete").click(function(b){var c=a(this);f()&&(b.preventDefault(),a("#deletion-dialog").dialog({modal:!0,
11
  buttons:[{text:"Only This Event",click:function(){document.location=c.attr("href")+"&event_start="+a(this).data("start")}},{text:"All Events",click:function(){document.location=c.attr("href")+"&deleteAll"}}]}))});a('[name="recurrence[type]"]').change(function(){var b=a(this).find("option:selected").val();a(".custom-recurrence-row").hide();"Custom"==b?(a("#recurrence-end").show(),a("#custom-recurrence-frequency").show(),a('[name="recurrence[custom-type]"]').change()):("None"==b?a("#recurrence-end").hide():
12
  a("#recurrence-end").show(),a("#custom-recurrence-frequency").hide())});a('[name="recurrence[end-type]"]').change(function(){"On"==a(this).find("option:selected").val()?(a("#rec-count").hide(),a("#recurrence_end").show()):(a("#recurrence_end").hide(),a("#rec-count").show())});a('[name="recurrence[custom-type]"]').change(function(){a(".custom-recurrence-row").hide();var b=a(this).find("option:selected"),c=b.data("tablerow");a(c).show();a("#recurrence-interval-type").text(b.data("plural"));a('[name="recurrence[custom-type-text]"]').val(b.data("plural"))});
13
  a("#recurrence_end_count").change(function(){a('[name="recurrence[type]"]').change()});a('[name="recurrence[type]"]').change(function(){var b=a(this).find("option:selected"),c=a("#recurrence_end_count").val();a("#occurence-count-text").text(1==c?b.data("single"):b.data("plural"));a('[name="recurrence[occurrence-count-text]"]').val(a("#occurence-count-text").text())});a('[name="recurrence[custom-month-number]"]').change(function(){var b=a(this).find("option:selected"),c=a('[name="recurrence[custom-month-day]"]');
14
  isNaN(b.val())?c.show():c.hide()});a("#icon-edit").hasClass("icon32-posts-tribe_venue")&&a("#menu-posts-tribe_events, #menu-posts-tribe_events a.wp-has-submenu").addClass("wp-menu-open wp-has-current-submenu").removeClass("wp-not-current-submenu").find("li:contains('Venues')").addClass("current");a("#icon-edit").hasClass("icon32-posts-tribe_organizer")&&a("#menu-posts-tribe_events, #menu-posts-tribe_events a.wp-has-submenu").addClass("wp-menu-open wp-has-current-submenu").removeClass("wp-not-current-submenu").find("li:contains('Organizers')").addClass("current");
15
  if(a("#tribe-field-tribeEnableViews").length)a("#tribe-field-tribeEnableViews").on("change","input:checkbox",function(){reset_val=!1;1>jQuery('[name="tribeEnableViews[]"]:checked').size()?(a(this).attr("checked",!0),a("#tribe-field-tribeEnableViews .tribe-field-wrap p.description").css("color","red")):a("#tribe-field-tribeEnableViews .tribe-field-wrap p.description").removeAttr("style");a('select[name="viewOption"] option').each(function(b,c){option_val=a(this).val();a("#tribe-field-tribeEnableViews input[value="+
16
  option_val+"]").is(":checked")?a(this).prop("disabled",!1):(a(this).removeProp("selected"),a(this).prop("disabled",!0))});views=[];a('[name="tribeEnableViews[]"]:checked').each(function(){views.push(a(this).val())});("undefined"==typeof a('select[name="viewOption"] option:selected').first().val()||!a.inArray(a('select[name="viewOption"] option:selected').first().val(),views))&&a('select[name="viewOption"] option').not(":disabled").first().attr("selected","selected");a('select[name="viewOption"]').trigger("change")})});
17
+ jQuery(document).ajaxSuccess(function(a,g,f){"undefined"!==typeof f&&("undefined"!==typeof f.data&&-1!=f.data.search("action=save-widget"))&&jQuery("#widgets-right .chosen").chosen()});
resources/jquery-ecp-plugins.js CHANGED
File without changes
resources/tickets.js CHANGED
@@ -1,319 +1,327 @@
1
- jQuery( document ).ready( function ( $ ) {
2
-
3
-
4
- var datepickerOpts = {
5
- dateFormat:'yy-mm-dd',
6
- showAnim:'fadeIn',
7
- changeMonth:true,
8
- changeYear:true,
9
- numberOfMonths:3,
10
- showButtonPanel:true,
11
- onChange:function () {
12
- alert( 'lala' );
13
- },
14
- onSelect:function (dateText, inst) {
15
- var the_date = $.datepicker.parseDate('yy-mm-dd', dateText);
16
- if (inst.id === "ticket_start_date") {
17
- $("#ticket_end_date").datepicker('option', 'minDate', the_date)
18
- } else {
19
- $("#ticket_start_date").datepicker('option', 'maxDate', the_date)
20
 
21
- }
22
- }
23
- };
24
 
 
25
 
26
- $("#ticket_start_date").datepicker(datepickerOpts).keyup(function (e) {
27
- if (e.keyCode == 8 || e.keyCode == 46) {
28
- $.datepicker._clearDate(this);
29
- }
30
- });
31
- $("#ticket_end_date").datepicker(datepickerOpts).keyup(function (e) {
32
- if (e.keyCode == 8 || e.keyCode == 46) {
33
- $.datepicker._clearDate(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
- });
36
 
37
- /* Show the advanced metabox for the selected provider and hide the others on selection change */
38
- $( 'input[name=ticket_provider]:radio' ).change( function () {
39
- $( 'tr.ticket_advanced' ).hide();
40
- $( 'tr.ticket_advanced_' + this.value ).show();
41
- } );
42
-
43
- /* Show the advanced metabox for the selected provider and hide the others at ready */
44
- $( 'input[name=ticket_provider]:checked' ).each( function () {
45
- $( 'tr.ticket_advanced' ).hide();
46
- $( 'tr.ticket_advanced_' + this.value ).show();
47
- } );
48
-
49
- /* "Add a ticket" link action */
50
- $( 'a#ticket_form_toggle' ).click( function ( e ) {
51
- $( 'h4.ticket_form_title_edit' ).hide();
52
- $( 'h4.ticket_form_title_add' ).show();
53
- $( this ).hide();
54
- ticket_clear_form();
55
- $( '#ticket_form' ).show();
56
- $( 'html, body' ).animate( {
57
- scrollTop:$( "#ticket_form_table" ).offset().top - 50
58
- }, 500 );
59
- e.preventDefault();
60
- } );
61
-
62
- /* "Cancel" button action */
63
- $( '#ticket_form_cancel' ).click( function () {
64
-
65
- ticket_clear_form();
66
-
67
- $( 'html, body' ).animate( {
68
- scrollTop:$( "#event_tickets" ).offset().top - 50
69
- }, 500 );
70
-
71
- } );
72
-
73
- /* "Save Ticket" button action */
74
- $( '#ticket_form_save' ).click( function () {
75
-
76
- tickets_start_spin();
77
-
78
- var params = {
79
- action:'tribe-ticket-add-' + $( 'input[name=ticket_provider]:checked' ).val(),
80
- formdata:$( '.ticket_field' ).serialize(),
81
- post_ID:$( '#post_ID' ).val(),
82
- nonce:TribeTickets.add_ticket_nonce
83
- };
84
 
85
- $.post(
86
- ajaxurl,
87
- params,
88
- function ( response ) {
89
- if ( response.success ) {
90
- ticket_clear_form();
91
- $( 'td.ticket_list_container' ).empty().html( response.data );
92
- }
 
 
93
  },
94
- 'json'
95
- ).complete( function () {
96
- $( 'html, body' ).animate( {
97
- scrollTop:$( "#event_tickets" ).offset().top - 50
98
- }, 500 );
 
99
 
100
- tickets_stop_spin();
101
- } );
 
102
 
103
- } );
104
 
105
- /* "Delete Ticket" link action */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- $( '#tribetickets' ).on( 'click', '.ticket_delete', function ( e ) {
 
108
 
109
- e.preventDefault();
110
 
111
- tickets_start_spin();
112
 
113
- var params = {
114
- action:'tribe-ticket-delete-' + $( this ).attr( "attr-provider" ),
115
- post_ID:$( '#post_ID' ).val(),
116
- ticket_id:$( this ).attr( "attr-ticket-id" ),
117
- nonce:TribeTickets.remove_ticket_nonce
118
- };
119
 
120
- $.post(
121
- ajaxurl,
122
- params,
123
- function ( response ) {
124
 
125
- if ( response.success ) {
126
- ticket_clear_form();
127
- $( 'td.ticket_list_container' ).empty().html( response.data );
128
- }
129
- },
130
- 'json'
131
- ).complete( function () {
132
- tickets_stop_spin();
133
- } );
134
 
 
 
 
 
 
 
135
 
136
- } );
 
 
 
137
 
138
- /* "Edit Ticket" link action */
 
 
 
 
 
 
 
 
139
 
140
- $( '#tribetickets' ).on( 'click', '.ticket_edit', function ( e ) {
141
 
142
- e.preventDefault();
143
 
144
- $( 'h4.ticket_form_title_edit' ).show();
145
- $( 'h4.ticket_form_title_add' ).hide();
146
 
 
 
147
 
148
- tickets_start_spin();
149
 
150
- var params = {
151
- action:'tribe-ticket-edit-' + $( this ).attr( "attr-provider" ),
152
- post_ID:$( '#post_ID' ).val(),
153
- ticket_id:$( this ).attr( "attr-ticket-id" ),
154
- nonce:TribeTickets.edit_ticket_nonce
155
- };
156
 
157
- $.post(
158
- ajaxurl,
159
- params,
160
- function ( response ) {
161
- ticket_clear_form();
162
-
163
- $( '#ticket_id' ).val( response.data.ID );
164
- $( '#ticket_name' ).val( response.data.name );
165
- $( '#ticket_description' ).val( response.data.description );
166
- $( '#ticket_price' ).val( response.data.price );
167
-
168
- $( '#ticket_start_date' ).val( response.data.start_date.substring( 0, 10 ) );
169
- $( '#ticket_end_date' ).val( response.data.end_date.substring( 0, 10 ) );
170
-
171
- if ( response.data.start_date ) {
172
- var start_hour = response.data.start_date.substring( 11, 13 );
173
- var start_meridian = 'am';
174
- if ( parseInt( start_hour ) > 12 ) {
175
- start_meridian = 'pm';
176
- start_hour = parseInt( start_hour ) - 12;
177
- start_hour = ("0" + start_hour).slice( -2 );
178
- }
179
- if ( parseInt( start_hour ) === 12 ) {
180
- start_meridian = 'pm';
181
- }
182
 
183
- $( '#ticket_start_hour' ).val( start_hour );
184
- $( '#ticket_start_meridian' ).val( start_meridian );
185
- }
186
 
187
- if ( response.data.end_date ) {
 
 
 
 
 
188
 
189
- var end_hour = response.data.end_date.substring( 11, 13 );
190
- var end_meridian = 'am';
191
- if ( parseInt( end_hour ) > 12 ) {
192
- end_meridian = 'pm';
193
- end_hour = parseInt( end_hour ) - 12;
194
- end_hour = ("0" + end_hour).slice( -2 );
195
- }
196
- if ( parseInt( end_hour ) === 12 ) {
197
- end_meridian = 'pm';
198
- }
199
 
200
- $( '#ticket_end_hour' ).val( end_hour );
201
- $( '#ticket_end_meridian' ).val( end_meridian );
 
 
202
 
203
- $( '#ticket_start_minute' ).val( response.data.start_date.substring( 14, 16 ) );
204
- $( '#ticket_end_minute' ).val( response.data.end_date.substring( 14, 16 ) );
205
- }
206
 
207
- $( 'tr.ticket_advanced_' + response.data.provider_class ).remove();
208
- $( 'tr.ticket.bottom' ).before( response.data.advanced_fields );
 
 
 
 
 
 
 
 
 
209
 
210
- $( 'input:radio[name=ticket_provider]' ).filter( '[value=' + response.data.provider_class + ']' ).click();
 
 
211
 
212
- $( 'a#ticket_form_toggle' ).hide();
213
- $( '#ticket_form' ).show();
214
 
215
- },
216
- 'json'
217
- ).complete( function () {
218
- $( 'html, body' ).animate( {
219
- scrollTop:$( "#ticket_form_table" ).offset().top - 50
220
- }, 500 );
 
 
 
 
221
 
222
- tickets_stop_spin();
223
- } );
224
 
 
 
 
225
 
226
- } );
 
227
 
 
228
 
229
- ticketHeaderImage = {
 
230
 
231
- // Call this from the upload button to initiate the upload frame.
232
- uploader:function () {
 
 
 
 
233
 
234
- var frame = wp.media( {
235
- title : HeaderImageData.title,
236
- multiple:false,
237
- library :{ type:'image' },
238
- button :{ text:HeaderImageData.button }
239
- } );
240
 
241
- // Handle results from media manager.
242
- frame.on( 'close', function () {
243
- var attachments = frame.state().get( 'selection' ).toJSON();
244
- if ( attachments.length )
245
- ticketHeaderImage.render( attachments[0] );
246
- } );
247
 
248
- frame.open();
249
- return false;
250
- },
251
- // Output Image preview and populate widget form.
252
- render:function ( attachment ) {
253
- $( '#tribe_ticket_header_preview' ).html( ticketHeaderImage.imgHTML( attachment ) );
254
- $( '#tribe_ticket_header_image_id' ).val( attachment.id );
255
- $( '#tribe_ticket_header_remove' ).show();
256
- },
257
- // Render html for the image.
258
- imgHTML :function ( attachment ) {
259
- var img_html = '<img src="' + attachment.url + '" ';
260
- img_html += 'width="' + attachment.width + '" ';
261
- img_html += 'height="' + attachment.height + '" ';
262
- img_html += '/>';
263
- return img_html;
264
- }
265
- };
266
 
267
- var $remove = $( '#tribe_ticket_header_remove' );
268
- var $preview = $( '#tribe_ticket_header_preview' );
269
 
270
- if ( $preview.find( 'img' ).length )
271
- $remove.show();
272
 
273
- $remove.live( 'click', function ( e ) {
274
 
275
- e.preventDefault();
276
- $preview.html('');
277
- $remove.hide();
278
- $( '#tribe_ticket_header_image_id' ).val('');
279
 
280
- } );
281
 
282
- /* Helper functions */
283
 
284
- function ticket_clear_form() {
285
- $( 'a#ticket_form_toggle' ).show();
286
 
287
- $( '#ticket_form input:not(:button):not(:radio):not(:checkbox)' ).val( '' );
288
- $( '#ticket_form input:checkbox' ).attr( 'checked', false );
289
 
290
- $( '#ticket_form textarea' ).val( '' );
291
 
292
- $( '#ticket_form' ).hide();
293
- }
294
 
295
- function tickets_start_spin() {
296
- jQuery( '#event_tickets' ).css( 'opacity', '0.5' );
297
- jQuery( "#tribe-loading" ).show();
298
- }
299
 
300
- function tickets_stop_spin() {
301
- jQuery( '#event_tickets' ).css( 'opacity', '1' );
302
- jQuery( "#tribe-loading" ).hide();
303
- }
304
 
305
- if($('#tribe_ticket_header_preview img').length){
306
 
307
- var $tiximg = $('#tribe_ticket_header_preview img');
308
- $tiximg.removeAttr("width").removeAttr("height");
309
 
310
- function tribe_fix_image_width(){
311
- if($('#tribetickets').width() < $tiximg.width()){
312
- $tiximg.css("width",'95%');
313
- }
314
- }
315
- tribe_fix_image_width();
316
- }
317
 
 
 
 
318
 
319
- } );
1
+ var ticketHeaderImage = window.ticketHeaderImage || {};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ (function (window, $, undefined) {
 
 
4
 
5
+ ticketHeaderImage = {
6
 
7
+ // Call this from the upload button to initiate the upload frame.
8
+ uploader: function () {
9
+
10
+ var frame = wp.media({
11
+ title: HeaderImageData.title,
12
+ multiple: false,
13
+ library: { type: 'image' },
14
+ button: { text: HeaderImageData.button }
15
+ });
16
+
17
+ // Handle results from media manager.
18
+ frame.on('close', function () {
19
+ var attachments = frame.state().get('selection').toJSON();
20
+ if (attachments.length)
21
+ ticketHeaderImage.render(attachments[0]);
22
+ });
23
+
24
+ frame.open();
25
+ return false;
26
+ },
27
+ // Output Image preview and populate widget form.
28
+ render: function (attachment) {
29
+ $('#tribe_ticket_header_preview').html(ticketHeaderImage.imgHTML(attachment));
30
+ $('#tribe_ticket_header_image_id').val(attachment.id);
31
+ $('#tribe_ticket_header_remove').show();
32
+ },
33
+ // Render html for the image.
34
+ imgHTML: function (attachment) {
35
+ var img_html = '<img src="' + attachment.url + '" ';
36
+ img_html += 'width="' + attachment.width + '" ';
37
+ img_html += 'height="' + attachment.height + '" ';
38
+ img_html += '/>';
39
+ return img_html;
40
  }
41
+ };
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
+ $(document).ready(function () {
45
+ var datepickerOpts = {
46
+ dateFormat: 'yy-mm-dd',
47
+ showAnim: 'fadeIn',
48
+ changeMonth: true,
49
+ changeYear: true,
50
+ numberOfMonths: 3,
51
+ showButtonPanel: true,
52
+ onChange: function () {
53
+ alert('lala');
54
  },
55
+ onSelect: function (dateText, inst) {
56
+ var the_date = $.datepicker.parseDate('yy-mm-dd', dateText);
57
+ if (inst.id === "ticket_start_date") {
58
+ $("#ticket_end_date").datepicker('option', 'minDate', the_date)
59
+ } else {
60
+ $("#ticket_start_date").datepicker('option', 'maxDate', the_date)
61
 
62
+ }
63
+ }
64
+ };
65
 
 
66
 
67
+ $("#ticket_start_date").datepicker(datepickerOpts).keyup(function (e) {
68
+ if (e.keyCode == 8 || e.keyCode == 46) {
69
+ $.datepicker._clearDate(this);
70
+ }
71
+ });
72
+ $("#ticket_end_date").datepicker(datepickerOpts).keyup(function (e) {
73
+ if (e.keyCode == 8 || e.keyCode == 46) {
74
+ $.datepicker._clearDate(this);
75
+ }
76
+ });
77
+
78
+ /* Show the advanced metabox for the selected provider and hide the others on selection change */
79
+ $('input[name=ticket_provider]:radio').change(function () {
80
+ $('tr.ticket_advanced').hide();
81
+ $('tr.ticket_advanced_' + this.value).show();
82
+ });
83
+
84
+ /* Show the advanced metabox for the selected provider and hide the others at ready */
85
+ $('input[name=ticket_provider]:checked').each(function () {
86
+ $('tr.ticket_advanced').hide();
87
+ $('tr.ticket_advanced_' + this.value).show();
88
+ });
89
+
90
+ /* "Add a ticket" link action */
91
+ $('a#ticket_form_toggle').click(function (e) {
92
+ $('h4.ticket_form_title_edit').hide();
93
+ $('h4.ticket_form_title_add').show();
94
+ $(this).hide();
95
+ ticket_clear_form();
96
+ $('#ticket_form').show();
97
+ $('html, body').animate({
98
+ scrollTop: $("#ticket_form_table").offset().top - 50
99
+ }, 500);
100
+ e.preventDefault();
101
+ });
102
+
103
+ /* "Cancel" button action */
104
+ $('#ticket_form_cancel').click(function () {
105
+
106
+ ticket_clear_form();
107
+
108
+ $('html, body').animate({
109
+ scrollTop: $("#event_tickets").offset().top - 50
110
+ }, 500);
111
+
112
+ });
113
+
114
+ /* "Save Ticket" button action */
115
+ $('#ticket_form_save').click(function () {
116
+
117
+ tickets_start_spin();
118
+
119
+ var params = {
120
+ action: 'tribe-ticket-add-' + $('input[name=ticket_provider]:checked').val(),
121
+ formdata: $('.ticket_field').serialize(),
122
+ post_ID: $('#post_ID').val(),
123
+ nonce: TribeTickets.add_ticket_nonce
124
+ };
125
+
126
+ $.post(
127
+ ajaxurl,
128
+ params,
129
+ function (response) {
130
+ if (response.success) {
131
+ ticket_clear_form();
132
+ $('td.ticket_list_container').empty().html(response.data);
133
+ }
134
+ },
135
+ 'json'
136
+ ).complete(function () {
137
+ $('html, body').animate({
138
+ scrollTop: $("#event_tickets").offset().top - 50
139
+ }, 500);
140
 
141
+ tickets_stop_spin();
142
+ });
143
 
144
+ });
145
 
146
+ /* "Delete Ticket" link action */
147
 
148
+ $('#tribetickets').on('click', '.ticket_delete', function (e) {
 
 
 
 
 
149
 
150
+ e.preventDefault();
 
 
 
151
 
152
+ tickets_start_spin();
 
 
 
 
 
 
 
 
153
 
154
+ var params = {
155
+ action: 'tribe-ticket-delete-' + $(this).attr("attr-provider"),
156
+ post_ID: $('#post_ID').val(),
157
+ ticket_id: $(this).attr("attr-ticket-id"),
158
+ nonce: TribeTickets.remove_ticket_nonce
159
+ };
160
 
161
+ $.post(
162
+ ajaxurl,
163
+ params,
164
+ function (response) {
165
 
166
+ if (response.success) {
167
+ ticket_clear_form();
168
+ $('td.ticket_list_container').empty().html(response.data);
169
+ }
170
+ },
171
+ 'json'
172
+ ).complete(function () {
173
+ tickets_stop_spin();
174
+ });
175
 
 
176
 
177
+ });
178
 
179
+ /* "Edit Ticket" link action */
 
180
 
181
+ $('#tribetickets')
182
+ .on('click', '.ticket_edit', function (e) {
183
 
184
+ e.preventDefault();
185
 
186
+ $('h4.ticket_form_title_edit').show();
187
+ $('h4.ticket_form_title_add').hide();
 
 
 
 
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
+ tickets_start_spin();
 
 
191
 
192
+ var params = {
193
+ action: 'tribe-ticket-edit-' + $(this).attr("attr-provider"),
194
+ post_ID: $('#post_ID').val(),
195
+ ticket_id: $(this).attr("attr-ticket-id"),
196
+ nonce: TribeTickets.edit_ticket_nonce
197
+ };
198
 
199
+ $.post(
200
+ ajaxurl,
201
+ params,
202
+ function (response) {
203
+ ticket_clear_form();
 
 
 
 
 
204
 
205
+ $('#ticket_id').val(response.data.ID);
206
+ $('#ticket_name').val(response.data.name);
207
+ $('#ticket_description').val(response.data.description);
208
+ $('#ticket_price').val(response.data.price);
209
 
210
+ $('#ticket_start_date').val(response.data.start_date.substring(0, 10));
211
+ $('#ticket_end_date').val(response.data.end_date.substring(0, 10));
 
212
 
213
+ if (response.data.start_date) {
214
+ var start_hour = response.data.start_date.substring(11, 13);
215
+ var start_meridian = 'am';
216
+ if (parseInt(start_hour) > 12) {
217
+ start_meridian = 'pm';
218
+ start_hour = parseInt(start_hour) - 12;
219
+ start_hour = ("0" + start_hour).slice(-2);
220
+ }
221
+ if (parseInt(start_hour) === 12) {
222
+ start_meridian = 'pm';
223
+ }
224
 
225
+ $('#ticket_start_hour').val(start_hour);
226
+ $('#ticket_start_meridian').val(start_meridian);
227
+ }
228
 
229
+ if (response.data.end_date) {
 
230
 
231
+ var end_hour = response.data.end_date.substring(11, 13);
232
+ var end_meridian = 'am';
233
+ if (parseInt(end_hour) > 12) {
234
+ end_meridian = 'pm';
235
+ end_hour = parseInt(end_hour) - 12;
236
+ end_hour = ("0" + end_hour).slice(-2);
237
+ }
238
+ if (parseInt(end_hour) === 12) {
239
+ end_meridian = 'pm';
240
+ }
241
 
242
+ $('#ticket_end_hour').val(end_hour);
243
+ $('#ticket_end_meridian').val(end_meridian);
244
 
245
+ $('#ticket_start_minute').val(response.data.start_date.substring(14, 16));
246
+ $('#ticket_end_minute').val(response.data.end_date.substring(14, 16));
247
+ }
248
 
249
+ $('tr.ticket_advanced_' + response.data.provider_class).remove();
250
+ $('tr.ticket.bottom').before(response.data.advanced_fields);
251
 
252
+ $('input:radio[name=ticket_provider]').filter('[value=' + response.data.provider_class + ']').click();
253
 
254
+ $('a#ticket_form_toggle').hide();
255
+ $('#ticket_form').show();
256
 
257
+ },
258
+ 'json'
259
+ ).complete(function () {
260
+ $('html, body').animate({
261
+ scrollTop: $("#ticket_form_table").offset().top - 50
262
+ }, 500);
263
 
264
+ tickets_stop_spin();
265
+ });
 
 
 
 
266
 
267
+ })
268
+ .on('click', '#tribe_ticket_header_image', function (e) {
269
+ e.preventDefault();
270
+ ticketHeaderImage.uploader( '', '' );
271
+ });
 
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
 
274
+ var $remove = $('#tribe_ticket_header_remove');
275
+ var $preview = $('#tribe_ticket_header_preview');
276
 
277
+ if ($preview.find('img').length)
278
+ $remove.show();
279
 
280
+ $remove.live('click', function (e) {
281
 
282
+ e.preventDefault();
283
+ $preview.html('');
284
+ $remove.hide();
285
+ $('#tribe_ticket_header_image_id').val('');
286
 
287
+ });
288
 
289
+ /* Helper functions */
290
 
291
+ function ticket_clear_form() {
292
+ $('a#ticket_form_toggle').show();
293
 
294
+ $('#ticket_form input:not(:button):not(:radio):not(:checkbox)').val('');
295
+ $('#ticket_form input:checkbox').attr('checked', false);
296
 
297
+ $('#ticket_form textarea').val('');
298
 
299
+ $('#ticket_form').hide();
300
+ }
301
 
302
+ function tickets_start_spin() {
303
+ jQuery('#event_tickets').css('opacity', '0.5');
304
+ jQuery("#tribe-loading").show();
305
+ }
306
 
307
+ function tickets_stop_spin() {
308
+ jQuery('#event_tickets').css('opacity', '1');
309
+ jQuery("#tribe-loading").hide();
310
+ }
311
 
312
+ if ($('#tribe_ticket_header_preview img').length) {
313
 
314
+ var $tiximg = $('#tribe_ticket_header_preview img');
315
+ $tiximg.removeAttr("width").removeAttr("height");
316
 
317
+ function tribe_fix_image_width() {
318
+ if ($('#tribetickets').width() < $tiximg.width()) {
319
+ $tiximg.css("width", '95%');
320
+ }
321
+ }
 
 
322
 
323
+ tribe_fix_image_width();
324
+ }
325
+ });
326
 
327
+ })(window, jQuery);
resources/tickets.min.js CHANGED
@@ -1,10 +1,12 @@
1
- jQuery(document).ready(function(a){function g(){a("a#ticket_form_toggle").show();a("#ticket_form input:not(:button):not(:radio):not(:checkbox)").val("");a("#ticket_form input:checkbox").attr("checked",!1);a("#ticket_form textarea").val("");a("#ticket_form").hide()}function h(){jQuery("#event_tickets").css("opacity","0.5");jQuery("#tribe-loading").show()}function k(){jQuery("#event_tickets").css("opacity","1");jQuery("#tribe-loading").hide()}var f={dateFormat:"yy-mm-dd",showAnim:"fadeIn",changeMonth:!0,
2
- changeYear:!0,numberOfMonths:3,showButtonPanel:!0,onChange:function(){alert("lala")},onSelect:function(b,d){var c=a.datepicker.parseDate("yy-mm-dd",b);"ticket_start_date"===d.id?a("#ticket_end_date").datepicker("option","minDate",c):a("#ticket_start_date").datepicker("option","maxDate",c)}};a("#ticket_start_date").datepicker(f).keyup(function(b){(8==b.keyCode||46==b.keyCode)&&a.datepicker._clearDate(this)});a("#ticket_end_date").datepicker(f).keyup(function(b){(8==b.keyCode||46==b.keyCode)&&a.datepicker._clearDate(this)});
3
- a("input[name=ticket_provider]:radio").change(function(){a("tr.ticket_advanced").hide();a("tr.ticket_advanced_"+this.value).show()});a("input[name=ticket_provider]:checked").each(function(){a("tr.ticket_advanced").hide();a("tr.ticket_advanced_"+this.value).show()});a("a#ticket_form_toggle").click(function(b){a("h4.ticket_form_title_edit").hide();a("h4.ticket_form_title_add").show();a(this).hide();g();a("#ticket_form").show();a("html, body").animate({scrollTop:a("#ticket_form_table").offset().top-
4
- 50},500);b.preventDefault()});a("#ticket_form_cancel").click(function(){g();a("html, body").animate({scrollTop:a("#event_tickets").offset().top-50},500)});a("#ticket_form_save").click(function(){h();var b={action:"tribe-ticket-add-"+a("input[name=ticket_provider]:checked").val(),formdata:a(".ticket_field").serialize(),post_ID:a("#post_ID").val(),nonce:TribeTickets.add_ticket_nonce};a.post(ajaxurl,b,function(b){b.success&&(g(),a("td.ticket_list_container").empty().html(b.data))},"json").complete(function(){a("html, body").animate({scrollTop:a("#event_tickets").offset().top-
5
- 50},500);k()})});a("#tribetickets").on("click",".ticket_delete",function(b){b.preventDefault();h();b={action:"tribe-ticket-delete-"+a(this).attr("attr-provider"),post_ID:a("#post_ID").val(),ticket_id:a(this).attr("attr-ticket-id"),nonce:TribeTickets.remove_ticket_nonce};a.post(ajaxurl,b,function(b){b.success&&(g(),a("td.ticket_list_container").empty().html(b.data))},"json").complete(function(){k()})});a("#tribetickets").on("click",".ticket_edit",function(b){b.preventDefault();a("h4.ticket_form_title_edit").show();
6
- a("h4.ticket_form_title_add").hide();h();b={action:"tribe-ticket-edit-"+a(this).attr("attr-provider"),post_ID:a("#post_ID").val(),ticket_id:a(this).attr("attr-ticket-id"),nonce:TribeTickets.edit_ticket_nonce};a.post(ajaxurl,b,function(b){g();a("#ticket_id").val(b.data.ID);a("#ticket_name").val(b.data.name);a("#ticket_description").val(b.data.description);a("#ticket_price").val(b.data.price);a("#ticket_start_date").val(b.data.start_date.substring(0,10));a("#ticket_end_date").val(b.data.end_date.substring(0,
7
- 10));if(b.data.start_date){var c=b.data.start_date.substring(11,13),e="am";12<parseInt(c)&&(e="pm",c=parseInt(c)-12,c=("0"+c).slice(-2));12===parseInt(c)&&(e="pm");a("#ticket_start_hour").val(c);a("#ticket_start_meridian").val(e)}b.data.end_date&&(c=b.data.end_date.substring(11,13),e="am",12<parseInt(c)&&(e="pm",c=parseInt(c)-12,c=("0"+c).slice(-2)),12===parseInt(c)&&(e="pm"),a("#ticket_end_hour").val(c),a("#ticket_end_meridian").val(e),a("#ticket_start_minute").val(b.data.start_date.substring(14,
8
- 16)),a("#ticket_end_minute").val(b.data.end_date.substring(14,16)));a("tr.ticket_advanced_"+b.data.provider_class).remove();a("tr.ticket.bottom").before(b.data.advanced_fields);a("input:radio[name=ticket_provider]").filter("[value="+b.data.provider_class+"]").click();a("a#ticket_form_toggle").hide();a("#ticket_form").show()},"json").complete(function(){a("html, body").animate({scrollTop:a("#ticket_form_table").offset().top-50},500);k()})});ticketHeaderImage={uploader:function(){var a=wp.media({title:HeaderImageData.title,
9
- multiple:!1,library:{type:"image"},button:{text:HeaderImageData.button}});a.on("close",function(){var d=a.state().get("selection").toJSON();d.length&&ticketHeaderImage.render(d[0])});a.open();return!1},render:function(b){a("#tribe_ticket_header_preview").html(ticketHeaderImage.imgHTML(b));a("#tribe_ticket_header_image_id").val(b.id);a("#tribe_ticket_header_remove").show()},imgHTML:function(a){var d='<img src="'+a.url+'" ',d=d+('width="'+a.width+'" '),d=d+('height="'+a.height+'" ');return d+"/>"}};
10
- var l=a("#tribe_ticket_header_remove"),m=a("#tribe_ticket_header_preview");m.find("img").length&&l.show();l.live("click",function(b){b.preventDefault();m.html("");l.hide();a("#tribe_ticket_header_image_id").val("")});a("#tribe_ticket_header_preview img").length&&(f=a("#tribe_ticket_header_preview img"),f.removeAttr("width").removeAttr("height"),a("#tribetickets").width()<f.width()&&f.css("width","95%"))});
 
 
1
+ var ticketHeaderImage=window.ticketHeaderImage||{};
2
+ (function(m,a,n){ticketHeaderImage={uploader:function(){var a=wp.media({title:HeaderImageData.title,multiple:!1,library:{type:"image"},button:{text:HeaderImageData.button}});a.on("close",function(){var c=a.state().get("selection").toJSON();c.length&&ticketHeaderImage.render(c[0])});a.open();return!1},render:function(e){a("#tribe_ticket_header_preview").html(ticketHeaderImage.imgHTML(e));a("#tribe_ticket_header_image_id").val(e.id);a("#tribe_ticket_header_remove").show()},imgHTML:function(a){var c=
3
+ '<img src="'+a.url+'" ',c=c+('width="'+a.width+'" '),c=c+('height="'+a.height+'" ');return c+"/>"}};a(document).ready(function(){function e(){a("a#ticket_form_toggle").show();a("#ticket_form input:not(:button):not(:radio):not(:checkbox)").val("");a("#ticket_form input:checkbox").attr("checked",!1);a("#ticket_form textarea").val("");a("#ticket_form").hide()}function c(){jQuery("#event_tickets").css("opacity","0.5");jQuery("#tribe-loading").show()}function g(){jQuery("#event_tickets").css("opacity",
4
+ "1");jQuery("#tribe-loading").hide()}var f={dateFormat:"yy-mm-dd",showAnim:"fadeIn",changeMonth:!0,changeYear:!0,numberOfMonths:3,showButtonPanel:!0,onChange:function(){alert("lala")},onSelect:function(b,l){var d=a.datepicker.parseDate("yy-mm-dd",b);"ticket_start_date"===l.id?a("#ticket_end_date").datepicker("option","minDate",d):a("#ticket_start_date").datepicker("option","maxDate",d)}};a("#ticket_start_date").datepicker(f).keyup(function(b){(8==b.keyCode||46==b.keyCode)&&a.datepicker._clearDate(this)});
5
+ a("#ticket_end_date").datepicker(f).keyup(function(b){(8==b.keyCode||46==b.keyCode)&&a.datepicker._clearDate(this)});a("input[name=ticket_provider]:radio").change(function(){a("tr.ticket_advanced").hide();a("tr.ticket_advanced_"+this.value).show()});a("input[name=ticket_provider]:checked").each(function(){a("tr.ticket_advanced").hide();a("tr.ticket_advanced_"+this.value).show()});a("a#ticket_form_toggle").click(function(b){a("h4.ticket_form_title_edit").hide();a("h4.ticket_form_title_add").show();
6
+ a(this).hide();e();a("#ticket_form").show();a("html, body").animate({scrollTop:a("#ticket_form_table").offset().top-50},500);b.preventDefault()});a("#ticket_form_cancel").click(function(){e();a("html, body").animate({scrollTop:a("#event_tickets").offset().top-50},500)});a("#ticket_form_save").click(function(){c();var b={action:"tribe-ticket-add-"+a("input[name=ticket_provider]:checked").val(),formdata:a(".ticket_field").serialize(),post_ID:a("#post_ID").val(),nonce:TribeTickets.add_ticket_nonce};
7
+ a.post(ajaxurl,b,function(b){b.success&&(e(),a("td.ticket_list_container").empty().html(b.data))},"json").complete(function(){a("html, body").animate({scrollTop:a("#event_tickets").offset().top-50},500);g()})});a("#tribetickets").on("click",".ticket_delete",function(b){b.preventDefault();c();b={action:"tribe-ticket-delete-"+a(this).attr("attr-provider"),post_ID:a("#post_ID").val(),ticket_id:a(this).attr("attr-ticket-id"),nonce:TribeTickets.remove_ticket_nonce};a.post(ajaxurl,b,function(b){b.success&&
8
+ (e(),a("td.ticket_list_container").empty().html(b.data))},"json").complete(function(){g()})});a("#tribetickets").on("click",".ticket_edit",function(b){b.preventDefault();a("h4.ticket_form_title_edit").show();a("h4.ticket_form_title_add").hide();c();b={action:"tribe-ticket-edit-"+a(this).attr("attr-provider"),post_ID:a("#post_ID").val(),ticket_id:a(this).attr("attr-ticket-id"),nonce:TribeTickets.edit_ticket_nonce};a.post(ajaxurl,b,function(b){e();a("#ticket_id").val(b.data.ID);a("#ticket_name").val(b.data.name);
9
+ a("#ticket_description").val(b.data.description);a("#ticket_price").val(b.data.price);a("#ticket_start_date").val(b.data.start_date.substring(0,10));a("#ticket_end_date").val(b.data.end_date.substring(0,10));if(b.data.start_date){var d=b.data.start_date.substring(11,13),c="am";12<parseInt(d)&&(c="pm",d=parseInt(d)-12,d=("0"+d).slice(-2));12===parseInt(d)&&(c="pm");a("#ticket_start_hour").val(d);a("#ticket_start_meridian").val(c)}b.data.end_date&&(d=b.data.end_date.substring(11,13),c="am",12<parseInt(d)&&
10
+ (c="pm",d=parseInt(d)-12,d=("0"+d).slice(-2)),12===parseInt(d)&&(c="pm"),a("#ticket_end_hour").val(d),a("#ticket_end_meridian").val(c),a("#ticket_start_minute").val(b.data.start_date.substring(14,16)),a("#ticket_end_minute").val(b.data.end_date.substring(14,16)));a("tr.ticket_advanced_"+b.data.provider_class).remove();a("tr.ticket.bottom").before(b.data.advanced_fields);a("input:radio[name=ticket_provider]").filter("[value="+b.data.provider_class+"]").click();a("a#ticket_form_toggle").hide();a("#ticket_form").show()},
11
+ "json").complete(function(){a("html, body").animate({scrollTop:a("#ticket_form_table").offset().top-50},500);g()})}).on("click","#tribe_ticket_header_image",function(a){a.preventDefault();ticketHeaderImage.uploader("","")});var h=a("#tribe_ticket_header_remove"),k=a("#tribe_ticket_header_preview");k.find("img").length&&h.show();h.live("click",function(b){b.preventDefault();k.html("");h.hide();a("#tribe_ticket_header_image_id").val("")});a("#tribe_ticket_header_preview img").length&&(f=a("#tribe_ticket_header_preview img"),
12
+ f.removeAttr("width").removeAttr("height"),a("#tribetickets").width()<f.width()&&f.css("width","95%"))})})(window,jQuery);
resources/tribe-settings.js CHANGED
File without changes
resources/warning.png CHANGED
File without changes
screenshot-10.png CHANGED
Binary file
screenshot-11.png CHANGED
Binary file
screenshot-12.png CHANGED
Binary file
screenshot-13.png CHANGED
Binary file
screenshot-14.png DELETED
Binary file
screenshot-6.png ADDED
Binary file
screenshot-7.png CHANGED
Binary file
screenshot-8.png CHANGED
Binary file
screenshot-9.png CHANGED
Binary file
tests/PHPUnit/bootstrap.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Load WordPress test environment
3
+ // https://github.com/nb/wordpress-tests
4
+ //
5
+ // The path to wordpress-tests
6
+ $path = 'wordpress-tests/init.php';
7
+
8
+ require_once $path;
tests/PHPUnit/phpunit-test.Test.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Simple test to make sure PHPUnit is functioning properly, even without the wordpress setup.
5
+ *
6
+ * @package TribeEvents
7
+ * @since 2.0.5
8
+ * @author Paul Hughes
9
+ */
10
+ class PhpUnitTest extends PHPUnit_Framework_TestCase
11
+ {
12
+
13
+ /**
14
+ * Tests if true is true, just to make sure PHPUnit is working.
15
+ *
16
+ * @since 2.0.5
17
+ * @author Paul Hughes
18
+ */
19
+ public function testPhpUnit()
20
+ {
21
+ $this->assertTrue( true );
22
+ }
23
+ }
tests/PHPUnit/phpunit.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit backupGlobals="false"
4
+ backupStaticAttributes="false"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnFailure="false"
11
+ syntaxCheck="false"
12
+ bootstrap="bootstrap.php"
13
+ >
14
+ <testsuites>
15
+ <testsuite name="The Events Calendar Test Suite">
16
+ <directory>./</directory>
17
+ </testsuite>
18
+ </testsuites>
19
+ </phpunit>
tests/PHPUnit/tribe-capabilities.Test.php ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tests tribe capabilities assignations to make sure they are correct.
5
+ *
6
+ * @package TribeEvents
7
+ * @since 2.0.5
8
+ * @author Paul Hughes
9
+ */
10
+ class WP_Test_TribeCapabilities extends Tribe_WP_UnitTestCase {
11
+
12
+ /**
13
+ * Add to the setUp() function the initialization of the plugin, when assignations take place.
14
+ *
15
+ * @since 2.0.5
16
+ * @author Paul Hughes
17
+ */
18
+ public function setUp() {
19
+ parent::setUp();
20
+ $tribe_ecp = TribeEvents::instance();
21
+ $tribe_ecp->init();
22
+ }
23
+
24
+ /**
25
+ * Test to make sure the administrator role has all the capabilities related to tribe events.
26
+ *
27
+ * @since 2.0.5
28
+ * @author Paul Hughes
29
+ */
30
+ public function test_administrator_role_capabilities() {
31
+
32
+ $role = get_role('administrator');
33
+
34
+ $this->assertInstanceOf( 'WP_Role', $role );
35
+
36
+ $this->assertTrue( $role->has_cap( 'edit_tribe_event' ) );
37
+ $this->assertTrue( $role->has_cap( 'read_tribe_event' ) );
38
+ $this->assertTrue( $role->has_cap( 'delete_tribe_event' ) );
39
+ $this->assertTrue( $role->has_cap( 'delete_tribe_events') );
40
+ $this->assertTrue( $role->has_cap( 'edit_tribe_events' ) );
41
+ $this->assertTrue( $role->has_cap( 'edit_others_tribe_events' ) );
42
+ $this->assertTrue( $role->has_cap( 'delete_others_tribe_events' ) );
43
+ $this->assertTrue( $role->has_cap( 'publish_tribe_events' ) );
44
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_events' ) );
45
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_events' ) );
46
+ $this->assertTrue( $role->has_cap( 'delete_private_tribe_events' ) );
47
+ $this->assertTrue( $role->has_cap( 'edit_private_tribe_events' ) );
48
+ $this->assertTrue( $role->has_cap( 'read_private_tribe_events' ) );
49
+
50
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venue' ) );
51
+ $this->assertTrue( $role->has_cap( 'read_tribe_venue' ) );
52
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venue' ) );
53
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venues') );
54
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venues' ) );
55
+ $this->assertTrue( $role->has_cap( 'edit_others_tribe_venues' ) );
56
+ $this->assertTrue( $role->has_cap( 'delete_others_tribe_venues' ) );
57
+ $this->assertTrue( $role->has_cap( 'publish_tribe_venues' ) );
58
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_venues' ) );
59
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_venues' ) );
60
+ $this->assertTrue( $role->has_cap( 'delete_private_tribe_venues' ) );
61
+ $this->assertTrue( $role->has_cap( 'edit_private_tribe_venues' ) );
62
+ $this->assertTrue( $role->has_cap( 'read_private_tribe_venues' ) );
63
+
64
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizer' ) );
65
+ $this->assertTrue( $role->has_cap( 'read_tribe_organizer' ) );
66
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizer' ) );
67
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizers') );
68
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizers' ) );
69
+ $this->assertTrue( $role->has_cap( 'edit_others_tribe_organizers' ) );
70
+ $this->assertTrue( $role->has_cap( 'delete_others_tribe_organizers' ) );
71
+ $this->assertTrue( $role->has_cap( 'publish_tribe_organizers' ) );
72
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_organizers' ) );
73
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_organizers' ) );
74
+ $this->assertTrue( $role->has_cap( 'delete_private_tribe_organizers' ) );
75
+ $this->assertTrue( $role->has_cap( 'edit_private_tribe_organizers' ) );
76
+ $this->assertTrue( $role->has_cap( 'read_private_tribe_organizers' ) );
77
+ }
78
+
79
+ /**
80
+ * Test to make sure the editor role has all the capabilities related to tribe events.
81
+ *
82
+ * @since 2.0.5
83
+ * @author Paul Hughes
84
+ */
85
+ public function test_editor_role_capabilities() {
86
+
87
+ $role = get_role('editor');
88
+
89
+ $this->assertInstanceOf( 'WP_Role', $role );
90
+
91
+ $this->assertTrue( $role->has_cap( 'edit_tribe_event' ) );
92
+ $this->assertTrue( $role->has_cap( 'read_tribe_event' ) );
93
+ $this->assertTrue( $role->has_cap( 'delete_tribe_event' ) );
94
+ $this->assertTrue( $role->has_cap( 'delete_tribe_events') );
95
+ $this->assertTrue( $role->has_cap( 'edit_tribe_events' ) );
96
+ $this->assertTrue( $role->has_cap( 'edit_others_tribe_events' ) );
97
+ $this->assertTrue( $role->has_cap( 'delete_others_tribe_events' ) );
98
+ $this->assertTrue( $role->has_cap( 'publish_tribe_events' ) );
99
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_events' ) );
100
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_events' ) );
101
+ $this->assertTrue( $role->has_cap( 'delete_private_tribe_events' ) );
102
+ $this->assertTrue( $role->has_cap( 'edit_private_tribe_events' ) );
103
+ $this->assertTrue( $role->has_cap( 'read_private_tribe_events' ) );
104
+
105
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venue' ) );
106
+ $this->assertTrue( $role->has_cap( 'read_tribe_venue' ) );
107
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venue' ) );
108
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venues') );
109
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venues' ) );
110
+ $this->assertTrue( $role->has_cap( 'edit_others_tribe_venues' ) );
111
+ $this->assertTrue( $role->has_cap( 'delete_others_tribe_venues' ) );
112
+ $this->assertTrue( $role->has_cap( 'publish_tribe_venues' ) );
113
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_venues' ) );
114
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_venues' ) );
115
+ $this->assertTrue( $role->has_cap( 'delete_private_tribe_venues' ) );
116
+ $this->assertTrue( $role->has_cap( 'edit_private_tribe_venues' ) );
117
+ $this->assertTrue( $role->has_cap( 'read_private_tribe_venues' ) );
118
+
119
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizer' ) );
120
+ $this->assertTrue( $role->has_cap( 'read_tribe_organizer' ) );
121
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizer' ) );
122
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizers') );
123
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizers' ) );
124
+ $this->assertTrue( $role->has_cap( 'edit_others_tribe_organizers' ) );
125
+ $this->assertTrue( $role->has_cap( 'delete_others_tribe_organizers' ) );
126
+ $this->assertTrue( $role->has_cap( 'publish_tribe_organizers' ) );
127
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_organizers' ) );
128
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_organizers' ) );
129
+ $this->assertTrue( $role->has_cap( 'delete_private_tribe_organizers' ) );
130
+ $this->assertTrue( $role->has_cap( 'edit_private_tribe_organizers' ) );
131
+ $this->assertTrue( $role->has_cap( 'read_private_tribe_organizers' ) );
132
+ }
133
+
134
+ /**
135
+ * Test to make sure the author role has the proper capabilities related to tribe events.
136
+ *
137
+ * @since 2.0.5
138
+ * @author Paul Hughes
139
+ */
140
+ public function test_author_role_capabilities() {
141
+
142
+ $role = get_role('author');
143
+
144
+ $this->assertInstanceOf( 'WP_Role', $role );
145
+
146
+ $this->assertTrue( $role->has_cap( 'edit_tribe_event' ) );
147
+ $this->assertTrue( $role->has_cap( 'read_tribe_event' ) );
148
+ $this->assertTrue( $role->has_cap( 'delete_tribe_event' ) );
149
+ $this->assertTrue( $role->has_cap( 'delete_tribe_events') );
150
+ $this->assertTrue( $role->has_cap( 'edit_tribe_events' ) );
151
+ $this->assertTrue( $role->has_cap( 'publish_tribe_events' ) );
152
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_events' ) );
153
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_events' ) );
154
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_events' ) );
155
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_events' ) );
156
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_events' ) );
157
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_events' ) );
158
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_events' ) );
159
+
160
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venue' ) );
161
+ $this->assertTrue( $role->has_cap( 'read_tribe_venue' ) );
162
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venue' ) );
163
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venues') );
164
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venues' ) );
165
+ $this->assertTrue( $role->has_cap( 'publish_tribe_venues' ) );
166
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_venues' ) );
167
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_venues' ) );
168
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_venues' ) );
169
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_venues' ) );
170
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_venues' ) );
171
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_venues' ) );
172
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_venues' ) );
173
+
174
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizer' ) );
175
+ $this->assertTrue( $role->has_cap( 'read_tribe_organizer' ) );
176
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizer' ) );
177
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizers') );
178
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizers' ) );
179
+ $this->assertTrue( $role->has_cap( 'publish_tribe_organizers' ) );
180
+ $this->assertTrue( $role->has_cap( 'edit_published_tribe_organizers' ) );
181
+ $this->assertTrue( $role->has_cap( 'delete_published_tribe_organizers' ) );
182
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_organizers' ) );
183
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_organizers' ) );
184
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_organizers' ) );
185
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_organizers' ) );
186
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_organizers' ) );
187
+ }
188
+
189
+ /**
190
+ * Test to make sure the contributor role has the proper capabilities related to tribe events.
191
+ *
192
+ * @since 2.0.5
193
+ * @author Paul Hughes
194
+ */
195
+ public function test_contributor_role_capabilities() {
196
+
197
+ $role = get_role('contributor');
198
+
199
+ $this->assertInstanceOf( 'WP_Role', $role );
200
+
201
+ $this->assertTrue( $role->has_cap( 'edit_tribe_event' ) );
202
+ $this->assertTrue( $role->has_cap( 'read_tribe_event' ) );
203
+ $this->assertTrue( $role->has_cap( 'delete_tribe_event' ) );
204
+ $this->assertTrue( $role->has_cap( 'delete_tribe_events') );
205
+ $this->assertTrue( $role->has_cap( 'edit_tribe_events' ) );
206
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_events' ) );
207
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_events' ) );
208
+ $this->assertFalse( $role->has_cap( 'publish_tribe_events' ) );
209
+ $this->assertFalse( $role->has_cap( 'edit_published_tribe_events' ) );
210
+ $this->assertFalse( $role->has_cap( 'delete_published_tribe_events' ) );
211
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_events' ) );
212
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_events' ) );
213
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_events' ) );
214
+
215
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venue' ) );
216
+ $this->assertTrue( $role->has_cap( 'read_tribe_venue' ) );
217
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venue' ) );
218
+ $this->assertTrue( $role->has_cap( 'delete_tribe_venues') );
219
+ $this->assertTrue( $role->has_cap( 'edit_tribe_venues' ) );
220
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_venues' ) );
221
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_venues' ) );
222
+ $this->assertFalse( $role->has_cap( 'publish_tribe_venues' ) );
223
+ $this->assertFalse( $role->has_cap( 'edit_published_tribe_venues' ) );
224
+ $this->assertFalse( $role->has_cap( 'delete_published_tribe_venues' ) );
225
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_venues' ) );
226
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_venues' ) );
227
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_venues' ) );
228
+
229
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizer' ) );
230
+ $this->assertTrue( $role->has_cap( 'read_tribe_organizer' ) );
231
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizer' ) );
232
+ $this->assertTrue( $role->has_cap( 'delete_tribe_organizers') );
233
+ $this->assertTrue( $role->has_cap( 'edit_tribe_organizers' ) );
234
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_organizers' ) );
235
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_organizers' ) );
236
+ $this->assertFalse( $role->has_cap( 'publish_tribe_organizers' ) );
237
+ $this->assertFalse( $role->has_cap( 'edit_published_tribe_organizers' ) );
238
+ $this->assertFalse( $role->has_cap( 'delete_published_tribe_organizers' ) );
239
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_organizers' ) );
240
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_organizers' ) );
241
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_organizers' ) );
242
+ }
243
+
244
+ /**
245
+ * Test to make sure the subscriber role has the proper capabilities related to tribe events.
246
+ *
247
+ * @since 2.0.5
248
+ * @author Paul Hughes
249
+ */
250
+ public function test_subscriber_role_capabilities() {
251
+
252
+ $role = get_role('subscriber');
253
+
254
+ $this->assertInstanceOf( 'WP_Role', $role );
255
+
256
+ $this->assertTrue( $role->has_cap( 'read_tribe_event' ) );
257
+ $this->assertFalse( $role->has_cap( 'edit_tribe_event' ) );
258
+ $this->assertFalse( $role->has_cap( 'delete_tribe_event' ) );
259
+ $this->assertFalse( $role->has_cap( 'delete_tribe_events') );
260
+ $this->assertFalse( $role->has_cap( 'edit_tribe_events' ) );
261
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_events' ) );
262
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_events' ) );
263
+ $this->assertFalse( $role->has_cap( 'publish_tribe_events' ) );
264
+ $this->assertFalse( $role->has_cap( 'edit_published_tribe_events' ) );
265
+ $this->assertFalse( $role->has_cap( 'delete_published_tribe_events' ) );
266
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_events' ) );
267
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_events' ) );
268
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_events' ) );
269
+
270
+ $this->assertTrue( $role->has_cap( 'read_tribe_venue' ) );
271
+ $this->assertFalse( $role->has_cap( 'edit_tribe_event' ) );
272
+ $this->assertFalse( $role->has_cap( 'delete_tribe_event' ) );
273
+ $this->assertFalse( $role->has_cap( 'delete_tribe_events') );
274
+ $this->assertFalse( $role->has_cap( 'edit_tribe_events' ) );
275
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_events' ) );
276
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_events' ) );
277
+ $this->assertFalse( $role->has_cap( 'publish_tribe_events' ) );
278
+ $this->assertFalse( $role->has_cap( 'edit_published_tribe_events' ) );
279
+ $this->assertFalse( $role->has_cap( 'delete_published_tribe_events' ) );
280
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_events' ) );
281
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_events' ) );
282
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_events' ) );
283
+
284
+ $this->assertTrue( $role->has_cap( 'read_tribe_organizer' ) );
285
+ $this->assertFalse( $role->has_cap( 'edit_tribe_event' ) );
286
+ $this->assertFalse( $role->has_cap( 'delete_tribe_event' ) );
287
+ $this->assertFalse( $role->has_cap( 'delete_tribe_events') );
288
+ $this->assertFalse( $role->has_cap( 'edit_tribe_events' ) );
289
+ $this->assertFalse( $role->has_cap( 'edit_others_tribe_events' ) );
290
+ $this->assertFalse( $role->has_cap( 'delete_others_tribe_events' ) );
291
+ $this->assertFalse( $role->has_cap( 'publish_tribe_events' ) );
292
+ $this->assertFalse( $role->has_cap( 'edit_published_tribe_events' ) );
293
+ $this->assertFalse( $role->has_cap( 'delete_published_tribe_events' ) );
294
+ $this->assertFalse( $role->has_cap( 'delete_private_tribe_events' ) );
295
+ $this->assertFalse( $role->has_cap( 'edit_private_tribe_events' ) );
296
+ $this->assertFalse( $role->has_cap( 'read_private_tribe_events' ) );
297
+ }
298
+
299
+ }
tests/PHPUnit/tribe-event-creation.Test.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tests event creation functionality
5
+ *
6
+ * @package TribeEvents
7
+ * @since 2.0.5
8
+ * @author Paul Hughes
9
+ */
10
+ class WP_Test_TribeEventCreation extends Tribe_WP_UnitTestCase {
11
+
12
+ /**
13
+ * @since 2.0.5
14
+ * @author Paul Hughes
15
+ * @var holds example data for the post
16
+ */
17
+ var $postExampleSettings;
18
+
19
+ /**
20
+ * Extend the setUp() function by assigning values for the event creation.
21
+ *
22
+ * @since 2.0.5
23
+ * @author Paul Hughes
24
+ * @uses $postExampleSettings
25
+ */
26
+ function setUp() {
27
+ parent::setUp();
28
+ $this->postExampleSettings = array(
29
+ 'post_author' => 3,
30
+ 'post_content' => 'This is event content!',
31
+ 'EventAllDay' => false,
32
+ 'EventHideFromUpcoming' => true,
33
+ 'EventOrganizerID' => 5,
34
+ 'EventVenueID' => 8,
35
+ 'EventShowMapLink' => true,
36
+ 'EventShowMap' => true,
37
+ 'EventStartDate' => '2012-01-01',
38
+ 'EventEndDate' => '2012-01-03',
39
+ 'EventStartHour' => '01',
40
+ 'EventStartMinute' => '15',
41
+ 'EventStartMeridian' => 'am',
42
+ 'EventEndHour' => '03',
43
+ 'EventEndMinute' => '25',
44
+ 'EventEndMeridian' => 'pm'
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Check to make sure that the post object is created from a returned post ID.
50
+ *
51
+ * @since 2.0.5
52
+ * @author Paul Hughes
53
+ * @uses $postExampleSettings
54
+ */
55
+ function test_tribe_create_event_template_tag_post_object_created() {
56
+ $post = get_post( tribe_create_event( $this->postExampleSettings ) );
57
+
58
+ $this->assertInternalType( 'object', $post);
59
+ }
60
+
61
+ /**
62
+ * Check to make sure that the event data is saved properly.
63
+ *
64
+ * @since 2.0.5
65
+ * @author Paul Hughes
66
+ */
67
+ function test_tribe_create_event_template_tag_meta_information() {
68
+ $post = get_post( tribe_create_event( $this->postExampleSettings ) );
69
+
70
+ $this->assertEquals( 3, $post->post_author );
71
+ $this->assertEquals( 'This is event content!', $post->post_content );
72
+ $this->assertEquals( '', get_post_meta( $post->ID, '_EventAllDay', true ) );
73
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventHideFromUpcoming', true ) );
74
+ $this->assertEquals( 5, get_post_meta( $post->ID, '_EventOrganizerID', true ) );
75
+ $this->assertEquals( 8, get_post_meta( $post->ID, '_EventVenueID', true ) );
76
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventShowMapLink', true ) );
77
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventShowMapLink', true ) );
78
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventShowMap', true ) );
79
+ $this->assertEquals( '2012-01-01 01:15:00', get_post_meta( $post->ID, '_EventStartDate', true ) );
80
+ $this->assertEquals( '2012-01-03 15:25:59', get_post_meta( $post->ID, '_EventEndDate', true ) );
81
+ }
82
+
83
+ /**
84
+ * Check to make sure that the post object is created from a returned post ID.
85
+ *
86
+ * @since 2.0.5
87
+ * @author Paul Hughes
88
+ * @uses $postExampleSettings
89
+ */
90
+ function test_tribe_create_event_API_post_object_created() {
91
+ $post = get_post( TribeEventsAPI::createEvent($this->postExampleSettings) );
92
+
93
+ $this->assertInternalType( 'object', $post);
94
+ }
95
+
96
+ /**
97
+ * Check to make sure that the event data is saved properly.
98
+ *
99
+ * @since 2.0.5
100
+ * @author Paul Hughes
101
+ */
102
+ function test_tribe_create_event_API_meta_information() {
103
+ $post = get_post( TribeEventsAPI::createEvent( $this->postExampleSettings ) );
104
+
105
+ $this->assertEquals( 3, $post->post_author );
106
+ $this->assertEquals( 'This is event content!', $post->post_content );
107
+ $this->assertEquals( '', get_post_meta( $post->ID, '_EventAllDay', true ) );
108
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventHideFromUpcoming', true ) );
109
+ $this->assertEquals( 5, get_post_meta( $post->ID, '_EventOrganizerID', true ) );
110
+ $this->assertEquals( 8, get_post_meta( $post->ID, '_EventVenueID', true ) );
111
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventShowMapLink', true ) );
112
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventShowMapLink', true ) );
113
+ $this->assertEquals( 1, get_post_meta( $post->ID, '_EventShowMap', true ) );
114
+ $this->assertEquals( '2012-01-01 01:15:00', get_post_meta( $post->ID, '_EventStartDate', true ) );
115
+ $this->assertEquals( '2012-01-03 15:25:59', get_post_meta( $post->ID, '_EventEndDate', true ) );
116
+ }
117
+
118
+ }
tests/PHPUnit/tribe-events-class.Test.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * An example test checking if the TribeEvents class exists after initialization.
5
+ *
6
+ * @package TribeEvents
7
+ * @since 2.0.5
8
+ * @author Paul Hughes
9
+ */
10
+ class WP_Test_TribeEventsClass extends Tribe_WP_UnitTestCase {
11
+
12
+ /**
13
+ * Test if the TribeEvents class exists.
14
+ *
15
+ * @since 2.0.5
16
+ * @author Paul Hughes
17
+ */
18
+ function test_events_class_exists() {
19
+ $class = 'TribeEvents';
20
+ $this->assertTrue( class_exists( $class ), 'Class "' . $class . '" does not exist.' );
21
+ }
22
+
23
+ }
tests/PHPUnit/tribe-previous-ecp-versions.Test.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Tests the previous version option to make sure it get's set properly
5
+ *
6
+ * @package TribeEvents
7
+ * @since 2.0.5
8
+ * @author Paul Hughes
9
+ */
10
+ class WP_Test_TribePreviousEcpVersionsClass extends Tribe_WP_UnitTestCase {
11
+
12
+ /**
13
+ * Check to make sure that the 'previous_ecp_versions' option exists.
14
+ *
15
+ * @since 2.0.5
16
+ * @author Paul Hughes
17
+ */
18
+ function test_previous_ecp_versions_exists() {
19
+ $this->assertTrue( count( tribe_get_option( 'previous_ecp_versions' ) ) > 0 );
20
+ }
21
+
22
+ /**
23
+ * Check to make sure that 'previous_ecp_versions' is saving correctly.
24
+ *
25
+ * @since 2.0.5
26
+ * @author Paul Hughes
27
+ */
28
+ function test_previous_ecp_versions_saving() {
29
+ $tribe_ecp = TribeEvents::instance();
30
+ $tribe_ecp->init();
31
+ $tribe_ecp->setOption('latest_ecp_version', '1.6.5');
32
+ $tribe_ecp->init();
33
+ $previous_ecp_versions = tribe_get_option( 'previous_ecp_versions' );
34
+ $this->assertEquals( '0', $previous_ecp_versions[0] );
35
+ $this->assertEquals( '1.6.5', $previous_ecp_versions[1]);
36
+ $this->assertFalse( isset( $previous_ecp_versions[2] ) );
37
+ }
38
+
39
+ }
tests/PHPUnit/wordpress-tests/bin/install.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Installs WordPress for the purpose of the unit-tests
4
+ *
5
+ * @todo Reuse the init/load code in init.php
6
+ */
7
+ error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
8
+
9
+ $config_file_path = $argv[1];
10
+
11
+ define( 'WP_INSTALLING', true );
12
+
13
+ $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
14
+ $_SERVER['HTTP_HOST'] = 'example.org';
15
+ $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
16
+
17
+ require_once $config_file_path;
18
+ require_once ABSPATH . '/wp-settings.php';
19
+
20
+ require_once ABSPATH . '/wp-admin/includes/upgrade.php';
21
+ require_once ABSPATH . '/wp-includes/wp-db.php';
22
+
23
+ define( 'WP_TESTS_DB_VERSION_FILE', ABSPATH . '.wp-tests-db-version' );
24
+
25
+ $wpdb->suppress_errors();
26
+ $wpdb->hide_errors();
27
+ $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
28
+
29
+ if ( $installed && file_exists( WP_TESTS_DB_VERSION_FILE ) ) {
30
+ $install_db_version = file_get_contents( WP_TESTS_DB_VERSION_FILE );
31
+ $db_version = get_option( 'db_version' );
32
+ if ( $db_version == $install_db_version ) {
33
+ return;
34
+ }
35
+ }
36
+ $wpdb->query( 'SET storage_engine = INNODB;' );
37
+ $wpdb->query( 'DROP DATABASE IF EXISTS '.DB_NAME.";" );
38
+ $wpdb->query( 'CREATE DATABASE '.DB_NAME.";" );
39
+ $wpdb->select( DB_NAME, $wpdb->dbh );
40
+
41
+ add_filter( 'dbdelta_create_queries', function($queries) {
42
+ foreach( $queries as &$query ) {
43
+ $query .= ' ENGINE=InnoDB';
44
+ }
45
+ return $queries;
46
+ });
47
+ echo "Installing…\n";
48
+ wp_install( "Baba's blog", 'admin', 'admin@baba.net', true, '', 'a' );
49
+ file_put_contents( WP_TESTS_DB_VERSION_FILE, get_option('db_version') );
tests/PHPUnit/wordpress-tests/init.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Installs WordPress for running the tests and loads WordPress and the test libraries
4
+ */
5
+
6
+ error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
7
+
8
+ require_once 'PHPUnit/Autoload.php';
9
+
10
+ $config_file_path = dirname( __FILE__ ) . '/unittests-config.php';
11
+
12
+ /*
13
+ Globalize some WordPress variables, because PHPUnit loads this file inside a function
14
+ See: https://github.com/sebastianbergmann/phpunit/issues/325
15
+
16
+ These are not needed for WordPress 3.3+, only for older versions
17
+ */
18
+ global $table_prefix, $wp_embed, $wp_locale, $_wp_deprecated_widgets_callbacks, $wp_widget_factory;
19
+
20
+ $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
21
+ $_SERVER['HTTP_HOST'] = 'example.org';
22
+ $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
23
+
24
+ system( 'php '.escapeshellarg( dirname( __FILE__ ) . '/bin/install.php' ) . ' ' . escapeshellarg( $config_file_path ) );
25
+
26
+ require_once $config_file_path;
27
+
28
+ require_once ABSPATH . '/wp-settings.php';
29
+ require dirname( __FILE__ ) . '/lib/testcase.php';
30
+ require dirname( __FILE__ ) . '/lib/exceptions.php';
31
+ // Load Tribe-specific Test Class.
32
+ require dirname( __FILE__ ) . '/lib/tribe-testcase.php';
tests/PHPUnit/wordpress-tests/lib/exceptions.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class WP_Tests_Exception extends PHPUnit_Framework_Exception {
4
+
5
+ }
tests/PHPUnit/wordpress-tests/lib/testcase.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
3
+
4
+ var $url = 'http://example.org/';
5
+ var $plugin_slug = null;
6
+
7
+ function setUp() {
8
+ global $wpdb;
9
+ $wpdb->suppress_errors = false;
10
+ $wpdb->show_errors = true;
11
+ $wpdb->db_connect();
12
+ ini_set('display_errors', 1 );
13
+ $this->clean_up_global_scope();
14
+ $this->start_transaction();
15
+ add_filter( 'gp_get_option_uri', array( $this, 'url_filter') );
16
+ $this->activate_tested_plugin();
17
+ }
18
+
19
+ function activate_tested_plugin() {
20
+ if ( !$this->plugin_slug ) {
21
+ return;
22
+ }
23
+ require_once ABSPATH . '/wp-admin/includes/plugin.php';
24
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $this->plugin_slug . '.php' ) )
25
+ activate_plugin( $this->plugin_slug . '.php' );
26
+ elseif ( file_exists( WP_PLUGIN_DIR . '/' . $this->plugin_slug . '/' . $this->plugin_slug . '.php' ) )
27
+ activate_plugin( $this->plugin_slug . '/' . $this->plugin_slug . '.php' );
28
+ else
29
+ throw new WP_Tests_Exception( "Couldn't find a plugin with slug $this->plugin_slug" );
30
+ }
31
+
32
+ function url_filter( $url ) {
33
+ return $this->url;
34
+ }
35
+
36
+ function tearDown() {
37
+ global $wpdb;
38
+ $wpdb->query( 'ROLLBACK' );
39
+ remove_filter( 'gp_get_option_uri', array( $this, 'url_filter') );
40
+ }
41
+
42
+ function clean_up_global_scope() {
43
+ wp_cache_flush();
44
+ $_GET = array();
45
+ $_POST = array();
46
+ }
47
+
48
+ function start_transaction() {
49
+ global $wpdb;
50
+ $wpdb->query( 'SET autocommit = 0;' );
51
+ $wpdb->query( 'SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;' );
52
+ $wpdb->query( 'START TRANSACTION;' );
53
+ }
54
+
55
+ function force_innodb( $schema ) {
56
+ foreach( $schema as &$sql ) {
57
+ $sql = str_replace( ');', ') TYPE=InnoDB;', $sql );
58
+ }
59
+ return $schema;
60
+ }
61
+
62
+ function assertWPError( $actual, $message = '' ) {
63
+ $this->assertTrue( is_wp_error( $actual ), $message );
64
+ }
65
+
66
+ function assertEqualFields( $object, $fields ) {
67
+ foreach( $fields as $field_name => $field_value ) {
68
+ if ( $object->$field_name != $field_value ) {
69
+ $this->fail();
70
+ }
71
+ }
72
+ }
73
+
74
+ function assertDiscardWhitespace( $expected, $actual ) {
75
+ $this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) );
76
+ }
77
+
78
+ function checkAtLeastPHPVersion( $version ) {
79
+ if ( version_compare( PHP_VERSION, $version, '<' ) ) {
80
+ $this->markTestSkipped();
81
+ }
82
+ }
83
+
84
+ function go_to( $url ) {
85
+ // note: the WP and WP_Query classes like to silently fetch parameters
86
+ // from all over the place (globals, GET, etc), which makes it tricky
87
+ // to run them more than once without very carefully clearing everything
88
+ $_GET = $_POST = array();
89
+ foreach (array('query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow') as $v) {
90
+ if ( isset( $GLOBALS[$v] ) ) unset( $GLOBALS[$v] );
91
+ }
92
+ $parts = parse_url($url);
93
+ if (isset($parts['scheme'])) {
94
+ $req = $parts['path'];
95
+ if (isset($parts['query'])) {
96
+ $req .= '?' . $parts['query'];
97
+ // parse the url query vars into $_GET
98
+ parse_str($parts['query'], $_GET);
99
+ } else {
100
+ $parts['query'] = '';
101
+ }
102
+ }
103
+ else {
104
+ $req = $url;
105
+ }
106
+
107
+ $_SERVER['REQUEST_URI'] = $req;
108
+ unset($_SERVER['PATH_INFO']);
109
+
110
+ wp_cache_flush();
111
+ unset($GLOBALS['wp_query'], $GLOBALS['wp_the_query']);
112
+ $GLOBALS['wp_the_query'] =& new WP_Query();
113
+ $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
114
+ $GLOBALS['wp'] =& new WP();
115
+
116
+ // clean out globals to stop them polluting wp and wp_query
117
+ foreach ($GLOBALS['wp']->public_query_vars as $v) {
118
+ unset($GLOBALS[$v]);
119
+ }
120
+ foreach ($GLOBALS['wp']->private_query_vars as $v) {
121
+ unset($GLOBALS[$v]);
122
+ }
123
+
124
+ $GLOBALS['wp']->main($parts['query']);
125
+ }
126
+
127
+ }
tests/PHPUnit/wordpress-tests/lib/tribe-testcase.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tribe_WP_UnitTestCase extends WP_UnitTestCase {
3
+ var $plugin_slugs = array(
4
+ 'the-events-calendar'
5
+ );
6
+
7
+ function setUp() {
8
+ parent::setUp();
9
+ $this->activate_tested_plugins();
10
+ }
11
+
12
+ function activate_tested_plugins() {
13
+ $plugin_slugs = unserialize( LOCAL_PLUGINS );
14
+ require_once ABSPATH . '/wp-admin/includes/plugin.php';
15
+ if ( !$plugin_slugs ) {
16
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $this->default_plugin_slug . '/' .$this->default_plugin_slug . '.php' ) )
17
+ activate_plugin( $this->default_plugin_slug . '/' . $this->default_plugin_slug . '.php' );
18
+ return;
19
+ }
20
+ foreach( $plugin_slugs as $plugin_slug ) {
21
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug . '.php' ) )
22
+ activate_plugin( $plugin_slug . '.php' );
23
+ elseif ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug . '/' . $plugin_slug . '.php' ) )
24
+ activate_plugin( $plugin_slug . '/' . $plugin_slug . '.php' );
25
+ else
26
+ throw new WP_Tests_Exception( "Couldn't find a plugin with slug $plugin_slug" );
27
+ }
28
+ }
29
+ }
tests/PHPUnit/wordpress-tests/phpunit.xml ADDED
@@ -0,0 +1 @@
 
1
+ <phpunit bootstrap="./init.php"></phpunit>
tests/PHPUnit/wordpress-tests/unittests-config-sample.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tribe Unit Tests
4
+ * How to get Started:
5
+ * First, copy this file to unittests-config.php, and customize with your settings (see below).
6
+ * After you're done customizing your config file (see instructions below), you are ready
7
+ * to run your tests! Navigate your terminal to the tests/PHPUnit directory and run the command:
8
+ * $ phpunit
9
+ * That's all there is to it. Happy testing!
10
+ */
11
+
12
+ /**
13
+ * Path to the WordPress codebase you'd like to test. Add a backslash in the end.
14
+ */
15
+ define( 'ABSPATH', 'path-to-WP/' );
16
+
17
+ /**
18
+ * Now setup a new database for test purposes of a new wordpress instance.
19
+ * USE A NEW DATABASE, BECAUSE ALL THE DATA INSIDE WILL BE DELETED.
20
+ */
21
+ define( 'DB_NAME', 'trunk_test' );
22
+ define( 'DB_USER', 'user' );
23
+ define( 'DB_PASSWORD', 'password' );
24
+ define( 'DB_HOST', 'localhost' );
25
+ define( 'DB_CHARSET', 'utf8' );
26
+ define( 'DB_COLLATE', '' );
27
+
28
+ define( 'WPLANG', '' );
29
+ define( 'WP_DEBUG', true );
30
+ define( 'WP_DEBUG_DISPLAY', true );
31
+
32
+ /**
33
+ * Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only.
34
+ */
35
+ define( 'DISABLE_WP_CRON', true );
36
+
37
+ /**
38
+ * Set this constant to a serialized array of plugins
39
+ * (without php suffix, but can be with directory) that you want to activate.
40
+ * e.g. define( 'LOCAL_PLUGINS', serialize( array( 'the-events-calendar/the-events-calendar', 'events-calendar-pro/events-calendar-pro' ) ) );
41
+ */
42
+ define( 'LOCAL_PLUGINS', serialize( array(
43
+ 'the-events-calendar/the-events-calendar'
44
+ ) ) );
45
+
46
+ $table_prefix = 'wp_';
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.1
6
  Author: Modern Tribe, Inc.
7
  Author URI: http://m.tri.be/1x
8
  Text Domain: tribe-events-calendar
views/modules/bar.php CHANGED
@@ -16,7 +16,7 @@
16
  <?php
17
 
18
  $filters = tribe_events_get_filters();
19
- $views = tribe_events_get_views();
20
 
21
  ?>
22
 
16
  <?php
17
 
18
  $filters = tribe_events_get_filters();
19
+ $views = tribe_events_get_views();
20
 
21
  ?>
22