示例#1
0
 }
 $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);
     $key = strtotime($event_end_date_only . ' ' . $event_time_end);
     $start_unix_cal = strtotime($event_start_date_only . ' ' . $start_time);
 }
 if ($diff_date > 1) {
     $key = $key + 4320;
 }
 $gmts = date('Y-m-d H:i:s', $start_unix_cal);
 $gmte = date('Y-m-d H:i:s', $key);
 $gmts = strtotime($gmts);
 $gmte = strtotime($gmte);
 $stime = date('c', $gmts);
 $etime = date('c', $gmte);
 $st_all_day = get_post_meta($value, 'imic_event_all_day', true);
$imic_upcoming_events_area = get_post_meta($home_id, 'imic_upcoming_area', true);
if ($imic_upcoming_events_area == 1) {
    if (!empty($firstEventTitle) && $imic_latest_sermon_events == 'letest_event' || !empty($firstEventTitle) && $imic_latest_sermon_events == '') {
        ?>
<div class="notice-bar">
<div class="container">
<?php 
        $imic_going_on_events = get_post_meta($home_id, 'imic_going_on_events', true);
        if ($imic_going_on_events == 2) {
            $event_add_going = imic_recur_events('future', 'nos', '', '');
            ksort($event_add_going);
            $currently_running = array();
            foreach ($event_add_going as $key => $value) {
                $today = date('Y-m-d');
                $event_ongoing_date = date('Y-m-d', $key);
                $days_extra = imic_dateDiff($today, $event_ongoing_date);
                $event_st_time = get_post_meta($value, 'imic_event_start_tm', true);
                $event_en_time = get_post_meta($value, 'imic_event_end_tm', true);
                $evemt_st_time = strtotime($today . ' ' . $event_st_time);
                $event_en_time = strtotime($today . ' ' . $event_en_time);
                if ($days_extra > 0) {
                    break;
                }
                if ($event_st_time < date('U') && $event_en_time > date('U')) {
                    $currently_running[$key] = $value;
                }
            }
            $going_nos_event = 1;
            $google_events = getGoogleEvent('goingEvent');
            if (!empty($google_events)) {
                $new_events = $google_events + $currently_running;
示例#3
0
             }
             $value_event = 1;
             break;
         } else {
         }
     }
     if ($value_event == '') {
         $st_dt = get_post_meta(get_the_ID(), 'imic_event_start_dt', true);
         $en_dt = get_post_meta(get_the_ID(), 'imic_event_end_dt', true);
         $st_dt_unix = strtotime($st_dt);
         if ($en_dt != '') {
             $en_dt_unix = strtotime($en_dt);
         } else {
             $en_dt = $st_dt;
         }
         $days_extra = imic_dateDiff($st_dt, $en_dt);
         if ($days_extra > 0) {
             $st_dt_unix1 = date(get_option('date_format'), $st_dt_unix);
             $st_dt_unix = '<strong>' . date_i18n('l', $st_dt_unix) . '</strong> | ' . $st_dt_unix1;
             $en_dt_unix1 = date_i18n(get_option('date_format'), $en_dt_unix);
             $en_dt_unix = '<strong>' . date_i18n('l', $en_dt_unix) . '</strong> | ' . $en_dt_unix1;
             $date_opt = $st_dt_unix . ' ' . __('to', 'framework') . ' ' . $en_dt_unix;
         } else {
             $st_dt_unix = date(get_option('date_format'), $st_dt_unix);
             $date_opt = '<strong>' . date_i18n('l', $st_dt_unix) . '</strong> | ' . $st_dt_unix;
             $event_dt_outs = '';
         }
     }
     $eventDetailsData = array($date_opt, $event_dt_out[0], get_post_meta(get_the_ID(), 'imic_event_address', true), get_post_meta(get_the_ID(), 'imic_event_contact', true));
 }
 /*			 $eventDetailsData = array($date, $stime . $etime, get_post_meta(get_the_ID(), 'imic_event_address', true),
 function imic_recur_events_calendar($status, $featured = "nos", $term = '', $month = '')
 {
     $offset = get_option('timezone_string');
     if ($offset == '') {
         $offset = "Australia/Melbourne";
     }
     date_default_timezone_set($offset);
     global $imic_options;
     $event_show_until = isset($imic_options['countdown_timer']) ? $imic_options['countdown_timer'] : '0';
     $featured = $featured == "yes" ? "no" : "nos";
     $today = date('Y-m-d');
     if ($month != "") {
         $stop_date = $month;
         $curr_month = date('Y-m-t 23:59', strtotime('-1 month', strtotime($stop_date)));
         $current_end_date = date('Y-m-d H:i:s', strtotime($stop_date . ' + 1 day'));
         $previous_month_end = strtotime(date('Y-m-d 00:01', strtotime($stop_date)));
         $next_month_start = strtotime(date('Y-m-d 00:01', strtotime('+1 month', strtotime($stop_date))));
         query_posts(array('post_type' => 'event', 'event-category' => $term, 'meta_key' => 'imic_event_start_dt', 'meta_query' => array('relation' => 'AND', array('key' => 'imic_event_frequency_end', 'value' => $curr_month, 'compare' => '>'), array('key' => 'imic_event_start_dt', 'value' => date('Y-m-t 23:59', strtotime($stop_date)), 'compare' => '<')), 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => -1));
     } else {
         if ($status == 'future') {
             query_posts(array('post_type' => 'event', 'event-category' => $term, 'meta_key' => 'imic_event_start_dt', 'meta_query' => array(array('key' => 'imic_event_frequency_end', 'value' => $today, 'compare' => '>=')), 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => -1));
         } else {
             query_posts(array('post_type' => 'event', 'event-category' => $term, 'meta_key' => 'imic_event_start_dt', 'meta_query' => array(array('key' => 'imic_event_start_dt', 'value' => $today, 'compare' => '<')), 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => -1));
         }
     }
     $event_add = array();
     $sinc = 1;
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             $frequency = get_post_meta(get_the_ID(), 'imic_event_frequency', true);
             $frequency_count = get_post_meta(get_the_ID(), 'imic_event_frequency_count', true);
             $frequency_month_day = get_post_meta(get_the_ID(), 'imic_event_day_month', true);
             $frequency_week_day = get_post_meta(get_the_ID(), 'imic_event_week_day', true);
             $multiple_dates = get_post_meta(get_the_ID(), 'imic_event_recurring_dt', true);
             if ($frequency != '0' && $frequency != '32') {
                 $frequency_count = $frequency_count;
             } elseif ($frequency == '32') {
                 $frequency_count = count($multiple_dates);
             } else {
                 $frequency_count = 0;
             }
             $seconds = $frequency * 86400;
             $fr_repeat = 0;
             while ($fr_repeat <= $frequency_count) {
                 $eventDate = get_post_meta(get_the_ID(), 'imic_event_start_dt', true);
                 $MetaStartTime = get_post_meta(get_the_ID(), 'imic_event_start_tm', true);
                 $eventEndDate = get_post_meta(get_the_ID(), 'imic_event_end_dt', true);
                 $MetaEndTime = get_post_meta(get_the_ID(), 'imic_event_end_tm', true);
                 $inc = '';
                 $eventEndDate = strtotime($eventEndDate . ' ' . $MetaEndTime);
                 $eventDate = strtotime($eventDate . ' ' . $MetaStartTime);
                 $diff_start = date('Y-m-d', $eventDate);
                 $diff_end = date('Y-m-d', $eventEndDate);
                 $days_extra = imic_dateDiff($diff_start, $diff_end);
                 $go_cl = '';
                 //echo "sn";
                 if ($days_extra > 0) {
                     $go_cl = '';
                     $en_dt_cl = strtotime(get_post_meta(get_the_ID(), 'imic_event_end_dt', true));
                     $st_dt_cl = strtotime(get_post_meta(get_the_ID(), 'imic_event_start_dt', true));
                     $en_dt_cl_mn = date('m', $en_dt_cl);
                     $st_dt_cl_mn = date('m', $st_dt_cl);
                     if ($en_dt_cl_mn != $st_dt_cl_mn) {
                         $go_cl = 1;
                     }
                     $start_day = 0;
                     while ($start_day <= $days_extra) {
                         $diff_sec = 86400 * $start_day;
                         $new_date = $eventDate + $diff_sec;
                         $str_only_date = date('Y-m-d', $new_date);
                         $en_only_time = date("G:i", $eventEndDate);
                         $start_dt_tm = strtotime($str_only_date . ' ' . $en_only_time);
                         //echo date('U');
                         if ($start_dt_tm > date('U')) {
                             $eventDate = $new_date;
                             break;
                         }
                         $start_day++;
                     }
                 }
                 if ($days_extra < 1) {
                     if ($frequency != '35' && $frequency != '32') {
                         if ($frequency == 30) {
                             $eventDate = strtotime("+" . $fr_repeat . " month", $eventDate);
                             $eventEndDate = strtotime("+" . $fr_repeat . " month", $eventEndDate);
                         } else {
                             $new_date = $seconds * $fr_repeat;
                             $eventDate = $eventDate + $new_date;
                             $eventEndDate = $eventEndDate + $new_date;
                             //echo $eventEndDate;
                         }
                     } elseif ($frequency == '32') {
                         if ($fr_repeat != $frequency_count) {
                             $eventDate = $multiple_dates[$fr_repeat];
                             $eventDate = strtotime($eventDate);
                         }
                     } else {
                         $eventTime = date('G:i', $eventDate);
                         $eventDate = strtotime(date('Y-m-01', $eventDate));
                         //$eventEndDate = date('G:i',$eventEndDate);
                         //$eventEndDate = strtotime( date('Y-m-01',$eventEndDate) );
                         if ($fr_repeat == 0) {
                             $fr_repeat = $fr_repeat + 1;
                         }
                         $eventDate = strtotime("+" . $fr_repeat . " month", $eventDate);
                         //$eventEndDate = strtotime("+".$fr_repeat." month", $eventEndDate);
                         $next_month = date('F', $eventDate);
                         $next_event_year = date('Y', $eventDate);
                         //echo $next_month;
                         $eventDate = date('Y-m-d ' . $eventTime, strtotime($frequency_month_day . ' ' . $frequency_week_day . ' of ' . $next_month . ' ' . $next_event_year));
                         //Changed in v1.1
                         //$eventEndDate = date('Y-m-d '.$eventTime, strtotime($frequency_month_day.' '.$frequency_week_day.' of '.$next_month.' '.$next_event_year));
                         //echo $eventDate;
                         $eventDate = strtotime($eventDate);
                         //Changed in 1.1
                         //$eventEndDate = strtotime($eventEndDate);
                     }
                 }
                 $st_dt = date('Y-m-d', $eventDate);
                 if ($MetaStartTime != '') {
                     if ($event_show_until == '1') {
                         $en_tm = date("G:i", $eventEndDate);
                     } else {
                         $en_tm = date("G:i", $eventDate);
                     }
                 } else {
                     $en_tm = "23:59";
                 }
                 $dt_tm = strtotime($st_dt . ' ' . $en_tm);
                 if ($month != '') {
                     if ($dt_tm > $previous_month_end && $dt_tm < $next_month_start || $go_cl == 1) {
                         $event_add[$dt_tm + $sinc + $inc] = get_the_ID();
                         $sinc++;
                     }
                 } else {
                     if ($status == "future") {
                         if ($dt_tm >= date('U')) {
                             $event_add[$dt_tm + $sinc + $inc] = get_the_ID();
                             $sinc++;
                         }
                     } else {
                         if ($dt_tm <= date('U')) {
                             $event_add[$dt_tm + $sinc + $inc] = get_the_ID();
                             $sinc++;
                         }
                     }
                 }
                 if ($days_extra < 1) {
                     $fr_repeat++;
                 } else {
                     $fr_repeat = 1000000;
                 }
             }
         }
     }
     wp_reset_query();
     return $event_add;
 }