Skip to content

Commit

Permalink
v5.15.5
Browse files Browse the repository at this point in the history
v5.15.5
  • Loading branch information
webnuswp committed Jan 3, 2021
1 parent 1eb2244 commit 180df6c
Show file tree
Hide file tree
Showing 77 changed files with 18,953 additions and 17,220 deletions.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Tags:** Event, Events, Calendar, Booking, Schedule, Organizer, Venue \
**Requires at least:** 4.0.0 \
**Tested up to:** 5.6 \
**Stable tag:** 5.15.0 \
**Stable tag:** 5.15.5 \
**Requires PHP:** 5.6 \
**License:** GPLv2 or later \
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -235,6 +235,7 @@ You can see [plugin documentation](https://webnus.net/dox/modern-events-calendar

## Key Features

- Calendar method to show available occurrences to book (*pro*)
- Shortcode to display users events
- Resend booking verification and confirmation email (*pro*)
- Countdown method per event
Expand Down Expand Up @@ -586,6 +587,31 @@ You can see [plugin documentation](https://webnus.net/dox/modern-events-calendar

## Changelog

### v 5.15.5 – 30 December 2020

- Added: An advanced calendar method to show available occurrences to book (pro)
- Added: the feature to create segmetns in MailChimp integration (pro)
- Added: Ability to edit booking fields in “Booking Edit” page in WordPress backend (pro)
- Added: “Fallback Image“ feature to set an image for categories and display it as the event featured image if no image was set for the events
- Added: Link attribute “rel

### noopener” for events display method to be able to set them to open in a new window

- Improved: MailChimp integration by adding some relevant tags to the subscribers (pro)
- Improved: The booking CSV import (pro)
- Improved: The booking reminder email (pro)
- Improved: Backend speed and optimization
- Improved: MEC capabilities (pro)
- Fixed: An issue in the “Next/Previous Events” Module
- Fixed: A date display issue on carousel skins
- Fixed: Importing modified series of Google events in addition to their main event
- Fixed: Carousel and slider issue in Divi page builder environment
- Fixed: MEC Shortcodes assets in Elementor page builder environment
- Fixed: Some issues on WP Multisite
- Fixed: Label of booking button (pro)
- Fixed: Arabic character in the event link
- Fixed: Some PHP notices

### v 5.15.0 – 16 December 2020

- Added: A shortcode to display current users' events in a preferred skin e.g. monthly, list, grid, etc.
Expand Down
2 changes: 1 addition & 1 deletion app/addons/beaver.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct()
public function init()
{
// Beaver Builder is not installed
if( !class_exists( 'FLBuilder' ) ) return false;
if(!class_exists( 'FLBuilder' ) ) return false;
define( 'MEC_BEAVER_DIR', plugin_dir_path( __FILE__ ) );
define( 'MEC_BEAVER_URL', plugins_url( '/', __FILE__ ) );
add_action( 'init', array($this,'mec_beaver_builder_shortcode') );
Expand Down
4 changes: 2 additions & 2 deletions app/addons/divi/includes/MECShortcodesForDivi.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
if( ! function_exists( 'MECDIVI_et_builder_load_actions' )) {
if(! function_exists( 'MECDIVI_et_builder_load_actions' )) {
function MECDIVI_et_builder_load_actions( $actions ) {
$actions[] = 'MECDIVI_load_mec_shortcode';

Expand All @@ -9,7 +9,7 @@ function MECDIVI_et_builder_load_actions( $actions ) {

add_filter( 'et_builder_load_actions', 'MECDIVI_et_builder_load_actions' );

if( ! function_exists( 'MECDIVI_load_mec_shortcode' )) {
if(! function_exists( 'MECDIVI_load_mec_shortcode' )) {
function MECDIVI_load_mec_shortcode() {
if(!current_user_can('manage_options')) return;
$post_id = $_POST['shortcode_id'];
Expand Down
1 change: 1 addition & 0 deletions app/addons/divi/styles/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions app/addons/elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ public function init()
if(!did_action('elementor/loaded')) return false;

add_action('elementor/widgets/widgets_registered', array($this, 'register_shortcode'));

add_action( 'elementor/preview/enqueue_styles', function() {
wp_enqueue_style( 'mec-elementor-owl-carousel-css', plugins_url( '../../assets/packages/owl-carousel/owl.carousel.min.css', __FILE__ ), array() );
wp_enqueue_style( 'mec-elementor-frontend-css', plugins_url( '../../assets/css/frontend.css', __FILE__ ), array() );
});

add_action('elementor/editor/after_enqueue_scripts', function() {
wp_enqueue_script('mec-elementor-owl-carousel-js', plugin_dir_url( __FILE__ ) . '../../assets/packages/owl-carousel/owl.carousel.min.js');
wp_enqueue_script('mec-elementor-frontend-js', plugin_dir_url( __FILE__ ) . '../../assets/js/frontend.js');
});

return true;
}

Expand Down
6 changes: 3 additions & 3 deletions app/api/Ctct/Components/EventSpot/EventSpot.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ public static function create(array $props)
$event->location = parent::getValue($props, "location");
$event->meta_data_tags = parent::getValue($props, "meta_data_tags");
$event->name = parent::getValue($props, "name");
if( parent::getValue( $props, "notification_options" ) ) {
if(parent::getValue( $props, "notification_options" ) ) {
$event->notification_options = NotificationOption::create( parent::getValue( $props, "notification_options" ) );
}
$event->online_meeting = parent::getValue($props, "online_meeting");
$event->payable_to = parent::getValue($props, "payable_to");
$event->payable_to = parent::getValue($props, "payable_to");
if( parent::getValue( $props, "payment_address" ) ) {
if(parent::getValue( $props, "payment_address" ) ) {
$event->payment_address = Address::create( parent::getValue( $props, "payment_address" ) );
}
$event->payment_options = parent::getValue($props, "payment_options");
Expand All @@ -349,7 +349,7 @@ public static function create(array $props)
$event->time_zone_id = parent::getValue($props, "time_zone_id");
$event->title = parent::getValue($props, "title");
$event->total_registered_count = parent::getValue($props, "total_registered_count");
if( parent::getValue( $props, "track_information" ) ) {
if(parent::getValue( $props, "track_information" ) ) {
$event->track_information = TrackInformation::create( parent::getValue( $props, "track_information" ) );
}
$event->twitter_hash_tag = parent::getValue($props, "twitter_hash_tag");
Expand Down
2 changes: 1 addition & 1 deletion app/api/Ctct/Components/EventSpot/PaymentSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function create(array $props)
$payment_summary->payment_status = parent::getValue($props, "payment_status");
$payment_summary->payment_type = parent::getValue($props, "payment_type");

if( isset($props["order"])) {
if(isset($props["order"])) {
$payment_summary->order = RegistrantOrder::create( parent::getValue( $props, "order" ) );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function getFieldValue( $fieldName ) {

/** @var RegistrantSectionField $field */
foreach ( $section->fields as $field ) {
if( $fieldName === $field->name ) {
if($fieldName === $field->name ) {
return is_null( $field->values ) ? $field->value : $field->values;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function create(array $props)
$registrant_order->currency_type = parent::getValue($props, "currency_type");
$registrant_order->total = parent::getValue($props, "total");

if( isset($props['fees']) ) {
if(isset($props['fees']) ) {
foreach ( $props['fees'] as $fee ) {
$registrant_order->fees[] = RegistrantFee::create($fee);
}
Expand Down
2 changes: 1 addition & 1 deletion app/api/Ctct/Services/EventSpotService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getEvents($accessToken, Array $params = array())
$body = json_decode($response->getBody(), true);

$events = array();
if( ! empty( $body['results'] ) ) {
if(! empty( $body['results'] ) ) {
foreach ( $body['results'] as $event ) {
$events[] = EventSpot::create( $event );
}
Expand Down
180 changes: 180 additions & 0 deletions app/features/booking/calendar_novel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<?php
/** no direct access **/
defined('MECEXEC') or die();

/** @var MEC_feature_bookingcalendar $this */

// Available Dates
$dates = isset($event->dates) ? $event->dates : array($event->date);

// Multiple Day Event
$multiple_date = (isset($dates) && $dates[0]['start']['date'] != $dates[0]['end']['date']) ? 'mec-multiple-event' : '';

$first_date = (isset($start) ? $start : (isset($dates[0]) ? $dates[0]['start']['date'] : NULL));
if(!$first_date) return;

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

// Options
$event_color = isset($event->data->meta['mec_color']) ? '#'.$event->data->meta['mec_color'] : '';
$date_format = (isset($settings['booking_date_format1']) and trim($settings['booking_date_format1'])) ? $settings['booking_date_format1'] : 'Y-m-d';
$date_format = trim(str_replace(['H', 'h', 'i', 's', 'A', 'a', 'G', 'g', 'B', 'u', 'v', ':'], '', $date_format), ': ');
$time_format = get_option('time_format');

// before/after Month
$_1month_before = strtotime('first day of -1 month', strtotime($first_date));
$_1month_after = strtotime('first day of +1 month', strtotime($first_date));
$current_month_time = strtotime($first_date);

$year = date('Y', strtotime($first_date));
$month = date('m', strtotime($first_date));
$active_day = date('d', strtotime($first_date));

// Start day of week
$week_start = $this->main->get_first_day_of_week();

// days and weeks vars
$running_day = date('w', mktime(0, 0, 0, $month, 1, $year));
$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
$days_in_previous_month = date('t', strtotime('-1 month', strtotime($active_day)));

$days_in_this_week = 1;
$day_counter = 0;

if($week_start == 0) $running_day = $running_day; // Sunday
elseif($week_start == 1) // Monday
{
if($running_day != 0) $running_day = $running_day - 1;
else $running_day = 6;
}
elseif($week_start == 6) // Saturday
{
if($running_day != 6) $running_day = $running_day + 1;
else $running_day = 0;
}
elseif($week_start == 5) // Friday
{
if($running_day < 4) $running_day = $running_day + 2;
elseif($running_day == 5) $running_day = 0;
elseif($running_day == 6) $running_day = 1;
}

$navigator_html = '';

// Show previous navigation
if(strtotime(date('Y-m-t', $_1month_before)) >= time())
{
$navigator_html .= '<div class="mec-previous-month mec-load-month mec-previous-month" data-mec-year="'.date('Y', $_1month_before).'" data-mec-month="'.date('m', $_1month_before).'"><i class="mec-sl-angle-left"></i> '.$this->main->date_i18n('F', $_1month_before).'</div>';
}

$navigator_html .= '<div class="mec-calendar-header"><h2>'.$this->main->date_i18n('F Y', $current_month_time).'</h2></div>';

// Show next navigation
if(strtotime(date('Y-m-01', $_1month_after)) >= time())
{
$navigator_html .= '<div class="mec-next-month mec-load-month mec-next-month" data-mec-year="'.date('Y', $_1month_after).'" data-mec-month="'.date('m', $_1month_after).'">'.$this->main->date_i18n('F', $_1month_after).' <i class="mec-sl-angle-right"></i></div>';
}

// Generating javascript code tpl
$javascript = '<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#mec_booking_calendar_'.$uniqueid.'").mecBookingCalendar(
{
active_month: {year: "'.date('Y', $current_month_time).'", month: "'.date('m', $current_month_time).'"},
next_month: {year: "'.date('Y', $_1month_after).'", month: "'.date('m', $_1month_after).'"},
ajax_url: "'.admin_url('admin-ajax.php', NULL).'",
id: "'.$uniqueid.'",
event_id: "'.$event->ID.'",
});
});
</script>';

// Include javascript code into the page
echo $javascript;
?>
<div class="mec-booking-calendar mec-wrap" id="mec_booking_calendar_<?php echo $uniqueid; ?>">
<div class="mec-booking-calendar-month-navigation"><?php echo $navigator_html; ?></div>
<div class="mec-calendar mec-box-calendar mec-event-calendar-classic mec-event-container-novel <?php echo $multiple_date; ?>">
<?php
// Table Headings
$headings = $this->main->get_weekday_abbr_labels();
echo '<dl class="mec-calendar-table-head"><dt class="mec-calendar-day-head">'.implode('</dt><dt class="mec-calendar-day-head">', $headings).'</dt></dl>';
?>
<dl class="mec-calendar-row">
<?php
// print "blank" days until the first of the current week
for($x = 0; $x < $running_day; $x++)
{
echo '<dt class="mec-table-nullday">'.($days_in_previous_month - ($running_day-1-$x)).'</dt>';
$days_in_this_week++;
}

// keep going with days ....
for($list_day = 1; $list_day <= $days_in_month; $list_day++)
{
$time = strtotime($year.'-'.$month.'-'.$list_day);
$today = date('Y-m-d', $time);
$day_id = date('Ymd', $time);

$render = '';
$first_day = '';
$middle_day = '';
$last_day = '';
$repeat = 0;

foreach($dates as $date)
{
if(!isset($date['fake']) and strtotime($date['start']['date']) <= $time and $time <= strtotime($date['end']['date']) and (isset($date['start']['timestamp']) and $date['start']['timestamp'] >= current_time('timestamp', 0)))
{
$repeat++;
$date_timestamp = $this->book->timestamp($date['start'], $date['end']);
$start_datetime = $date['start']['date'].' '.sprintf("%02d", $date['start']['hour']).':'.sprintf("%02d", $date['start']['minutes']).' '.$date['start']['ampm'];

$render .='<div class="mec-booking-calendar-date '.($this->main->is_soldout($event->ID, $start_datetime) ?'mec-booking-calendar-date-soldout' : '').' " data-timestamp="'.$this->book->timestamp($date['start'], $date['end']).'">' .(($date['start']['date'] !== $date['end']['date']) ? '<div class="mec-booking-calendar-date-hover">'.strip_tags($this->main->date_label($date['start'], $date['end'], $date_format, ' - ', false, (isset($date['allday']) ? $date['allday'] : 0))).'</div><div class="mec-booking-calendar-time-hover">' : '').strip_tags($this->main->date_label($date['start'], $date['end'], $time_format, ' - ', false, (isset($date['allday']) ? $date['allday'] : 0))).'</div>';

$first_day = strtotime($date['start']['date']) == $time ? ' first-day' : null;
$middle_day = (strtotime($date['end']['date']) != $time && strtotime($date['start']['date']) != $time) ? ' middle-day' : null;
$last_day = strtotime($date['end']['date']) == $time ? ' last-day' : null;
}
}

$repeat_class = $repeat > 1 ? ' mec-has-time-repeat' : '';
$date_for_wrap = $repeat == 1 ? 'data-timestamp="'.$date_timestamp.'"' : '';
$custom_class1 = $repeat == 1 ? ' mec-has-one-repeat-in-day' : '';
$custom_class2 = $repeat >= 1 ? ' mec-has-event-for-booking' : '';

echo '<dt class="mec-calendar-day'.$repeat_class.$custom_class1.$custom_class2.$first_day.$last_day.$middle_day.'" '.$date_for_wrap.'><div class="mec-calendar-novel-selected-day"><span>'.$list_day.'</span></div>';
echo '<div class="mec-booking-tooltip">'.$render.'</div>';
echo '</dt>';

if($running_day == 6)
{
echo '</dl>';

if((($day_counter+1) != $days_in_month) or (($day_counter+1) == $days_in_month and $days_in_this_week == 7))
{
echo '<dl class="mec-calendar-row">';
}

$running_day = -1;
$days_in_this_week = 0;
}

$days_in_this_week++; $running_day++; $day_counter++;
}

// finish the rest of the days in the week
if($days_in_this_week < 8)
{
for($x = 1; $x <= (8 - $days_in_this_week); $x++)
{
echo '<dt class="mec-table-nullday">'.$x.'</dt>';
}
}
?>
</dl>
</div>
</div>
<div class="mec-choosen-time-message disable"><?php echo __('Chosen Time:', 'modern-events-calendar-lite'); ?> <span class="mec-choosen-time"></span></div>
Loading

0 comments on commit 180df6c

Please sign in to comment.