Skip to content

Commit

Permalink
v5.19.0
Browse files Browse the repository at this point in the history
v5.19.0
  • Loading branch information
webnuswp committed May 12, 2021
1 parent f4f8f0d commit cb0dfdc
Show file tree
Hide file tree
Showing 74 changed files with 36,371 additions and 30,348 deletions.
7 changes: 5 additions & 2 deletions app/features/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ class="thickbox mec_category_icon button"><?php echo __('Select icon', 'modern-e
*/
public function save_metadata($term_id)
{
// Quick Edit
if(!isset($_POST['mec_cat_icon'])) return;

$icon = isset($_POST['mec_cat_icon']) ? sanitize_text_field($_POST['mec_cat_icon']) : '';
update_term_meta($term_id, 'mec_cat_icon', $icon);

Expand Down Expand Up @@ -2097,7 +2100,7 @@ class="mec-col-12"/>
</div>
<div class="mec-form-row">
<div class="mec-col-4">
<input type="text" name="mec[tickets][:i:][minimum_ticket]" placeholder="<?php _e('Minimum Ticket e.g. 3', 'modern-events-calendar-lite'); ?>">
<input type="text" name="mec[tickets][:i:][minimum_ticket]" value="1" placeholder="<?php _e('Minimum Ticket e.g. 3', 'modern-events-calendar-lite'); ?>">
<span class="mec-tooltip">
<div class="box top">
<h5 class="title"><?php _e('MinimumTicket', 'modern-events-calendar-lite'); ?></h5>
Expand Down Expand Up @@ -3915,7 +3918,7 @@ public function csvexcel()

$event = array(
$post_id,
$data->title,
html_entity_decode($data->title, ENT_QUOTES | ENT_HTML5),
html_entity_decode(strip_tags($data->content), ENT_QUOTES | ENT_HTML5),
$date['start']['date'],
$data->time['start'],
Expand Down
17 changes: 12 additions & 5 deletions app/features/feed/rss2.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
<link><?php bloginfo_rss('url'); ?></link>
<description><?php bloginfo_rss("description"); ?></description>
<lastBuildDate><?php echo wp_date('D, d M Y H:i:s O', strtotime(get_lastpostmodified('GMT'))); ?></lastBuildDate>
<lastBuildDate><?php echo $this->main->mysql2date('D, d M Y H:i:s O', get_lastpostmodified('GMT'), wp_timezone()); ?></lastBuildDate>
<language><?php bloginfo_rss('language'); ?></language>
<sy:updatePeriod><?php echo apply_filters('rss_update_period', 'hourly'); ?></sy:updatePeriod>
<sy:updateFrequency><?php echo apply_filters('rss_update_frequency', 1); ?></sy:updateFrequency>
Expand All @@ -39,7 +39,7 @@
<comments><?php $this->feed->comments_link_feed($event->ID); ?></comments>
<?php endif; ?>

<pubDate><?php echo wp_date('D, d M Y H:i:s O', strtotime($event->date['start']['date'].' '.$event->data->time['start']), $tz); ?></pubDate>
<pubDate><?php echo $this->main->mysql2date('D, d M Y H:i:s O', $event->date['start']['date'].' '.$event->data->time['start'], $tz); ?></pubDate>
<dc:creator><![CDATA[<?php $this->feed->author($event->data->post->post_author); ?>]]></dc:creator>

<guid isPermaLink="false"><?php the_guid($event->ID); ?></guid>
Expand All @@ -60,11 +60,18 @@
<?php endif; ?>

<mec:startDate><?php echo $date; ?></mec:startDate>
<?php if(isset($event->data) and isset($event->data->time) and isset($event->data->time['start'])): ?><mec:startHour><?php echo $event->data->time['start']; ?></mec:startHour><?php endif; ?>
<?php if(isset($event->data) and isset($event->data->time) and isset($event->data->time['start'])): ?>
<mec:startHour><?php echo $event->data->time['start']; ?></mec:startHour>
<?php endif; ?>

<mec:endDate><?php echo $this->main->get_end_date_by_occurrence($event->ID, $date); ?></mec:endDate>
<?php if(isset($event->data) and isset($event->data->time) and isset($event->data->time['end'])): ?><mec:endHour><?php echo $event->data->time['end']; ?></mec:endHour><?php endif; ?>
<?php if(isset($event->data) and isset($event->data->time) and isset($event->data->time['end'])): ?>
<mec:endHour><?php echo $event->data->time['end']; ?></mec:endHour>
<?php endif; ?>

<?php if(isset($event->data) and isset($event->data->meta) and isset($event->data->meta['mec_location_id']) and isset($event->data->locations[$event->data->meta['mec_location_id']])): ?><mec:location><?php echo $event->data->locations[$event->data->meta['mec_location_id']]['address']; ?></mec:location><?php endif; ?>
<?php if(isset($event->data) and isset($event->data->meta) and isset($event->data->meta['mec_location_id']) and isset($event->data->locations[$event->data->meta['mec_location_id']])): ?>
<mec:location><?php echo $event->data->locations[$event->data->meta['mec_location_id']]['address']; ?></mec:location>
<?php endif; ?>

<?php if(isset($event->data->meta) and isset($event->data->meta['mec_cost']) and trim($event->data->meta['mec_cost'])): ?>
<mec:cost><?php echo (is_numeric($event->data->meta['mec_cost']) ? $this->main->render_price($event->data->meta['mec_cost'], $event->ID) : $event->data->meta['mec_cost']); ?></mec:cost>
Expand Down
19 changes: 16 additions & 3 deletions app/features/fes.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@ public function mec_fes_csv_export()
}
}

$book = $this->getBook();
$ticket_variations = $this->main->ticket_variations($post_id);
$transaction = $book->get_transaction($transaction_id);

$counter = 0;
foreach($attendees as $key => $attendee)
Expand All @@ -314,7 +312,22 @@ public function mec_fes_csv_export()
}

