Skip to content

Commit

Permalink
v5.18.5
Browse files Browse the repository at this point in the history
v5.18.5
  • Loading branch information
webnuswp committed Apr 21, 2021
1 parent 8de0281 commit f4f8f0d
Show file tree
Hide file tree
Showing 75 changed files with 31,732 additions and 28,672 deletions.
210 changes: 134 additions & 76 deletions README.md

Large diffs are not rendered by default.

377 changes: 209 additions & 168 deletions app/features/events.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/features/feed/rss2.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<?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->data->meta['mec_cost']); ?></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>
<?php endif; ?>

<?php if(isset($event->data->categories) and is_array($event->data->categories) and count($event->data->categories)): ?>
Expand Down
4 changes: 3 additions & 1 deletion app/features/fes.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ 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)), $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, 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 = apply_filters('mec_csv_export_booking', $booking, $post_id, $event_id);

$reg_form = isset($attendee['reg']) ? $attendee['reg'] : array();
Expand Down Expand Up @@ -510,13 +510,15 @@ public function fes_form()
$more_info_title = isset($mec['more_info_title']) ? sanitize_text_field($mec['more_info_title']) : '';
$more_info_target = isset($mec['more_info_target']) ? sanitize_text_field($mec['more_info_target']) : '';
$cost = isset($mec['cost']) ? sanitize_text_field($mec['cost']) : '';
$currency_options = ((isset($mec['currency']) and is_array($mec['currency'])) ? $mec['currency'] : array());
$note = isset($mec['note']) ? sanitize_text_field($mec['note']) : '';

update_post_meta($post_id, 'mec_read_more', $read_more);
update_post_meta($post_id, 'mec_more_info', $more_info);
update_post_meta($post_id, 'mec_more_info_title', $more_info_title);
update_post_meta($post_id, 'mec_more_info_target', $more_info_target);
update_post_meta($post_id, 'mec_cost', $cost);
update_post_meta($post_id, 'mec_currency', $currency_options);
update_post_meta($post_id, 'mec_note', $note);

// Guest Name and Email
Expand Down
67 changes: 67 additions & 0 deletions app/features/fes/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,14 @@ function mec_fes_upload_organizer_thumbnail()
<?php
$cost = get_post_meta($post_id, 'mec_cost', true);
$cost_type = ((isset($this->settings['single_cost_type']) and trim($this->settings['single_cost_type'])) ? $this->settings['single_cost_type'] : 'numeric');

$currency = get_post_meta($post_id, 'mec_currency', true);
if(!is_array($currency)) $currency = array();

$currency_per_event = ((isset($this->settings['currency_per_event']) and trim($this->settings['currency_per_event'])) ? $this->settings['currency_per_event'] : 0);

$currencies = $this->main->get_currencies();
$current_currency = (isset($currency['currency']) ? $currency['currency'] : $this->settings['currency']);
?>
<div class="mec-meta-box-fields" id="mec-event-cost">
<h4><?php echo $this->main->m('event_cost', __('Event Cost', 'modern-events-calendar-lite')); ?> <?php echo ((isset($this->settings['fes_required_cost']) and $this->settings['fes_required_cost']) ? '<span class="mec-required">*</span>' : ''); ?></h4>
Expand All @@ -856,6 +864,65 @@ function mec_fes_upload_organizer_thumbnail()
<input type="<?php echo ($cost_type === 'alphabetic' ? 'text' : 'number'); ?>" class="mec-col-3" name="mec[cost]" id="mec_cost" value="<?php echo esc_attr($cost); ?>" placeholder="<?php _e('Cost', 'modern-events-calendar-lite'); ?>" <?php echo ((isset($this->settings['fes_required_cost']) and $this->settings['fes_required_cost']) ? 'required' : ''); ?> />
</div>
</div>

