Skip to content

Commit

Permalink
Merge pull request #39 from shashachu/5.9.8.1-upgrade
Browse files Browse the repository at this point in the history
Upgrade to EM 5.9.8.1
  • Loading branch information
shashachu authored Apr 29, 2024
2 parents 2b1d71b + 2b09543 commit d16e740
Show file tree
Hide file tree
Showing 36 changed files with 2,125 additions and 187 deletions.
6 changes: 5 additions & 1 deletion admin/em-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function em_options_save(){
//Do nothing, keep old setting.
}elseif( ($postKey == 'dbem_category_default_color' || $postKey == 'dbem_tag_default_color') && !sanitize_hex_color($postValue) ){
$EM_Notices->add_error( sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>').' '. esc_html__('This setting was not changed.', 'events-manager'), true);
}elseif( $postKey == 'dbem_oauth' && is_array($postValue) ){
foreach($postValue as $postValue_key=>$postValue_val){
EM_Options::set($postValue_key, wp_unslash($postValue_val), 'dbem_oauth');
}
}else{
//TODO slashes being added?
if( is_array($postValue) ){
Expand Down Expand Up @@ -845,7 +849,7 @@ function em_admin_option_box_uninstall(){
<th style="text-align:right;">
<a href="<?php echo $export_settings_url; ?>" class="button-secondary"><?php esc_html_e('Export Settings','events-manager'); ?></a>
</th>
<td><?php esc_html_e('Export your Events Manager settings and restore them here or on another website running this plugin.','events-manager'); ?></td>
<td><p><?php esc_html_e('Export your Events Manager settings and restore them here or on another website running this plugin.','events-manager'); ?></p></td>
</tr>
</table>

Expand Down
89 changes: 62 additions & 27 deletions admin/settings/tabs/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,76 @@
if( get_option('dbem_attributes_enabled') ){
em_options_textarea ( sprintf(__( '%s Attributes', 'events-manager'),__('Event','events-manager')), 'dbem_placeholders_custom', sprintf(__( "You can also add event attributes here, one per line in this format <code>#_ATT{key}</code>. They will not appear on event pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'events-manager'), EM_ADMIN_URL .'&amp;page=events-manager-help') );
}
if( get_option('dbem_locations_enabled') ){
/*default location*/
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') && EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS ){
em_options_input_text( __( 'Default Location', 'events-manager'), 'dbem_default_location', __('Please enter your Location ID, or leave blank for no location.','events-manager').' '.__( 'This option allows you to select the default location when adding an event.','events-manager')." ".__('(not applicable with event ownership on presently, coming soon!)','events-manager') );
}else{
$location_options = array();
$location_options[0] = __('no default location','events-manager');
$EM_Locations = EM_Locations::get();
foreach($EM_Locations as $EM_Location){
$location_options[$EM_Location->location_id] = $EM_Location->location_name;
}
em_options_select ( __( 'Default Location', 'events-manager'), 'dbem_default_location', $location_options, __('Please enter your Location ID.','events-manager').' '.__( 'This option allows you to select the default location when adding an event.','events-manager')." ".__('(not applicable with event ownership on presently, coming soon!)','events-manager') );
}

/*default location country*/
em_options_select ( __( 'Default Location Country', 'events-manager'), 'dbem_location_default_country', em_get_countries(__('no default country', 'events-manager')), __('If you select a default country, that will be pre-selected when creating a new location.','events-manager') );
}
?>
<tr class="em-header">
<td colspan="2">
<h4><?php echo sprintf(__('%s Settings','events-manager'),__('Location','events-manager')); ?></h4>
</td>
</tr>
<?php
em_options_radio_binary ( __( 'Enable locations?', 'events-manager'), 'dbem_locations_enabled', __( 'If you disable locations, bear in mind that you should remove your location page, shortcodes and related placeholders from your <a href="#formats" class="nav-tab-link" rel="#em-menu-formats">formats</a>.','events-manager') );
if( get_option('dbem_locations_enabled') ){
em_options_radio_binary ( __( 'Require locations for events?', 'events-manager'), 'dbem_require_location', __( 'Setting this to no will allow you to submit events without locations. You can use the <code>{no_location}...{/no_location}</code> or <code>{has_location}..{/has_location}</code> conditional placeholder to selectively display location information.','events-manager') );
em_options_radio_binary ( __( 'Use dropdown for locations?', 'events-manager'), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drop-down menu; location selection will be faster, but you will lose the ability to insert locations with events','events-manager') );
em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'events-manager'),__('location','events-manager')), 'dbem_location_attributes_enabled', __( 'Select yes to enable the attributes feature','events-manager') );
em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'events-manager'),__('location','events-manager')), 'dbem_cp_locations_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','events-manager') );
if( get_option('dbem_location_attributes_enabled') ){
em_options_textarea ( sprintf(__( '%s Attributes', 'events-manager'),__('Location','events-manager')), 'dbem_location_placeholders_custom', sprintf(__( "You can also add location attributes here, one per line in this format <code>#_LATT{key}</code>. They will not appear on location pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'events-manager'), EM_ADMIN_URL .'&amp;page=events-manager-help') );
}
}
em_options_radio_binary ( __( 'Enable locations?', 'events-manager'), 'dbem_locations_enabled', __( 'If you disable locations, bear in mind that you should remove your location page, shortcodes and related placeholders from your <a href="#formats" class="nav-tab-link" rel="#em-menu-formats">formats</a>.','events-manager'), '', '.em-location-type-option' );
?>
<tbody class="em-location-type-option">
<?php
em_options_radio_binary ( __( 'Require locations for events?', 'events-manager'), 'dbem_require_location', __( 'Setting this to no will allow you to submit events without locations. You can use the <code>{no_location}...{/no_location}</code> or <code>{has_location}..{/has_location}</code> conditional placeholder to selectively display location information.','events-manager') );
?>
<tr valign="top" id='dbem_location_types_row'>
<th scope="row"><?php esc_html_e('Location Types', 'events-manager'); ?></th>
<td>
<?php
$location_types = get_option('dbem_location_types', array());
?>
<label>
<input type="checkbox" name="dbem_location_types[location]" value="1" <?php if( !empty($location_types['location']) ) echo 'checked'; ?> data-trigger=".em-location-type-option-physical" class="em-trigger">
<?php esc_html_e('Physicial Locations', 'events-manager'); ?>
</label>
<?php foreach (EM_Event_Locations\Event_Locations::get_types() as $event_location_type => $EM_Event_Location_Class): /* @var EM_Event_Locations\Event_Location $EM_Event_Location_Class */ ?>
<br>
<label>
<input type="checkbox" name="dbem_location_types[<?php echo esc_attr($event_location_type); ?>]" value="1" <?php if( !empty($location_types[$event_location_type]) ) echo 'checked'; ?> data-trigger=".em-location-type-option-<?php echo esc_attr($event_location_type); ?>" class="em-trigger">
<?php echo $EM_Event_Location_Class::get_label('plural'); ?>
</label>
<?php endforeach; ?>
<p><em><?php echo sprintf( esc_html__('You can allow different location types which can be assigned to an event. For more information see our %s.', 'events-manager'), '<a href="http://wp-events-plugin.com/documentation/location-types/" target="_blank">'.esc_html__('documentation', 'events-manager').'</a>'); ?></em></p>
</td>
</tr>
</tbody>
</table>
<table class="form-table em-location-type-option">
<tbody class="em-location-type-option-physical">
<tr class="em-subheader">
<td colspan="2">
<h5><?php esc_html_e('Physicial Locations', 'events-manager'); ?></h5>
</td>
</tr>
<?php
if( get_option('dbem_locations_enabled') ){
em_options_radio_binary ( __( 'Use dropdown for locations?', 'events-manager'), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drop-down menu; location selection will be faster, but you will lose the ability to insert locations with events','events-manager') );
em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'events-manager'),__('location','events-manager')), 'dbem_location_attributes_enabled', __( 'Select yes to enable the attributes feature','events-manager') );
em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'events-manager'),__('location','events-manager')), 'dbem_cp_locations_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','events-manager') );
if( get_option('dbem_location_attributes_enabled') ){
em_options_textarea ( sprintf(__( '%s Attributes', 'events-manager'),__('Location','events-manager')), 'dbem_location_placeholders_custom', sprintf(__( "You can also add location attributes here, one per line in this format <code>#_LATT{key}</code>. They will not appear on location pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'events-manager'), EM_ADMIN_URL .'&amp;page=events-manager-help') );
}
/*default location*/
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') && EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS ){
em_options_input_text( __( 'Default Location', 'events-manager'), 'dbem_default_location', __('Please enter your Location ID, or leave blank for no location.','events-manager').' '.__( 'This option allows you to select the default location when adding an event.','events-manager')." ".__('(not applicable with event ownership on presently, coming soon!)','events-manager') );
}else{
$location_options = array();
$location_options[0] = __('no default location','events-manager');
$EM_Locations = EM_Locations::get();
foreach($EM_Locations as $EM_Location){
$location_options[$EM_Location->location_id] = $EM_Location->location_name;
}
em_options_select ( __( 'Default Location', 'events-manager'), 'dbem_default_location', $location_options, __('Please enter your Location ID.','events-manager').' '.__( 'This option allows you to select the default location when adding an event.','events-manager')." ".__('(not applicable with event ownership on presently, coming soon!)','events-manager') );
}

/*default location country*/
em_options_select ( __( 'Default Location Country', 'events-manager'), 'dbem_location_default_country', em_get_countries(__('no default country', 'events-manager')), __('If you select a default country, that will be pre-selected when creating a new location.','events-manager') );
}
?>
</tbody>
</table>
<table class="form-table">
<tr class="em-header">
<td colspan="2">
<h4><?php echo sprintf(__('%s Settings','events-manager'),__('Other','events-manager')); ?></h4>
Expand Down
4 changes: 0 additions & 4 deletions buddypress/screens/my-bookings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ function bp_em_my_bookings() {
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','pending_booking');
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','confirmed_booking');
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','cancelled_booking');
}else{
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','pending_booking');
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','confirmed_booking');
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','cancelled_booking');
}

em_load_event();
Expand Down
1 change: 1 addition & 0 deletions classes/em-admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,5 @@ public static function admin_footer(){
<?php
}
}
include('em-admin-notice.php');
EM_Admin_Notices::init();
12 changes: 8 additions & 4 deletions classes/em-booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function em_get_booking($id = false) {
}
/**
* Contains all information and relevant functions surrounding a single booking made with Events Manager
* @property int|false $booking_status
* @property string $language
*/
class EM_Booking extends EM_Object{
Expand All @@ -37,7 +38,7 @@ class EM_Booking extends EM_Object{
var $booking_price = null;
var $booking_spaces;
var $booking_comment;
var $booking_status = false;
protected $booking_status = false;
var $booking_tax_rate = null;
var $booking_taxes = null;
var $booking_meta = array();
Expand Down Expand Up @@ -174,6 +175,8 @@ function __get( $var ){
if( !empty($this->booking_meta['lang']) ){
return $this->booking_meta['lang'];
}
}elseif( $var == 'booking_status' ){
return ($this->booking_status == 0 && !get_option('dbem_bookings_approval') ) ? 1:$this->booking_status;
}
return null;
}
Expand Down Expand Up @@ -261,14 +264,14 @@ function save($mail = true){
$this->email();
}
$this->compat_keys();
return apply_filters('em_booking_save', ( count($this->errors) == 0 ), $this);
return apply_filters('em_booking_save', ( count($this->errors) == 0 ), $this, $update);
}else{
$this->feedback_message = __('There was a problem saving the booking.', 'events-manager');
if( !$this->can_manage() ){
$this->add_error(sprintf(__('You cannot manage this %s.', 'events-manager'),__('Booking','events-manager')));
}
}
return apply_filters('em_booking_save', false, $this);
return apply_filters('em_booking_save', false, $this, false);
}