$ticket_id = isset($attendee['id']) ? $attendee['id'] : get_post_meta($post_id, 'mec_ticket_id', true);
$booking = array($post_id, get_the_title($event_id), get_the_date('', $post_id), $order_time, (isset($tickets[$ticket_id]['name']) ? $tickets[$ticket_id]['name'] : __('Unknown', 'modern-events-calendar-lite')), $transaction_id, $this->main->render_price(($price ? $price : 0), $post_id), $gateway_label, (isset($attendee['name']) ? $attendee['name'] : (isset($booker->first_name) ? trim($booker->first_name.' '.$booker->last_name) : '')), (isset($attendee['email']) ? $attendee['email'] : @$booker->user_email), trim($ticket_variations_output, ', '), $confirmed, $verified);
$booking = array(
$post_id,
html_entity_decode(get_the_title($event_id), ENT_QUOTES | ENT_HTML5),
get_the_date('', $post_id),
$order_time,
(isset($tickets[$ticket_id]['name']) ? $tickets[$ticket_id]['name'] : __('Unknown', 'modern-events-calendar-lite')),
$transaction_id,
$this->main->render_price(($price ? $price : 0), $post_id),
html_entity_decode($gateway_label, ENT_QUOTES | ENT_HTML5),
(isset($attendee['name']) ? $attendee['name'] : (isset($booker->first_name) ? trim($booker->first_name.' '.$booker->last_name) : '')),
(isset($attendee['email']) ? $attendee['email'] : @$booker->user_email),
html_entity_decode(trim($ticket_variations_output, ', '), ENT_QUOTES | ENT_HTML5),
$confirmed,
$verified
);

$booking = apply_filters('mec_csv_export_booking', $booking, $post_id, $event_id);

$reg_form = isset($attendee['reg']) ? $attendee['reg'] : array();
Expand Down
58 changes: 55 additions & 3 deletions app/features/ix.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public function init()

// Export All Events
if($mec_ix_action == 'export-events') $this->factory->action('init', array($this, 'export_all_events_do'), 9999);
elseif($mec_ix_action == 'export-bookings') $this->factory->action('init', array($this, 'export_all_bookings_do'), 9999);
elseif($mec_ix_action == 'google-calendar-export-get-token') $this->factory->action('init', array($this, 'g_calendar_export_get_token'), 9999);

// AJAX Actions
$this->factory->action('wp_ajax_mec_ix_add_to_g_calendar', array($this, 'g_calendar_export_do'));
$this->factory->action('wp_ajax_mec_ix_g_calendar_authenticate', array($this, 'g_calendar_export_authenticate'));
Expand Down Expand Up @@ -3532,8 +3533,19 @@ public function g_calendar_import_do()

$repeat_type = 'certain_weekdays';
}

$finish = isset($rule['until']) ? date('Y-m-d', strtotime($rule['until'])) : NULL;

// It's all day event so we should reduce one day from the end date! Google provides 2020-12-12 while the event ends at 2020-12-11
if($allday)
{
$diff = $this->main->date_diff($start_date, $end_date);
if(($diff ? $diff->days : 0) >= 1)
{
$date_end->sub(new DateInterval('P1D'));
$end_date = $date_end->format('Y-m-d');
}
}
}
// Single Event
else
Expand Down Expand Up @@ -4104,7 +4116,7 @@ public function export_all_events_do()

$event = array(
$event_id,
html_entity_decode($data->title),
html_entity_decode($data->title, ENT_QUOTES | ENT_HTML5),
$date['start']['date'],
$data->time['start'],
$date['end']['date'],
Expand Down Expand Up @@ -4196,6 +4208,46 @@ public function export_all_events_do()
break;
}
}

public function export_all_bookings_do()
{
// Current User Doesn't Have Access
if(!current_user_can('mec_import_export')) return false;

$format = isset($_GET['format']) ? sanitize_text_field($_GET['format']) : 'csv';
switch($format)
{
case 'ms-excel':

header('Content-Type: application/vnd.ms-excel; charset=utf-8');
header('Content-Disposition: attachment; filename=bookings-'.md5(time().mt_rand(100, 999)).'.xls');

$this->bookings_csvexcel();

exit;
break;
case 'csv':

header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=bookings-'.md5(time().mt_rand(100, 999)).'.csv');

$this->bookings_csvexcel();

exit;
break;
}
}