<?php if($currency_per_event): ?>
<h4><?php echo __('Currency Options', 'modern-events-calendar-lite'); ?></h4>
<div class="mec-form-row">
<label class="mec-col-2" for="mec_currency_currency"><?php _e('Currency', 'modern-events-calendar-lite'); ?></label>
<div class="mec-col-4">
<select name="mec[currency][currency]" id="mec_currency_currency">
<?php foreach($currencies as $c=>$currency_name): ?>
<option value="<?php echo $c; ?>" <?php echo (($current_currency == $c) ? 'selected="selected"' : ''); ?>><?php echo $currency_name; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="mec-form-row">
<label class="mec-col-2" for="mec_currency_currency_symptom"><?php _e('Currency Sign', 'modern-events-calendar-lite'); ?></label>
<div class="mec-col-4">
<input type="text" name="mec[currency][currency_symptom]" id="mec_currency_currency_symptom" value="<?php echo (isset($currency['currency_symptom']) ? $currency['currency_symptom'] : ''); ?>" />
<span class="mec-tooltip">
<div class="box left">
<h5 class="title"><?php _e('Currency Sign', 'modern-events-calendar-lite'); ?></h5>
<div class="content"><p><?php esc_attr_e("Default value will be \"currency\" if you leave it empty.", 'modern-events-calendar-lite'); ?><a href="https://webnus.net/dox/modern-events-calendar/currency-options/" target="_blank"><?php _e('Read More', 'modern-events-calendar-lite'); ?></a></p></div>
</div>
<i title="" class="dashicons-before dashicons-editor-help"></i>
</span>
</div>
</div>
<div class="mec-form-row">
<label class="mec-col-2" for="mec_currency_currency_sign"><?php _e('Currency Position', 'modern-events-calendar-lite'); ?></label>
<div class="mec-col-4">
<select name="mec[currency][currency_sign]" id="mec_currency_currency_sign">
<option value="before" <?php echo ((isset($currency['currency_sign']) and $currency['currency_sign'] == 'before') ? 'selected="selected"' : ''); ?>><?php _e('$10 (Before)', 'modern-events-calendar-lite'); ?></option>
<option value="before_space" <?php echo ((isset($currency['currency_sign']) and $currency['currency_sign'] == 'before_space') ? 'selected="selected"' : ''); ?>><?php _e('$ 10 (Before with Space)', 'modern-events-calendar-lite'); ?></option>
<option value="after" <?php echo ((isset($currency['currency_sign']) and $currency['currency_sign'] == 'after') ? 'selected="selected"' : ''); ?>><?php _e('10$ (After)', 'modern-events-calendar-lite'); ?></option>
<option value="after_space" <?php echo ((isset($currency['currency_sign']) and $currency['currency_sign'] == 'after_space') ? 'selected="selected"' : ''); ?>><?php _e('10 $ (After with Space)', 'modern-events-calendar-lite'); ?></option>
</select>
</div>
</div>
<div class="mec-form-row">
<label class="mec-col-2" for="mec_currency_thousand_separator"><?php _e('Thousand Separator', 'modern-events-calendar-lite'); ?></label>
<div class="mec-col-4">
<input type="text" name="mec[currency][thousand_separator]" id="mec_currency_thousand_separator" value="<?php echo (isset($currency['thousand_separator']) ? $currency['thousand_separator'] : ','); ?>" />
</div>
</div>
<div class="mec-form-row">
<label class="mec-col-2" for="mec_currency_decimal_separator"><?php _e('Decimal Separator', 'modern-events-calendar-lite'); ?></label>
<div class="mec-col-4">
<input type="text" name="mec[currency][decimal_separator]" id="mec_currency_decimal_separator" value="<?php echo (isset($currency['decimal_separator']) ? $currency['decimal_separator'] : '.'); ?>" />
</div>
</div>
<div class="mec-form-row">
<div class="mec-col-12">
<label for="mec_currency_decimal_separator_status">
<input type="hidden" name="mec[currency][decimal_separator_status]" value="1" />
<input type="checkbox" name="mec[currency][decimal_separator_status]" id="mec_currency_decimal_separator_status" <?php echo ((isset($currency['decimal_separator_status']) and $currency['decimal_separator_status'] == '0') ? 'checked="checked"' : ''); ?> value="0" />
<?php _e('No decimal', 'modern-events-calendar-lite'); ?>
</label>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>

