Skip to content

Commit

Permalink
version 5.7.5
Browse files Browse the repository at this point in the history
version 5.7.5
  • Loading branch information
webnuswp committed Jul 9, 2020
1 parent 67a4fd5 commit d214e79
Show file tree
Hide file tree
Showing 70 changed files with 18,639 additions and 17,230 deletions.
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Modern Events Calendar Lite
# Modern Events Calendar Lite ===
**Contributors:** webnus
**Donate link:** https://webnus.net
**Tags:** Event, Events, Calendar, Booking, Schedule, Organizer, Venue
**Requires at least:** 4.0.0
**Tested up to:** 5.4.2
**Stable tag:** 5.7.0
**Stable tag:** 5.7.5
**Requires PHP:** 5.6
**License:** GPLv2 or later
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -211,9 +211,9 @@ You can see [plugin documentation](https://webnus.net/dox/modern-events-calendar


## Key Features
- User Role created after booking
- Sort payment gateways
- Booking fixed fields per booking
- Download-able file feature (*pro*)
- Sort payment gateways (*pro*)
- Booking fixed fields per booking (*pro*)
- Custom event fields
- Multiple occurrences in one day
- Different hours for custom days repeat
Expand Down Expand Up @@ -341,7 +341,9 @@ You can see [plugin documentation](https://webnus.net/dox/modern-events-calendar
- Maximum discount for coupons (*pro*)
- Booking report page (*pro*)
- Book All Occurrences (*pro*)
- Total User Booking Limits (*pro*)
- Stop selling Ticket Option (*pro*)
- Sell all occurrences by one booking (*pro*)
- [Organizer payment](https://webnus.net/dox/modern-events-calendar/organizer-payment/) (*pro*)
- [Individual booking form per event](https://webnus.net/dox/modern-events-calendar/booking-form/) (*pro*)
- [Advanced Tax/Fee system](https://webnus.net/dox/modern-events-calendar/taxes-or-fees/) (*pro*)
Expand Down Expand Up @@ -493,6 +495,28 @@ You can see [plugin documentation](https://webnus.net/dox/modern-events-calendar

## Changelog

### 5.7.5 – 9 July 2020
- Refactored: The booking reminder to accept hours interval instead of days (pro)
- Added: A download-able file feature. This file can be downloaded after confirmed booking by bookers (pro)
- Added: A placeholder to include the downloadable file link in booking notifications (pro)
- Added: An option to disable confirmation email (pro)
- Added: A feature to show attendees of bookings in main booking manage page (pro)
- Added: Featured image of events into the RSS feed
- Added: Available tickets if user is restricted to book only 1 ticket (pro)
- Improved: The stripe payment by sending payer email (pro)
- Improved: The display of time for those multiple days events that last after midnight
- Improved: The search module to show searched events
- Improved: The “Show Booking Form Interval” option to be more compatible with “Sell All Occurrences” events (pro)
- Updated: Polish translation (Thanks to Monika Osowicz)
- Fixed: Some issues in fixed and per attendee booking fields (pro)
- Fixed: Some issues in event fields
- Fixed: Some translation issue in single event modules
- Fixed: An issue in booking module loaded in popup event (pro)
- Fixed: An issue in google calendar link in email notifications
- Fixed: An issue in event link for recurring events in email notifications
- Fixed: An issue in archive page meta title


### 5.7.0 – 1 July 2020
- Added: WeatherAPI.com provider for weather module (pro)
- Added: A new feature to sort payment gateways in backend and frontend (pro)
Expand All @@ -503,7 +527,7 @@ You can see [plugin documentation](https://webnus.net/dox/modern-events-calendar
- Added: %%payment_gateway%% placeholder (pro)
- Added: %%booking_id%% placeholder (pro)
- Added: %%booking_transaction_id%% placeholder (pro)
- Added: %% ticket_name%% and %%ticket_time%% placeholders to notifications (pro)
- Added: %%ticket_name%% and %%ticket_time%% placeholders to notifications (pro)
- Improved: The Facebook Importer
- Improved: The attendees section of Frontend Submission
- Fixed: An issue related to event time in booking notifications (pro)
Expand Down
201 changes: 201 additions & 0 deletions app/features/dlfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?php
/** no direct access **/
defined('MECEXEC') or die();

/**
* Webnus MEC Downloadable File class.
* @author Webnus <info@webnus.biz>
*/
class MEC_feature_dlfile extends MEC_base
{
public $factory;
public $main;
public $settings;

/**
* Constructor method
* @author Webnus <info@webnus.biz>
*/
public function __construct()
{
// Import MEC Factory
$this->factory = $this->getFactory();

// Import MEC Main
$this->main = $this->getMain();

// MEC Settings
$this->settings = $this->main->get_settings();
}

/**
* Initialize locations feature
* @author Webnus <info@webnus.biz>
*/
public function init()
{
// Booking Status
$booking_status = (isset($this->settings['booking_status']) and $this->settings['booking_status']) ? true : false;

// Downloadable Status
$downloadable_status = (isset($this->settings['downloadable_file_status']) and $this->settings['downloadable_file_status']);

// Feature is not enabled
if(!$booking_status or !$downloadable_status) return;

// Metabox
$this->factory->action('mec_metabox_booking', array($this, 'meta_box_downloadable_file'), 17);

// Downloadable File for FES
if(!isset($this->settings['fes_section_downloadable_file']) or (isset($this->settings['fes_section_downloadable_file']) and $this->settings['fes_section_downloadable_file'])) $this->factory->action('mec_fes_metabox_details', array($this, 'meta_box_downloadable_file'), 47);

// AJAX
$this->factory->action('wp_ajax_mec_downloadable_file_upload', array($this, 'upload'));
}

/**
* Show downloadable file of event into the Add/Edit event page
*
* @author Webnus <info@webnus.biz>
* @param object $post
*/
public function meta_box_downloadable_file($post)
{
// Disable For Guest
if(!get_current_user_id()) return;

$file_id = get_post_meta($post->ID, 'mec_dl_file', true);
if(trim($file_id) == '') $file_id = '';

$file_url = $file_id ? wp_get_attachment_url($file_id) : '';
?>
<script>
jQuery(document).ready(function()
{
jQuery("#mec_downloadable_file_uploader").on('change', function()
{
var fd = new FormData();
fd.append("action", "mec_downloadable_file_upload");
fd.append("_wpnonce", "<?php echo wp_create_nonce('mec_downloadable_file_upload'); ?>");
fd.append("file", jQuery("#mec_downloadable_file_uploader").prop("files")[0]);

jQuery("#mec_downloadable_file_error").html("").addClass("mec-util-hidden");
jQuery.ajax(
{
url: "<?php echo admin_url('admin-ajax.php', NULL); ?>",
type: "POST",
data: fd,
dataType: "json",
processData: false,
contentType: false
})
.done(function(response)
{
if(response.success)
{
jQuery("#mec_downloadable_file_link").html('<a href="'+response.data.url+'" target="_blank">'+response.data.url+'</a>').removeClass("mec-util-hidden");
jQuery("#mec_downloadable_file").val(response.data.id);
jQuery("#mec_downloadable_file_remove_image_button").removeClass("mec-util-hidden");
}
else
{
jQuery("#mec_downloadable_file_error").html(response.message).removeClass("mec-util-hidden");
}

// Reset File Input
jQuery("#mec_downloadable_file_uploader").val('');
});

return false;
});

jQuery("#mec_downloadable_file_remove_image_button").on('click', function()
{
jQuery("#mec_downloadable_file_link").html('').addClass("mec-util-hidden");
jQuery("#mec_downloadable_file").val('');
jQuery("#mec_downloadable_file_remove_image_button").addClass("mec-util-hidden");
});
});
</script>
<div class="mec-meta-box-fields mec-event-tab-content" id="mec-downloadable-file">
<h4><?php _e('Downloadable File', 'modern-events-calendar-lite'); ?></h4>
<div id="mec_meta_box_downloadable_file_options">
<input type="hidden" id="mec_downloadable_file" name="mec[downloadable_file]" value="<?php echo $file_id; ?>">
<input type="file" id="mec_downloadable_file_uploader">
<p class="description"><?php esc_html_e('pdf,zip,png,jpg and gif files are allowed.', 'modern-events-calendar-lite'); ?></p>
<div id="mec_downloadable_file_link" class="<?php echo (trim($file_id) ? '' : 'mec-util-hidden'); ?>"><?php echo ($file_id ? '<a href="'.$file_url.'" target="_blank">'.$file_url.'</a>' : ''); ?></div>
<button type="button" id="mec_downloadable_file_remove_image_button" class="<?php echo (trim($file_id) ? '' : 'mec-util-hidden'); ?>"><?php _e('Remove File', 'modern-events-calendar-lite'); ?></button>
<div class="mec-error mec-util-hidden" id="mec_downloadable_file_error"></div>
</div>
</div>
<?php
}

public function upload()
{
// Check if our nonce is set.
if(!isset($_POST['_wpnonce'])) $this->main->response(array('success'=>0, 'code'=>'NONCE_MISSING'));

// Verify that the nonce is valid.
if(!wp_verify_nonce(sanitize_text_field($_POST['_wpnonce']), 'mec_downloadable_file_upload')) $this->main->response(array('success'=>0, 'code'=>'NONCE_IS_INVALID'));

$uploaded_file = isset($_FILES['file']) ? $_FILES['file'] : NULL;

// No file
if(!$uploaded_file) $this->main->response(array('success'=>0, 'code'=>'NO_FILE', 'message'=>esc_html__('Please upload a file.', 'modern-events-calendar-lite')));

$allowed = array('gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip');

$ex = explode('.', $uploaded_file['name']);
$extension = end($ex);

// Invalid Extension
if(!in_array($extension, $allowed)) $this->main->response(array('success'=>0, 'code'=>'INVALID_EXTENSION', 'message'=>sprintf(esc_html__('File extension is invalid. You can upload %s files.', 'modern-events-calendar-lite'), implode(', ', $allowed))));

// Maximum File Size
$max_file_size = isset($this->settings['fes_max_file_size']) ? (int) ($this->settings['fes_max_file_size'] * 1000) : (5000 * 1000);

// Invalid Size
if($uploaded_file['size'] > $max_file_size) $this->main->response(array('success'=>0, 'code'=>'IMAGE_IS_TOO_BIG', 'message'=>sprintf(esc_html__('File is too big. Maximum size is %s KB.', 'modern-events-calendar-lite'), ($max_file_size / 1000))));

// Include the functions
if(!function_exists('wp_handle_upload'))
{
require_once ABSPATH.'wp-admin/includes/file.php';
require_once(ABSPATH.'wp-admin/includes/image.php');
}

$upload = wp_upload_bits($uploaded_file['name'], NULL, file_get_contents($uploaded_file['tmp_name']));
$wp_filetype = wp_check_filetype(basename($upload['file']), NULL);

$wp_upload_dir = wp_upload_dir();
$attachment = array(
'guid' => $wp_upload_dir['baseurl'] . _wp_relative_upload_path($upload['file']),
'post_mime_type' => $wp_filetype['type'],
'post_title' => preg_replace('/\.[^.]+$/', '', basename($upload['file'])),
'post_content' => '',
'post_status' => 'inherit'
);

$attach_id = wp_insert_attachment($attachment, $upload['file']);
wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $upload['file']));

$success = 0;
$data = array();

if($attach_id and (!isset($upload['error']) or (isset($upload['error']) and !$upload['error'])))
{
$success = 1;
$message = __('File uploaded!', 'modern-events-calendar-lite');

$data['url'] = $upload['url'];
$data['id'] = $attach_id;
}
else
{
$message = $upload['error'];
}

$this->main->response(array('success'=>$success, 'message'=>$message, 'data'=>$data));
}
}
12 changes: 11 additions & 1 deletion app/features/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function init()
}

// Show ticket variations meta box only if the module is enabled
if(isset($this->settings['ticket_variations_status']) and $this->settings['ticket_variations_status'])
if($booking_status and isset($this->settings['ticket_variations_status']) and $this->settings['ticket_variations_status'])
{
$this->factory->action('mec_metabox_booking', array($this, 'meta_box_ticket_variations'), 16);

Expand Down Expand Up @@ -1559,6 +1559,9 @@ public function meta_box_booking($post)
<?php if(isset($gateway_settings['op_status']) && $gateway_settings['op_status'] == 1): ?>
<a class="mec-add-booking-tabs-link" data-href="mec_meta_box_op_form" href="#"><?php echo esc_html__('Organizer Payment' ,'modern-events-calendar-lite'); ?></a>
<?php endif; ?>
<?php if(isset($this->settings['downloadable_file_status']) and $this->settings['downloadable_file_status']): ?>
<a class="mec-add-booking-tabs-link" data-href="mec-downloadable-file" href="#"><?php echo esc_html__('Downloadable File' ,'modern-events-calendar-lite'); ?></a>
<?php endif; ?>
<?php do_action('add_event_booking_sections_left_menu'); ?>
</div>
<div class="mec-add-booking-tabs-right">
Expand Down Expand Up @@ -3259,6 +3262,13 @@ public function save_event($post_id)
$fields = (isset($_mec['fields']) and is_array($_mec['fields'])) ? $_mec['fields'] : array();
update_post_meta($post_id, 'mec_fields', $fields);

// Downloadable File
if(isset($_mec['downloadable_file']))
{
$dl_file = isset($_mec['downloadable_file']) ? $_mec['downloadable_file'] : '';
update_post_meta($post_id, 'mec_dl_file', $dl_file);
}

$mec_update = (isset($_REQUEST['original_publish']) and strtolower(trim($_REQUEST['original_publish'])) == 'publish') ? false : true;
do_action('mec_after_publish_admin_event', $post_id, $mec_update);
}
Expand Down
7 changes: 7 additions & 0 deletions app/features/fes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,13 @@ public function fes_form()
$fields = (isset($mec['fields']) and is_array($mec['fields'])) ? $mec['fields'] : array();
update_post_meta($post_id, 'mec_fields', $fields);

// Downloadable File
if(isset($mec['downloadable_file']))
{
$dl_file = isset($mec['downloadable_file']) ? $mec['downloadable_file'] : '';
update_post_meta($post_id, 'mec_dl_file', $dl_file);
}

do_action('save_fes_meta_action', $post_id, $mec);

// For Event Notification Badge.
Expand Down
15 changes: 15 additions & 0 deletions app/features/mec.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function init()

// Close Custom Text Notification
$this->factory->action('wp_ajax_close_cmsg_notification', array($this, 'close_cmsg_notification'));
$this->factory->action('wp_ajax_close_cmsg_2_notification', array($this, 'close_cmsg_2_notification'));

// Close Custom Text Notification
$this->factory->action('wp_ajax_report_event_dates', array($this, 'report_event_dates'));
Expand Down Expand Up @@ -228,6 +229,20 @@ public function close_notification()
wp_die();
}

/* Close addons notification */
public function close_cmsg_2_notification()
{
// Current User is not Permitted
if(!current_user_can('manage_options')) $this->main->response(array('success'=>0, 'code'=>'ADMIN_ONLY'));

if(!wp_verify_nonce( $_REQUEST['nonce'], 'mec_settings_nonce'))
{
exit();
}
update_option('mec_custom_msg_2_close_option', 'open');
wp_die();
}

/* Close addons notification */
public function close_cmsg_notification()
{
Expand Down
Loading

0 comments on commit d214e79

Please sign in to comment.