Events Manager - Version 5.6.6

Version Description

  • improvements to ical formatting, including static/unique UIDs, more accurate locations with geo coordinates, categories and featured image
  • replaced code using stripslashes() with wp_unslash() (kudos @webaware)
  • removed use of jQuery.live() on settings page
  • tweaked event search form elements and events list table to be ADA compliant
  • added $EM_Ticket_Booking to em_tickets_bookings_add filter arguments
  • removed translations of weekdays within EM and using WP translations instead,
  • changed calendar templates to stop using ucfirst() to uppercase month first letters since it breaks some languages and the languages that need it don't capitalize their months anyway
  • fixed anonymous event submitter info not showing in recurring event admin area
  • fixed wrong nav id in BuddyPress (kudos @lyevalley)
  • fixed 'no location' checkbox not remaining checked if event submission returns an validation error
  • tweaked templates/forms/event/location.php and added some extra output sanitization
  • fixed 404 errors in calendar links to eventful day list for a specific location
  • fixed syncing of tables when WP uses utf8mb4 collation which causes errors when saving emojis in post content
  • fixed WP 4.6 PHP warnings and featured image problems when using a theme that limits specific CPTs to use thumbnails
  • fixed action typo in EM_Ticket::get_post() from em_location_get_post_pre to em_ticket_get_post_pre
  • fixed location not showing up in admin area within dropdown if previously assigned to an event but not available to user due to permission changes
Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Events Manager
Version 5.6.6
Comparing to
See all releases

Code changes from version 5.6.5 to 5.6.6

admin/em-options.php CHANGED
@@ -22,9 +22,9 @@ function em_options_save(){
22
  }else{
23
  //TODO slashes being added?
24
  if( is_array($postValue) ){
25
- foreach($postValue as $postValue_key=>$postValue_val) $postValue[$postValue_key] = stripslashes($postValue_val);
26
  }else{
27
- $postValue = stripslashes($postValue);
28
  }
29
  update_option($postKey, $postValue);
30
  }
22
  }else{
23
  //TODO slashes being added?
24
  if( is_array($postValue) ){
25
+ foreach($postValue as $postValue_key=>$postValue_val) $postValue[$postValue_key] = wp_unslash($postValue_val);
26
  }else{
27
+ $postValue = wp_unslash($postValue);
28
  }
29
  update_option($postKey, $postValue);
30
  }
buddypress/bp-em-core.php CHANGED
@@ -269,7 +269,7 @@ class BP_EM_Component extends BP_Component {
269
  'screen_function' => 'bp_em_group_events',
270
  'position' => 50,
271
  'user_has_access' => $user_access,
272
- 'item_css_id' => 'forums'
273
  ));
274
  }
275
  }
269
  'screen_function' => 'bp_em_group_events',
270
  'position' => 50,
271
  'user_has_access' => $user_access,
272
+ 'item_css_id' => 'events'
273
  ));
274
  }
275
  }
classes/em-booking.php CHANGED
@@ -274,7 +274,7 @@ class EM_Booking extends EM_Object{
274
  }
275
  }
276
  }
277
- $this->booking_comment = (!empty($_REQUEST['booking_comment'])) ? wp_kses_data(stripslashes($_REQUEST['booking_comment'])):'';
278
  //allow editing of tax rate