public function bookings_csvexcel()
{
$bookings = get_posts(array('post_type'=>$this->main->get_book_post_type(), 'numberposts'=>-1, 'post_status'=>'publish'));

$booking_ids = array();
foreach($bookings as $booking) $booking_ids[] = $booking->ID;

$book = new MEC_feature_books();
$book->csvexcel($booking_ids);
}

public function g_calendar_export_authenticate()
{
Expand Down
9 changes: 9 additions & 0 deletions app/features/ix/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
<h3><?php _e('Export certain events', 'modern-events-calendar-lite'); ?></h3>
<p class="description"><?php echo sprintf(__("For exporting filtered events, you can use bulk actions in %s page.", 'modern-events-calendar-lite'), '<a href="'.$this->main->URL('backend').'edit.php?post_type=mec-events">'.__('Events', 'modern-events-calendar-lite').'</a>'); ?></p>
</div>
<hr>
<div class="mec-export-all-bookings">
<h3><?php _e('Export all bookings to file', 'modern-events-calendar-lite'); ?></h3>
<p class="description"><?php _e("This will export all of your website bookings' data into your desired format.", 'modern-events-calendar-lite'); ?></p>
<ul>
<li><a href="<?php echo $this->main->add_qs_vars(array('mec-ix-action'=>'export-bookings', 'format'=>'csv')); ?>"><?php _e('CSV', 'modern-events-calendar-lite'); ?></a></li>
<li><a href="<?php echo $this->main->add_qs_vars(array('mec-ix-action'=>'export-bookings', 'format'=>'ms-excel')); ?>"><?php _e('MS Excel', 'modern-events-calendar-lite'); ?></a></li>
</ul>
</div>
<div class="mec-export-certain-bookings">
<h3><?php _e('Export certain bookings', 'modern-events-calendar-lite'); ?></h3>
<p class="description"><?php echo sprintf(__("For exporting bookings, you can use bulk actions in %s page.", 'modern-events-calendar-lite'), '<a href="'.$this->main->URL('backend').'edit.php?post_type=mec-books">'.__('Bookings', 'modern-events-calendar-lite').'</a>'); ?></p>
Expand Down
3 changes: 3 additions & 0 deletions app/features/labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ public function add_form()
*/
public function save_metadata($term_id)
{
// Quick Edit
if(!isset($_POST['color'])) return;

$color = isset($_POST['color']) ? sanitize_text_field($_POST['color']) : $this->main->get_default_label_color();
update_term_meta($term_id, 'color', $color);

Expand Down
3 changes: 3 additions & 0 deletions app/features/locations.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ public function add_form()
*/
public function save_metadata($term_id)
{
// Quick Edit
if(!isset($_POST['address'])) return;

$address = isset($_POST['address']) ? sanitize_text_field($_POST['address']) : '';
$latitude = isset($_POST['latitude']) ? floatval(sanitize_text_field($_POST['latitude'])) : '0';
$longitude = isset($_POST['longitude']) ? floatval(sanitize_text_field($_POST['longitude'])) : '0';
Expand Down
24 changes: 19 additions & 5 deletions app/features/mec.php
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ public function page()
elseif($tab == 'MEC-single') $this->single();
elseif($tab == 'MEC-booking') $this->booking();
elseif($tab == 'MEC-modules') $this->modules();
elseif($tab == 'MEC-integrations') $this->integrations();
elseif (apply_filters('mec_is_custom_settings',false,$tab)){
do_action('mec_display_settings_page',$tab);
}
Expand Down Expand Up @@ -983,6 +984,20 @@ public function messages()
echo $output = ob_get_clean();
}

/**
* Show content of integrations tab
* @author Webnus <[email protected]>
* @return void
*/
public function integrations()
{
$path = MEC::import('app.features.mec.integrations', true, true);

ob_start();
include $path;
echo $output = ob_get_clean();
}

/**
* Whether to include google recaptcha library
* @author Webnus <[email protected]>
Expand Down Expand Up @@ -1326,17 +1341,16 @@ public function widget_news()
}

public function dashboard_widget_total_booking_ajax_handler()
{

{
$start = isset($_REQUEST['start']) ? sanitize_text_field($_REQUEST['start']) : date('Y-m-d', strtotime('-15 days'));
$end = isset($_REQUEST['end']) ? sanitize_text_field($_REQUEST['end']) : date('Y-m-d');
$type = isset($_REQUEST['type']) ? sanitize_text_field($_REQUEST['type']) : 'daily';
$chart = isset($_REQUEST['chart']) ? sanitize_text_field($_REQUEST['chart']) : 'bar';

$chart = isset($_REQUEST['chart']) ? sanitize_text_field($_REQUEST['chart']) : 'bar';

ob_start();
$this->display_total_booking_chart($start,$end,$type,$chart);
$this->display_total_booking_chart($start, $end, $type, $chart);
$r = ob_get_clean();

wp_send_json($r);
}

Expand Down
Loading

0 comments on commit cb0dfdc

Please sign in to comment.