function imic_event($atts, $content = null) { extract(shortcode_atts(array("number" => 10, "title" => "", "category" => "", "style" => "", "type" => ""), $atts)); $output = ''; $number = $number == '' ? 10 : $number; if ($type == 'future') { $future_events = imic_recur_events("future", "", $category, ""); $google_events = getGoogleEvent(); $events = $future_events + $google_events; ksort($events); } else { $events = imic_recur_events("past", "", $category, ""); krsort($events); } if ($style == "list") { $count = 1; $output .= '<div class="listing events-listing"> <header class="listing-header"> <div class="row"> <div class="col-md-12 col-sm-12"> <h3>' . esc_attr($title) . '</h3> </div> </div> </header>'; $output .= '<section class="listing-cont"> <ul>'; if (!empty($events)) { foreach ($events as $key => $value) { if (preg_match('/^[0-9]+$/', $value)) { $eventStartTime = strtotime(get_post_meta($value, 'imic_event_start_tm', true)); $eventStartDate = strtotime(get_post_meta($value, 'imic_event_start_dt', true)); $eventEndTime = strtotime(get_post_meta($value, 'imic_event_end_tm', true)); $eventEndDate = strtotime(get_post_meta($value, 'imic_event_end_dt', true)); $evstendtime = $eventStartTime . '|' . $eventEndTime; $evstenddate = $eventStartDate . '|' . $eventEndDate; $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); $event_dt_out = imic_get_event_timeformate($evstendtime, $evstenddate, $value, $key); $event_dt_out = explode('BR', $event_dt_out); if ($eventStartTime != '') { $eventStartTime = date(get_option('time_format'), $eventStartTime); } $custom_event_url = imic_query_arg($date_converted, $value); $event_title = get_the_title($value); $stime = ''; if ($eventStartTime != '') { $stime = ' | ' . $eventStartTime; } } else { $google_data = explode('!', $value); $event_title = $google_data[0]; $custom_event_url = $google_data[1]; $options = get_option('imic_options'); $eventTime = $key; if ($eventTime != '') { $eventTime = date_i18n(get_option('time_format'), $key); } $eventEndTime = $google_data[2]; if ($eventEndTime != '') { $eventEndTime = ' - ' . date_i18n(get_option('time_format'), strtotime($eventEndTime)); } $eventAddress = $google_data[3]; $event_dt_out = imic_get_event_timeformate($key . '|' . strtotime($google_data[2]), $key . '|' . $key, $value, $key); $event_dt_out = explode('BR', $event_dt_out); } $output .= '<li class="item event-item"> <div class="event-date"> <span class="date">' . date_i18n('d', $key) . '</span> <span class="month">' . imic_global_month_name($key) . '</span> </div> <div class="event-detail"> <h4> <a href="' . $custom_event_url . '"> ' . $event_title . ' </a>' . imicRecurrenceIcon($value) . ' </h4> <span class="event-dayntime meta-data"> ' . $event_dt_out[1] . ', ' . $event_dt_out[0] . '</span> </div> <div class="to-event-url"> <div> <a href="' . $custom_event_url . '" class="btn btn-default btn-sm">' . __('Details', 'framework') . '</a></div> </div> </li>'; if ($count++ >= $number) { break; } } } $output .= '</ul> </section></div>'; } else { $output .= '<header class="listing-header"> <div class="row"> <div class="col-md-12 col-sm-12"> <h3>' . esc_attr($title) . '</h3> </div> </div> </header>'; $output .= '<div class="container"><div class="row">'; $output .= '<ul class="grid-holder col-3 events-grid">'; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $count = 1; $grid_item = 1; $perPage = get_option('posts_per_page'); $paginate = 1; if ($paged > 1) { $paginate = ($paged - 1) * $perPage; $paginate = $paginate + 1; } $TotalEvents = count($events); if ($TotalEvents % $perPage == 0) { $TotalPages = $TotalEvents / $perPage; } else { $TotalPages = $TotalEvents / $perPage; $TotalPages = $TotalPages + 1; } foreach ($events as $key => $value) { if (preg_match('/^[0-9]+$/', $value)) { $google_flag = 1; } else { $google_flag = 2; } if ($google_flag == 1) { setup_postdata(get_post($value)); $eventStartTime = strtotime(get_post_meta($value, 'imic_event_start_tm', true)); $eventStartDate = strtotime(get_post_meta($value, 'imic_event_start_dt', true)); $eventEndTime = strtotime(get_post_meta($value, 'imic_event_end_tm', true)); $eventEndDate = strtotime(get_post_meta($value, 'imic_event_end_dt', true)); $event_dt_out = imic_get_event_timeformate($eventStartTime . '|' . $eventEndTime, $eventStartDate . '|' . $eventEndDate, $value, $key); $event_dt_out = explode('BR', $event_dt_out); $registration_status = get_post_meta($value, 'imic_event_registration_status', true); /** Event Details Manage **/ if ($registration_status == 1 && function_exists('imic_get_currency_symbol')) { $eventDetailIcons = array('fa-calendar', 'fa-clock-o', 'fa-map-marker', 'fa-money'); } else { $eventDetailIcons = array('fa-calendar', 'fa-clock-o', 'fa-map-marker'); } $stime = ""; $etime = ""; if ($eventStartTime != '') { $stime = ' | ' . date_i18n(get_option('time_format'), $eventStartTime); } if ($eventEndTime != '') { $etime = ' - ' . date_i18n(get_option('time_format'), $eventEndTime); } if ($registration_status == 1 && function_exists('imic_get_currency_symbol')) { $event_registration_fee = get_post_meta($value, 'imic_event_registration_fee', true); $registration_charge = $event_registration_fee == '' ? 'Free' : imic_get_currency_symbol(get_option('paypal_currency_options')) . get_post_meta($value, 'imic_event_registration_fee', true); $eventDetailsData = array($event_dt_out[1], $event_dt_out[0], get_post_meta($value, 'imic_event_address', true), $registration_charge); /* $eventDetailsData = array(date_i18n('j M, ',$key).date_i18n('l',$key). $stime . $etime, get_post_meta($value,'imic_event_address',true),$registration_charge); */ } else { /*$eventDetailsData = array(date_i18n('j M, ',$key).date_i18n('l',$key). $stime . $etime, get_post_meta($value,'imic_event_address',true));*/ $eventDetailsData = array($event_dt_out[1], $event_dt_out[0], get_post_meta($value, 'imic_event_address', true)); } $eventValues = array_filter($eventDetailsData, 'strlen'); } if ($count == $paginate && $grid_item <= $perPage) { $paginate++; $grid_item++; if ($google_flag == 1) { $frequency = get_post_meta($value, 'imic_event_frequency', true); } //if ('' != get_the_post_thumbnail($value)) { $output .= '<li class="grid-item format-standard">'; if ($google_flag == 1) { $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); } if ($google_flag == 2) { $google_data = explode('!', $value); $event_title = $google_data[0]; $custom_event_url = $google_data[1]; $stime = ""; $etime = ""; $etime = $google_data[2]; if ($key != '') { $stime = ' | ' . date_i18n(get_option('time_format'), $key); } if ($etime != '') { $etime = ' - ' . date_i18n(get_option('time_format'), strtotime($etime)); } $eventAddress = $google_data[3]; /* $eventDetailsData = array(date_i18n('j M, ',$key).date_i18n('l',$key). $stime . $etime,$eventAddress);*/ $event_dt_out = imic_get_event_timeformate($key . '|' . $google_data[2], $key . '|' . $key, $value, $key); $event_dt_out = explode('BR', $event_dt_out); $eventDetailsData = array($event_dt_out[1], $event_dt_out[0], $eventAddress); $eventValues = array_filter($eventDetailsData, 'strlen'); $eventDetailIcons = array('fa-calendar', 'fa-clock-o', 'fa-map-marker'); } $output .= '<div class="grid-item-inner">'; if ($google_flag == 1) { $output .= '<a href="' . $custom_event_url . '" class="media-box">'; $output .= get_the_post_thumbnail($value, 'full'); $output .= '</a>'; $event_title = get_the_title($value); } $output .= '<div class="grid-content">'; $output .= '<h3><a href="' . $custom_event_url . '">' . $event_title . '</a>' . imicRecurrenceIcon($value) . '</h3>'; if ($google_flag == 1) { $output .= '<div class="page-content">'; $output .= imic_excerpt(25); $output .= '</div>'; } $output .= '</div>'; if (!empty($eventValues)) { $output .= '<ul class="info-table">'; $flag = 0; foreach ($eventDetailsData as $edata) { if (!empty($edata)) { $output .= '<li><i class="fa ' . $eventDetailIcons[$flag] . '"></i> ' . $edata . ' </li>'; } $flag++; } $output .= '</ul>'; //} $output .= '</div> </li>'; } } $count++; } $output .= '</ul></div></div>'; } return $output; }
if (!empty($cat_id)) { $cat_id = $cat_id[0]->term_id; $cat_data = get_option("category_" . $cat_id); $event_color = $cat_data['catBG'] != '' ? $cat_data['catBG'] : $imic_options['event_default_color']; } $frequency_count = ''; $frequency_count = get_post_meta($value, 'imic_event_frequency_count', true); if ($frequency > 0) { $color = $event_color != '' ? $event_color : $imic_options['recurring_event_color']; $frequency_count = $frequency_count; } else { $frequency_count = 0; $color = $event_color; } $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); $start_unix_time = get_post_meta($value, 'imic_event_start_tm', true); $start_unix_time = strtotime($start_unix_time); $start_time = date('G:i', $start_unix_time); $event_time_end = date('G:i', $key); $start_date_cal = date('Y-m-d', $key); $start_unix_cal = strtotime($start_date_cal . ' ' . $start_time); $event_start_date_only = get_post_meta($value, 'imic_event_start_dt', true); $event_start_date_only_str = strtotime($event_start_date_only); $event_start_date_only = date('Y-m-d', $event_start_date_only_str); $event_end_date_only = get_post_meta($value, 'imic_event_end_dt', true); $event_end_date_only_str = strtotime($event_end_date_only); $event_end_date_only = date('Y-m-d', $event_end_date_only_str); $diff_date = imic_dateDiff($event_start_date_only, $event_end_date_only); if ($diff_date > 1) { $end_time = date('G:i', $key);
_e('Save to Yahoo! Calendar', 'framework'); ?> </a></li> </ul> </div> </div> </article> <?php } $date = get_query_var('event_date'); if (empty($date)) { $date = get_post_meta(get_the_ID(), 'imic_event_start_dt', true); } $date = strtotime($date); $date_converted = date('Y-m-d', $date); $custom_event_url = imic_query_arg($date_converted, get_the_ID()); ?> </div> <div class="modal fade" id="PaymentModal" tabindex="-1" data-backdrop="static" role="dialog" aria-labelledby="PaymentModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel"><?php _e('Register for Event: ', 'framework'); ?> <span class="accent-color payment-to-cause"><?php the_title(); ?> </span></h4> </div>
function imic_get_data_by_path($id, $imic_custom_read_more) { $slug_data = get_post($id); $post_type = get_post_type($id); $slug_thumbnail_id = get_post_meta($id, '_thumbnail_id', 'true'); $src = wp_get_attachment_image_src($slug_thumbnail_id, 'full'); $read_More_text = !empty($imic_custom_read_more) ? $imic_custom_read_more : $slug_data->post_title; if (!empty($slug_thumbnail_id)) { echo '<div class="col-md-4 col-sm-4 featured-block">'; if ($post_type == 'event') { $customeventSt = strtotime(get_post_meta($id, 'imic_event_start_dt', true)); $date_converted = date('Y-m-d', $customeventSt); $custom_event_url = imic_query_arg($date_converted, $slug_data->ID); } else { $custom_event_url = get_permalink($slug_data->ID); } echo '<a href="' . $custom_event_url . '" class="img-thumbnail"> <img src="' . $src[0] . '" alt="' . $slug_data->post_title . '"> <strong>' . $read_More_text . '</strong> <span class="more">' . __('read more', 'framework') . '</span> </a> </div>'; } }
function imic_event_grid() { $EventTerm = ''; $offset = get_option('timezone_string'); if ($offset == '') { $offset = "Australia/Melbourne"; } date_default_timezone_set($offset); echo '<div class="listing events-listing"> <header class="listing-header"> <div class="row"> <div class="col-md-6 col-sm-6"> <h3>' . __('All events', 'framework') . '</h3> </div> <div class="listing-header-sub col-md-6 col-sm-6">'; $currentEventTime = $_POST['date']; $EventTerm = $_POST['term']; $prev_month = date('Y-m', strtotime('-1 month', strtotime($currentEventTime))); $next_month = date('Y-m', strtotime('+1 month', strtotime($currentEventTime))); echo '<h5>' . date_i18n('F', strtotime($currentEventTime)) . '</h5> <nav class="next-prev-nav"> <a href="javascript:" class="upcomingEvents" rel="' . $EventTerm . '" id="' . $prev_month . '"><i class="fa fa-angle-left"></i></a> <a href="javascript:" class="upcomingEvents" rel="' . $EventTerm . '" id="' . $next_month . '"><i class="fa fa-angle-right"></i></a> </nav> </div> </div> </header> <section class="listing-cont"> <ul>'; $today = date('Y-m'); $curr_month = date('Y-m-t', strtotime('-1 month', strtotime($currentEventTime))); $currentTime = date(get_option('time_format')); $sp = imic_recur_events('future', 'nos', $EventTerm, $currentEventTime); $this_month_last = strtotime(date('Y-m-t 23:59', strtotime($currentEventTime))); $google_events = getGoogleEvent($this_month_last); if (!empty($google_events)) { $new_events = $google_events + $sp; } else { $new_events = $sp; } ksort($new_events); if (!empty($new_events)) { foreach ($new_events as $key => $value) { if (preg_match('/^[0-9]+$/', $value)) { $frequency = get_post_meta($value, 'imic_event_frequency', true); $frequency_count = get_post_meta($value, 'imic_event_frequency_count', true); $satime = get_post_meta($value, 'imic_event_start_tm', true); $satime = strtotime($satime); $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); $event_title = get_the_title($value); /* event time date formate */ $eventStartTime = strtotime(get_post_meta($value, 'imic_event_start_tm', true)); $eventStartDate = strtotime(get_post_meta($value, 'imic_event_start_dt', true)); $eventEndTime = strtotime(get_post_meta($value, 'imic_event_end_tm', true)); $eventEndDate = strtotime(get_post_meta($value, 'imic_event_end_dt', true)); $evstendtime = $eventStartTime . '|' . $eventEndTime; $evstenddate = $eventStartDate . '|' . $eventEndDate; $event_dt_out = imic_get_event_timeformate($evstendtime, $evstenddate, $value, $key); $event_dt_out = explode('BR', $event_dt_out); /* event time date formate end */ } else { $google_data = explode('!', $value); $event_title = $google_data[0]; $custom_event_url = $google_data[1]; $options = get_option('imic_options'); $satime = $key; /* event time date formate */ $event_dt_out = imic_get_event_timeformate($key . '|' . strtotime($google_data[2]), $key . '|' . $key, $value, $key); $event_dt_out = explode('BR', $event_dt_out); /* event time date formate end */ } echo '<li class="item event-item"> <div class="event-date"> <span class="date">' . date_i18n('d', $key) . '</span> <span class="month">' . imic_global_month_name($key) . '</span> </div> <div class="event-detail"> <h4><a href="' . $custom_event_url . '">' . $event_title . '</a>' . imicRecurrenceIcon($value) . '</h4>'; echo '<span class="event-dayntime meta-data">' . $event_dt_out[1] . ', ' . $event_dt_out[0] . '</span> </div> <div class="to-event-url"> <div><a href="' . $custom_event_url . '" class="btn btn-default btn-sm">' . __('Details', 'framework') . '</a></div> </div> </li>'; } } else { echo '<li class="item event-item"> <div class="event-detail"> <h4>' . __('Sorry, there are no events for this month.', 'framework') . '</h4> </div> </li>'; } echo '</ul> </section> </div>'; die; }
foreach ($specific_event_data as $key => $value) { $eventTime = get_post_meta($value, 'imic_event_start_tm', true); $event_End_time = get_post_meta($value, 'imic_event_end_tm', true); $event_End_time = strtotime($event_End_time); $eventTime = strtotime($eventTime); $count_from = isset($imic_options['countdown_timer']) ? $imic_options['countdown_timer'] : ''; if ($count_from == 1) { $counter_time = date('G:i', $event_End_time); } else { $counter_time = date('G:i', $eventTime); } $firstEventDateData = date('Y-m-d', $key) . ' ' . $counter_time; $firstEventTitle = get_the_title($value); $firstEventDate = date_i18n(get_option('date_format'), $key); $date_converted = date('Y-m-d', $key); $firstEventURL = imic_query_arg($date_converted, $value); break; } } ?> <h5><a href="<?php echo $firstEventURL; ?> "><?php echo $firstEventTitle; ?> </a></h5> <span class="meta-data"><?php echo $firstEventDate; ?> </span> </div>
function event_calendar($atts) { extract(shortcode_atts(array("category_id" => '', "filter" => '', "preview" => ''), $atts)); wp_enqueue_style('imic_fullcalendar_css'); wp_enqueue_style('imic_fullcalendar_print'); global $imic_options; $facebook = $imic_options['share_icon'][1]; $twitter = $imic_options['share_icon'][2]; $google = $imic_options['share_icon'][3]; $tumblr = $imic_options['share_icon'][4]; $pinterest = $imic_options['share_icon'][5]; $reddit = $imic_options['share_icon'][6]; $linkedin = $imic_options['share_icon'][7]; $email_share = $imic_options['share_icon'][8]; $event_preview = $preview; $term_output = ''; if ($filter == 1) { $e_terms = get_terms('event-category'); $term_output .= '<div class="events-listing-header"><ul class="sort-calendar sort-source"><li class="e1Div active" id=""><a href="javascript:void(0)">' . __('All', 'framework') . '</a></li>'; if ($imic_options['google_feed_id'] != '') { $term_output .= '<li class="e1Div" id="google"><a href="javascript:void(0)">' . __('Google', 'framework') . '</a></li>'; } foreach ($e_terms as $term) { $term_output .= '<li class="e1Div" id="' . $term->term_id . '"><a href="javascript:void(0)">' . $term->name . '</a></li>'; } $term_output .= '</ul></div>'; } //$google_feeds = $imic_options['google_feed']; $google_api_key = $imic_options['google_feed_key']; $google_calendar_id = $imic_options['google_feed_id']; $monthNamesValue = $imic_options['calendar_month_name']; $monthNames = empty($monthNamesValue) ? array() : explode(',', trim($monthNamesValue)); $monthNamesShortValue = $imic_options['calendar_month_name_short']; $monthNamesShort = empty($monthNamesShortValue) ? array() : explode(',', trim($monthNamesShortValue)); $dayNamesValue = $imic_options['calendar_day_name']; $dayNames = empty($dayNamesValue) ? array() : explode(',', trim($dayNamesValue)); $dayNamesShortValue = $imic_options['calendar_day_name_short']; $dayNamesShort = empty($dayNamesShortValue) ? array() : explode(',', trim($dayNamesShortValue)); wp_enqueue_script('imic_fullcalendar'); wp_enqueue_script('imic_gcal'); wp_enqueue_script('imic_calender_events'); wp_enqueue_script('imic_jquery_countdown'); wp_localize_script('imic_jquery_countdown', 'upcoming_data', array('c_time' => time())); wp_enqueue_script('imic_counter_init'); $format = ImicConvertDate(get_option('time_format')); wp_localize_script('imic_calender_events', 'calenderEvents', array('homeurl' => get_template_directory_uri(), 'monthNames' => $monthNames, 'monthNamesShort' => $monthNamesShort, 'dayNames' => $dayNames, 'dayNamesShort' => $dayNamesShort, 'time_format' => $format, 'start_of_week' => get_option('start_of_week'), 'googlekey' => $google_api_key, 'googlecalid' => $google_calendar_id, 'ajaxurl' => admin_url('admin-ajax.php'), 'preview' => $event_preview, 'facebook' => $facebook, 'twitter' => $twitter, 'google' => $google, 'tumblr' => $tumblr, 'pinterest' => $pinterest, 'reddit' => $reddit, 'linkedin' => $linkedin, 'email' => $email_share)); if ($event_preview == 1) { $output = ''; $events = imic_recur_events('future', '', ''); ksort($events); foreach ($events as $key => $value) { $id = $value; break; } $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $id); $output .= '<ul class=" sort-destination events-ajax-caller">'; $output .= '<li class="event-item event-dynamic">'; $output .= '<div class="grid-item-inner">'; $output .= '<div class="preview-event-bar"> <div id="counter" class="counter-preview top-header" data-date="' . $key . '"> <div class="timer-col"> <span id="days"></span> <span class="timer-type">' . __('d', 'framework') . '</span> </div> <div class="timer-col"> <span id="hours"></span> <span class="timer-type">' . __('h', 'framework') . '</span> </div> <div class="timer-col"> <span id="minutes"></span> <span class="timer-type">' . __('m', 'framework') . '</span> </div> <div class="timer-col"> <span id="seconds"></span> <span class="timer-type">' . __('s', 'framework') . '</span> </div> </div> </div>'; $event_address = get_post_meta($id, 'imic_event_address2', true); if ('' != get_the_post_thumbnail($id)) { $output .= '<a href="' . esc_url($custom_event_url) . '" class="media-box">' . get_the_post_thumbnail($id, 'full') . '</a>'; } $output .= '<div id="load-preview-events" class="load-events" style="display:none;"><img src="' . IMIC_THEME_PATH . '/images/loader.gif"></div>'; $output .= '<div class="grid-content">'; $output .= '<h3><a class="event-title" href="' . esc_url($custom_event_url) . '">' . get_the_title($id) . '</a></h3>'; $address1 = get_post_meta($id, 'imic_event_address1', true); $address2 = get_post_meta($id, 'imic_event_address2', true); $output .= '<span class="meta-data"><i class="fa fa-calendar"></i> <span class="event-date">' . esc_attr(date_i18n(get_option('date_format'), $key)) . '</span>' . __(' at ', 'framework') . '<span class="event-time">' . esc_attr(date_i18n(get_option('time_format'), $key)) . '</span></span> <span class="meta-data event-location-address"><i class="fa fa-map-marker"></i> ' . esc_attr($event_address) . '</span>'; $output .= '</div>'; $output .= '<div class="grid-footer clearfix">'; $event_registration = get_post_meta($value, 'imic_event_registration', true); if ($event_registration == 1) { $output .= '<a id="register-' . ($value + 2648) . '|' . $key . '" href="#" class="pull-right btn btn-sm btn-primary btn-sm event-tickets event-register-button">' . __('Register', 'framework') . '</a>'; } $output .= '<ul class="action-buttons">'; if ($imic_options['switch_sharing'] == 1 && $imic_options['share_post_types']['3'] == '1') { $output .= '<li title="Share event"><a href="#" data-trigger="focus" data-placement="right" data-content="" data-toggle="popover" data-original-title="Share Event" class="event-share-link"><i class="icon-share"></i></a></li>'; } $event_map = get_post_meta($value, 'imic_event_address2', true); if ($event_map != '') { $output .= '<li title="Get directions" class="hidden-xs"><a href="#" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li>'; } $event_contact_info = get_post_meta($value, 'imic_event_manager', true); if ($event_contact_info != '') { $output .= '<li title="Contact event manager"><a id="contact-' . ($value + 2648) . '|' . $key . '" href="#" data-toggle="modal" data-target="#Econtact" class="event-contact-link"><i class="icon-mail"></i></a></li>'; } $output .= '</ul></div>'; $output .= '</div></div></li></ul>'; return '<div class="row"><div class="col-md-9">' . $term_output . '<div id="calendar"><div id ="' . $category_id . '" class ="event_calendar calendar"></div></div></div><div class="col-md-3"><h2 class="title ">' . __('Event Preview', 'framework') . '</h2><div id="events-preview-box">' . $output . '</div></div>'; } else { return $term_output . '<div id="calendar"><div id ="' . $category_id . '" class ="event_calendar calendar"></div></div>'; } }
function widget($args, $instance) { $cache = array(); if (!$this->is_preview()) { $cache = wp_cache_get('upcoming_events', 'widget'); } if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); // these are the widget options $post_title = apply_filters('widget_title', $instance['title']); $post_title = $post_title == '' ? __('Upcoming Events', 'imic-framework-admin') : $post_title; $number = apply_filters('widget_number', $instance['number']); $category = apply_filters('widget-category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base); $numberEvent = !empty($number) ? $number : 4; $EventHeading = $post_title; $status = apply_filters('widget_status', $instance['status']); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title']; echo apply_filters('widget_title', $EventHeading, $instance, $this->id_base); echo $args['after_title']; } wp_reset_postdata(); global $imic_options; $event_view = $imic_options['event_time_view']; $event_counter_view = $imic_options['event_countdown_position']; $events = imic_recur_events($status, 'nos', $category); if ($status == 'future') { ksort($events); } else { krsort($events); } if (!empty($events)) { $total = 1; echo '<div class="events-listing-content smaller-cont">'; foreach ($events as $key => $value) { $style = ''; $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); $start_time = '23:59'; $start_time_meta = get_post_meta($value, 'imic_event_start_dt', true); if ($start_time_meta != '') { $start_time_meta = strtotime($start_time_meta); $start_time = date('G:i', $start_time_meta); } $st_time = ''; $st_time = date('Y-m-d', $key); $st_time = strtotime($st_time . ' ' . $start_time); if ($event_counter_view == 0) { $end_date_event = $key; } else { $end_time_meta = get_post_meta($value, 'imic_event_end_dt', true); $end_date_event = ''; if ($end_time_meta != '') { $end_time_meta = strtotime($end_time_meta); $end_time = date('G:i', $end_time_meta); } $en_time = ''; $en_time = date('Y-m-d', $key); $end_date_event = strtotime($en_time . ' ' . $end_time); } echo '<div class="event-list-item"> <div class="event-list-item-date"> <span class="event-date"> <span class="event-day">' . date_i18n('d', $key) . '</span> <span class="event-month">' . date_i18n('M, ', $key) . date_i18n('y', $key) . '</span> </span> </div> <div class="event-list-item-info"> <div class="lined-info event-title"> <h4><a href="' . $custom_event_url . '">' . get_the_title($value) . '</a></h4> </div>'; if ($event_view == 0) { echo '<span class="meta-data"><i class="fa fa-clock-o"></i> ' . date_i18n('l, ', $key); echo date_i18n(get_option('time_format'), $st_time); if ($end_date_event != '') { echo ' - ' . date_i18n(get_option('time_format'), $end_date_event); } echo '</span> '; } else { echo '<span class="meta-data"><i class="fa fa-clock-o"></i> ' . date_i18n('l, ', $key); echo date_i18n(get_option('time_format'), $st_time); echo '</span> '; } if ($key < date('U')) { echo '<span class="label label-default">' . __('Passed', 'framework') . '</span>'; } elseif (date('U') > $st_time && date('U') < $key) { echo '<span class="label label-success">' . __('Going On', 'framework') . '</span>'; } else { echo '<span class="label label-primary">' . __('Upcoming', 'framework') . '</span>'; } echo '</span>'; $address = get_post_meta($value, 'imic_event_address2', true); if ($address != '') { echo '<span class="meta-data"><i class="fa fa-map-marker"></i> ' . $address . '</span>'; } echo '</div> </div>'; if (++$total > $numberEvent) { break; } } } else { echo '<div class="event-list-item"> <div class="event-list-item-info"> <div class="lined-info event-title"><h4>' . __('No Upcoming Events Found', 'imic-framework-admin') . '</div></div></div>'; } echo '</div>'; echo $args['after_widget']; if (!$this->is_preview()) { $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('upcoming_events', $cache, 'widget'); } else { ob_end_flush(); } }
function imic_get_event_details() { global $imic_options; $offset = get_option('timezone_string'); if ($offset == '') { $offset = "Australia/Melbourne"; } date_default_timezone_set($offset); $id = $_POST['id']; $data = explode("|", $id); $id = $data[0]; $key = $data[1]; $output = ''; $custom_event_url = ''; //$key = ''; $date_converted = date('Y-m-d', $key); $start_time = '23:59'; $start_time_meta = get_post_meta($id, 'imic_event_start_dt', true); if ($start_time_meta != '') { $start_time_meta = strtotime($start_time_meta); $start_time = date('G:i', $start_time_meta); } $st_time = ''; $st_time = date('Y-m-d', $key); $st_time = strtotime($st_time . ' ' . $start_time); $custom_event_url = imic_query_arg($date_converted, $id); $output .= '<ul class=" sort-destination events-ajax-caller">'; $output .= '<li class="event-item event-dynamic">'; $output .= '<div class="grid-item-inner">'; $output .= '<div class="preview-event-bar"> <div id="counter" class="counter-preview top-header" data-date="' . $key . '"> <div class="timer-col"> <span id="days"></span> <span class="timer-type">' . __('d', 'framework') . '</span> </div> <div class="timer-col"> <span id="hours"></span> <span class="timer-type">' . __('h', 'framework') . '</span> </div> <div class="timer-col"> <span id="minutes"></span> <span class="timer-type">' . __('m', 'framework') . '</span> </div> <div class="timer-col"> <span id="seconds"></span> <span class="timer-type">' . __('s', 'framework') . '</span> </div> </div> </div>'; $event_address = get_post_meta($id, 'imic_event_address2', true); if ('' != get_the_post_thumbnail($id)) { $output .= '<a href="' . esc_url($custom_event_url) . '" class="media-box">' . get_the_post_thumbnail($id, 'full') . '</a>'; } $output .= '<div id="load-preview-events" class="load-events" style="display:none;"><img src="' . IMIC_THEME_PATH . '/images/loader.gif"></div>'; $output .= '<div class="grid-content">'; $output .= '<h3><a class="event-title" href="' . esc_url($custom_event_url) . '">' . get_the_title($id) . '</a></h3>'; $address1 = get_post_meta($id, 'imic_event_address1', true); $address2 = get_post_meta($id, 'imic_event_address2', true); $output .= '<span class="meta-data"><i class="fa fa-calendar"></i> <span class="event-date">' . esc_attr(date_i18n(get_option('date_format'), $key)) . '</span>' . __(' at ', 'framework') . '<span class="event-time">' . date_i18n(get_option('time_format'), $st_time) . '</span></span>'; if ($event_address != '') { $output .= '<span class="meta-data event-location-address"><i class="fa fa-map-marker"></i> ' . $event_address . '</span>'; } $output .= '</div>'; $output .= '<div class="grid-footer clearfix">'; if ($key > date('U')) { $event_registration = get_post_meta($value, 'imic_event_registration', true); $event_custom_url = get_post_meta($value, 'imic_custom_event_registration', true); $event_custom_url_target = get_post_meta($value, 'imic_custom_event_registration_target', true); $event_registration = get_post_meta($value, 'imic_event_registration', true); if (!empty($event_custom_url)) { $target = $event_custom_url_target == 1 ? '_blank' : ''; echo '<a href="' . $event_custom_url . '" class="btn btn-default btn-transparent" target="' . $target . '">' . __('Register', 'framework') . ' <i class="fa fa-sign-out"></i></a>'; } elseif ($event_registration == 1) { echo '<a id="register-' . ($value + 2648) . '|' . $key . '" href="#" class="btn btn-default btn-transparent event-tickets event-register-button">' . __('Register', 'framework') . '</a>'; } } $output .= '<ul class="action-buttons">'; if ($imic_options['switch_sharing'] == 1 && $imic_options['share_post_types']['3'] == '1') { $output .= '<li title="Share event"><a href="#" data-trigger="focus" data-placement="right" data-content="" data-toggle="popover" data-original-title="Share Event" class="event-share-link"><i class="icon-share"></i></a></li>'; } $event_map = get_post_meta($id, 'imic_event_address2', true); if ($event_map != '') { $output .= '<li title="Get directions" class="hidden-xs"><a href="#" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li>'; } $event_contact_info = get_post_meta($id, 'imic_event_manager', true); if ($event_contact_info != '') { $output .= '<li title="Contact event manager"><a id="contact-' . ($id + 2648) . '|' . $key . '" href="#" data-toggle="modal" data-target="#Econtact" class="event-contact-link"><i class="icon-mail"></i></a></li>'; } $output .= '</ul></div>'; $output .= '</div></div></li></ul>'; echo $output; die; }
_e('From ', 'framework'); ?> <span class="event-time"><?php echo date_i18n(get_option('time_format'), $event_time); ?> </span><?php echo __(' to ', 'framework') . date_i18n(get_option('time_format'), $event_end_time); ?> </span> <span class="meta-data event-location-address"><i class="fa fa-map-marker"></i> <?php echo $event_address; ?> </span> <hr class="sm"> <a href="<?php echo esc_url(imic_query_arg($date, $id)); ?> " class="event-title hidden"></a> <ul class="list-group"> <?php if (!empty($event_details[0])) { foreach ($event_details[0] as $key => $value) { ?> <li class="list-group-item"> <span class="badge"><?php if (!empty($value[1])) { echo $value[1]; } ?> </span> <?php if (!empty($value[0])) { echo $value[0];
//echo $next_month; $eventDate = date('Y-m-d ' . $eventTime, strtotime($frequency_month_day . ' ' . $frequency_week_day . ' of ' . $next_month . ' ' . $next_event_year)); //echo $eventDate; $start = strtotime($eventDate); } $date_converted = date('Y-m-d', $start); // - grab gmt for start - $gmts = date('Y-m-d H:i:s', $start); $gmts = get_gmt_from_date($gmts); // this function requires Y-m-d H:i:s $gmts = strtotime($gmts); // - grab gmt for end - $gmte = date('Y-m-d H:i:s', strtotime($end)); $gmte = get_gmt_from_date($gmte); // this function requires Y-m-d H:i:s $gmte = strtotime($gmte); // - set to ISO 8601 date format - $stime = esc_attr(date('Y-m-d H:i:s', $start)); $etime = esc_attr(date('Y-m-d H:i:s', strtotime($end))); // - json items - $jsonevents[] = array('id' => $post->ID . '|' . $start, 'title' => esc_attr($post->post_title), 'allDay' => false, 'start' => $stime, 'end' => $etime, 'url' => esc_url(imic_query_arg($date_converted, $post->ID)), 'backgroundColor' => $color, 'borderColor' => $color); $fr_repeat++; } } } // - fire away - $options = get_option('imic_options'); $events_feeds = $options['event_feeds']; if ($events_feeds == 1) { echo json_encode($jsonevents); }
function widget($args, $instance) { extract($args); // these are the widget options $post_title = apply_filters('widget_title', $instance['title']); $number = apply_filters('widget_number', $instance['number']); $category = apply_filters('widget-category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base); $numberEvent = !empty($number) ? $number : 3; $EventHeading = !empty($post_title) ? $post_title : __('Upcoming Events', 'imic-framework-admin'); $today = date('Y-m-d'); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title']; echo apply_filters('widget_title', $EventHeading, $instance, $this->id_base); echo $args['after_title']; } $event_add = imic_recur_events('future', '', $category, ''); $nos_event = 1; $google_events = getGoogleEvent(); if (!empty($google_events)) { $new_events = $google_events + $event_add; } else { $new_events = $event_add; } ksort($new_events); if (!empty($new_events)) { echo '<ul>'; foreach ($new_events as $key => $value) { if (preg_match('/^[0-9]+$/', $value)) { $eventTime = get_post_meta($value, 'imic_event_start_tm', true); if (!empty($eventTime)) { $eventTime = strtotime($eventTime); $eventTime = date_i18n(get_option('time_format'), $eventTime); } $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); $event_title = get_the_title($value); } else { $google_data = explode('!', $value); $event_title = $google_data[0]; $custom_event_url = $google_data[1]; $eventTime = ''; if (!empty($key)) { $eventTime = ' | ' . date(get_option('time_format'), $key); } } echo '<li class="item event-item clearfix"> <div class="event-date"> <span class="date">' . date_i18n('d', $key) . '</span> <span class="month">' . imic_global_month_name($key) . '</span> </div> <div class="event-detail"> <h4><a href="' . $custom_event_url . '">' . $event_title . '</a>' . imicRecurrenceIcon($value) . '</h4>'; $stime = ''; if ($eventTime != '') { $stime = ' | ' . $eventTime; } echo '<span class="event-dayntime meta-data">' . date_i18n('l', $key) . $stime . '</span> </div> </li>'; if (++$nos_event > $numberEvent) { break; } } echo '</ul>'; } else { _e('No Upcoming Events Found', 'imic-framework-admin'); } echo $args['after_widget']; }
function widget($args, $instance) { $cache = array(); if (!$this->is_preview()) { $cache = wp_cache_get('event_counter', 'widget'); } if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); // these are the widget options $post_title = apply_filters('widget_title', $instance['title']); $post_title = $post_title == '' ? __('Upcoming Events', 'imic-framework-admin') : $post_title; $category = apply_filters('widget-category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base); $EventHeading = $post_title; echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title']; echo '<i class="fa fa-calendar"></i> ' . apply_filters('widget_title', $EventHeading, $instance, $this->id_base); echo $args['after_title']; } wp_reset_postdata(); wp_enqueue_script('imic_jquery_countdown'); wp_localize_script('imic_jquery_countdown', 'upcoming_data', array('c_time' => time())); wp_enqueue_script('imic_counter_init'); global $imic_options; $events = imic_recur_events('future', 'nos', $category); ksort($events); if (!empty($events)) { $total = 1; foreach ($events as $key => $value) { $date_converted = date('Y-m-d', $key); $custom_event_url = imic_query_arg($date_converted, $value); $start_time = '23:59'; $start_time_meta = get_post_meta($value, 'imic_event_start_dt', true); if ($start_time_meta != '') { $start_time_meta = strtotime($start_time_meta); $start_time = date('G:i', $start_time_meta); } $st_time = ''; $st_time = date('Y-m-d', $key); $st_time = strtotime($st_time . ' ' . $start_time); $event_end_date = get_post_meta($value, 'imic_event_end_dt', true); $event_end_date = strtotime($event_end_date); $st_date = date('Y-m-d', $key); $en_tm = date('G:i', $event_end_date); $counter_time = $key; echo '<section class="upcoming-event format-standard event-list-item event-dynamic">'; if (has_post_thumbnail($value)) { echo '<a href="' . esc_url($custom_event_url) . '" class="media-box">' . get_the_post_thumbnail($value, '600x400') . ' </a>'; } echo '<div class="upcoming-event-content"> <span class="label label-primary upcoming-event-label">' . __('Next coming event', 'framework') . '</span> <div id="event-counter-' . $this->id . '" class="counter clearfix" data-date="' . $counter_time . '"> <div class="timer-col"> <span id="days"></span> <span class="timer-type">' . __('Days', 'framework') . '</span> </div> <div class="timer-col"> <span id="hours"></span> <span class="timer-type">' . __('Hours', 'framework') . '</span> </div> <div class="timer-col"> <span id="minutes"></span> <span class="timer-type">' . __('Minutes', 'framework') . '</span> </div> <div class="timer-col"> <span id="seconds"></span> <span class="timer-type">' . __('Seconds', 'framework') . '</span> </div> </div> <h3><a href="' . esc_url($custom_event_url) . '" class="event-title">' . get_the_title($value) . '</a></h3> <span class="meta-data">On <span class="event-date">' . date_i18n(get_option('date_format'), $key) . '</span>' . __(' at ', 'framework') . '<span class="event-time">' . date_i18n(get_option('time_format'), $st_time) . '</span>' . __(' at', 'framework') . '</span>'; $address = get_post_meta($value, 'imic_event_address2', true); if ($address != '') { echo '<span class="meta-data event-location"> <span class="event-location-address">' . $address . '</span></span>'; } echo '</div> <div class="upcoming-event-footer">'; $event_registration = get_post_meta($value, 'imic_event_registration', true); if ($event_registration == 1) { echo '<a id="imicregister-' . ($value + 2648) . '|' . $key . '" href="#" class="pull-right btn btn-primary btn-sm event-tickets event-register-button">' . __('Register', 'framework') . '</a>'; } echo '<ul class="action-buttons">'; if ($imic_options['switch_sharing'] == 1 && $imic_options['share_post_types']['3'] == '1') { echo '<li title="Share event"><a href="#" data-trigger="focus" data-placement="top" data-content="" data-toggle="popover" data-original-title="Share Event" class="event-share-link"><i class="icon-share"></i></a></li>'; } $event_map = get_post_meta($value, 'imic_event_address2', true); if ($event_map != '') { echo '<li title="Get directions" class="hidden-xs"><a href="#" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li>'; } $event_contact_info = get_post_meta($value, 'imic_event_manager', true); if ($event_contact_info != '') { echo '<li title="Contact event manager"><a id="imiccontact-' . ($value + 2648) . '|' . $key . '" href="#" data-toggle="modal" data-target="#Econtact" class="event-contact-link"><i class="icon-mail"></i></a></li>'; } echo '</ul> </div> </section>'; if (++$total > 1) { break; } } } else { echo '<section class="upcoming-event format-standard event-list-item event-dynamic"> <div class="upcoming-event-content"> <h3>' . __('No Upcoming Events Found', 'imic-framework-admin') . '</h3></div></div>'; } echo $args['after_widget']; if (!$this->is_preview()) { $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('event_counter', $cache, 'widget'); } else { ob_end_flush(); } }