279
  if( !empty($this->booking_id) && $this->can_manage() ){
280
  $this->booking_tax_rate = (!empty($_REQUEST['booking_tax_rate']) && is_numeric($_REQUEST['booking_tax_rate'])) ? $_REQUEST['booking_tax_rate']:$this->booking_tax_rate;
@@ -663,7 +663,7 @@ class EM_Booking extends EM_Object{
663
  $registration = true;
664
  if( empty($this->booking_meta['registration']) ) $this->booking_meta['registration'] = array();
665
  // Check the e-mail address
666
- $user_email = trim(stripslashes($_REQUEST['user_email'])); //apostrophes will not be allowed otherwise
667
  if ( $user_email == '' ) {
668
  $registration = false;
669
  $this->add_error(__( '<strong>ERROR</strong>: Please type your e-mail address.', 'events-manager') );
@@ -679,7 +679,7 @@ class EM_Booking extends EM_Object{
679
  //Check the user name
680
  if( !empty($_REQUEST['user_name']) ){
681
  //split full name up and save full, first and last names
682
- $user_data['user_name'] = wp_kses(stripslashes($_REQUEST['user_name']), array());
683
  $name_string = explode(' ',$user_data['user_name']);
684
  $user_data['first_name'] = array_shift($name_string);
685
  $user_data['last_name'] = implode(' ', $name_string);
@@ -687,10 +687,10 @@ class EM_Booking extends EM_Object{
687
  //Check the first/last name
688
  $name_string = array();
689
  if( !empty($_REQUEST['first_name']) ){
690
- $user_data['first_name'] = $name_string[] = wp_kses(stripslashes($_REQUEST['first_name']), array());
691
  }
692
  if( !empty($_REQUEST['last_name']) ){
693
- $user_data['last_name'] = $name_string[] = wp_kses(stripslashes($_REQUEST['last_name']), array());
694
  }
695
  if( !empty($name_string) ) $user_data['user_name'] = implode(' ', $name_string);
696
  }
@@ -698,7 +698,7 @@ class EM_Booking extends EM_Object{
698
  if( !empty($user_data['first_name']) || !empty($user_data['last_name']) )
699
  //Check the phone
700
  if( !empty($_REQUEST['dbem_phone']) ){
701
- $user_data['dbem_phone'] = wp_kses(stripslashes($_REQUEST['dbem_phone']), array());
702
  }
703
  //Add booking meta
704
  if( $registration ){
274
  }
275
  }
276
  }
277
+ $this->booking_comment = (!empty($_REQUEST['booking_comment'])) ? wp_kses_data(wp_unslash($_REQUEST['booking_comment'])):'';
278
  //allow editing of tax rate
279
  if( !empty($this->booking_id) && $this->can_manage() ){
280
  $this->booking_tax_rate = (!empty($_REQUEST['booking_tax_rate']) && is_numeric($_REQUEST['booking_tax_rate'])) ? $_REQUEST['booking_tax_rate']:$this->booking_tax_rate;
663
  $registration = true;
664
  if( empty($this->booking_meta['registration']) ) $this->booking_meta['registration'] = array();
665
  // Check the e-mail address
666
+ $user_email = trim(wp_unslash($_REQUEST['user_email'])); //apostrophes will not be allowed otherwise
667
  if ( $user_email == '' ) {
668
  $registration = false;
669
  $this->add_error(__( '<strong>ERROR</strong>: Please type your e-mail address.', 'events-manager') );
679
  //Check the user name
680
  if( !empty($_REQUEST['user_name']) ){
681
  //split full name up and save full, first and last names
682
+ $user_data['user_name'] = wp_kses(wp_unslash($_REQUEST['user_name']), array());
683
  $name_string = explode(' ',$user_data['user_name']);
684
  $user_data['first_name'] = array_shift($name_string);
685
  $user_data['last_name'] = implode(' ', $name_string);
687
  //Check the first/last name
688
  $name_string = array();
689
  if( !empty($_REQUEST['first_name']) ){
690
+ $user_data['first_name'] = $name_string[] = wp_kses(wp_unslash($_REQUEST['first_name']), array());
691
  }
692
  if( !empty($_REQUEST['last_name']) ){
693
+ $user_data['last_name'] = $name_string[] = wp_kses(wp_unslash($_REQUEST['last_name']), array());
694
  }
695
  if( !empty($name_string) ) $user_data['user_name'] = implode(' ', $name_string);
696
  }
698
  if( !empty($user_data['first_name']) || !empty($user_data['last_name']) )
699
  //Check the phone
700
  if( !empty($_REQUEST['dbem_phone']) ){
701
+ $user_data['dbem_phone'] = wp_kses(wp_unslash($_REQUEST['dbem_phone']), array());
702
  }
703
  //Add booking meta
704
  if( $registration ){
classes/em-calendar.php CHANGED
@@ -358,12 +358,12 @@ class EM_Calendar extends EM_Object {
358
  public static function translate_and_trim($string, $length = 1) {
359
  if( $length > 0 ){
360
  if(function_exists('mb_substr')){ //fix for diacritic calendar names
361
- return mb_substr(__($string,'events-manager'), 0, $length, 'UTF-8');
362
  }else{
363
- return substr(__($string,'events-manager'), 0, $length);
364
  }
365
  }
366
- return __($string,'events-manager');
367
  }
368
 
369
  /**
@@ -394,6 +394,15 @@ class EM_Calendar extends EM_Object {
394
  }
395
  }
396
  }
 
 
 
 
 
 
 
 
 
397
  return $args;
398
  }
399
 
358
  public static function translate_and_trim($string, $length = 1) {
359
  if( $length > 0 ){
360
  if(function_exists('mb_substr')){ //fix for diacritic calendar names
361
+ return mb_substr(translate($string), 0, $length, 'UTF-8');
362
  }else{
363
+ return substr(translate($string), 0, $length);
364
  }
365
  }
366
+ return translate($string);
367
  }
368
 
369
  /**
394
  }
395
  }
396
  }
397
+ //clean up post type conflicts in a URL
398
+ if( !empty($args['event']) ){
399
+ $args['event_id'] = $args['event'];
400
+ unset($args['event']);
401
+ }
402
+ if( !empty($args['location']) ){
403
+ $args['location_id'] = $args['location'];
404
+ unset($args['location']);
405
+ }
406
  return $args;
407
  }
408
 
classes/em-event-post-admin.php CHANGED
@@ -455,6 +455,9 @@ class EM_Event_Recurring_Post_Admin{
455
  if( empty($EM_Event) && !empty($post) ){
456
  $EM_Event = em_get_event($post->ID, 'post_id');
457
  }
 
 
 
458
  add_meta_box('em-event-recurring', __('Recurrences','events-manager'), array('EM_Event_Recurring_Post_Admin','meta_box_recurrence'),'event-recurring', 'normal','high');
459
  //add_meta_box('em-event-meta', 'Event Meta (debugging only)', array('EM_Event_Post_Admin','meta_box_metadump'),'event-recurring', 'normal','high');
460
  add_meta_box('em-event-where', __('Where','events-manager'), array('EM_Event_Post_Admin','meta_box_location'),'event-recurring', 'normal','high');
455
  if( empty($EM_Event) && !empty($post) ){
456
  $EM_Event = em_get_event($post->ID, 'post_id');
457
  }
458
+ if( !empty($EM_Event->event_owner_anonymous) ){
459
+ add_meta_box('em-event-anonymous', __('Anonymous Submitter Info','events-manager'), array('EM_Event_Post_Admin','meta_box_anonymous'),'event-recurring', 'side','high');
460
+ }
461
  add_meta_box('em-event-recurring', __('Recurrences','events-manager'), array('EM_Event_Recurring_Post_Admin','meta_box_recurrence'),'event-recurring', 'normal','high');
462
  //add_meta_box('em-event-meta', 'Event Meta (debugging only)', array('EM_Event_Post_Admin','meta_box_metadump'),'event-recurring', 'normal','high');
463
  add_meta_box('em-event-where', __('Where','events-manager'), array('EM_Event_Post_Admin','meta_box_location'),'event-recurring', 'normal','high');
classes/em-event.php CHANGED
@@ -363,16 +363,16 @@ class EM_Event extends EM_Object{
363
  global $allowedposttags;
364
  do_action('em_event_get_post_pre', $this);
365
  //we need to get the post/event name and content.... that's it.
366
- $this->post_content = isset($_POST['content']) ? wp_kses( stripslashes($_POST['content']), $allowedposttags):'';
367
  $this->post_excerpt = !empty($this->post_excerpt) ? $this->post_excerpt:''; //fix null error
368
- $this->event_name = !empty($_POST['event_name']) ? htmlspecialchars_decode(wp_kses_data(htmlspecialchars_decode(stripslashes($_POST['event_name'])))):'';
369
  $this->post_type = ($this->is_recurring() || !empty($_POST['recurring'])) ? 'event-recurring':EM_POST_TYPE_EVENT;
370
  //don't forget categories!
371
  if( get_option('dbem_categories_enabled') ) $this->get_categories()->get_post();
372
  //anonymous submissions and guest basic info
373
  if( !is_user_logged_in() && get_option('dbem_events_anonymous_submissions') && empty($this->event_id) ){
374
  $this->event_owner_anonymous = 1;
375
- $this->event_owner_name = !empty($_POST['event_owner_name']) ? wp_kses_data(stripslashes($_POST['event_owner_name'])):'';
376
  $this->event_owner_email = !empty($_POST['event_owner_email']) ? wp_kses_data($_POST['event_owner_email']):'';
377
  }
378
  //get the rest and validate (optional)
@@ -512,11 +512,11 @@ class EM_Event extends EM_Object{
512
  $att_vals = isset($event_available_attributes['values'][$att_key]) ? count($event_available_attributes['values'][$att_key]) : 0;
513
  if( !empty($att_value) ){
514
  if( $att_vals <= 1 || ($att_vals > 1 && in_array($att_value, $event_available_attributes['values'][$att_key])) ){
515
- $this->event_attributes[$att_key] = stripslashes($att_value);
516
  }
517
  }
518
  if( empty($att_value) && $att_vals > 1){
519
- $this->event_attributes[$att_key] = stripslashes(wp_kses($event_available_attributes['values'][$att_key][0], $allowedtags));
520
  }
521
  }
522
  }
@@ -1580,7 +1580,7 @@ class EM_Event extends EM_Object{
1580
  case '#_EVENTLINK': //HTML Link
1581
  $event_link = esc_url($this->get_permalink());
1582
  if($result == '#_LINKEDNAME' || $result == '#_EVENTLINK'){
1583
- $replace = '<a href="'.$event_link.'" title="'.esc_attr($this->event_name).'">'.esc_attr($this->event_name).'</a>';
1584
  }else{
1585
  $replace = $event_link;
1586
  }
@@ -2345,7 +2345,7 @@ class EM_Event extends EM_Object{
2345
  function get_recurrence_description() {
2346
  $EM_Event_Recurring = $this->get_event_recurrence();
2347
  $recurrence = $this->to_array();
2348
- $weekdays_name = array(__('Sunday', 'events-manager'),__('Monday', 'events-manager'),__('Tuesday', 'events-manager'),__('Wednesday', 'events-manager'),__('Thursday', 'events-manager'),__('Friday', 'events-manager'),__('Saturday', 'events-manager'));
2349
  $monthweek_name = array('1' => __('the first %s of the month', 'events-manager'),'2' => __('the second %s of the month', 'events-manager'), '3' => __('the third %s of the month', 'events-manager'), '4' => __('the fourth %s of the month', 'events-manager'), '-1' => __('the last %s of the month', 'events-manager'));
2350
  $output = sprintf (__('From %1$s to %2$s', 'events-manager'), $EM_Event_Recurring->event_start_date, $EM_Event_Recurring->event_end_date).", ";
2351
  if ($EM_Event_Recurring->recurrence_freq == 'daily') {
363
  global $allowedposttags;
364
  do_action('em_event_get_post_pre', $this);
365
  //we need to get the post/event name and content.... that's it.
366
+ $this->post_content = isset($_POST['content']) ? wp_kses( wp_unslash($_POST['content']), $allowedposttags):'';
367
  $this->post_excerpt = !empty($this->post_excerpt) ? $this->post_excerpt:''; //fix null error
368
+ $this->event_name = !empty($_POST['event_name']) ? htmlspecialchars_decode(wp_kses_data(htmlspecialchars_decode(wp_unslash($_POST['event_name'])))):'';
369
  $this->post_type = ($this->is_recurring() || !empty($_POST['recurring'])) ? 'event-recurring':EM_POST_TYPE_EVENT;
370
  //don't forget categories!
371
  if( get_option('dbem_categories_enabled') ) $this->get_categories()->get_post();
372
  //anonymous submissions and guest basic info
373
  if( !is_user_logged_in() && get_option('dbem_events_anonymous_submissions') && empty($this->event_id) ){
374
  $this->event_owner_anonymous = 1;
375
+ $this->event_owner_name = !empty($_POST['event_owner_name']) ? wp_kses_data(wp_unslash($_POST['event_owner_name'])):'';
376
  $this->event_owner_email = !empty($_POST['event_owner_email']) ? wp_kses_data($_POST['event_owner_email']):'';
377
  }
378
  //get the rest and validate (optional)
512
  $att_vals = isset($event_available_attributes['values'][$att_key]) ? count($event_available_attributes['values'][$att_key]) : 0;
513
  if( !empty($att_value) ){
514
  if( $att_vals <= 1 || ($att_vals > 1 && in_array($att_value, $event_available_attributes['values'][$att_key])) ){
515
+ $this->event_attributes[$att_key] = wp_unslash($att_value);
516
  }
517
  }
518
  if( empty($att_value) && $att_vals > 1){
519
+ $this->event_attributes[$att_key] = wp_unslash(wp_kses($event_available_attributes['values'][$att_key][0], $allowedtags));
520
  }
521
  }
522
  }
1580
  case '#_EVENTLINK': //HTML Link
1581
  $event_link = esc_url($this->get_permalink());
1582
  if($result == '#_LINKEDNAME' || $result == '#_EVENTLINK'){
1583
+ $replace = '<a href="'.$event_link.'">'.esc_attr($this->event_name).'</a>';
1584
  }else{
1585
  $replace = $event_link;
1586
  }
2345
  function get_recurrence_description() {
2346
  $EM_Event_Recurring = $this->get_event_recurrence();
2347
  $recurrence = $this->to_array();
2348
+ $weekdays_name = array( translate('Sunday'),translate('Monday'),translate('Tuesday'),translate('Wednesday'),translate('Thursday'),translate('Friday'),translate('Saturday'));
2349
  $monthweek_name = array('1' => __('the first %s of the month', 'events-manager'),'2' => __('the second %s of the month', 'events-manager'), '3' => __('the third %s of the month', 'events-manager'), '4' => __('the fourth %s of the month', 'events-manager'), '-1' => __('the last %s of the month', 'events-manager'));
2350
  $output = sprintf (__('From %1$s to %2$s', 'events-manager'), $EM_Event_Recurring->event_start_date, $EM_Event_Recurring->event_end_date).", ";
2351
  if ($EM_Event_Recurring->recurrence_freq == 'daily') {
classes/em-location.php CHANGED
@@ -203,8 +203,8 @@ class EM_Location extends EM_Object {
203
  function get_post($validate = true){
204
  global $allowedtags;
205
  do_action('em_location_get_post_pre', $this);
206
- $this->location_name = ( !empty($_POST['location_name']) ) ? htmlspecialchars_decode(wp_kses_data(htmlspecialchars_decode(stripslashes($_POST['location_name'])))):'';
207
- $this->post_content = ( !empty($_POST['content']) ) ? wp_kses( stripslashes($_POST['content']), $allowedtags):'';
208
  $this->get_post_meta(false);
209
  $result = $validate ? $this->validate():true; //validate both post and meta, otherwise return true
210
  $this->compat_keys();
@@ -218,12 +218,12 @@ class EM_Location extends EM_Object {
218
  function get_post_meta($validate = true){
219
  //We are getting the values via POST or GET
220
  do_action('em_location_get_post_meta_pre', $this);
221
- $this->location_address = ( !empty($_POST['location_address']) ) ? wp_kses(stripslashes($_POST['location_address']), array()):'';
222
- $this->location_town = ( !empty($_POST['location_town']) ) ? wp_kses(stripslashes($_POST['location_town']), array()):'';
223
- $this->location_state = ( !empty($_POST['location_state']) ) ? wp_kses(stripslashes($_POST['location_state']), array()):'';
224
- $this->location_postcode = ( !empty($_POST['location_postcode']) ) ? wp_kses(stripslashes($_POST['location_postcode']), array()):'';
225
- $this->location_region = ( !empty($_POST['location_region']) ) ? wp_kses(stripslashes($_POST['location_region']), array()):'';
226
- $this->location_country = ( !empty($_POST['location_country']) ) ? wp_kses(stripslashes($_POST['location_country']), array()):'';
227
  $this->location_latitude = ( !empty($_POST['location_latitude']) && is_numeric($_POST['location_latitude']) ) ? $_POST['location_latitude']:'';
228
  $this->location_longitude = ( !empty($_POST['location_longitude']) && is_numeric($_POST['location_longitude']) ) ? $_POST['location_longitude']:'';
229
  //Sort out event attributes - note that custom post meta now also gets inserted here automatically (and is overwritten by these attributes)
@@ -236,9 +236,9 @@ class EM_Location extends EM_Object {
236
  if( (in_array($att_key, $location_available_attributes['names']) || array_key_exists($att_key, $this->location_attributes) ) ){
237
  $att_vals = count($location_available_attributes['values'][$att_key]);
238
  if( $att_vals == 0 || ($att_vals > 0 && in_array($att_value, $location_available_attributes['values'][$att_key])) ){
239
- $this->location_attributes[$att_key] = stripslashes($att_value);
240
  }elseif($att_vals > 0){
241
- $this->location_attributes[$att_key] = stripslashes(wp_kses($location_available_attributes['values'][$att_key][0], $allowedtags));
242
  }
243
  }
244
  }
@@ -752,18 +752,9 @@ class EM_Location extends EM_Object {
752
  $replace = $this->get_country();
753
  break;
754
  case '#_LOCATIONFULLLINE':
755
- $replace = $this->location_address;
756
- $replace .= empty($this->location_town) ? '':', '.$this->location_town;
757
- $replace .= empty($this->location_state) ? '':', '.$this->location_state;
758
- $replace .= empty($this->location_postcode) ? '':', '.$this->location_postcode;
759
- $replace .= empty($this->location_region) ? '':', '.$this->location_region;
760
- break;
761
  case '#_LOCATIONFULLBR':
762
- $replace = $this->location_address;
763
- $replace .= empty($this->location_town) ? '':'<br />'.$this->location_town;
764
- $replace .= empty($this->location_state) ? '':'<br />'.$this->location_state;
765
- $replace .= empty($this->location_postcode) ? '':'<br />'.$this->location_postcode;
766
- $replace .= empty($this->location_region) ? '':'<br />'.$this->location_region;
767
  break;
768
  case '#_MAP': //Depricated (but will remain)
769
  case '#_LOCATIONMAP':
@@ -864,7 +855,7 @@ class EM_Location extends EM_Object {
864
  case '#_LOCATIONLINK':
865
  case '#_LOCATIONPAGEURL': //Depricated
866
  $link = esc_url($this->get_permalink());
867
- $replace = ($result == '#_LOCATIONURL' || $result == '#_LOCATIONPAGEURL') ? $link : '<a href="'.$link.'" title="'.esc_attr($this->location_name).'">'.esc_html($this->location_name).'</a>';
868
  break;
869
  case '#_LOCATIONEDITURL':
870
  case '#_LOCATIONEDITLINK':
@@ -956,4 +947,14 @@ class EM_Location extends EM_Object {
956
  return apply_filters('em_location_get_country', false, $this);
957
 
958
  }
 
 
 
 
 
 
 
 
 
 
959
  }
203
  function get_post($validate = true){
204
  global $allowedtags;
205
  do_action('em_location_get_post_pre', $this);
206
+ $this->location_name = ( !empty($_POST['location_name']) ) ? htmlspecialchars_decode(wp_kses_data(htmlspecialchars_decode(wp_unslash($_POST['location_name'])))):'';
207
+ $this->post_content = ( !empty($_POST['content']) ) ? wp_kses( wp_unslash($_POST['content']), $allowedtags):'';
208
  $this->get_post_meta(false);
209
  $result = $validate ? $this->validate():true; //validate both post and meta, otherwise return true
210
  $this->compat_keys();
218
  function get_post_meta($validate = true){
219
  //We are getting the values via POST or GET
220
  do_action('em_location_get_post_meta_pre', $this);
221
+ $this->location_address = ( !empty($_POST['location_address']) ) ? wp_kses(wp_unslash($_POST['location_address']), array()):'';
222
+ $this->location_town = ( !empty($_POST['location_town']) ) ? wp_kses(wp_unslash($_POST['location_town']), array()):'';
223
+ $this->location_state = ( !empty($_POST['location_state']) ) ? wp_kses(wp_unslash($_POST['location_state']), array()):'';
224
+ $this->location_postcode = ( !empty($_POST['location_postcode']) ) ? wp_kses(wp_unslash($_POST['location_postcode']), array()):'';
225
+ $this->location_region = ( !empty($_POST['location_region']) ) ? wp_kses(wp_unslash($_POST['location_region']), array()):'';
226
+ $this->location_country = ( !empty($_POST['location_country']) ) ? wp_kses(wp_unslash($_POST['location_country']), array()):'';
227
  $this->location_latitude = ( !empty($_POST['location_latitude']) && is_numeric($_POST['location_latitude']) ) ? $_POST['location_latitude']:'';
228
  $this->location_longitude = ( !empty($_POST['location_longitude']) && is_numeric($_POST['location_longitude']) ) ? $_POST['location_longitude']:'';
229
  //Sort out event attributes - note that custom post meta now also gets inserted here automatically (and is overwritten by these attributes)
236
  if( (in_array($att_key, $location_available_attributes['names']) || array_key_exists($att_key, $this->location_attributes) ) ){
237
  $att_vals = count($location_available_attributes['values'][$att_key]);
238
  if( $att_vals == 0 || ($att_vals > 0 && in_array($att_value, $location_available_attributes['values'][$att_key])) ){
239
+ $this->location_attributes[$att_key] = wp_unslash($att_value);
240
  }elseif($att_vals > 0){
241
+ $this->location_attributes[$att_key] = wp_unslash(wp_kses($location_available_attributes['values'][$att_key][0], $allowedtags));
242
  }
243
  }
244
  }
752
  $replace = $this->get_country();
753
  break;
754
  case '#_LOCATIONFULLLINE':
 
 
 
 
 
 
755
  case '#_LOCATIONFULLBR':
756
+ $glue = $result == '#_LOCATIONFULLLINE' ? ', ':'<br />';
757
+ $replace = $this->get_full_address($glue);
 
 
 
758
  break;
759
  case '#_MAP': //Depricated (but will remain)
760
  case '#_LOCATIONMAP':
855
  case '#_LOCATIONLINK':
856
  case '#_LOCATIONPAGEURL': //Depricated
857
  $link = esc_url($this->get_permalink());
858
+ $replace = ($result == '#_LOCATIONURL' || $result == '#_LOCATIONPAGEURL') ? $link : '<a href="'.$link.'">'.esc_html($this->location_name).'</a>';
859
  break;
860
  case '#_LOCATIONEDITURL':
861
  case '#_LOCATIONEDITLINK':
947
  return apply_filters('em_location_get_country', false, $this);
948
 
949
  }
950
+
951
+ function get_full_address($glue = ', '){
952
+ $location_array = array();
953
+ if( !empty($this->location_address) ) $location_array[] = $this->location_address;
954
+ if( !empty($this->location_town) ) $location_array[] = $this->location_town;
955
+ if( !empty($this->location_state) ) $location_array[] = $this->location_state;
956
+ if( !empty($this->location_postcode) ) $location_array[] = $this->location_postcode;
957
+ if( !empty($this->location_region) ) $location_array[] = $this->location_region;
958
+ return implode($glue, $location_array);
959
+ }
960
  }
classes/em-notices.php CHANGED
@@ -5,8 +5,14 @@
5
  *
6
  */
7
  class EM_Notices implements Iterator {
8
- var $set_cookies = true;
9
- var $notices = array('errors'=>array(), 'infos'=>array(), 'alerts'=>array(), 'confirms'=>array());
 
 
 
 
 
 
10
 
11
  function __construct( $set_cookies = true ){
12
  //Grab from cookie, if it exists
@@ -57,6 +63,7 @@
57
  if(count($this->notices['confirms']) > 0){
58
  $string .= "<div class='em-warning em-warning-confirms updated'>{$this->get_confirms()}</div>";
59
  }
 
60
  return ($string !== false) ? "<div class='statusnotice'>".$string."</div>" : '';
61
  }
62
 
5
  *
6
  */
7
  class EM_Notices implements Iterator {
8
+ /**
9
+ * If object has been displayed, this gets set to true, can be checked to avoid duplicates.
10
+ * @var boolean
11
+ * @since 5.5.7
12
+ */
13
+ public $displayed = false;
14
+ public $set_cookies = true;
15
+ public $notices = array('errors'=>array(), 'infos'=>array(), 'alerts'=>array(), 'confirms'=>array());
16
 
17
  function __construct( $set_cookies = true ){
18
  //Grab from cookie, if it exists
63
  if(count($this->notices['confirms']) > 0){
64
  $string .= "<div class='em-warning em-warning-confirms updated'>{$this->get_confirms()}</div>";
65
  }
66
+ $this->displayed = true;
67
  return ($string !== false) ? "<div class='statusnotice'>".$string."</div>" : '';
68
  }
69
 
classes/em-object.php CHANGED
@@ -900,7 +900,7 @@ class EM_Object {
900
  if(is_array($post_value)){
901
  $post_value = implode(',',$post_value);
902
  }else{
903
- $post_value = stripslashes($post_value);
904
  }
905
  if($post_value != ',' ){
906
  $args[$post_key] = $post_value;
@@ -1088,9 +1088,9 @@ class EM_Object {
1088
  foreach ( array_keys($this->fields) as $key ) {
1089
  if(array_key_exists($key, $array)){
1090
  if( !is_object($array[$key]) && !is_array($array[$key]) ){
1091
- $array[$key] = ($addslashes) ? stripslashes($array[$key]):$array[$key];
1092
  }elseif( is_array($array[$key]) ){
1093
- $array[$key] = ($addslashes) ? stripslashes_deep($array[$key]):$array[$key];
1094
  }
1095
  $this->$key = $array[$key];
1096
  }
@@ -1170,7 +1170,7 @@ class EM_Object {
1170
  */
1171
  function sanitize( $value ) {
1172
  if( get_magic_quotes_gpc() )
1173
- $value = stripslashes( $value );
1174
 
1175
  //check if this function exists
1176
  if( function_exists( "mysql_real_escape_string" ) ) {
900
  if(is_array($post_value)){
901
  $post_value = implode(',',$post_value);
902
  }else{
903
+ $post_value = wp_unslash($post_value);
904
  }
905
  if($post_value != ',' ){
906
  $args[$post_key] = $post_value;
1088
  foreach ( array_keys($this->fields) as $key ) {
1089
  if(array_key_exists($key, $array)){
1090
  if( !is_object($array[$key]) && !is_array($array[$key]) ){
1091
+ $array[$key] = ($addslashes) ? wp_unslash($array[$key]):$array[$key];
1092
  }elseif( is_array($array[$key]) ){
1093
+ $array[$key] = ($addslashes) ? wp_unslash_deep($array[$key]):$array[$key];
1094
  }
1095
  $this->$key = $array[$key];
1096
  }
1170
  */
1171
  function sanitize( $value ) {
1172
  if( get_magic_quotes_gpc() )
1173
+ $value = wp_unslash( $value );
1174
 
1175
  //check if this function exists
1176
  if( function_exists( "mysql_real_escape_string" ) ) {
classes/em-ticket.php CHANGED
@@ -157,11 +157,11 @@ class EM_Ticket extends EM_Object{
157
  if( empty($post) ){
158
  $post = $_REQUEST;
159
  }
160
- do_action('em_location_get_post_pre', $this, $post);
161
  $this->ticket_id = ( !empty($post['ticket_id']) && is_numeric($post['ticket_id']) ) ? $post['ticket_id']:'';
162
  $this->event_id = ( !empty($post['event_id']) && is_numeric($post['event_id']) ) ? $post['event_id']:'';
163
- $this->ticket_name = ( !empty($post['ticket_name']) ) ? wp_kses_data(stripslashes($post['ticket_name'])):'';
164
- $this->ticket_description = ( !empty($post['ticket_description']) ) ? wp_kses(stripslashes($post['ticket_description']), $allowedposttags):'';
165
  //spaces and limits
166
  $this->ticket_min = ( !empty($post['ticket_min']) && is_numeric($post['ticket_min']) ) ? $post['ticket_min']:'';
167
  $this->ticket_max = ( !empty($post['ticket_max']) && is_numeric($post['ticket_max']) ) ? $post['ticket_max']:'';
157
  if( empty($post) ){
158
  $post = $_REQUEST;
159
  }
160
+ do_action('em_ticket_get_post_pre', $this, $post);
161
  $this->ticket_id = ( !empty($post['ticket_id']) && is_numeric($post['ticket_id']) ) ? $post['ticket_id']:'';
162
  $this->event_id = ( !empty($post['event_id']) && is_numeric($post['event_id']) ) ? $post['event_id']:'';
163
+ $this->ticket_name = ( !empty($post['ticket_name']) ) ? wp_kses_data(wp_unslash($post['ticket_name'])):'';
164
+ $this->ticket_description = ( !empty($post['ticket_description']) ) ? wp_kses(wp_unslash($post['ticket_description']), $allowedposttags):'';
165
  //spaces and limits
166
  $this->ticket_min = ( !empty($post['ticket_min']) && is_numeric($post['ticket_min']) ) ? $post['ticket_min']:'';
167
  $this->ticket_max = ( !empty($post['ticket_max']) && is_numeric($post['ticket_max']) ) ? $post['ticket_max']:'';
classes/em-tickets-bookings.php CHANGED
@@ -88,19 +88,19 @@ class EM_Tickets_Bookings extends EM_Object implements Iterator{
88
  //previously booked ticket, so let's just reset spaces/prices and replace it
89
  $this->tickets_bookings[$EM_Ticket_Booking->ticket_id]->ticket_booking_spaces = $EM_Ticket_Booking->get_spaces();
90
  $this->tickets_bookings[$EM_Ticket_Booking->ticket_id]->ticket_booking_price = $EM_Ticket_Booking->get_price();
91
- return apply_filters('em_tickets_bookings_add',true,$this);
92
  }elseif( $EM_Ticket_Booking->get_spaces() > 0 ){
93
  //new ticket in booking
94
  $this->tickets_bookings[$EM_Ticket_Booking->ticket_id] = $EM_Ticket_Booking;
95
  $this->get_spaces(true);
96
  $this->get_price();
97
- return apply_filters('em_tickets_bookings_add',true,$this);
98
  }
99
  } else {
100
  $this->add_error(get_option('dbem_booking_feedback_full'));
101
- return apply_filters('em_tickets_bookings_add',false,$this);
102
  }
103
- return apply_filters('em_tickets_bookings_add',false,$this);
104
  }
105
 
106
  /**
88
  //previously booked ticket, so let's just reset spaces/prices and replace it
89
  $this->tickets_bookings[$EM_Ticket_Booking->ticket_id]->ticket_booking_spaces = $EM_Ticket_Booking->get_spaces();
90
  $this->tickets_bookings[$EM_Ticket_Booking->ticket_id]->ticket_booking_price = $EM_Ticket_Booking->get_price();
91
+ return apply_filters('em_tickets_bookings_add', true, $this, $EM_Ticket_Booking);
92
  }elseif( $EM_Ticket_Booking->get_spaces() > 0 ){
93
  //new ticket in booking
94
  $this->tickets_bookings[$EM_Ticket_Booking->ticket_id] = $EM_Ticket_Booking;
95
  $this->get_spaces(true);
96
  $this->get_price();
97
+ return apply_filters('em_tickets_bookings_add', true, $this, $EM_Ticket_Booking);
98
  }
99
  } else {
100
  $this->add_error(get_option('dbem_booking_feedback_full'));
101
+ return apply_filters('em_tickets_bookings_add', false, $this, $EM_Ticket_Booking);
102
  }
103
+ return apply_filters('em_tickets_bookings_add', false, $this, $EM_Ticket_Booking);
104
  }
105
 
106
  /**
em-actions.php CHANGED
@@ -202,7 +202,7 @@ function em_init_actions() {
202
  $location_cond = " AND location_private=0";
203
  }
204
  $location_cond = apply_filters('em_actions_locations_search_cond', $location_cond);
205
- $term = (isset($_REQUEST['term'])) ? '%'.$wpdb->esc_like(stripslashes($_REQUEST['term'])).'%' : '%'.$wpdb->esc_like(stripslashes($_REQUEST['q'])).'%';
206
  $sql = $wpdb->prepare("
207
  SELECT
208
  location_id AS `id`,
@@ -452,7 +452,7 @@ function em_init_actions() {
452
  do_action('em_booking_modify_person', $EM_Event, $EM_Booking);
453
  }elseif( $_REQUEST['action'] == 'bookings_add_note' && $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ) {
454
  em_verify_nonce('bookings_add_note');
455
- if( $EM_Booking->add_note(stripslashes($_REQUEST['booking_note'])) ){
456
  $EM_Notices->add_confirm($EM_Booking->feedback_message, true);
457
  $redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : em_wp_get_referer();
458
  wp_redirect( $redirect );
202
  $location_cond = " AND location_private=0";
203
  }
204
  $location_cond = apply_filters('em_actions_locations_search_cond', $location_cond);
205
+ $term = (isset($_REQUEST['term'])) ? '%'.$wpdb->esc_like(wp_unslash($_REQUEST['term'])).'%' : '%'.$wpdb->esc_like(wp_unslash($_REQUEST['q'])).'%';
206
  $sql = $wpdb->prepare("
207
  SELECT
208
  location_id AS `id`,
452
  do_action('em_booking_modify_person', $EM_Event, $EM_Booking);
453
  }elseif( $_REQUEST['action'] == 'bookings_add_note' && $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ) {
454
  em_verify_nonce('bookings_add_note');
455
+ if( $EM_Booking->add_note(wp_unslash($_REQUEST['booking_note'])) ){
456
  $EM_Notices->add_confirm($EM_Booking->feedback_message, true);
457
  $redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : em_wp_get_referer();
458
  wp_redirect( $redirect );
em-functions.php CHANGED
@@ -253,7 +253,7 @@ function em_get_hour_format(){
253
  }
254
 
255
  function em_get_days_names(){
256
- return array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 0 => __ ( 'Sun' ) );
257
  }
258
 
259
  /**
@@ -354,7 +354,7 @@ function em_booking_add_registration( $EM_Booking ){
354
  $registration = true;
355
  if( ((!is_user_logged_in() && get_option('dbem_bookings_anonymous')) || EM_Bookings::is_registration_forced()) && !get_option('dbem_bookings_registration_disable') ){
356
  //find random username - less options for user, less things go wrong
357
- $user_email = trim(stripslashes($_REQUEST['user_email'])); //otherwise may fail validation
358
  $username_root = explode('@', wp_kses_data($user_email));
359
  $username_root = $username_rand = sanitize_user($username_root[0], true);
360
  while( username_exists($username_rand) ) {
@@ -485,8 +485,8 @@ function em_new_user_notification() {
485
  //Copied out of /wp-includes/pluggable.php
486
  $user = new WP_User($user_id);
487
 
488
- $user_login = stripslashes($user->user_login);
489
- $user_email = stripslashes($user->user_email);
490
 
491
  // The blogname option is escaped with esc_html on the way into the database in sanitize_option
492
  // we want to reverse this for the plain text arena of emails.
@@ -587,13 +587,13 @@ function em_get_search_form_defaults($args = array()){
587
  $args = array_merge($search_args, $args);
588
  //overwrite with $_REQUEST defaults in event of a submitted search
589
  if( isset($_REQUEST['geo']) ) $args['geo'] = $_REQUEST['geo']; //if geo search string requested, use that for search form
590
- if( isset($_REQUEST['near']) ) $args['near'] = stripslashes($_REQUEST['near']); //if geo search string requested, use that for search form
591
- if( isset($_REQUEST['em_search']) ) $args['search'] = stripslashes($_REQUEST['em_search']); //if geo search string requested, use that for search form
592
  if( isset($_REQUEST['category']) ) $args['category'] = $_REQUEST['category']; //if state requested, use that for searching
593
- if( isset($_REQUEST['country']) ) $args['country'] = stripslashes($_REQUEST['country']); //if country requested, use that for searching
594
- if( isset($_REQUEST['region']) ) $args['region'] = stripslashes($_REQUEST['region']); //if region requested, use that for searching
595
- if( isset($_REQUEST['state']) ) $args['state'] = stripslashes($_REQUEST['state']); //if state requested, use that for searching
596
- if( isset($_REQUEST['town']) ) $args['town'] = stripslashes($_REQUEST['town']); //if state requested, use that for searching
597
  if( isset($_REQUEST['near_unit']) ) $args['near_unit'] = $_REQUEST['near_unit']; //if state requested, use that for searching
598
  if( isset($_REQUEST['near_distance']) ) $args['near_distance'] = $_REQUEST['near_distance']; //if state requested, use that for searching
599
  if( !empty($_REQUEST['scope']) && !is_array($_REQUEST['scope'])){
253
  }
254
 
255
  function em_get_days_names(){
256
+ return array (1 => translate( 'Mon' ), 2 => translate( 'Tue' ), 3 => translate( 'Wed' ), 4 => translate( 'Thu' ), 5 => translate( 'Fri' ), 6 => translate( 'Sat' ), 0 => translate( 'Sun' ) );
257
  }
258
 
259
  /**
354
  $registration = true;
355
  if( ((!is_user_logged_in() && get_option('dbem_bookings_anonymous')) || EM_Bookings::is_registration_forced()) && !get_option('dbem_bookings_registration_disable') ){
356
  //find random username - less options for user, less things go wrong
357
+ $user_email = trim(wp_unslash($_REQUEST['user_email'])); //otherwise may fail validation
358
  $username_root = explode('@', wp_kses_data($user_email));
359
  $username_root = $username_rand = sanitize_user($username_root[0], true);
360
  while( username_exists($username_rand) ) {
485
  //Copied out of /wp-includes/pluggable.php
486
  $user = new WP_User($user_id);
487
 
488
+ $user_login = wp_unslash($user->user_login);
489
+ $user_email = wp_unslash($user->user_email);
490
 
491
  // The blogname option is escaped with esc_html on the way into the database in sanitize_option
492
  // we want to reverse this for the plain text arena of emails.
587
  $args = array_merge($search_args, $args);
588
  //overwrite with $_REQUEST defaults in event of a submitted search
589
  if( isset($_REQUEST['geo']) ) $args['geo'] = $_REQUEST['geo']; //if geo search string requested, use that for search form
590
+ if( isset($_REQUEST['near']) ) $args['near'] = wp_unslash($_REQUEST['near']); //if geo search string requested, use that for search form
591
+ if( isset($_REQUEST['em_search']) ) $args['search'] = wp_unslash($_REQUEST['em_search']); //if geo search string requested, use that for search form
592
  if( isset($_REQUEST['category']) ) $args['category'] = $_REQUEST['category']; //if state requested, use that for searching
593
+ if( isset($_REQUEST['country']) ) $args['country'] = wp_unslash($_REQUEST['country']); //if country requested, use that for searching
594
+ if( isset($_REQUEST['region']) ) $args['region'] = wp_unslash($_REQUEST['region']); //if region requested, use that for searching
595
+ if( isset($_REQUEST['state']) ) $args['state'] = wp_unslash($_REQUEST['state']); //if state requested, use that for searching
596
+ if( isset($_REQUEST['town']) ) $args['town'] = wp_unslash($_REQUEST['town']); //if state requested, use that for searching
597
  if( isset($_REQUEST['near_unit']) ) $args['near_unit'] = $_REQUEST['near_unit']; //if state requested, use that for searching
598
  if( isset($_REQUEST['near_distance']) ) $args['near_distance'] = $_REQUEST['near_distance']; //if state requested, use that for searching
599
  if( !empty($_REQUEST['scope']) && !is_array($_REQUEST['scope'])){
em-install.php CHANGED
@@ -88,10 +88,40 @@ function em_sort_out_table_nu_keys($table_name, $clean_keys = array()){
88
  }
89
  //add new keys
90
  foreach($new_keys as $key){
91
- $wpdb->query("ALTER TABLE $table_name ADD INDEX ($key)");
 
 
 
 
92
  }
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  function em_create_events_table() {
96
  global $wpdb;
97
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
@@ -161,6 +191,7 @@ function em_create_events_table() {
161
  dbDelta($sql);
162
  }
163
  em_sort_out_table_nu_keys($table_name, array('event_status','post_id','blog_id','group_id','location_id'));
 
164
  }
165
 
166
  function em_create_events_meta_table(){
@@ -181,6 +212,7 @@ function em_create_events_meta_table(){
181
 
182
  dbDelta($sql);
183
  em_sort_out_table_nu_keys($table_name, array('object_id','meta_key'));
 
184
  }
185
 
186
  function em_create_locations_table() {
@@ -232,7 +264,12 @@ function em_create_locations_table() {
232
  $wpdb->query("UPDATE ".$table_name." SET location_status=1");
233
  }
234
  }
235
- em_sort_out_table_nu_keys($table_name, array('location_state','location_region','location_country','post_id','blog_id'));
 
 
 
 
 
236
  }
237
 
238
  function em_create_bookings_table() {
@@ -257,6 +294,7 @@ function em_create_bookings_table() {
257
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
258
  dbDelta($sql);
259
  em_sort_out_table_nu_keys($table_name, array('event_id','person_id','booking_status'));
 
260
  }
261
 
262
 
@@ -289,6 +327,7 @@ function em_create_tickets_table() {
289
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
290
  dbDelta($sql);
291
  em_sort_out_table_nu_keys($table_name, array('event_id'));
 
292
  }
293
 
294
  //Add the categories table
@@ -309,6 +348,7 @@ function em_create_tickets_bookings_table() {
309
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
310
  dbDelta($sql);
311
  em_sort_out_table_nu_keys($table_name, array('booking_id','ticket_id'));
 
312
  }
313
 
314
  function em_add_options() {
@@ -426,11 +466,11 @@ function em_add_options() {
426
  'dbem_events_page_title' => __('Events','events-manager'),
427
  'dbem_events_page_scope' => 'future',
428
  'dbem_events_page_search_form' => 1,
429
- 'dbem_event_list_item_format_header' => '<table cellpadding="0" cellspacing="0" class="events-table" >
430
  <thead>
431
  <tr>
432
- <th class="event-time" width="150">'.__('Date/Time','events-manager').'</th>
433
- <th class="event-description" width="*">'.__('Event','events-manager').'</th>
434
  </tr>
435
  </thead>
436
  <tbody>',
@@ -564,9 +604,9 @@ function em_add_options() {
564
  //iCal Stuff
565
  'dbem_ical_limit' => 0,
566
  'dbem_ical_scope' => "future",
567
- 'dbem_ical_description_format' => "#_EVENTNAME - #_LOCATIONNAME - #_EVENTDATES - #_EVENTTIMES",
568
  'dbem_ical_real_description_format' => "#_EVENTEXCERPT",
569
- 'dbem_ical_location_format' => "#_LOCATION",
570
  //Google Maps
571
  'dbem_gmap_is_active'=> 1,
572
  'dbem_google_maps_browser_key'=> '',
@@ -914,6 +954,15 @@ function em_add_options() {
914
  $wpdb->query('DELETE FROM '.$wpdb->postmeta." WHERE (meta_key='_event_date_created' OR meta_key='_event_date_modified') AND post_id IN (SELECT ID FROM ".$wpdb->posts." WHERE post_type='".EM_POST_TYPE_EVENT."' OR post_type='event-recurring')");
915
  $wpdb->query('ALTER TABLE '. $wpdb->prefix.'em_bookings CHANGE event_id event_id BIGINT(20) UNSIGNED NULL');
916
  }
 
 
 
 
 
 
 
 
 
917
  //set time localization for first time depending on current settings
918
  if( get_option('dbem_time_24h','not set') == 'not set'){
919
  //Localise vars regardless
88
  }
89
  //add new keys
90
  foreach($new_keys as $key){
91
+ if( preg_match('/\(/', $key) ){
92
+ $wpdb->query("ALTER TABLE $table_name ADD INDEX $key");
93
+ }else{
94
+ $wpdb->query("ALTER TABLE $table_name ADD INDEX ($key)");
95
+ }
96
  }
97
  }
98
 
99
+ /**
100
+ * Since WP 4.2 tables are created with utf8mb4 collation. This creates problems when storing content in previous utf8 tables such as when using emojis.
101
+ * This function checks whether the table in WP was changed
102
+ * @return boolean
103
+ */
104
+ function em_check_utf8mb4_tables(){
105
+ global $wpdb, $em_check_utf8mb4_tables;
106
+
107
+ if( $em_check_utf8mb4_tables || $em_check_utf8mb4_tables === false ) return $em_check_utf8mb4_tables;
108
+
109
+ $column = $wpdb->get_row( "SHOW FULL COLUMNS FROM {$wpdb->posts} WHERE Field='post_content';" );
110
+ if ( ! $column ) {
111
+ return false;
112
+ }
113
+
114
+ //if this doesn't become true further down, that means we couldn't find a correctly converted utf8mb4 posts table
115
+ $em_check_utf8mb4_tables = false;
116
+
117
+ if ( $column->Collation ) {
118
+ list( $charset ) = explode( '_', $column->Collation );
119
+ $em_check_utf8mb4_tables = ( 'utf8mb4' === strtolower( $charset ) );
120
+ }
121
+ return $em_check_utf8mb4_tables;
122
+
123
+ }
124
+
125
  function em_create_events_table() {
126
  global $wpdb;
127
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
191
  dbDelta($sql);
192
  }
193
  em_sort_out_table_nu_keys($table_name, array('event_status','post_id','blog_id','group_id','location_id'));
194
+ if( em_check_utf8mb4_tables() ) maybe_convert_table_to_utf8mb4( $table_name );
195
  }
196
 
197
  function em_create_events_meta_table(){
212
 
213
  dbDelta($sql);
214
  em_sort_out_table_nu_keys($table_name, array('object_id','meta_key'));
215
+ if( em_check_utf8mb4_tables() ) maybe_convert_table_to_utf8mb4( $table_name );
216
  }
217
 
218
  function em_create_locations_table() {
264
  $wpdb->query("UPDATE ".$table_name." SET location_status=1");
265
  }
266
  }
267
+ if( em_check_utf8mb4_tables() ){
268
+ maybe_convert_table_to_utf8mb4( $table_name );
269
+ em_sort_out_table_nu_keys($table_name, array('location_state (location_state(191))','location_region (location_region(191))','location_country','post_id','blog_id'));
270
+ }else{
271
+ em_sort_out_table_nu_keys($table_name, array('location_state','location_region','location_country','post_id','blog_id'));
272
+ }
273
  }
274
 
275
  function em_create_bookings_table() {
294
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
295
  dbDelta($sql);
296
  em_sort_out_table_nu_keys($table_name, array('event_id','person_id','booking_status'));
297
+ if( em_check_utf8mb4_tables() ) maybe_convert_table_to_utf8mb4( $table_name );
298
  }
299
 
300
 
327
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
328
  dbDelta($sql);
329
  em_sort_out_table_nu_keys($table_name, array('event_id'));
330
+ if( em_check_utf8mb4_tables() ) maybe_convert_table_to_utf8mb4( $table_name );
331
  }
332
 
333
  //Add the categories table
348
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
349
  dbDelta($sql);
350
  em_sort_out_table_nu_keys($table_name, array('booking_id','ticket_id'));
351
+ if( em_check_utf8mb4_tables() ) maybe_convert_table_to_utf8mb4( $table_name );
352
  }
353
 
354
  function em_add_options() {
466
  'dbem_events_page_title' => __('Events','events-manager'),
467
  'dbem_events_page_scope' => 'future',
468
  'dbem_events_page_search_form' => 1,
469
+ 'dbem_event_list_item_format_header' => '<table class="events-table" >
470
  <thead>
471
  <tr>
472
+ <th class="event-time" scope="col">'.__('Date/Time','events-manager').'</th>
473
+ <th class="event-description" scope="col">'.__('Event','events-manager').'</th>
474
  </tr>
475
  </thead>
476
  <tbody>',
604
  //iCal Stuff
605
  'dbem_ical_limit' => 0,
606
  'dbem_ical_scope' => "future",
607
+ 'dbem_ical_description_format' => "#_EVENTNAME",
608
  'dbem_ical_real_description_format' => "#_EVENTEXCERPT",
609
+ 'dbem_ical_location_format' => "#_LOCATIONNAME, #_LOCATIONFULLLINE, #_LOCATIONCOUNTRY",
610
  //Google Maps
611
  'dbem_gmap_is_active'=> 1,
612
  'dbem_google_maps_browser_key'=> '',
954
  $wpdb->query('DELETE FROM '.$wpdb->postmeta." WHERE (meta_key='_event_date_created' OR meta_key='_event_date_modified') AND post_id IN (SELECT ID FROM ".$wpdb->posts." WHERE post_type='".EM_POST_TYPE_EVENT."' OR post_type='event-recurring')");
955
  $wpdb->query('ALTER TABLE '. $wpdb->prefix.'em_bookings CHANGE event_id event_id BIGINT(20) UNSIGNED NULL');
956
  }
957
+ if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.66 ){
958
+ if( get_option('dbem_ical_description_format') == "#_EVENTNAME - #_LOCATIONNAME - #_EVENTDATES - #_EVENTTIMES" ) update_option('dbem_ical_description_format',"#_EVENTNAME");
959
+ if( get_option('dbem_ical_location_format') == "#_LOCATION" ) update_option('dbem_ical_location_format', "#_LOCATIONNAME, #_LOCATIONFULLLINE, #_LOCATIONCOUNTRY");
960
+ $old_values = array(
961
+ 'dbem_ical_description_format' => "#_EVENTNAME - #_LOCATIONNAME - #_EVENTDATES - #_EVENTTIMES",
962
+ 'dbem_ical_location_format' => "#_LOCATION",
963
+ );
964
+ }
965
+
966
  //set time localization for first time depending on current settings
967
  if( get_option('dbem_time_24h','not set') == 'not set'){
968
  //Localise vars regardless
em-posts.php CHANGED
@@ -24,8 +24,8 @@ function wp_events_plugin_after_setup_theme(){
24
  global $_wp_theme_features;
25
  if( !empty($_wp_theme_features['post-thumbnails']) ){
26
  //either leave as true, or add our cpts to this
27
- if( is_array($_wp_theme_features['post-thumbnails']) ){
28
- $post_thumbnails = array_shift($_wp_theme_features['post-thumbnails']);
29
  //add to featured image post types for specific themes
30
  $post_thumbnails[] = EM_POST_TYPE_EVENT;
31
  $post_thumbnails[] = 'event-recurring';
@@ -33,7 +33,8 @@ function wp_events_plugin_after_setup_theme(){
33
  add_theme_support('post-thumbnails', $post_thumbnails);
34
  }
35
  }else{
36
- add_theme_support('post-thumbnails'); //need to add this for themes that don't have it.
 
37
  }
38
  }
39
  }
24
  global $_wp_theme_features;
25
  if( !empty($_wp_theme_features['post-thumbnails']) ){
26
  //either leave as true, or add our cpts to this
27
+ if( !empty($_wp_theme_features['post-thumbnails'][0]) && is_array($_wp_theme_features['post-thumbnails'][0]) ){
28
+ $post_thumbnails = $_wp_theme_features['post-thumbnails'][0];
29
  //add to featured image post types for specific themes
30
  $post_thumbnails[] = EM_POST_TYPE_EVENT;
31
  $post_thumbnails[] = 'event-recurring';
33
  add_theme_support('post-thumbnails', $post_thumbnails);
34
  }
35
  }else{
36
+ $post_thumbnails = array(EM_POST_TYPE_EVENT, 'event-recurring', EM_POST_TYPE_LOCATION);
37
+ add_theme_support('post-thumbnails', $post_thumbnails); //need to add this for themes that don't have it.
38
  }
39
  }
40
  }
events-manager.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Events Manager
4
- Version: 5.6.5
5
  Plugin URI: http://wp-events-plugin.com
6
  Description: Event registration and booking management for WordPress. Recurring events, locations, google maps, rss, ical, booking registration and more!
7
  Author: Marcus Sykes
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
  // Setting constants
31
- define('EM_VERSION', 5.64); //self expanatory
32
  define('EM_PRO_MIN_VERSION', 2.392); //self expanatory
33
  define('EM_PRO_MIN_VERSION_CRITICAL', 2.377); //self expanatory
34
  define('EM_DIR', dirname( __FILE__ )); //an absolute path to this directory
1
  <?php
2
  /*
3
  Plugin Name: Events Manager
4
+ Version: 5.6.6
5
  Plugin URI: http://wp-events-plugin.com
6
  Description: Event registration and booking management for WordPress. Recurring events, locations, google maps, rss, ical, booking registration and more!
7
  Author: Marcus Sykes
28
  */
29
 
30
  // Setting constants
31
+ define('EM_VERSION', 5.6624); //self expanatory
32
  define('EM_PRO_MIN_VERSION', 2.392); //self expanatory
33
  define('EM_PRO_MIN_VERSION_CRITICAL', 2.377); //self expanatory
34
  define('EM_DIR', dirname( __FILE__ )); //an absolute path to this directory
includes/css/events_manager.css CHANGED
@@ -1,5 +1,6 @@
1
  div#em-loading { position:absolute; width:100%; height:100%; background:#FFFFFF url(../images/loading.gif) 50% 50% no-repeat; left:0px; top:0px; opacity:0.8; filter:alpha(opacity=80); z-index:99998; }
2
  .em-search-ajax { position:relative; }
 
3
  /* Warnings */
4
  .em-warning { margin:10px 0px; padding:10px; color:#333; border-radius:3px; display:block !important; }
5
  .em-warning p { margin:10px 0px !important; padding:0px; color:#333 }
@@ -72,12 +73,18 @@ div#em-loading { position:absolute; width:100%; height:100%; background:#FFFFFF
72
  div.css-search div.em-search-location, div.em-search-location-meta { margin:0px; padding: 0px; }
73
  div.css-search div.em-search-advanced, div.css-search div.em-search-options { padding:5px 8px; }
74
  div.css-search div.em-search-advanced > div { clear:both; }
75
- div.css-search div.em-search-advanced label { display:block; float:left; min-width:100px; }
76
  div.css-search div.em-search-advanced .em-search-submit { margin:10px 0px; }
77
  div.css-search.no-search-main div.em-search-advanced.visible div { display:inline; clear:none; }
78
  div.css-search.no-search-main div.em-search-advanced.visible label { display:none; }
79
  div.css-search div.em-search-options { text-align:right; }
80
-
 
 
 
 
 
 
81
  /* Booking Form */
82
  .em-booking { margin:15px 0px 10px 0px; position:relative; }
83
  .em-booking-form { position:relative; clear:left; }
1
  div#em-loading { position:absolute; width:100%; height:100%; background:#FFFFFF url(../images/loading.gif) 50% 50% no-repeat; left:0px; top:0px; opacity:0.8; filter:alpha(opacity=80); z-index:99998; }
2
  .em-search-ajax { position:relative; }
3
+ .em-wrapper label span.screen-reader-text, #em-wrapper label span.screen-reader-text { clip: rect(1px 1px 1px 1px); position: absolute !important; height: 1px; width: 1px; overflow: hidden; }
4
  /* Warnings */
5
  .em-warning { margin:10px 0px; padding:10px; color:#333; border-radius:3px; display:block !important; }
6
  .em-warning p { margin:10px 0px !important; padding:0px; color:#333 }
73
  div.css-search div.em-search-location, div.em-search-location-meta { margin:0px; padding: 0px; }
74
  div.css-search div.em-search-advanced, div.css-search div.em-search-options { padding:5px 8px; }
75
  div.css-search div.em-search-advanced > div { clear:both; }
76
+ div.css-search div.em-search-advanced label > span { display:block; float:left; min-width:100px; }
77
  div.css-search div.em-search-advanced .em-search-submit { margin:10px 0px; }
78
  div.css-search.no-search-main div.em-search-advanced.visible div { display:inline; clear:none; }
79
  div.css-search.no-search-main div.em-search-advanced.visible label { display:none; }
80
  div.css-search div.em-search-options { text-align:right; }
81
+
82
+ /* Events List */
83
+ .css-events-list table.events-table { border-spacing: 0px; border-collapse: collapse; }
84
+ .css-events-list table.events-table td { padding:0px; }
85
+ .css-events-list table.events-table th.event-time { width:150px; }
86
+ .css-events-list table.events-table th.event-description { width:auto; }
87
+
88
  /* Booking Form */
89
  .em-booking { margin:15px 0px 10px 0px; position:relative; }
90
  .em-booking-form { position:relative; clear:left; }
includes/js/admin-settings.js CHANGED
@@ -80,7 +80,7 @@ jQuery(document).ready(function($){
80
  }
81
  }).trigger('change');
82
  //For rewrite titles
83
- $('input:radio[name=dbem_disable_title_rewrites]').live('change',function(){
84
  checked_check = $('input:radio[name=dbem_disable_title_rewrites]:checked');
85
  if( checked_check.val() == 1 ){
86
  $('#dbem_title_html_row').show();
80
  }
81
  }).trigger('change');
82
  //For rewrite titles
83
+ $('input:radio[name=dbem_disable_title_rewrites]').on('change',function(){
84
  checked_check = $('input:radio[name=dbem_disable_title_rewrites]:checked');
85
  if( checked_check.val() == 1 ){
86
  $('#dbem_title_html_row').show();
multilingual/em-ml-io.php CHANGED
@@ -124,8 +124,8 @@ class EM_ML_IO {
124
  // We need to save ticket translations here as well to the ticket objects
125
  foreach( $EM_Event->get_tickets()->tickets as $EM_Ticket ){ /* @var $EM_Ticket EM_Ticket */
126
  $ticket_translation = array();
127
- if( !empty($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_name'] ) ) $ticket_translation['ticket_name'] = wp_kses_data(stripslashes($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_name']));
128
- if( !empty($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_description'] ) ) $ticket_translation['ticket_description'] = wp_kses_post(stripslashes($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_description']));
129
  if( !empty($ticket_translation) ) $EM_Ticket->ticket_meta['langs'][EM_ML::$current_language] = $ticket_translation;
130
  }
131
  }elseif( !empty($EM_Event->location_id) ){
124
  // We need to save ticket translations here as well to the ticket objects
125
  foreach( $EM_Event->get_tickets()->tickets as $EM_Ticket ){ /* @var $EM_Ticket EM_Ticket */
126
  $ticket_translation = array();
127
+ if( !empty($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_name'] ) ) $ticket_translation['ticket_name'] = wp_kses_data(wp_unslash($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_name']));
128
+ if( !empty($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_description'] ) ) $ticket_translation['ticket_description'] = wp_kses_post(wp_unslash($_REQUEST['ticket_translations'][$EM_Ticket->ticket_id]['ticket_description']));
129
  if( !empty($ticket_translation) ) $EM_Ticket->ticket_meta['langs'][EM_ML::$current_language] = $ticket_translation;
130
  }
131
  }elseif( !empty($EM_Event->location_id) ){
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wp-events-plugin.com
4
  Tags: bookings, buddypress, calendar, event, event management, events, google maps, maps, locations, registration, registration, tickets
5
  Text Domain: events-manager
6
  Requires at least: 3.5
7
- Tested up to: 4.6
8
- Stable tag: 5.6.5
9
 
10
  Fully featured event registration management including recurring events, locations management, calendar, Google map integration, booking management
11
 
@@ -99,6 +99,24 @@ See our [FAQ](http://wp-events-plugin.com/documentation/faq/) page, which is upd
99
  6. Manage attendees with various booking reports
100
 
101
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  = 5.6.5 =
103
  * added option to add Google Maps API key
104
  * fixed category image uploader not working properly on some specific setups
4
  Tags: bookings, buddypress, calendar, event, event management, events, google maps, maps, locations, registration, registration, tickets
5
  Text Domain: events-manager
6
  Requires at least: 3.5
7
+ Tested up to: 4.6.1
8
+ Stable tag: 5.6.6
9
 
10
  Fully featured event registration management including recurring events, locations management, calendar, Google map integration, booking management
11
 
99
  6. Manage attendees with various booking reports
100
 
101
  == Changelog ==
102
+ = 5.6.6 =
103
+ * improvements to ical formatting, including static/unique UIDs, more accurate locations with geo coordinates, categories and featured image
104
+ * replaced code using stripslashes() with wp_unslash() (kudos @webaware)
105
+ * removed use of jQuery.live() on settings page
106
+ * tweaked event search form elements and events list table to be ADA compliant
107
+ * added $EM_Ticket_Booking to em_tickets_bookings_add filter arguments
108
+ * removed translations of weekdays within EM and using WP translations instead,
109
+ * changed calendar templates to stop using ucfirst() to uppercase month first letters since it breaks some languages and the languages that need it don't capitalize their months anyway
110
+ * fixed anonymous event submitter info not showing in recurring event admin area
111
+ * fixed wrong nav id in BuddyPress (kudos @lyevalley)
112
+ * fixed 'no location' checkbox not remaining checked if event submission returns an validation error
113
+ * tweaked templates/forms/event/location.php and added some extra output sanitization
114
+ * fixed 404 errors in calendar links to eventful day list for a specific location
115
+ * fixed syncing of tables when WP uses utf8mb4 collation which causes errors when saving emojis in post content
116
+ * fixed WP 4.6 PHP warnings and featured image problems when using a theme that limits specific CPTs to use thumbnails
117
+ * fixed action typo in EM_Ticket::get_post() from em_location_get_post_pre to em_ticket_get_post_pre
118
+ * fixed location not showing up in admin area within dropdown if previously assigned to an event but not available to user due to permission changes
119
+
120
  = 5.6.5 =
121
  * added option to add Google Maps API key
122
  * fixed category image uploader not working properly on some specific setups
templates/forms/event/bookings-ticket-form.php CHANGED
@@ -15,7 +15,7 @@ $col_count = absint($col_count); //now we know it's a number
15
  </div>
16
  <div class="ticket-description">
17
  <label><?php esc_html_e('Description','events-manager') ?></label>
18
- <textarea name="em_tickets[<?php echo $col_count; ?>][ticket_description]" class="ticket_description"><?php echo esc_html(stripslashes($EM_Ticket->ticket_description)) ?></textarea>
19
  </div>
20
  <div class="ticket-price"><label><?php esc_html_e('Price','events-manager') ?></label><input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_price]" class="ticket_price" value="<?php echo esc_attr($EM_Ticket->get_price_precise()) ?>" /></div>
21
  <div class="ticket-spaces">
15
  </div>
16
  <div class="ticket-description">
17
  <label><?php esc_html_e('Description','events-manager') ?></label>
18
+ <textarea name="em_tickets[<?php echo $col_count; ?>][ticket_description]" class="ticket_description"><?php echo esc_html(wp_unslash($EM_Ticket->ticket_description)) ?></textarea>
19
  </div>
20
  <div class="ticket-price"><label><?php esc_html_e('Price','events-manager') ?></label><input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_price]" class="ticket_price" value="<?php echo esc_attr($EM_Ticket->get_price_precise()) ?>" /></div>
21
  <div class="ticket-spaces">
templates/forms/event/location.php CHANGED
@@ -5,7 +5,7 @@ $required = apply_filters('em_required_html','<i>*</i>');
5
  <?php if( !get_option('dbem_require_location') && !get_option('dbem_use_select_for_locations') ): ?>
6
  <div class="em-location-data-nolocation">
7
  <p>
8
- <input type="checkbox" name="no_location" id="no-location" value="1" <?php if( !empty($EM_Event->event_id) && ($EM_Event->location_id === '0' || $EM_Event->location_id === 0) ) echo 'checked="checked"'; ?>>
9
  <?php _e('This event does not have a physical location.','events-manager'); ?>
10
  </p>
11
  <script type="text/javascript">
@@ -23,16 +23,16 @@ $required = apply_filters('em_required_html','<i>*</i>');
23
  <?php endif; ?>
24
  <div id="em-location-data" class="em-location-data">
25
  <div id="location_coordinates" style='display: none;'>
26
- <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $EM_Event->get_location()->location_latitude; ?>' size='15' />
27
- <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $EM_Event->get_location()->location_longitude; ?>' size='15' />
28
  </div>
29
  <?php if( get_option('dbem_use_select_for_locations') || !$EM_Event->can_manage('edit_locations','edit_others_locations') ) : ?>
30
  <table class="em-location-data">
31
  <tr class="em-location-data-select">
32
- <th><?php _e('Location:','events-manager') ?> </th>
33
  <td>
34
  <select name="location_id" id='location-select-id' size="1">
35
- <?php if(!get_option('dbem_require_location',true)): ?><option value="0"><?php _e('No Location','events-manager'); ?></option><?php endif; ?>
36
  <?php
37
  $ddm_args = array('blog'=>false, 'private'=>$EM_Event->can_manage('read_private_locations'));
38
  $ddm_args['owner'] = (is_user_logged_in() && !current_user_can('read_others_locations')) ? get_current_user_id() : false;
@@ -40,10 +40,19 @@ $required = apply_filters('em_required_html','<i>*</i>');
40
  $selected_location = !empty($EM_Event->location_id) || !empty($EM_Event->event_id) ? $EM_Event->location_id:get_option('dbem_default_location');
41
  foreach($locations as $EM_Location) {
42
  $selected = ($selected_location == $EM_Location->location_id) ? "selected='selected' " : '';
 
43
  ?>
44
- <option value="<?php echo $EM_Location->location_id ?>" title="<?php echo "{$EM_Location->location_latitude},{$EM_Location->location_longitude}" ?>" <?php echo $selected ?>><?php echo $EM_Location->location_name; ?></option>
45
  <?php
46
  }
 
 
 
 
 
 
 
 
47
  ?>
48
  </select>
49
  </td>
@@ -64,41 +73,41 @@ $required = apply_filters('em_required_html','<i>*</i>');
64
  <tr class="em-location-data-name">
65
  <th><?php _e ( 'Location Name:', 'events-manager')?></th>
66
  <td>
67
- <input id='location-id' name='location_id' type='hidden' value='<?php echo $EM_Location->location_id; ?>' size='15' />
68
  <input id="location-name" type="text" name="location_name" value="<?php echo esc_attr($EM_Location->location_name, ENT_QUOTES); ?>" /><?php echo $required; ?>
69
  <br />
70
- <em id="em-location-search-tip"><?php _e( 'Create a location or start typing to search a previously created location.', 'events-manager')?></em>
71
- <em id="em-location-reset" style="display:none;"><?php _e('You cannot edit saved locations here.', 'events-manager'); ?> <a href="#"><?php _e('Reset this form to create a location or search again.', 'events-manager')?></a></em>
72
  </td>
73
  </tr>
74
  <tr class="em-location-data-address">
75
  <th><?php _e ( 'Address:', 'events-manager')?>&nbsp;</th>
76
  <td>
77
- <input id="location-address" type="text" name="location_address" value="<?php echo esc_attr($EM_Location->location_address, ENT_QUOTES); ; ?>" /><?php echo $required; ?>
78
  </td>
79
  </tr>
80
  <tr class="em-location-data-town">
81
  <th><?php _e ( 'City/Town:', 'events-manager')?>&nbsp;</th>
82
  <td>
83
- <input id="location-town" type="text" name="location_town" value="<?php echo esc_attr($EM_Location->location_town, ENT_QUOTES); ?>" /><?php echo $required; ?>
84
  </td>
85
  </tr>
86
  <tr class="em-location-data-state">
87
  <th><?php _e ( 'State/County:', 'events-manager')?>&nbsp;</th>
88
  <td>
89
- <input id="location-state" type="text" name="location_state" value="<?php echo esc_attr($EM_Location->location_state, ENT_QUOTES); ?>" />
90
  </td>
91
  </tr>
92
  <tr class="em-location-data-postcode">
93
  <th><?php _e ( 'Postcode:', 'events-manager')?>&nbsp;</th>
94
  <td>
95
- <input id="location-postcode" type="text" name="location_postcode" value="<?php echo esc_attr($EM_Location->location_postcode, ENT_QUOTES); ?>" />
96
  </td>
97
  </tr>
98
  <tr class="em-location-data-region">
99
  <th><?php _e ( 'Region:', 'events-manager')?>&nbsp;</th>
100
  <td>
101
- <input id="location-region" type="text" name="location_region" value="<?php echo esc_attr($EM_Location->location_region, ENT_QUOTES); ?>" />
102
  </td>
103
  </tr>
104
  <tr class="em-location-data-country">
@@ -107,7 +116,7 @@ $required = apply_filters('em_required_html','<i>*</i>');
107
  <select id="location-country" name="location_country">
108
  <option value="0" <?php echo ( $EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country') == '' ) ? 'selected="selected"':''; ?>><?php _e('none selected','events-manager'); ?></option>
109
  <?php foreach(em_get_countries() as $country_key => $country_name): ?>
110
- <option value="<?php echo $country_key; ?>" <?php echo ( $EM_Location->location_country == $country_key || ($EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country')==$country_key) ) ? 'selected="selected"':''; ?>><?php echo $country_name; ?></option>
111
  <?php endforeach; ?>
112
  </select><?php echo $required; ?>
113
  </td>
5
  <?php if( !get_option('dbem_require_location') && !get_option('dbem_use_select_for_locations') ): ?>
6
  <div class="em-location-data-nolocation">
7
  <p>
8
+ <input type="checkbox" name="no_location" id="no-location" value="1" <?php if( $EM_Event->location_id === '0' || $EM_Event->location_id === 0 ) echo 'checked="checked"'; ?> />
9
  <?php _e('This event does not have a physical location.','events-manager'); ?>
10
  </p>
11
  <script type="text/javascript">
23
  <?php endif; ?>
24
  <div id="em-location-data" class="em-location-data">
25
  <div id="location_coordinates" style='display: none;'>
26
+ <input id='location-latitude' name='location_latitude' type='text' value='<?php echo esc_attr($EM_Event->get_location()->location_latitude); ?>' size='15' />
27
+ <input id='location-longitude' name='location_longitude' type='text' value='<?php echo esc_attr($EM_Event->get_location()->location_longitude); ?>' size='15' />
28
  </div>
29
  <?php if( get_option('dbem_use_select_for_locations') || !$EM_Event->can_manage('edit_locations','edit_others_locations') ) : ?>
30
  <table class="em-location-data">
31
  <tr class="em-location-data-select">
32
+ <th><?php esc_html_e('Location:','events-manager') ?> </th>
33
  <td>
34
  <select name="location_id" id='location-select-id' size="1">
35
+ <?php if(!get_option('dbem_require_location',true)): ?><option value="0"><?php esc_html_e('No Location','events-manager'); ?></option><?php endif; ?>
36
  <?php
37
  $ddm_args = array('blog'=>false, 'private'=>$EM_Event->can_manage('read_private_locations'));
38
  $ddm_args['owner'] = (is_user_logged_in() && !current_user_can('read_others_locations')) ? get_current_user_id() : false;
40
  $selected_location = !empty($EM_Event->location_id) || !empty($EM_Event->event_id) ? $EM_Event->location_id:get_option('dbem_default_location');
41
  foreach($locations as $EM_Location) {
42
  $selected = ($selected_location == $EM_Location->location_id) ? "selected='selected' " : '';
43
+ if( $selected ) $found_location = true;
44
  ?>
45
+ <option value="<?php echo esc_attr($EM_Location->location_id) ?>" title="<?php echo esc_attr("{$EM_Location->location_latitude},{$EM_Location->location_longitude}"); ?>" <?php echo $selected ?>><?php echo esc_html($EM_Location->location_name); ?></option>
46
  <?php
47
  }
48
+ if( empty($found_location) && !empty($EM_Event->location_id) ){
49
+ $EM_Location = $EM_Event->get_location();
50
+ if( $EM_Location->post_id ){
51
+ ?>
52
+ <option value="<?php echo esc_attr($EM_Location->location_id) ?>" title="<?php echo esc_attr("{$EM_Location->location_latitude},{$EM_Location->location_longitude}"); ?>" selected="selected"><?php echo esc_html($EM_Location->location_name); ?></option>
53
+ <?php
54
+ }
55
+ }
56
  ?>
57
  </select>
58
  </td>
73
  <tr class="em-location-data-name">
74
  <th><?php _e ( 'Location Name:', 'events-manager')?></th>
75
  <td>
76
+ <input id='location-id' name='location_id' type='hidden' value='<?php echo esc_attr($EM_Location->location_id); ?>' size='15' />
77
  <input id="location-name" type="text" name="location_name" value="<?php echo esc_attr($EM_Location->location_name, ENT_QUOTES); ?>" /><?php echo $required; ?>
78
  <br />
79
+ <em id="em-location-search-tip"><?php esc_html_e( 'Create a location or start typing to search a previously created location.', 'events-manager')?></em>
80
+ <em id="em-location-reset" style="display:none;"><?php esc_html_e('You cannot edit saved locations here.', 'events-manager'); ?> <a href="#"><?php esc_html_e('Reset this form to create a location or search again.', 'events-manager')?></a></em>
81
  </td>
82
  </tr>
83
  <tr class="em-location-data-address">
84
  <th><?php _e ( 'Address:', 'events-manager')?>&nbsp;</th>
85
  <td>
86
+ <input id="location-address" type="text" name="location_address" value="<?php echo esc_attr($EM_Location->location_address); ; ?>" /><?php echo $required; ?>
87
  </td>
88
  </tr>
89
  <tr class="em-location-data-town">
90
  <th><?php _e ( 'City/Town:', 'events-manager')?>&nbsp;</th>
91
  <td>
92
+ <input id="location-town" type="text" name="location_town" value="<?php echo esc_attr($EM_Location->location_town); ?>" /><?php echo $required; ?>
93
  </td>
94
  </tr>
95
  <tr class="em-location-data-state">
96
  <th><?php _e ( 'State/County:', 'events-manager')?>&nbsp;</th>
97
  <td>
98
+ <input id="location-state" type="text" name="location_state" value="<?php echo esc_attr($EM_Location->location_state); ?>" />
99
  </td>
100
  </tr>
101
  <tr class="em-location-data-postcode">
102
  <th><?php _e ( 'Postcode:', 'events-manager')?>&nbsp;</th>
103
  <td>
104
+ <input id="location-postcode" type="text" name="location_postcode" value="<?php echo esc_attr($EM_Location->location_postcode); ?>" />
105
  </td>
106
  </tr>
107
  <tr class="em-location-data-region">
108
  <th><?php _e ( 'Region:', 'events-manager')?>&nbsp;</th>
109
  <td>
110
+ <input id="location-region" type="text" name="location_region" value="<?php echo esc_attr($EM_Location->location_region); ?>" />
111
  </td>
112
  </tr>
113
  <tr class="em-location-data-country">
116
  <select id="location-country" name="location_country">
117
  <option value="0" <?php echo ( $EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country') == '' ) ? 'selected="selected"':''; ?>><?php _e('none selected','events-manager'); ?></option>
118
  <?php foreach(em_get_countries() as $country_key => $country_name): ?>
119
+ <option value="<?php echo esc_attr($country_key); ?>" <?php echo ( $EM_Location->location_country == $country_key || ($EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country')==$country_key) ) ? 'selected="selected"':''; ?>><?php echo esc_html($country_name); ?></option>
120
  <?php endforeach; ?>
121
  </select><?php echo $required; ?>
122
  </td>
templates/templates/calendar-full.php CHANGED
@@ -17,7 +17,7 @@ $col_max = count($calendar['row_headers']); //each time this collumn number is r
17
  <thead>
18
  <tr>
19
  <td><a class="em-calnav full-link em-calnav-prev" href="<?php echo esc_url($calendar['links']['previous_url']); ?>">&lt;&lt;</a></td>
20
- <td class="month_name" colspan="5"><?php echo esc_html(ucfirst(date_i18n(get_option('dbem_full_calendar_month_format'), $calendar['month_start']))); ?></td>
21
  <td><a class="em-calnav full-link em-calnav-next" href="<?php echo esc_url($calendar['links']['next_url']); ?>">&gt;&gt;</a></td>
22
  </tr>
23
  </thead>
17
  <thead>
18
  <tr>
19
  <td><a class="em-calnav full-link em-calnav-prev" href="<?php echo esc_url($calendar['links']['previous_url']); ?>">&lt;&lt;</a></td>
20
+ <td class="month_name" colspan="5"><?php echo esc_html(date_i18n(get_option('dbem_full_calendar_month_format'), $calendar['month_start'])); ?></td>
21
  <td><a class="em-calnav full-link em-calnav-next" href="<?php echo esc_url($calendar['links']['next_url']); ?>">&gt;&gt;</a></td>
22
  </tr>
23
  </thead>
templates/templates/calendar-small.php CHANGED
@@ -14,7 +14,7 @@
14
  <thead>
15
  <tr>
16
  <td><a class="em-calnav em-calnav-prev" href="<?php echo esc_url($calendar['links']['previous_url']); ?>" rel="nofollow">&lt;&lt;</a></td>
17
- <td class="month_name" colspan="5"><?php echo esc_html(ucfirst(date_i18n(get_option('dbem_small_calendar_month_format'), $calendar['month_start']))); ?></td>
18
  <td><a class="em-calnav em-calnav-next" href="<?php echo esc_url($calendar['links']['next_url']); ?>" rel="nofollow">&gt;&gt;</a></td>
19
  </tr>
20
  </thead>
14
  <thead>
15
  <tr>
16
  <td><a class="em-calnav em-calnav-prev" href="<?php echo esc_url($calendar['links']['previous_url']); ?>" rel="nofollow">&lt;&lt;</a></td>
17
+ <td class="month_name" colspan="5"><?php echo esc_html(date_i18n(get_option('dbem_small_calendar_month_format'), $calendar['month_start'])); ?></td>
18
  <td><a class="em-calnav em-calnav-next" href="<?php echo esc_url($calendar['links']['next_url']); ?>" rel="nofollow">&gt;&gt;</a></td>
19
  </tr>
20
  </thead>
templates/templates/events-search.php CHANGED
@@ -25,7 +25,7 @@ $args = !empty($args) ? $args:array(); /* @var $args array */
25
  <button type="submit" class="em-search-submit loading">
26
  <?php //before you ask, this hack is necessary thanks to stupid IE7 ?>
27
  <!--[if IE 7]><span><![endif]-->
28
- <img src="<?php echo EM_DIR_URI; ?>includes/images/search-mag.png" />
29
  <!--[if IE 7]></span><![endif]-->
30
  </button>
31
  <?php endif; ?>
25
  <button type="submit" class="em-search-submit loading">
26
  <?php //before you ask, this hack is necessary thanks to stupid IE7 ?>
27
  <!--[if IE 7]><span><![endif]-->
28
+ <img src="<?php echo EM_DIR_URI; ?>includes/images/search-mag.png" alt="<?php esc_attr_e('Search', 'events-manager'); ?>" />
29
  <!--[if IE 7]></span><![endif]-->
30
  </button>
31
  <?php endif; ?>
templates/templates/ical.php CHANGED
@@ -3,6 +3,8 @@
3
  $summary_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_ical_description_format' ) ) );
4
  $description_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_ical_real_description_format') ) );
5
  $location_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_ical_location_format' ) ) );
 
 
6
 
7
  //figure out limits
8
  $ical_limit = get_option('dbem_ical_limit');
@@ -43,24 +45,25 @@ while ( count($EM_Events) > 0 ){
43
  //formats
44
  $summary = $EM_Event->output($summary_format,'ical');
45
  $description = $EM_Event->output($description_format,'ical');
46
- $location = $EM_Event->output($location_format, 'ical');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
- //create a UID
49
- $UID = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
50
- // 32 bits for "time_low"
51
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
52
- // 16 bits for "time_mid"
53
- mt_rand( 0, 0xffff ),
54
- // 16 bits for "time_hi_and_version",
55
- // four most significant bits holds version number 4
56
- mt_rand( 0, 0x0fff ) | 0x4000,
57
- // 16 bits, 8 bits for "clk_seq_hi_res",
58
- // 8 bits for "clk_seq_low",
59
- // two most significant bits holds zero and one for variant DCE1.1
60
- mt_rand( 0, 0x3fff ) | 0x8000,
61
- // 48 bits for "node"
62
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
63
- );
64
 
65
  //output ical item
66
  $output = "
@@ -69,14 +72,38 @@ UID:{$UID}
69
  DTSTART{$dateStart}
70
  DTEND{$dateEnd}
71
  DTSTAMP:{$dateModified}
 
72
  SUMMARY:{$summary}";
 
73
  if( $description ){
74
  $output .= "
75
  DESCRIPTION:{$description}";
76
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  $output .= "
78
- LOCATION:{$location}
79
- URL:{$EM_Event->get_permalink()}
80
  END:VEVENT";
81
 
82
  //clean up new lines, rinse and repeat
3
  $summary_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_ical_description_format' ) ) );
4
  $description_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_ical_real_description_format') ) );
5
  $location_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_ical_location_format' ) ) );
6
+ $parsed_url = parse_url(get_bloginfo('url'));
7
+ $site_domain = preg_replace('/^www./', '', $parsed_url['host']);
8
 
9
  //figure out limits
10
  $ical_limit = get_option('dbem_ical_limit');
45
  //formats
46
  $summary = $EM_Event->output($summary_format,'ical');
47
  $description = $EM_Event->output($description_format,'ical');
48
+ $location = $geo = $apple_geo = $apple_location = $apple_location_title = $categories = false;
49
+ if( $EM_Event->location_id ){
50
+ $location = $EM_Event->output($location_format, 'ical');
51
+ if( $EM_Event->get_location()->location_latitude || $EM_Event->get_location()->location_longitude ){
52
+ $geo = $EM_Event->get_location()->location_latitude.";".$EM_Event->get_location()->location_longitude;
53
+ }
54
+ $apple_location = $EM_Event->output('#_LOCATIONFULLLINE, #_LOCATIONCOUNTRY', 'ical');
55
+ $apple_location_title = $EM_Event->get_location()->location_name;
56
+ $apple_geo = !empty($geo) ? $geo:'0,0';
57
+ }
58
+ $categories = array();
59
+ foreach( $EM_Event->get_categories() as $EM_Category ){ /* @var EM_Category $EM_Category */
60
+ $categories[] = $EM_Category->name;
61
+ }
62
+ $image = $EM_Event->get_image_url();
63
 
64
+ //create a UID, make it unique and update independent
65
+ $UID = $EM_Event->event_id . '@' . $site_domain;
66
+ if( is_multisite() ) $UID = absint($EM_Event->blog_id) . '-' . $UID;
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  //output ical item
69
  $output = "
72
  DTSTART{$dateStart}
73
  DTEND{$dateEnd}
74
  DTSTAMP:{$dateModified}
75
+ URL:{$EM_Event->get_permalink()}
76
  SUMMARY:{$summary}";
77
+ //Description if available
78
  if( $description ){
79
  $output .= "
80
  DESCRIPTION:{$description}";
81
  }
82
+ //add featured image if exists
83
+ if( $image ){
84
+ $output .= "
85
+ ATTACH;FMTTYPE=image/jpeg:".esc_url_raw($image);
86
+ }
87
+ //add categories if there are any
88
+ if( !empty($categories) ){
89
+ $output .= "
90
+ CATEGORIES:".implode(',', $categories);
91
+ }
92
+ //Location if there is one
93
+ if( $location ){
94
+ $output .= "
95
+ LOCATION:{$location}";
96
+ //geo coordinates if they exist
97
+ if( $geo ){
98
+ $output .= "
99
+ GEO:{$geo}";
100
+ }
101
+ //create apple-compatible feature for locations
102
+ $output .= "
103
+ X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS={$apple_location};X-APPLE-RADIUS=100;X-TITLE={$apple_location_title}:geo:{$apple_geo}";
104
+ }
105
+ //end the event
106
  $output .= "
 
 
107
  END:VEVENT";
108
 
109
  //clean up new lines, rinse and repeat
templates/templates/search/categories.php CHANGED
@@ -1,21 +1,23 @@
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Category Search -->
3
  <div class="em-search-category em-search-field">
4
- <label><?php echo esc_html($args['category_label']); ?></label>
5
- <?php
6
- EM_Object::ms_global_switch(); //in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
7
- wp_dropdown_categories(array(
8
- 'hide_empty' => 0,
9
- 'orderby' =>'name',
10
- 'name' => 'category',
11
- 'hierarchical' => true,
12
- 'taxonomy' => EM_TAXONOMY_CATEGORY,
13
- 'selected' => $args['category'],
14
- 'show_option_none' => $args['categories_label'],
15
- 'option_none_value'=> 0,
16
- 'class'=>'em-events-search-category'
17
- ));
18
- EM_Object::ms_global_switch_back(); //if switched above, switch back
19
- ?>
 
 
20
  </div>
21
  <!-- END Category Search -->
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Category Search -->
3
  <div class="em-search-category em-search-field">
4
+ <label>
5
+ <span><?php echo esc_html($args['category_label']); ?></span>
6
+ <?php
7
+ EM_Object::ms_global_switch(); //in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
8
+ wp_dropdown_categories(array(
9
+ 'hide_empty' => 0,
10
+ 'orderby' =>'name',
11
+ 'name' => 'category',
12
+ 'hierarchical' => true,
13
+ 'taxonomy' => EM_TAXONOMY_CATEGORY,
14
+ 'selected' => $args['category'],
15
+ 'show_option_none' => $args['categories_label'],
16
+ 'option_none_value'=> 0,
17
+ 'class'=>'em-events-search-category'
18
+ ));
19
+ EM_Object::ms_global_switch_back(); //if switched above, switch back
20
+ ?>
21
+ </label>
22
  </div>
23
  <!-- END Category Search -->
templates/templates/search/geo-units.php CHANGED
@@ -1,15 +1,20 @@
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Geo Units Search -->
3
  <div class="em-search-geo-units em-search-field" <?php if( empty($args['geo']) || empty($args['near']) ): ?>style="display:none;"<?php endif; /* show location fields if no geo search is made */ ?>>
4
- <label><?php echo esc_html($args['geo_units_label']); ?></label>
5
- <select name="near_distance" class="em-search-geo-distance">
6
- <?php foreach( $args['geo_distance_values'] as $unit ) : ?>
7
- <option value="<?php echo $unit; ?>" <?php if($args['near_distance'] == $unit) echo 'selected="selected"' ?>><?php echo $unit; ?></option>
8
- <?php endforeach; ?>
9
- </select>
10
- <select name="near_unit" class="em-search-geo-unit">
11
- <option value="mi">mi</option>
12
- <option value="km" <?php if($args['near_unit'] == 'km') echo 'selected="selected"' ?>>km</option>
13
- </select>
 
 
 
 
 
14
  </div>
15
  <!-- END Geo Units Search -->
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Geo Units Search -->
3
  <div class="em-search-geo-units em-search-field" <?php if( empty($args['geo']) || empty($args['near']) ): ?>style="display:none;"<?php endif; /* show location fields if no geo search is made */ ?>>
4
+ <label>
5
+ <span><?php echo esc_html($args['geo_units_label']); ?></span>
6
+ <select name="near_distance" class="em-search-geo-distance">
7
+ <?php foreach( $args['geo_distance_values'] as $unit ) : ?>
8
+ <option value="<?php echo $unit; ?>" <?php if($args['near_distance'] == $unit) echo 'selected="selected"' ?>><?php echo $unit; ?></option>
9
+ <?php endforeach; ?>
10
+ </select>
11
+ </label>
12
+ <label>
13
+ <span class="screen-reader-text"><?php echo esc_html(__('distance units','events-manager')); ?></span>
14
+ <select name="near_unit" class="em-search-geo-unit">
15
+ <option value="mi">mi</option>
16
+ <option value="km" <?php if($args['near_unit'] == 'km') echo 'selected="selected"' ?>>km</option>
17
+ </select>
18
+ </label>
19
  </div>
20
  <!-- END Geo Units Search -->
templates/templates/search/geo.php CHANGED
@@ -5,7 +5,10 @@
5
  /* This general search will find matches within event_name, event_notes, and the location_name, address, town, state and country. */
6
 
7
  ?>
8
- <input type="text" name="geo" class="em-search-geo" value="<?php echo esc_attr($args['geo']); ?>"/>
 
 
 
9
  <input type="hidden" name="near" class="em-search-geo-coords" value="<?php echo esc_attr($args['near']); ?>" />
10
  <div id="em-search-geo-attr" ></div>
11
  <script type="text/javascript">
5
  /* This general search will find matches within event_name, event_notes, and the location_name, address, town, state and country. */
6
 
7
  ?>
8
+ <label>
9
+ <span class="screen-reader-text"><?php echo esc_html($args['geo_label']); ?></span>
10
+ <input type="text" name="geo" class="em-search-geo" value="<?php echo esc_attr($args['geo']); ?>"/>
11
+ </label>
12
  <input type="hidden" name="near" class="em-search-geo-coords" value="<?php echo esc_attr($args['near']); ?>" />
13
  <div id="em-search-geo-attr" ></div>
14
  <script type="text/javascript">
templates/templates/search/location-countries.php CHANGED
@@ -1,25 +1,27 @@
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Country Search -->
3
  <div class="em-search-country em-search-field">
4
- <label><?php echo esc_html($args['country_label']); ?></label>
5
- <select name="country" class="em-search-country em-events-search-country">
6
- <option value=''><?php echo esc_html($args['countries_label']); ?></option>
7
- <?php
8
- //get the counties from locations table
9
- global $wpdb;
10
- $countries = em_get_countries();
11
- $em_countries = $wpdb->get_results("SELECT DISTINCT location_country FROM ".EM_LOCATIONS_TABLE." WHERE location_country IS NOT NULL AND location_country != '' AND location_status=1 ORDER BY location_country ASC", ARRAY_N);
12
- $ddm_countries = array();
13
- //filter out location countries so they're valid records (hence no sanitization)
14
- foreach($em_countries as $em_country){
15
- $ddm_countries[$em_country[0]] = $countries[$em_country[0]];
16
- }
17
- asort($ddm_countries);
18
- foreach( $ddm_countries as $country_code => $country_name ):
19
- //we're not using esc_ functions here because values are hard-coded within em_get_countries()
20
- ?>
21
- <option value="<?php echo $country_code; ?>"<?php echo (!empty($args['country']) && $args['country'] == $country_code) ? ' selected="selected"':''; ?>><?php echo $country_name; ?></option>
22
- <?php endforeach; ?>
23
- </select>
 
 
24
  </div>
25
  <!-- END Country Search -->
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Country Search -->
3
  <div class="em-search-country em-search-field">
4
+ <label>
5
+ <span><?php echo esc_html($args['country_label']); ?></span>
6
+ <select name="country" class="em-search-country em-events-search-country">
7
+ <option value=''><?php echo esc_html($args['countries_label']); ?></option>
8
+ <?php
9
+ //get the counties from locations table
10
+ global $wpdb;
11
+ $countries = em_get_countries();
12
+ $em_countries = $wpdb->get_results("SELECT DISTINCT location_country FROM ".EM_LOCATIONS_TABLE." WHERE location_country IS NOT NULL AND location_country != '' AND location_status=1 ORDER BY location_country ASC", ARRAY_N);
13
+ $ddm_countries = array();
14
+ //filter out location countries so they're valid records (hence no sanitization)
15
+ foreach($em_countries as $em_country){
16
+ $ddm_countries[$em_country[0]] = $countries[$em_country[0]];
17
+ }
18
+ asort($ddm_countries);
19
+ foreach( $ddm_countries as $country_code => $country_name ):
20
+ //we're not using esc_ functions here because values are hard-coded within em_get_countries()
21
+ ?>
22
+ <option value="<?php echo $country_code; ?>"<?php echo (!empty($args['country']) && $args['country'] == $country_code) ? ' selected="selected"':''; ?>><?php echo $country_name; ?></option>
23
+ <?php endforeach; ?>
24
+ </select>
25
+ </label>
26
  </div>
27
  <!-- END Country Search -->
templates/templates/search/location-regions.php CHANGED
@@ -1,22 +1,24 @@
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Region Search -->
3
  <div class="em-search-region em-search-field">
4
- <label><?php echo esc_html($args['region_label']); ?></label>
5
- <select name="region" class="em-search-region em-events-search-region">
6
- <option value=''><?php echo esc_html(get_option('dbem_search_form_regions_label')); ?></option>
7
- <?php
8
- global $wpdb;
9
- $em_states = $cond = array();
10
- if( !empty($args['country']) ) $cond[] = $wpdb->prepare("AND location_country=%s", $args['country']);
11
- if( !empty($cond) || empty($args['search_countries']) ){ //get specific country regions or all regions if no country fields exists
12
- $em_states = $wpdb->get_results("SELECT DISTINCT location_region FROM ".EM_LOCATIONS_TABLE." WHERE location_region IS NOT NULL AND location_region != '' AND location_status=1 ".implode(' ', $cond)." ORDER BY location_region", ARRAY_N);
13
- }
14
- foreach($em_states as $region){
15
- ?>
16
- <option<?php echo (!empty($args['region']) && $args['region'] == $region[0]) ? ' selected="selected"':''; ?>><?php echo esc_html($region[0]); ?></option>
17
  <?php
18
- }
19
- ?>
20
- </select>
 
 
 
 
 
 
 
 
 
 
 
21
  </div>
22
  <!-- END Region Search -->
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START Region Search -->
3
  <div class="em-search-region em-search-field">
4
+ <label>
5
+ <span><?php echo esc_html($args['region_label']); ?></span>
6
+ <select name="region" class="em-search-region em-events-search-region">
7
+ <option value=''><?php echo esc_html(get_option('dbem_search_form_regions_label')); ?></option>
 
 
 
 
 
 
 
 
 
8
  <?php
9
+ global $wpdb;
10
+ $em_states = $cond = array();
11
+ if( !empty($args['country']) ) $cond[] = $wpdb->prepare("AND location_country=%s", $args['country']);
12
+ if( !empty($cond) || empty($args['search_countries']) ){ //get specific country regions or all regions if no country fields exists
13
+ $em_states = $wpdb->get_results("SELECT DISTINCT location_region FROM ".EM_LOCATIONS_TABLE." WHERE location_region IS NOT NULL AND location_region != '' AND location_status=1 ".implode(' ', $cond)." ORDER BY location_region", ARRAY_N);
14
+ }
15
+ foreach($em_states as $region){
16
+ ?>
17
+ <option<?php echo (!empty($args['region']) && $args['region'] == $region[0]) ? ' selected="selected"':''; ?>><?php echo esc_html($region[0]); ?></option>
18
+ <?php
19
+ }
20
+ ?>
21
+ </select>
22
+ </label>
23
  </div>
24
  <!-- END Region Search -->
templates/templates/search/location-states.php CHANGED
@@ -1,23 +1,25 @@
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START State/County Search -->
3
  <div class="em-search-state em-search-field">
4
- <label><?php echo esc_html($args['state_label']); ?></label>
5
- <select name="state" class="em-search-state em-events-search-state">
6
- <option value=''><?php echo esc_html(get_option('dbem_search_form_states_label')); ?></option>
7
- <?php
8
- global $wpdb;
9
- $em_states = $cond = array();
10
- if( !empty($args['country']) ) $cond[] = $wpdb->prepare("AND location_country=%s", $args['country']);
11
- if( !empty($args['region']) ) $cond[] = $wpdb->prepare("AND location_region=%s", $args['region']);
12
- if( !empty($cond) || empty($args['search_countries']) ){ //get specific states, whether restricted by country/region or all states if no country field is displayed
13
- $em_states = $wpdb->get_results("SELECT DISTINCT location_state FROM ".EM_LOCATIONS_TABLE." WHERE location_state IS NOT NULL AND location_state != '' AND location_status=1 ".implode(' ', $cond)." ORDER BY location_state", ARRAY_N);
14
- }
15
- foreach($em_states as $state){
 
 
 
 
 
16
  ?>
17
- <option<?php echo (!empty($args['state']) && $args['state'] == $state[0]) ? ' selected="selected"':''; ?>><?php echo esc_html($state[0]); ?></option>
18
- <?php
19
- }
20
- ?>
21
- </select>
22
  </div>
23
  <!-- END State/County Search -->
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START State/County Search -->
3
  <div class="em-search-state em-search-field">
4
+ <label>
5
+ <span><?php echo esc_html($args['state_label']); ?></span>
6
+ <select name="state" class="em-search-state em-events-search-state">
7
+ <option value=''><?php echo esc_html(get_option('dbem_search_form_states_label')); ?></option>
8
+ <?php
9
+ global $wpdb;
10
+ $em_states = $cond = array();
11
+ if( !empty($args['country']) ) $cond[] = $wpdb->prepare("AND location_country=%s", $args['country']);
12
+ if( !empty($args['region']) ) $cond[] = $wpdb->prepare("AND location_region=%s", $args['region']);
13
+ if( !empty($cond) || empty($args['search_countries']) ){ //get specific states, whether restricted by country/region or all states if no country field is displayed
14
+ $em_states = $wpdb->get_results("SELECT DISTINCT location_state FROM ".EM_LOCATIONS_TABLE." WHERE location_state IS NOT NULL AND location_state != '' AND location_status=1 ".implode(' ', $cond)." ORDER BY location_state", ARRAY_N);
15
+ }
16
+ foreach($em_states as $state){
17
+ ?>
18
+ <option<?php echo (!empty($args['state']) && $args['state'] == $state[0]) ? ' selected="selected"':''; ?>><?php echo esc_html($state[0]); ?></option>
19
+ <?php
20
+ }
21
  ?>
22
+ </select>
23
+ </label>
 
 
 
24
  </div>
25
  <!-- END State/County Search -->
templates/templates/search/location-towns.php CHANGED
@@ -1,24 +1,26 @@
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START City Search -->
3
  <div class="em-search-town em-search-field">
4
- <label><?php echo esc_html($args['town_label']); ?></label>
5
- <select name="town" class="em-search-town em-events-search-town">
6
- <option value=''><?php echo esc_html(get_option('dbem_search_form_towns_label')); ?></option>
7
- <?php
8
- global $wpdb;
9
- $em_towns = $cond = array();
10
- if( !empty($args['country']) ) $cond[] = $wpdb->prepare("AND location_country=%s", $args['country']);
11
- if( !empty($args['region']) ) $cond[] = $wpdb->prepare("AND location_region=%s", $args['region']);
12
- if( !empty($args['state']) ) $cond[] = $wpdb->prepare(" AND location_state=%s ", $args['state']);
13
- if( !empty($cond) || empty($args['search_countries']) ){ //get specific towns, whether restricted by country/region/state or all towns if no country field is displayed
14
- $em_towns = $wpdb->get_results("SELECT DISTINCT location_town FROM ".EM_LOCATIONS_TABLE." WHERE location_town IS NOT NULL AND location_town != '' AND location_status=1 ".implode(' ', $cond)." ORDER BY location_town", ARRAY_N);
15
- }
16
- foreach($em_towns as $town){
 
 
 
 
 
17
  ?>
18
- <option<?php echo (!empty($args['town']) && $args['town'] == $town[0]) ? ' selected="selected"':''; ?>><?php echo esc_html($town[0]); ?></option>
19
- <?php
20
- }
21
- ?>
22
- </select>
23
  </div>
24
  <!-- END City Search -->
1
  <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
2
  <!-- START City Search -->
3
  <div class="em-search-town em-search-field">
4
+ <label>
5
+ <span><?php echo esc_html($args['town_label']); ?></span>
6
+ <select name="town" class="em-search-town em-events-search-town">
7
+ <option value=''><?php echo esc_html(get_option('dbem_search_form_towns_label')); ?></option>
8
+ <?php
9
+ global $wpdb;
10
+ $em_towns = $cond = array();
11
+ if( !empty($args['country']) ) $cond[] = $wpdb->prepare("AND location_country=%s", $args['country']);
12
+ if( !empty($args['region']) ) $cond[] = $wpdb->prepare("AND location_region=%s", $args['region']);
13
+ if( !empty($args['state']) ) $cond[] = $wpdb->prepare(" AND location_state=%s ", $args['state']);
14
+ if( !empty($cond) || empty($args['search_countries']) ){ //get specific towns, whether restricted by country/region/state or all towns if no country field is displayed
15
+ $em_towns = $wpdb->get_results("SELECT DISTINCT location_town FROM ".EM_LOCATIONS_TABLE." WHERE location_town IS NOT NULL AND location_town != '' AND location_status=1 ".implode(' ', $cond)." ORDER BY location_town", ARRAY_N);
16
+ }
17
+ foreach($em_towns as $town){
18
+ ?>
19
+ <option<?php echo (!empty($args['town']) && $args['town'] == $town[0]) ? ' selected="selected"':''; ?>><?php echo esc_html($town[0]); ?></option>
20
+ <?php
21
+ }
22
  ?>
23
+ </select>
24
+ </label>
 
 
 
25
  </div>
26
  <!-- END City Search -->
templates/templates/search/scope.php CHANGED
@@ -2,12 +2,16 @@
2
  <!-- START Date Search -->
3
  <div class="em-search-scope em-search-field">
4
  <span class="em-search-scope em-events-search-dates em-date-range">
5
- <label><?php echo esc_html($args['scope_label']); ?></label>
6
- <input type="text" class="em-date-input-loc em-date-start" />
7
- <input type="hidden" class="em-date-input" name="scope[0]" value="<?php echo esc_attr($args['scope'][0]); ?>" />
8
- <?php echo esc_html($args['scope_seperator']); ?>
9
- <input type="text" class="em-date-input-loc em-date-end" />
10
- <input type="hidden" class="em-date-input" name="scope[1]" value="<?php echo esc_attr($args['scope'][1]); ?>" />
 
 
 
 
11
  </span>
12
  </div>
13
  <!-- END Date Search -->
2
  <!-- START Date Search -->
3
  <div class="em-search-scope em-search-field">
4
  <span class="em-search-scope em-events-search-dates em-date-range">
5
+ <label>
6
+ <span><?php echo esc_html($args['scope_label']); ?></span>
7
+ <input type="text" class="em-date-input-loc em-date-start" />
8
+ <input type="hidden" class="em-date-input" name="scope[0]" value="<?php echo esc_attr($args['scope'][0]); ?>" />
9
+ </label>
10
+ <label>
11
+ <?php echo esc_html($args['scope_seperator']); ?>
12
+ <input type="text" class="em-date-input-loc em-date-end" />
13
+ <input type="hidden" class="em-date-input" name="scope[1]" value="<?php echo esc_attr($args['scope'][1]); ?>" />
14
+ </label>
15
  </span>
16
  </div>
17
  <!-- END Date Search -->
templates/templates/search/search.php CHANGED
@@ -7,6 +7,9 @@ $args = !empty($args) ? $args:array(); /* @var $args array */
7
  <script type="text/javascript">
8
  EM.search_term_placeholder = '<?php echo esc_attr($args['search_term_label']); ?>';
9
  </script>
10
- <input type="text" name="em_search" class="em-events-search-text em-search-text" value="<?php echo esc_attr($args['search']); ?>" />
 
 
 
11
  </div>
12
  <!-- END General Search -->
7
  <script type="text/javascript">
8
  EM.search_term_placeholder = '<?php echo esc_attr($args['search_term_label']); ?>';
9
  </script>
10
+ <label>
11
+ <span class="screen-reader-text"><?php echo esc_html($args['search_term_label']); ?></span>
12
+ <input type="text" name="em_search" class="em-events-search-text em-search-text" value="<?php echo esc_attr($args['search']); ?>" />
13
+ </label>
14
  </div>
15
  <!-- END General Search -->