Skip to content

Commit 08e787a

Browse files
committed
EM 5.12 upgrade
1 parent 53e0509 commit 08e787a

15 files changed

+97
-41
lines changed

admin/em-options.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function em_options_save(){
99
*/
1010
if( current_user_can('manage_options') && !empty($_POST['em-submitted']) && check_admin_referer('events-manager-options','_wpnonce') ){
1111
//Build the array of options here
12-
$post = $_POST;
1312
foreach ($_POST as $postKey => $postValue){
1413
if( $postKey != 'dbem_data' && substr($postKey, 0, 5) == 'dbem_' ){
1514
//TODO some more validation/reporting

classes/em-event.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ function output($format, $target="html") {
23632363
case '#_24HENDTIME_LOCAL':
23642364
case '#_24HTIMES_LOCAL':
23652365
$ts = ($result == '#_24HENDTIME_LOCAL') ? $this->end()->getTimestamp():$this->start()->getTimestamp();
2366-
$date_end = ($result == '#_24HTIMES_LOCAL' && $this->end()->getTimestamp() !== $ts) ? 'data-time-end="'. esc_attr($this->end()->getTimestamp()) .'" data-separator="'. esc_attr(get_option('dbem_times_separator')) . '"' : '';
2366+
$date_end = ($result == '#_24HTIMES_LOCAL' && $this->event_start_time !== $this->event_end_time) ? 'data-time-end="'. esc_attr($this->end()->getTimestamp()) .'" data-separator="'. esc_attr(get_option('dbem_times_separator')) . '"' : '';
23672367
$replace = '<span class="em-time-localjs" data-time-format="24" data-time="'. esc_attr($ts) .'" '. $date_end .'>JavaScript Disabled</span>';
23682368
break;
23692369
case '#_12HSTARTTIME':
@@ -2418,9 +2418,13 @@ function output($format, $target="html") {
24182418
}
24192419
if( $result === '#_EVENTDATES_LOCAL' ){
24202420
$time_format = ( get_option('dbem_date_format') ) ? get_option('dbem_date_format'):get_option('date_format');
2421+
$start_time = $this->start()->getTimestamp();
2422+
$end_time = $this->event_start_date == $this->event_end_date ? $start_time : $this->end()->getTimestamp();
24212423
if( empty($separator) ) $separator = get_option('dbem_dates_separator');
24222424
}else{
24232425
$time_format = ( get_option('dbem_time_format') ) ? get_option('dbem_time_format'):get_option('time_format');
2426+
$start_time = $this->start()->getTimestamp();
2427+
$end_time = $this->event_start_time == $this->event_end_time ? $start_time : $this->end()->getTimestamp();
24242428
if( empty($separator) ) $separator = get_option('dbem_times_separator');
24252429
}
24262430
$time_format = strtr($time_format, $replacements);
@@ -2429,7 +2433,7 @@ function output($format, $target="html") {
24292433
// start output
24302434
ob_start();
24312435
?>
2432-
<span class="em-date-momentjs" data-date-format="<?php echo esc_attr($time_format); ?>" data-date-start="<?php echo $this->start()->getTimestamp() ?>" data-date-end="<?php echo $this->end()->getTimestamp() ?>" data-date-separator="<?php echo esc_attr($separator); ?>">JavaScript Disabled</span>
2436+
<span class="em-date-momentjs" data-date-format="<?php echo esc_attr($time_format); ?>" data-date-start="<?php echo $start_time ?>" data-date-end="<?php echo $end_time ?>" data-date-separator="<?php echo esc_attr($separator); ?>">JavaScript Disabled</span>
24332437
<?php
24342438
$replace = ob_get_clean();
24352439
}

classes/em-events.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ public static function output_grouped( $args = array() ){
395395
}
396396
}
397397
}
398+
$events_dates = apply_filters('em_events_output_grouped_events_dates', $events_dates, $args);
398399
foreach ($events_dates as $year => $events){
399400
$EM_DateTime = new EM_DateTime($year.'-01-01');
400401
echo str_replace('#s', $EM_DateTime->i18n($format), $args['header_format']);
@@ -417,6 +418,7 @@ public static function output_grouped( $args = array() ){
417418
}
418419
}
419420
}
421+
$events_dates = apply_filters('em_events_output_grouped_events_dates', $events_dates, $args);
420422
foreach ($events_dates as $month => $events){
421423
$EM_DateTime = new EM_DateTime($month);
422424
echo str_replace('#s', $EM_DateTime->i18n($format), $args['header_format']);
@@ -443,6 +445,7 @@ public static function output_grouped( $args = array() ){
443445
}while( $EM_DateTime <= $EM_Event->end() );
444446
}
445447
}
448+
$events_dates = apply_filters('em_events_output_grouped_events_dates', $events_dates, $args);
446449
foreach ($events_dates as $date => $events){
447450
$dates_formatted = $EM_DateTime->modify($date)->i18n($format). get_option('dbem_dates_separator') . $EM_DateTime->add('P6D')->i18n($format);
448451
echo str_replace('#s', $dates_formatted, $args['header_format']);
@@ -465,6 +468,7 @@ public static function output_grouped( $args = array() ){
465468
}while( $EM_DateTime <= $EM_Event->end() );
466469
}
467470
}
471+
$events_dates = apply_filters('em_events_output_grouped_events_dates', $events_dates, $args);
468472
foreach ($events_dates as $date => $events){
469473
echo str_replace('#s', $EM_DateTime->modify($date)->i18n($format), $args['header_format']);
470474
echo self::output($events, $atts);
@@ -478,7 +482,7 @@ public static function output_grouped( $args = array() ){
478482
}elseif( $args['no_results_msg'] !== false ){
479483
echo !empty($args['no_results_msg']) ? $args['no_results_msg'] : get_option('dbem_no_events_message');
480484
}
481-
return ob_get_clean();
485+
return apply_filters('em_events_output_grouped', ob_get_clean(), $events, $args);
482486
}
483487