Expand Down
45 changes: 33 additions & 12 deletions app/features/ix.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public function ix_sync()
'sync_g_import_auto'=>isset($this->ix['sync_g_import_auto']) ? $this->ix['sync_g_import_auto'] : 0,
'sync_g_export'=>isset($this->ix['sync_g_export']) ? $this->ix['sync_g_export'] : 0,
'sync_g_export_auto'=>isset($this->ix['sync_g_export_auto']) ? $this->ix['sync_g_export_auto'] : 0,
'sync_g_export_attendees'=>isset($this->ix['sync_g_export_attendees']) ? $this->ix['sync_g_export_attendees'] : 0,
'sync_f_import'=>isset($this->ix['sync_f_import']) ? $this->ix['sync_f_import'] : 0,
'sync_meetup_import'=>isset($this->ix['sync_meetup_import']) ? $this->ix['sync_meetup_import'] : 0,
'sync_meetup_import_auto'=>isset($this->ix['sync_meetup_import_auto']) ? $this->ix['sync_meetup_import_auto'] : 0,
Expand Down Expand Up @@ -3187,7 +3188,7 @@ public function ix_g_calendar_export()
{
// Current Action
$this->action = isset($_POST['mec-ix-action']) ? sanitize_text_field($_POST['mec-ix-action']) : (isset($_GET['mec-ix-action']) ? sanitize_text_field($_GET['mec-ix-action']) : '');

$path = MEC::import('app.features.ix.export_g_calendar', true, true);

ob_start();
Expand Down Expand Up @@ -4092,16 +4093,17 @@ public function export_all_events_do()

foreach($events as $event)
{
$data = $render->data($event->ID);
$event_id = $event->ID;
$data = $render->data($event_id);

$dates = $render->dates($event->ID, $data);
$dates = $render->dates($event_id, $data);
$date = $dates[0];

$location = isset($data->locations[$data->meta['mec_location_id']]) ? $data->locations[$data->meta['mec_location_id']] : array();
$organizer = isset($data->organizers[$data->meta['mec_organizer_id']]) ? $data->organizers[$data->meta['mec_organizer_id']] : array();

$event = array(
$event->ID,
$event_id,
html_entity_decode($data->title),
$date['start']['date'],
$data->time['start'],
Expand All @@ -4113,7 +4115,7 @@ public function export_all_events_do()
(isset($organizer['name']) ? html_entity_decode($organizer['name']) : ''),
(isset($organizer['tel']) ? $organizer['tel'] : ''),
(isset($organizer['email']) ? $organizer['email'] : ''),
(isset($data->meta['mec_cost']) ? (is_numeric($data->meta['mec_cost']) ? $this->main->render_price($data->meta['mec_cost']) : $data->meta['mec_cost']) : '')
(isset($data->meta['mec_cost']) ? (is_numeric($data->meta['mec_cost']) ? $this->main->render_price($data->meta['mec_cost'], $event_id) : $data->meta['mec_cost']) : '')
);

fputcsv($output, $event);
Expand All @@ -4125,7 +4127,7 @@ public function export_all_events_do()
case 'ms-excel':

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

$columns = array(__('ID', 'modern-events-calendar-lite'), __('Title', 'modern-events-calendar-lite'), __('Start Date', 'modern-events-calendar-lite'), __('Start Time', 'modern-events-calendar-lite'), __('End Date', 'modern-events-calendar-lite'), __('End Time', 'modern-events-calendar-lite'), __('Link', 'modern-events-calendar-lite'), $this->main->m('taxonomy_location', __('Location', 'modern-events-calendar-lite')), __('Address', 'modern-events-calendar-lite'), $this->main->m('taxonomy_organizer', __('Organizer', 'modern-events-calendar-lite')), __('Organizer Tel', 'modern-events-calendar-lite'), __('Organizer Email', 'modern-events-calendar-lite'), $this->main->m('event_cost', __('Event Cost', 'modern-events-calendar-lite')));

Expand All @@ -4135,16 +4137,17 @@ public function export_all_events_do()

foreach($events as $event)
{
$data = $render->data($event->ID);
$event_id = $event->ID;
$data = $render->data($event_id);

$dates = $render->dates($event->ID, $data);
$dates = $render->dates($event_id, $data);
$date = $dates[0];

$location = isset($data->locations[$data->meta['mec_location_id']]) ? $data->locations[$data->meta['mec_location_id']] : array();
$organizer = isset($data->organizers[$data->meta['mec_organizer_id']]) ? $data->organizers[$data->meta['mec_organizer_id']] : array();

$event = array(
$event->ID,
$event_id,
html_entity_decode($data->title),
$date['start']['date'],
$data->time['start'],
Expand All @@ -4156,7 +4159,7 @@ public function export_all_events_do()
(isset($organizer['name']) ? html_entity_decode($organizer['name']) : ''),
(isset($organizer['tel']) ? $organizer['tel'] : ''),
(isset($organizer['email']) ? $organizer['email'] : ''),
(isset($data->meta['mec_cost']) ? (is_numeric($data->meta['mec_cost']) ? $this->main->render_price($data->meta['mec_cost']) : $data->meta['mec_cost']) : '')
(isset($data->meta['mec_cost']) ? (is_numeric($data->meta['mec_cost']) ? $this->main->render_price($data->meta['mec_cost'], $event_id) : $data->meta['mec_cost']) : '')
);

fputcsv($output, $event, "\t");
Expand Down Expand Up @@ -4270,8 +4273,9 @@ public function g_calendar_export_get_token()

public function g_calendar_export_do()
{
$mec_event_ids = isset($_POST['mec-events']) ? $_POST['mec-events'] : array();

$mec_event_ids = (isset($_POST['mec-events']) ? $_POST['mec-events'] : array());
$export_attendees = (isset($_POST['export_attendees']) ? $_POST['export_attendees'] : 0);

$ix = $this->main->get_ix_options();

$client_id = isset($ix['google_export_client_id']) ? $ix['google_export_client_id'] : NULL;
Expand Down Expand Up @@ -4371,6 +4375,23 @@ public function g_calendar_export_do()

$event->setOrganizer($g_organizer);
}

// Set the attendees
if($export_attendees)
{
$attendees = array();
foreach($this->main->get_event_attendees($data->ID) as $att)
{
$attendee = new Google_Service_Calendar_EventAttendee();
$attendee->setDisplayName($att['name']);
$attendee->setEmail($att['email']);
$attendee->setResponseStatus('accepted');

$attendees[] = $attendee;
}

$event->setAttendees($attendees);
}

try
{
Expand Down
9 changes: 8 additions & 1 deletion app/features/ix/export_g_calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@
</li>
<?php endforeach; ?>
</ul>
<div class="mec-options-fields">
<div class="mec-options-fields" style="padding-top: 0;">
<h4><?php _e('Import Options', 'modern-events-calendar-lite'); ?></h4>
<div class="mec-form-row">
<label>
<input type="checkbox" name="export_attendees" value="1" />
<?php _e('Export Attendees', 'modern-events-calendar-lite'); ?>
</label>
</div>
<button id="mec_ix_google_export_do_form_button" class="button button-primary mec-button-primary" type="submit"><?php _e('Add to Google Calendar', 'modern-events-calendar-lite'); ?></button>
</div>
<p id="mec_ix_google_export_do_message" class="mec-col-6 mec-util-hidden"></p>
Expand Down
Loading

0 comments on commit f4f8f0d

Please sign in to comment.