/**
Expand Down Expand Up @@ -899,11 +902,12 @@ function delete(){
$this->booking_status = false;
$this->feedback_message = sprintf(__('%s deleted', 'events-manager'), __('Booking','events-manager'));
$wpdb->delete( EM_META_TABLE, array('meta_key'=>'booking-note', 'object_id' => $this->booking_id), array('%s','%d'));
do_action('em_booking_deleted', $this);
}else{
$this->add_error(sprintf(__('%s could not be deleted', 'events-manager'), __('Booking','events-manager')));
}
}
do_action('em_bookings_deleted', $result, array($this->booking_id));
do_action('em_bookings_deleted', $result, array($this->booking_id), $this);
return apply_filters('em_booking_delete',( $result !== false ), $this);
}

Expand Down
2 changes: 2 additions & 0 deletions classes/em-datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public function i18n( $format = 'Y-m-d H:i:s' ){
$timestamp = parent::format('U');
$server_offset = date('Z', $timestamp);
return date_i18n( $format, $timestamp - ($server_offset * 2) + $this->getOffset() );
}elseif( function_exists('wp_date') ){
return wp_date( $format, $this->getTimestamp(), $this->getTimezone() );
}else{
return date_i18n( $format, $this->getTimestampWithOffset(true) );
}
Expand Down
1 change: 1 addition & 0 deletions classes/em-event-post-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public static function meta_boxes( $post ){
add_meta_box('em-event-anonymous', __('Anonymous Submitter Info','events-manager'), array('EM_Event_Post_Admin','meta_box_anonymous'),EM_POST_TYPE_EVENT, 'side','high');
}
add_meta_box('em-event-when', __('When','events-manager'), array('EM_Event_Post_Admin','meta_box_date'),EM_POST_TYPE_EVENT, 'side','high');
// GGG
add_meta_box('em-event-when-ec-rsvp', __('RSVP Date','events-manager'), array('EM_Event_Post_Admin','meta_box_ec_rsvp_date'),EM_POST_TYPE_EVENT, 'side','high'); // GGG
if(get_option('dbem_locations_enabled', true)){
add_meta_box('em-event-where', __('Where','events-manager'), array('EM_Event_Post_Admin','meta_box_location'),EM_POST_TYPE_EVENT, 'normal','high');
Expand Down
2 changes: 1 addition & 1 deletion classes/em-event-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public static function parse_query(){
}
// END
else {
$wp_query->query_vars['orderby'] = sanitize_key($_REQUEST['orderby']);
$wp_query->query_vars['orderby'] = sanitize_key($_REQUEST['orderby']);
}
}else{
$wp_query->query_vars['orderby'] = 'meta_value';
Expand Down
4 changes: 3 additions & 1 deletion classes/em-event-posts-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static function columns_output( $column ) {
case 'location':
//get meta value to see if post has location, otherwise
$EM_Location = $EM_Event->get_location();
if( !empty($EM_Location->location_id) ){
if( $EM_Event->has_location() ){
$actions = array();
$actions[] = "<a href='". esc_url($EM_Location->get_permalink())."'>". esc_html__('View') ."</a>";
if( $EM_Location->can_manage('edit_locations', 'edit_others_locations') ) {
Expand All @@ -221,6 +221,8 @@ public static function columns_output( $column ) {
echo "<strong><a href='". $EM_Location->get_permalink()."'>" . $EM_Location->location_name . "</a></strong>";
echo "<span class='row-actions'> - ". implode(' | ', $actions) . "</span>";
echo "<br/>" . $EM_Location->location_address . " - " . $EM_Location->location_town;
}elseif( $EM_Event->has_event_location() ) {
echo $EM_Event->get_event_location()->get_admin_column();
}else{
echo __('None','events-manager');
}
Expand Down
Loading

0 comments on commit d16e740

Please sign in to comment.