484488
public static function get_pagination_links($args, $count, $search_action = 'search_events', $default_args = array()){

classes/em-taxonomy-frontend.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ public static function template($template = ''){
8383
//sort out filters
8484
add_filter('wp_head', 'EM_Taxonomy_Frontend::remove_em_the_content', 10000);
8585
add_filter('the_content', array(self::$this_class,'the_content')); //come in slightly early and consider other plugins
86+
// Meta Tag Manager Tweaks
87+
if( defined('MTM_VERSION') ) {
88+
add_filter('mtm_is_taxonomy_page', '__return_true');
89+
add_filter('mtm_is_cpt_page', '__return_false');
90+
add_filter('mtm_get_queried_object', function(){
91+
global $em_the_query;
92+
return $em_the_query->get_queried_object();
93+
});
94+
}
8695
//Yoast WP SEO Tweals
8796
if( defined('WPSEO_VERSION') ){
8897
add_filter('wpseo_breadcrumb_links',array(self::$this_class,'wpseo_breadcrumb_links'));

classes/em-ticket.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ function validate(){
341341
}
342342

343343
function is_available( $ignore_member_restrictions = false, $ignore_guest_restrictions = false ){
344+
if( EM_Bookings::$disable_restrictions ) return true; // complete short-circuit
344345
if( isset($this->is_available) && !$ignore_member_restrictions && !$ignore_guest_restrictions ) return apply_filters('em_ticket_is_available', $this->is_available, $this); //save extra queries if doing a standard check
345346
$is_available = false;
346347
$EM_Event = $this->get_event();
@@ -350,7 +351,7 @@ function is_available( $ignore_member_restrictions = false, $ignore_guest_restri
350351
$condition_3 = $EM_Event->rsvp_end()->getTimestamp() > time(); //either defined ending rsvp time, or start datetime is used here
351352
$condition_4 = !$this->ticket_members || ($this->ticket_members && is_user_logged_in()) || $ignore_member_restrictions;
352353
$condition_5 = true;
353-
if( !$ignore_member_restrictions && !EM_Bookings::$disable_restrictions && $this->ticket_members && !empty($this->ticket_members_roles) ){
354+
if( !$ignore_member_restrictions && $this->ticket_members && !empty($this->ticket_members_roles) ){
354355
//check if user has the right role to use this ticket
355356
$condition_5 = false;
356357
if( is_user_logged_in() ){

classes/event-locations/em-event-location-url.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public function get_post(){
2121
if( !empty($_POST['event_location_url_text']) ){
2222
$this->data['text'] = sanitize_text_field($_POST['event_location_url_text']);
2323
}
24-
return $return;
24+
return apply_filters('em_event_location_url_get_post', $return, $this);
2525
}
2626

2727
public function validate(){
28-
$result = false;
28+
$result = parent::validate();
2929
if( empty($this->data['url']) ){
3030
$this->event->add_error( __('Please enter a valid URL for this event location.', 'events-manager') );
3131
$result = false;
@@ -34,7 +34,7 @@ public function validate(){
3434
$this->event->add_error( __('Please provide some link text for this event location URL.', 'events-manager') );
3535
$result = false;
3636
}
37-
return $result;
37+
return apply_filters('em_event_location_url_validate', $result, $this);
3838
}
3939

4040
public function get_link( $new_target = true ){
@@ -68,5 +68,9 @@ public function output( $what = null, $target = null ){
6868
return parent::output($what);
6969
}
7070
}
71+
72+
public function get_ical_location(){
73+
return $this->url;
74+
}
7175
}
7276
URL::init();

classes/event-locations/em-event-location.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function load_postdata( $event_meta = array(), $reload = false ){
103103
$this->data[$key] = maybe_unserialize($this->data[$key]);
104104
}
105105
}
106+
do_action('em_event_location_load_postdata', $this);
106107
}
107108

108109
/**
@@ -111,14 +112,14 @@ public function load_postdata( $event_meta = array(), $reload = false ){
111112
*/
112113
public function get_post(){
113114
$this->data = array();
114-
return true;
115+
return apply_filters('em_event_location_get_post', true, $this);
115116
}
116117

117118
/**
118119
* @return boolean
119120
*/
120121
public function validate(){
121-
return false;
122+
return apply_filters('em_event_location_validate', false, $this);
122123
}
123124

124125
public function save(){
@@ -133,13 +134,14 @@ public function save(){
133134
}
134135
}
135136
}
136-
return true;
137+
return apply_filters('em_event_location_save', true, $this);
137138
}
138139

139140
public function delete(){
140141
$this->reset_data();
141142
$this->data = array();
142-
return true;
143+
do_action('em_event_location_deleted', $this);
144+
return apply_filters('em_event_location_delete', true, $this);
143145
}
144146

145147
/**
@@ -199,6 +201,10 @@ public function output( $what = null, $target = null ){
199201
return static::get_label();
200202
}
201203
}
204+
205+
public function get_ical_location(){
206+
return false;
207+
}
202208
}
203209

204210
//include default Event Locations

em-functions.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -615,20 +615,23 @@ function em_get_search_form_defaults($args = array()){
615615
//merge defaults with supplied arguments
616616
$args = array_merge($search_args, $args);
617617
//overwrite with $_REQUEST defaults in event of a submitted search
618-
if( isset($_REQUEST['geo']) ) $args['geo'] = $_REQUEST['geo']; //if geo search string requested, use that for search form
619-
if( isset($_REQUEST['near']) ) $args['near'] = wp_unslash($_REQUEST['near']); //if geo search string requested, use that for search form
620-
if( isset($_REQUEST['em_search']) ) $args['search'] = wp_unslash($_REQUEST['em_search']); //if geo search string requested, use that for search form
621-
if( isset($_REQUEST['category']) ) $args['category'] = $_REQUEST['category']; //if state requested, use that for searching
622-
if( isset($_REQUEST['country']) ) $args['country'] = wp_unslash($_REQUEST['country']); //if country requested, use that for searching
623-
if( isset($_REQUEST['region']) ) $args['region'] = wp_unslash($_REQUEST['region']); //if region requested, use that for searching
624-
if( isset($_REQUEST['state']) ) $args['state'] = wp_unslash($_REQUEST['state']); //if state requested, use that for searching
625-
if( isset($_REQUEST['town']) ) $args['town'] = wp_unslash($_REQUEST['town']); //if state requested, use that for searching
626-
if( isset($_REQUEST['near_unit']) ) $args['near_unit'] = $_REQUEST['near_unit']; //if state requested, use that for searching
627-
if( isset($_REQUEST['near_distance']) ) $args['near_distance'] = $_REQUEST['near_distance']; //if state requested, use that for searching
618+
if( isset($_REQUEST['geo']) ) $args['geo'] = sanitize_text_field($_REQUEST['geo']); //if geo search string requested, use that for search form
619+
if( isset($_REQUEST['near']) ) $args['near'] = sanitize_text_field(wp_unslash($_REQUEST['near'])); //if geo search string requested, use that for search form
620+
if( isset($_REQUEST['em_search']) ) $args['search'] = sanitize_text_field(wp_unslash($_REQUEST['em_search'])); //if geo search string requested, use that for search form
621+
if( isset($_REQUEST['category']) ) $args['category'] = sanitize_text_field($_REQUEST['category']); //if category requested, use that for searching
622+
if( isset($_REQUEST['country']) ) $args['country'] = sanitize_text_field(wp_unslash($_REQUEST['country'])); //if country requested, use that for searching
623+
if( isset($_REQUEST['region']) ) $args['region'] = sanitize_text_field(wp_unslash($_REQUEST['region'])); //if region requested, use that for searching
624+
if( isset($_REQUEST['state']) ) $args['state'] = sanitize_text_field(wp_unslash($_REQUEST['state'])); //if state requested, use that for searching
625+
if( isset($_REQUEST['town']) ) $args['town'] = sanitize_text_field(wp_unslash($_REQUEST['town'])); //if state requested, use that for searching
626+
if( isset($_REQUEST['near_unit']) ) $args['near_unit'] = sanitize_text_field($_REQUEST['near_unit']); //if state requested, use that for searching
627+
if( isset($_REQUEST['near_distance']) ) $args['near_distance'] = sanitize_text_field($_REQUEST['near_distance']); //if state requested, use that for searching
628628
if( !empty($_REQUEST['scope']) && !is_array($_REQUEST['scope'])){
629-
$args['scope'] = explode(',',$_REQUEST['scope']); //convert scope to an array in event of pagination
629+
$args['scope'] = explode(',',sanitize_text_field($_REQUEST['scope'])); //convert scope to an array in event of pagination
630630
}elseif( !empty($_REQUEST['scope']) ){
631-
$args['scope'] = $_REQUEST['scope'];
631+
$args['scope'] = array(); // reset and populate sanitized
632+
foreach( $_REQUEST['scope'] as $k => $v ){
633+
$args['scope'][absint($k)] = sanitize_text_field($v);
634+
}
632635
}
633636
return $args;
634637
}

events-manager.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/*
33
Plugin Name: GGG Events Manager
4-
Version: 5.11.1
4+
Version: 5.12.2
55
Plugin URI: https://github.com/shashachu/ggg-events-manager/
66
Description: Customized version of the Events Manager plugin by Marcus Sykes, tailored towards trooping signups for the Golden Gate Garrison.
77
Author: Marcus Sykes, Sha Sha Chu
@@ -40,7 +40,7 @@
4040
$myUpdateChecker->getVcsApi()->enableReleaseAssets();
4141

4242
// Setting constants
43-
define('EM_VERSION', 5.99911); //self expanatory, although version currently may not correspond directly with published version number. until 6.0 we're stuck updating 5.999.x
43+
define('EM_VERSION', 5.99912); //self expanatory, although version currently may not correspond directly with published version number. until 6.0 we're stuck updating 5.999.x
4444
define('EM_PRO_MIN_VERSION', 2.6712); //self expanatory
4545
define('EM_PRO_MIN_VERSION_CRITICAL', 2.377); //self expanatory
4646
define('EM_DIR', dirname( __FILE__ )); //an absolute path to this directory
@@ -337,6 +337,11 @@ public static function public_enqueue() {
337337

338338
public static function admin_enqueue( $hook_suffix = false ){
339339
if( $hook_suffix == 'post.php' || (!empty($_GET['page']) && substr($_GET['page'],0,14) == 'events-manager') || (!empty($_GET['post_type']) && in_array($_GET['post_type'], array(EM_POST_TYPE_EVENT,EM_POST_TYPE_LOCATION,'event-recurring'))) ){
340+
if( $hook_suffix == 'post.php' && empty($_GET['post_type']) && !empty($_GET['post']) ){
341+
// don't load if the post being edited isn't an EM one
342+
$post = get_post($_GET['post']);
343+
if( !in_array($post->post_type, array(EM_POST_TYPE_EVENT,EM_POST_TYPE_LOCATION,'event-recurring')) ) return;
344+
}
340345
wp_enqueue_style( 'wp-color-picker' );
341346
wp_enqueue_script('events-manager', plugins_url('includes/js/events-manager.js',__FILE__), array('jquery', 'jquery-ui-core','jquery-ui-widget','jquery-ui-position','jquery-ui-sortable','jquery-ui-datepicker','jquery-ui-autocomplete','jquery-ui-dialog','wp-color-picker'), EM_VERSION);
342347
do_action('em_enqueue_admin_scripts');

readme.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Donate link: http://wp-events-plugin.com
44
Tags: bookings, calendar, tickets, events, buddypress, event management, google maps, maps, locations, registration, zoom
55
Text Domain: events-manager
66
Requires at least: 5.2
7-
Tested up to: 5.8
8-
Stable tag: 5.11.1
7+
Tested up to: 6.0
8+
Stable tag: 5.12.1
99
Requires PHP: 5.3
1010

1111
Fully featured event registration management including recurring events, locations management, calendar, Google map integration, booking management
@@ -119,6 +119,22 @@ See our [FAQ](http://wp-events-plugin.com/documentation/faq/) page, which is upd
119119
6. Manage attendees with various booking reports
120120

121121
== Changelog ==
122+
= 5.12.2 =
123+
* 5.12.1 with GGG mods
124+
125+
= 5.12.1 =
126+
* fixed issue with scope sanitization preventing search form searching by date range
127+
* added limitation to prevent JS loading on non-EM post type editors to potentially help prevent 3rd party conflicts
128+
* added support for event location displaying url or other custom info for the ical LOCATION property
129+
130+
= 5.12 =
131+
* changed EM_Booking::$disable_restricions so that all ticket restrictions can ignored for admin manual bookings (pro feature) including spaces, roles and dates
132+
* added taxonomy filters for Meta Tag Manager compatibility on overriden taxonomy pages
133+
* added filters to Event_Locations\Event_Location and Event_Locations\URL
134+
* added filters to EM_Events::output_grouped()
135+
* fixed #_EVENTDATES_LOCAL and #_24HHTIMES_LOCAL showing time/date range even if time/dates are the same
136+
* fixed XSS security vulnerability reported by/via WP Plugins team
137+
122138
= 5.11.1 =
123139
* 5.11 with GGG mods
124140

0 commit comments

Comments
 (0)