function widget($args, $instance) { if (empty($instance)) { $instance = array('title' => 'Upcoming events', 'calendar' => '0', 'theme' => '0', 'view_type' => '0', 'event_qauntity1' => '1', 'follow_quality1' => '10', 'follow_quality3' => '10', 'event_qauntity2' => '1', 'ordering' => '0', 'event_qauntity22' => '1', 'ordering1' => '0', 'event_select' => '', 'start_date' => '', 'starting' => '0', 'follow_quality2' => '10', 'event_qauntity3' => '1', 'event_date' => '1', 'repeat_rate' => '1', 'numbering' => '1', 'ev_text' => '1', 'width' => '200', 'bg_color' => 'FFFFFF', 'title_color' => '000000', 'title_size' => '14', 'title_font' => 'Arial', 'date_color' => '000000', 'date_format' => 'd F Y', 'repeat_color' => '000000', 'text_color' => '000000', 'divider_color' => 'C2C2C2'); } extract($args); $title = $instance['title']; $calendar_id = $instance['calendar']; $view_type = $instance['view_type']; $theme_id = $instance['theme'] ? $instance['theme'] : 1; $event_from_current_day = $instance['event_qauntity1']; $since = $instance['follow_quality1']; $since1 = $instance['follow_quality3']; $count = $instance['event_qauntity2']; $count1 = $instance['event_qauntity22']; $ordering = $instance['ordering']; $ordering1 = $instance['ordering1']; $event_select = $instance['event_select']; $start_day_calendar = $instance['start_date']; $event_from_day_interval = $instance['starting']; $follow_quality2 = $instance['follow_quality2']; $event_qauntity3 = $instance['event_qauntity3']; $show_time = $instance['event_date']; $show_repeat = $instance['repeat_rate']; $show_numbering = $instance['numbering']; $show_eventtext = $instance['ev_text']; $width = $instance['width']; $bg_color = $instance['bg_color']; $title_color = $instance['title_color']; $title_size = $instance['title_size']; $title_font = $instance['title_font']; $date_color = $instance['date_color']; $date_format = $instance['date_format']; $repeat_color = $instance['repeat_color']; $text_color = $instance['text_color']; $divider_color = $instance['divider_color']; // Before widget // echo $before_widget; // Title of widget // if ($title) { echo $before_title . $title . $after_title; } // Widget output // global $wpdb; $many_sp_calendar = isset($_GET['many_sp_calendar']) && is_numeric(esc_html($_GET['many_sp_calendar'])) ? esc_html($_GET['many_sp_calendar']) : rand(10, 10000); ?> <script> var thickDims, tbWidth, tbHeight; jQuery(document).ready(function ($) { thickDims = function () { var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h; if (tbWidth) { if (tbWidth < (W - 90)) w = tbWidth; else w = W - 200; } else w = W - 200; if (tbHeight) { if (tbHeight < (H - 90)) h = tbHeight; else h = H - 200; } else h = H - 200; if (tbWindow.size()) { tbWindow.width(w).height(h); $('#TB_iframeContent').width(w).height(h - 27); tbWindow.css({'margin-left':'-' + parseInt((w / 2), 10) + 'px'}); if (typeof document.body.style.maxWidth != 'undefined') tbWindow.css({'top':(H - h) / 2, 'margin-top':'0'}); } if(jQuery(window).width() < 640 ){ var tb_left = parseInt((w / 2), 10) + 20; tbWindow.css({'left':'' + tb_left + 'px'}); jQuery('#TB_window').css('width','91%'); jQuery('#TB_window').css('height','80%'); jQuery('#TB_window').css('margin-top','-10%'); jQuery('#TB_window iframe').css('width','100%'); jQuery('#TB_window iframe').css('height','87%'); } }; thickDims(); $(window).resize(function () { thickDims() }); $('a.thickbox-preview<?php echo $many_sp_calendar; ?> ').click(function () { tb_click.call(this); var alink = jQuery(this).parents('.available-theme').find('.activatelink'), link = '', href = jQuery(this).attr('href'), url, text; var reg_with = new RegExp(xx_cal_xx + "tbWidth=[0-9]+"); if (tbWidth = href.match(reg_with)) tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10); else tbWidth = jQuery(window).width() - 90; var reg_heght = new RegExp(xx_cal_xx + "tbHeight=[0-9]+"); if (tbHeight = href.match(reg_heght)) tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10); else tbHeight = jQuery(window).height() - 60; jQuery('#TB_title').css({'background-color':'#222', 'color':'#dfdfdf'}); jQuery('#TB_closeAjaxWindow').css({'float':'left'}); jQuery('#TB_ajaxWindowTitle').css({'float':'right'}).html(link); jQuery('#TB_iframeContent').width('100%'); thickDims(); return false; }); }); </script> <?php $widget = isset($_GET['widget']) && (int) $_GET['widget'] ? (int) $_GET['widget'] : 1; $query = "SELECT popup_width,popup_height FROM " . $wpdb->prefix . "spidercalendar_widget_theme WHERE id=" . $theme_id; $popup_w_hs = $wpdb->get_results($query); $popup_w_h = array(0 => $popup_w_hs[0]->popup_width, 1 => $popup_w_hs[0]->popup_height); $popup_width = $popup_w_h[0]; $popup_height = $popup_w_h[1]; $cal = strtotime($start_day_calendar); $id = $this->get_field_id('title'); global $callone; $callone = $callone + 1; if ($callone == 1) { function compare_str_to_array($string, $array, $end_date) { foreach ($array as $value) { if ($string <= $value and $end_date >= $value) { return $value; break; } } } function compare_str_to_array1($string, $array) { foreach ($array as $value) { if ($string <= $value) { return $value; break; } } } function week_number_recent($x) { if ($x == 1) { return __('First', 'sp_calendar'); } elseif ($x == 8) { return __('Second', 'sp_calendar'); } elseif ($x == 15) { return __('Third', 'sp_calendar'); } elseif ($x == 22) { return __('Fourth', 'sp_calendar'); } elseif ($x == 'last') { return __('Last', 'sp_calendar'); } } function week_convert_recent($x) { if ($x == 'Mon') { return __('Monday', 'sp_calendar'); } elseif ($x == 'Tue') { return __('Tuesday', 'sp_calendar'); } elseif ($x == 'Wed') { return __('Wednesday', 'sp_calendar'); } elseif ($x == 'Thu') { return __('Thursday', 'sp_calendar'); } elseif ($x == 'Fri') { return __('Friday', 'sp_calendar'); } elseif ($x == 'Sat') { return __('Saturday', 'sp_calendar'); } elseif ($x == 'Sun') { return __('Sunday', 'sp_calendar'); } } function sorrt($st_date, $array, $en_date) { $ids = array(); $dat = array(); $dats = array(); $ret_array = array(); foreach ($array as $key => $value) { $ids[] = $key; $dat[] = compare_str_to_array($st_date, $value, $en_date); $dats[] = $value; } asort($dat); foreach ($dat as $key => $val) { $ret_array[$ids[$key]] = $dats[$key]; } return $ret_array; } function sorrt1($st_date, $array) { $ids = array(); $dat = array(); $dats = array(); $ret_array = array(); foreach ($array as $key => $value) { $ids[] = $key; $dat[] = compare_str_to_array1($st_date, $value); $dats[] = $value; } asort($dat); foreach ($dat as $key => $val) { $ret_array[$ids[$key]] = $dats[$key]; } return $ret_array; } function add_00($str) { if (strlen($str) == 1) { return '0' . $str; } else { return $str; } } function num_to_str($x) { switch ($x) { case '1': return 'first'; break; case '8': return 'second'; break; case '15': return 'third'; break; case '22': return 'Fourth'; break; case 'last': return 'last'; break; } } } $id = $this->get_field_id('title'); ?> <style type="text/css"> #event_repeat<?php echo $id; ?> { color:#<?php echo str_replace('#', '', $repeat_color); ?> ; padding-top:14px; <?php if ($show_eventtext == 1) { ?> padding-bottom:14px!important; <?php } ?> } #event_table<?php echo $id; ?> { border:0px !important; border-spacing:0px !important; border-collapse:collapse; } #event_text<?php echo $id; ?> { padding:15px; color:#<?php echo str_replace('#', '', $text_color); ?> ; padding-bottom:14px!important; <?php if ($show_repeat == 1) { ?> padding-top:14px!important; <?php } ?> padding-left: 8px; } #event_date<?php echo $id; ?> { color:#<?php echo str_replace('#', '', $date_color); ?> ; <?php if ($show_eventtext == 1) { ?> padding-bottom:14px!important; <?php } if ($show_repeat == 1) { ?> padding-bottom:14px!important; <?php } ?> } #title<?php echo $id; ?> :link, #see_more<?php echo $id; ?> { font-size:<?php echo $title_size; ?> px; font-family:<?php echo $title_font; ?> ; color:#<?php echo str_replace('#', '', $title_color); ?> !important; text-decoration:none; } #title<?php echo $id; ?> :hover{ background:none ; text-decoration:underline ; } tr, td{ border:0px; padding-left:7px; padding-right:12px; padding-bottom:4px; padding-top:2px; } #divider<?php echo $id; ?> { background-color:#<?php echo str_replace('#', '', $instance['divider_color']); ?> ; border:none; height:1px; } .pad { <?php if ($show_time == 1) { ?> padding-bottom:14px; <?php } ?> } .module<?php echo $id; ?> { background-color:#<?php echo str_replace('#', '', $bg_color); ?> ; width:<?php echo $width; ?> px; border:1px ; border-radius:8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; padding-right:10px; padding-left:10px; border:2px solid #6A6A6A;; } </style> <?php $query1 = "SELECT * FROM " . $wpdb->prefix . "spidercalendar_event WHERE published='1' LIMIT 0," . $event_from_current_day; $rows = $wpdb->get_results($query1); $daysarray = array(); foreach ($rows as $row) { if ($row->date_end != '0000-00-00') { $Startdate = $row->date; $Enddate = $row->date_end; $ts1 = strtotime($Startdate); $ts2 = strtotime($Enddate); $seconds_diff = $ts2 - $ts1; $day_diff = floor($seconds_diff / 3600 / 24 + 1); for ($i = 0; $i < $day_diff; $i += $row->repeat) { $Nextdate = strtotime(date("Y-m-d", strtotime($row->date)) . " +" . $i . " day"); $Nextdate = date("Y-m-d", $Nextdate); array_push($daysarray, $Nextdate); } $weekdays = explode(',', $row->week); $weekdays = array_slice($weekdays, 0, count($weekdays) - 1); } } echo '<div class="module' . $id . '">'; if ($view_type == 0) { $query = "SELECT * FROM " . $wpdb->prefix . "spidercalendar_event WHERE calendar=" . $calendar_id . " AND published='1' ORDER BY date"; $evs = $wpdb->get_results($query); $st_date = date('Y-m-d'); $dates = array(); foreach ($evs as $ev) { $weekdays_start = array(); $st = $ev->date; if ($ev->date_end != '0000-00-00') { $en = $ev->date_end; } else { $en = date('Y-m-d', strtotime('+24 year', strtotime($st))); } $date_st = explode('-', $st); $date_end = explode('-', $en); $st_d = mktime(0, 0, 0, $date_st[1], $date_st[2], $date_st[0]); $en_d = mktime(0, 0, 0, $date_end[1], $date_end[2], $date_end[0]); $tarb = $en_d - $st_d; $weekly_array = explode(',', $ev->week); for ($j = 0; $j <= 6; $j++) { if (in_array(date("D", mktime(0, 0, 0, $date_st[1], $date_st[2] + $j, $date_st[0])), $weekly_array)) { $weekdays_start[] = $date_st[2] + $j; } } if ($ev->repeat_method == "no_repeat") { $dates[$ev->id][0] = $ev->date; } ///////////////////get days for daily repeat if ($ev->repeat_method == "daily") { if ($ev->repeat == "" || $ev->repeat == "0") { $ev->repeat = "1"; } if ($tarb <= 0) { $day_count = ($st_d - $en_d) / 3600 / 24 / $ev->repeat; } else { $day_count = ($en_d - $st_d) / 3600 / 24 / $ev->repeat; } $dates[$ev->id][0] = $ev->date; for ($i = 0; $i < $day_count; $i++) { if ($ev->repeat_method == "daily") { $dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' day', strtotime($dates[$ev->id][$i]))); } } } ///////////////////get days for weekly repeat if ($ev->repeat_method == "weekly") { $day_count = ($en_d - $st_d) / 3600 / 24 / ($ev->repeat * 7); $d = array(); $dat = array(); for ($j = 0; $j < count($weekdays_start); $j++) { unset($dat); $dat[0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($weekdays_start[$j]); for ($i = 0; $i < $day_count - 1; $i++) { $dat[] = date('Y-m-d', strtotime('+' . $ev->repeat . ' week', strtotime($dat[$i]))); } $d = array_merge($d, $dat); } sort($d); $dates[$ev->id] = $d; } ///////////////////get days for monthly repeat if ($ev->repeat_method == "monthly") { $start_date = strtotime($ev->date); $end_date = strtotime($en); $min_date = min($start_date, $end_date); $max_date = max($start_date, $end_date); $month_count = 0; while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) { $month_count++; } $month_days = date('t', mktime(0, 0, 0, $date_st[1], 1, $date_st[0])); if ($ev->month_type == 1) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($ev->month); } else { if ($ev->monthly_list != 'last') { for ($j = $ev->monthly_list; $j < $ev->monthly_list + 7; $j++) { if (date("D", mktime(0, 0, 0, $date_st[1], $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($j); } } } else { for ($j = 1; $j <= $month_days; $j++) { if (date("D", mktime(0, 0, 0, $date_st[1], $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($j); } } } } for ($i = 0; $i < $month_count; $i++) { $mon = date('F', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); if ($ev->month_type == 1) { $dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); } else { $mon = date('F', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); $dates[$ev->id][] = date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); } } } if ($ev->repeat_method == "yearly") { $start_date = strtotime($ev->date); $end_date = strtotime($en); $min_date = min($start_date, $end_date); $max_date = max($start_date, $end_date); $year_count = 0; while (($min_date = strtotime("+1 year", $min_date)) <= $max_date) { $year_count++; } $month_days = date('t', mktime(0, 0, 0, add_00($ev->year_month), 1, $date_st[0])); if ($ev->month_type == 1) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($ev->month); } else { if ($ev->monthly_list != 'last') { for ($j = $ev->monthly_list; $j < $ev->monthly_list + 7; $j++) { if (date("D", mktime(0, 0, 0, add_00($ev->year_month), $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($j); } } } else { for ($j = 1; $j <= $month_days; $j++) { if (date("D", mktime(0, 0, 0, add_00($ev->year_month), $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($j); } } } } for ($i = 0; $i < $year_count; $i++) { if ($ev->month_type == 1) { $dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); } else { $mon = date('F', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); $dates[$ev->id][] = date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); } } } sort($dates[$ev->id]); } foreach ($dates as $ev_id => $date) { //echo compare_str_to_array($st_date,$date,$en_date). ' '; $gag[$ev_id] = compare_str_to_array1($st_date, $date); } $dates = sorrt1($st_date, $dates); $isk = 1; $j = 0; $p = 0; foreach ($dates as $ev_id => $date) { $query0 = " SELECT * FROM " . $wpdb->prefix . "spidercalendar_event WHERE id=" . $ev_id; $curr_event = $wpdb->get_row($query0); if (compare_str_to_array1($st_date, $date) == '') { continue; } $event_id = $curr_event->id; $event_title = $curr_event->title; $event_date = compare_str_to_array1($st_date, $date); $event_end_date = $curr_event->date_end; $event_text = $curr_event->text_for_date; $calendar_id = $curr_event->calendar; $repeat = $curr_event->repeat; $week = explode(',', $curr_event->week); $year = substr($event_date, 0, 4); $month = substr($event_date, 5, -3); $day = substr($event_date, 8); /*$month_date_year = date("F j, Y",mktime(0,0,0,$month,$day,$year)); $jd=gregoriantojd($month,$day,$year); $weekday = jddayofweek($jd,2); $date = $weekday.' '.$month_date_year; echo $weekday;*/ echo '<div id="event_table' . $id . '" >'; if ($show_numbering == 1) { echo '<div style="padding-top:0px;" class="pad"><a id="title' . $id . '" class="thickbox-preview' . $many_sp_calendar . '" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'calendar_id' => $id, 'theme_id' => $theme_id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" ></br><b>' . $isk++ . '.' . $event_title . '</b></a></div>'; } else { echo '<div style="padding-top:0px;" class="pad"><a id="title' . $id . '" class="thickbox-preview' . $many_sp_calendar . '" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'calendar_id' => $id, 'theme_id' => $theme_id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" ></br><b>' . $event_title . '</b></a></div>'; } ?> <style> <?php if ($event_text == '') { ?> td #event_date<?php echo $id; ?> { padding-bottom:14px; } <?php } ?> </style> <?php $activedatestr = ''; $date_format_array = explode(' ', $date_format); for ($i = 0; $i < count($date_format_array); $i++) { $activedatestr .= __(date("" . $date_format_array[$i] . "", strtotime($event_date)), 'sp_calendar') . ' '; } if ($show_time == 1) { echo '<div id="event_date' . $id . '">' . $activedatestr . '</div>'; } if ($show_repeat == 1) { if ($event_text == '') { if ($curr_event->repeat_method == "no_repeat") { echo ''; } else { echo '<div id="event_repeat' . $id . '" >'; if ($curr_event->repeat_method == 'daily') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Day', 'sp_calendar') . '</div>'; } if ($curr_event->repeat_method == 'weekly') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Week(s) on', 'sp_calendar') . '</br>'; for ($g = 0; $g < count($week); $g++) { if ($week[$g] != '') { if ($g != count($week) - 2) { echo week_convert_recent($week[$g]) . ','; } else { echo week_convert_recent($week[$g]); } } } echo '</div>'; } if ($curr_event->repeat_method == 'monthly' and $curr_event->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . $curr_event->month . '</div>'; } if ($curr_event->repeat_method == 'monthly' and $curr_event->month_type == 2) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . week_number_recent($curr_event->monthly_list) . ' ' . week_convert_recent($curr_event->month_week) . '</div>'; } if ($curr_event->repeat_method == 'yearly' and $curr_event->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $curr_event->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . $curr_event->month . '</div>'; } if ($curr_event->repeat_method == 'yearly' and $curr_event->month_type == 2) { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $curr_event->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . week_number_recent($curr_event->monthly_list) . ' ' . week_convert_recent($curr_event->month_week) . '</div>'; } echo '</div>'; } } else { if ($curr_event->repeat_method == "no_repeat") { echo ''; } else { echo '<div id="event_repeat' . $id . '" >'; if ($curr_event->repeat_method == 'daily') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Day', 'sp_calendar') . '</div>'; } if ($curr_event->repeat_method == 'weekly') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Week(s) on', 'sp_calendar') . ' : '; for ($g = 0; $g < count($week); $g++) { if ($week[$g] != '') { if ($g != count($week) - 2) { echo week_convert_recent($week[$g]) . ','; } else { echo week_convert_recent($week[$g]); } } } echo '</div>'; } if ($curr_event->repeat_method == 'monthly' and $curr_event->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . $curr_event->month . '</div>'; } if ($curr_event->repeat_method == 'monthly' and $curr_event->month_type == 2) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . week_number_recent($curr_event->monthly_list) . ' ' . week_convert_recent($curr_event->month_week) . '</div>'; } if ($curr_event->repeat_method == 'yearly' and $curr_event->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $curr_event->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . $curr_event->month . '</div>'; } if ($curr_event->repeat_method == 'yearly' and $curr_event->month_type == 2) { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $curr_event->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . week_number_recent($curr_event->monthly_list) . ' ' . week_convert_recent($curr_event->month_week) . '</div>'; } echo '</div>'; } } } if ($show_eventtext == 1) { if ($event_text) { //$length = strlen($event_text); $text = mb_substr(html_entity_decode(strip_tags($event_text)), 0, 50); echo '<div id="event_text' . $id . '" style="padding-bottom:14px;">' . $text; echo '<br><a class="thickbox-preview' . $many_sp_calendar . '" id="see_more' . $id . '" style="text-decoration:none;" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" >' . __('See more', 'sp_calendar') . '</a></div>'; } } echo '<hr id="divider' . $id . '"/>'; $j++; echo '</div>'; $p++; if ($p == $event_from_current_day) { break; } } } if ($view_type == 1) { if ($event_from_day_interval == 0) { $st_date = date('Y-m-d'); $en_date = date('Y-m-d', strtotime('+' . $since . ' day', strtotime($st_date))); if ($ordering == 0) { $order = "ORDER BY date"; } else { $order = "ORDER BY RAND()"; } $limit = $count; } else { $st_date = $start_day_calendar; $en_date = date('Y-m-d', strtotime('+' . $since1 . ' day', strtotime($st_date))); if ($ordering1 == 0) { $order = "ORDER BY date"; } else { $order = "ORDER BY RAND()"; } $limit = $count1; } $query = " SELECT * FROM " . $wpdb->prefix . "spidercalendar_event WHERE calendar= " . $calendar_id . " AND published='1' " . $order; $evs = $wpdb->get_results($query); $dates = array(); foreach ($evs as $ev) { $weekdays_start = array(); $st = $ev->date; if ($ev->date_end != '0000-00-00' and $ev->date_end != '') { $en = $ev->date_end; } else { $en = date('Y-m-d', strtotime('+24 year', strtotime($st))); } $date_st = explode('-', $st); $date_end = explode('-', $en); $st_d = mktime(0, 0, 0, $date_st[1], $date_st[2], $date_st[0]); $en_d = mktime(0, 0, 0, $date_end[1], $date_end[2], $date_end[0]); $tarb = $en_d - $st_d; $weekly_array = explode(',', $ev->week); for ($j = 0; $j <= 6; $j++) { if (in_array(date("D", mktime(0, 0, 0, $date_st[1], $date_st[2] + $j, $date_st[0])), $weekly_array)) { $weekdays_start[] = $date_st[2] + $j; } } if ($ev->repeat_method == "no_repeat") { $dates[$ev->id][0] = $ev->date; } ///////////////////get days for daily repeat if ($ev->repeat_method == "daily") { if ($ev->repeat == "" || $ev->repeat == "0") { $ev->repeat = "1"; } if ($tarb <= 0) { $day_count = ($st_d - $en_d) / 3600 / 24 / $ev->repeat; } else { $day_count = ($en_d - $st_d) / 3600 / 24 / $ev->repeat; } $dates[$ev->id][0] = $ev->date; for ($i = 0; $i < $day_count; $i++) { if ($ev->repeat_method == "daily") { $dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' day', strtotime($dates[$ev->id][$i]))); } } } ///////////////////get days for weekly repeat if ($ev->repeat_method == "weekly") { $day_count = ($en_d - $st_d) / 3600 / 24 / ($ev->repeat * 7); $d = array(); $dat = array(); for ($j = 0; $j < count($weekdays_start); $j++) { unset($dat); $dat[0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($weekdays_start[$j]); for ($i = 0; $i < $day_count - 1; $i++) { $dat[] = date('Y-m-d', strtotime('+' . $ev->repeat . ' week', strtotime($dat[$i]))); } $d = array_merge($d, $dat); } sort($d); $dates[$ev->id] = $d; } ///////////////////get days for monthly repeat if ($ev->repeat_method == "monthly") { $start_date = strtotime($ev->date); $end_date = strtotime($en); $min_date = min($start_date, $end_date); $max_date = max($start_date, $end_date); $month_count = 0; while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) { $month_count++; } $month_days = date('t', mktime(0, 0, 0, $date_st[1], 1, $date_st[0])); if ($ev->month_type == 1) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($ev->month); } else { if ($ev->monthly_list != 'last') { for ($j = $ev->monthly_list; $j < $ev->monthly_list + 7; $j++) { if (date("D", mktime(0, 0, 0, $date_st[1], $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($j); } } } else { for ($j = 1; $j <= $month_days; $j++) { if (date("D", mktime(0, 0, 0, $date_st[1], $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($j); } } } } for ($i = 0; $i < $month_count; $i++) { $mon = date('F', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); if ($ev->month_type == 1) { $dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); } else { $mon = date('F', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' month', strtotime($dates[$ev->id][$i]))); $dates[$ev->id][] = date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); } } } if ($ev->repeat_method == "yearly") { $start_date = strtotime($ev->date); $end_date = strtotime($en); $min_date = min($start_date, $end_date); $max_date = max($start_date, $end_date); $year_count = 0; while (($min_date = strtotime("+1 year", $min_date)) <= $max_date) { $year_count++; } $month_days = date('t', mktime(0, 0, 0, add_00($ev->year_month), 1, $date_st[0])); if ($ev->month_type == 1) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($ev->month); } else { if ($ev->monthly_list != 'last') { for ($j = $ev->monthly_list; $j < $ev->monthly_list + 7; $j++) { if (date("D", mktime(0, 0, 0, add_00($ev->year_month), $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($j); } } } else { for ($j = 1; $j <= $month_days; $j++) { if (date("D", mktime(0, 0, 0, add_00($ev->year_month), $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($j); } } } } for ($i = 0; $i < $year_count; $i++) { if ($ev->month_type == 1) { $dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); } else { $mon = date('F', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); $dates[$ev->id][] = date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); } } } sort($dates[$ev->id]); } foreach ($dates as $ev_id => $date) { //echo compare_str_to_array($st_date,$date,$en_date). ' '; $gag[$ev_id] = compare_str_to_array($st_date, $date, $en_date); } if ($ordering == 0 or $ordering1 == 0) { $dates = sorrt($st_date, $dates, $en_date); } $isk = 1; $j = 0; $p = 0; foreach ($dates as $ev_id => $date) { if (compare_str_to_array($st_date, $date, $en_date) == '') { continue; } if (compare_str_to_array($st_date, $date, $en_date) != '') { $query0 = " SELECT * FROM " . $wpdb->prefix . "spidercalendar_event WHERE id=" . $ev_id; $curr_event1 = $wpdb->get_results($query0); $order_event_current_day = $curr_event1[0]; $event_id = $order_event_current_day->id; $event_title = $order_event_current_day->title; $event_date = compare_str_to_array($st_date, $date, $en_date); $event_end_date = $order_event_current_day->date_end; $event_text = $order_event_current_day->text_for_date; $calendar_id = $order_event_current_day->calendar; $repeat = $order_event_current_day->repeat; $year = substr($event_date, 0, 4); $month = substr($event_date, 5, -3); $day = substr($event_date, 8); $week = explode(',', $order_event_current_day->week); echo '<div id="event_table' . $id . '" >'; if ($show_numbering == 1) { echo '<div style="padding-top:14px;" class="pad"><a id= "title' . $id . '" class="thickbox-preview' . $many_sp_calendar . '" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" ><b>' . $isk++ . '.' . $event_title . '</b></a></div>'; } else { echo '<div style="padding-top:14px;" class="pad" ><a id="title' . $id . '" class="thickbox-preview' . $many_sp_calendar . '" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" ><b>' . $event_title . '</b></a></div>'; } ?> <style> <?php if ($event_text == '') { ?> td #event_date<?php echo $id; ?> { padding-bottom:14px; } <?php } ?> </style> <?php $activedatestr = ''; $date_format_array = explode(' ', $date_format); for ($i = 0; $i < count($date_format_array); $i++) { $activedatestr .= __(date("" . $date_format_array[$i] . "", strtotime($event_date)), 'sp_calendar') . ' '; } if ($show_time == 1) { echo '<div id="event_date' . $id . '">' . __($activedatestr, 'sp_calendar') . '</div>'; } if ($show_repeat == 1) { if ($order_event_current_day->repeat_method == "no_repeat") { echo ''; } else { echo '<div id="event_repeat' . $id . '" >'; if ($order_event_current_day->repeat_method == 'daily') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Day', 'sp_calendar') . '</div>'; } if ($order_event_current_day->repeat_method == 'weekly') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Week(s) on', 'sp_calendar') . ' : '; for ($g = 0; $g < count($week); $g++) { if ($week[$g] != '') { if ($g != count($week) - 2) { echo week_convert_recent($week[$g]) . ','; } else { echo week_convert_recent($week[$g]); } } } echo '</div>'; } if ($order_event_current_day->repeat_method == 'monthly' and $order_event_current_day->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . $order_event_current_day->month . '</div>'; } if ($order_event_current_day->repeat_method == 'monthly' and $order_event_current_day->month_type == 2) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . week_number_recent($order_event_current_day->monthly_list) . ' ' . week_convert_recent($order_event_current_day->month_week) . '</div>'; } if ($order_event_current_day->repeat_method == 'yearly' and $order_event_current_day->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $order_event_current_day->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . $order_event_current_day->month . '</div>'; } if ($order_event_current_day->repeat_method == 'yearly' and $order_event_current_day->month_type == 2) { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $order_event_current_day->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . week_number_recent($order_event_current_day->monthly_list) . ' ' . week_convert_recent($order_event_current_day->month_week) . '</div>'; } echo '</div>'; } } if ($show_eventtext == 1) { if ($event_text) { $text = mb_substr(html_entity_decode(strip_tags($event_text)), 0, 50); echo '<div id="event_text' . $id . '" >' . $text; echo '<br><a class="thickbox-preview' . $many_sp_calendar . '" id="see_more' . $id . '" style="text-decoration:none;" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" >' . __('See more', 'sp_calendar') . '</a></div>'; } } echo '<div style="padding-top:6px"><hr id="divider' . $id . '"/></div>'; $j++; echo '</div>'; } $p++; if ($p == $limit) { break; } } } if ($view_type == 2) { $events_id = explode(',', $event_select); $events_id = array_slice($events_id, 1, count($events_id) - 2); if (!empty($events_id)) { foreach ($events_id as $event_id) { $query = "SELECT * FROM " . $wpdb->prefix . "spidercalendar_event WHERE id=" . $event_id; $events[] = $wpdb->get_row($query); } $dates = array(); foreach ($events as $ev) { $weekdays_start = array(); $st = $ev->date; if ($ev->date_end != '0000-00-00') { $en = $ev->date_end; } else { $en = date('Y-m-d', strtotime('+24 year', strtotime($st))); } $date_st = explode('-', $st); $date_end = explode('-', $en); $st_d = mktime(0, 0, 0, $date_st[1], $date_st[2], $date_st[0]); $en_d = mktime(0, 0, 0, $date_end[1], $date_end[2], $date_end[0]); $tarb = $en_d - $st_d; $weekly_array = explode(',', $ev->week); for ($j = 0; $j <= 6; $j++) { if (in_array(date("D", mktime(0, 0, 0, $date_st[1], $date_st[2] + $j, $date_st[0])), $weekly_array)) { $weekdays_start[] = $date_st[2] + $j; } } if ($ev->repeat_method == "no_repeat") { $dates[$ev->id][0] = $ev->date; } ///////////////////get days for daily repeat if ($ev->repeat_method == "daily") { if ($ev->repeat == "" || $ev->repeat == "0") { $ev->repeat = "1"; } if ($tarb <= 0) { $day_count = ($st_d - $en_d) / 3600 / 24 / $ev->repeat; } else { $day_count = ($en_d - $st_d) / 3600 / 24 / $ev->repeat; } $dates[$ev->id][0] = $ev->date; } ///////////////////get days for weekly repeat if ($ev->repeat_method == "weekly") { $day_count = ($en_d - $st_d) / 3600 / 24 / ($ev->repeat * 7); $d = array(); $dat = array(); for ($j = 0; $j < count($weekdays_start); $j++) { unset($dat); $dat[] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($weekdays_start[$j]); $d = array_merge($d, $dat); } sort($d); $dates[$ev->id] = $d; } ///////////////////get days for monthly repeat if ($ev->repeat_method == "monthly") { $start_date = strtotime($ev->date); $end_date = strtotime($en); $min_date = min($start_date, $end_date); $max_date = max($start_date, $end_date); $month_count = 0; while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) { $month_count++; } $month_days = date('t', mktime(0, 0, 0, $date_st[1], 1, $date_st[0])); if ($ev->month_type == 1) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($ev->month); } else { if ($ev->monthly_list != 'last') { for ($j = $ev->monthly_list; $j < $ev->monthly_list + 7; $j++) { if (date("D", mktime(0, 0, 0, $date_st[1], $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($j); } } } else { for ($j = 1; $j <= $month_days; $j++) { if (date("D", mktime(0, 0, 0, $date_st[1], $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . $date_st[1] . '-' . add_00($j); } } } } } if ($ev->repeat_method == "yearly") { $start_date = strtotime($ev->date); $end_date = strtotime($en); $min_date = min($start_date, $end_date); $max_date = max($start_date, $end_date); $year_count = 0; while (($min_date = strtotime("+1 year", $min_date)) <= $max_date) { $year_count++; } $month_days = date('t', mktime(0, 0, 0, add_00($ev->year_month), 1, $date_st[0])); if ($ev->month_type == 1) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($ev->month); } else { if ($ev->monthly_list != 'last') { for ($j = $ev->monthly_list; $j < $ev->monthly_list + 7; $j++) { if (date("D", mktime(0, 0, 0, add_00($ev->year_month), $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($j); } } } else { for ($j = 1; $j <= $month_days; $j++) { if (date("D", mktime(0, 0, 0, add_00($ev->year_month), $j, $date_st[0])) == $ev->month_week) { $dates[$ev->id][0] = $date_st[0] . '-' . add_00($ev->year_month) . '-' . add_00($j); } } } } } sort($dates[$ev->id]); } $isk = 1; $j = 0; $ev = 0; foreach ($dates as $ev_id => $date) { $events = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_event WHERE id=' . $ev_id); $event = $events[0]; $event_id = $event->id; $event_title = $event->title; $event_date = $date[0]; $event_end_date = $event->date_end; $event_text = $event->text_for_date; $calendar_id = $event->calendar; $repeat = $event->repeat; $published = $event->published; $year = substr($event_date, 0, 4); $month = substr($event_date, 5, -3); $day = substr($event_date, 8); if ($published == 1) { echo '<div id="event_table' . $id . '" >'; if ($show_numbering == 1) { echo '<div style="padding-top:0px;" class="pad"><a id="title' . $id . '" class="thickbox-preview' . $many_sp_calendar . '" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" ></br><b>' . $isk++ . '.' . $event_title . '</b></a></div>'; } else { echo '<div style="padding-top:0px;" class="pad"><a id="title' . $id . '" class="thickbox-preview' . $many_sp_calendar . '" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" ></br><b>' . $event_title . '</b></a></div>'; } ?> <style> <?php if ($event_text == '') { ?> td #event_date<?php echo $id; ?> { padding-bottom:14px; } <?php } ?> </style> <?php if ($repeat == 1) { $repeat = ""; } $activedatestr = ''; $date_format_array = explode(' ', $date_format); for ($i = 0; $i < count($date_format_array); $i++) { $activedatestr .= __(date("" . $date_format_array[$i] . "", strtotime($event_date)), 'sp_calendar') . ' '; } if ($show_time == 1) { echo '<div id="event_date' . $id . '">' . __($activedatestr, 'sp_calendar') . '</div>'; } if ($show_repeat == 1) { if ($event->repeat_method == "no_repeat") { echo ''; } else { echo '<div id="event_repeat' . $id . '" >'; if ($event->repeat_method == 'daily') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Day', 'sp_calendar') . '</div>'; } if ($event->repeat_method == 'weekly') { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Week(s) on', 'sp_calendar') . ' : '; $week = explode(',', $event->week); for ($g = 0; $g < count($week); $g++) { if ($week[$g] != '') { if ($g != count($week) - 2) { echo week_convert_recent($week[$g]) . ','; } else { echo week_convert_recent($week[$g]); } } } echo '</div>'; } if ($event->repeat_method == 'monthly' and $event->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . $event->month . '</div>'; } if ($event->repeat_method == 'monthly' and $event->month_type == 2) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Month(s) on the', 'sp_calendar') . ' ' . week_number_recent($event->monthly_list) . ' ' . week_convert_recent($event->month_week) . '</div>'; } if ($event->repeat_method == 'yearly' and $event->month_type == 1) { echo '<div>' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $event->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . $event->month . '</div>'; } if ($event->repeat_method == 'yearly' and $event->month_type == 2) { echo '<div >' . __('Repeat Every', 'sp_calendar') . ' ' . $repeat . ' ' . __('Year(s) in', 'sp_calendar') . ' ' . date('F', mktime(0, 0, 0, $event->year_month + 1, 0, 0)) . ' ' . __('on the', 'sp_calendar') . ' ' . week_number_recent($event->monthly_list) . ' ' . week_convert_recent($event->month_week) . '</div>'; } echo '</div>'; } } if ($show_eventtext == 1) { if ($event_text) { //$length = strlen($event_text); $text = mb_substr(html_entity_decode(strip_tags($event_text)), 0, 50); echo '<div id="event_text' . $id . '"><span>' . $text . '</span><br>'; echo '<a class="thickbox-preview' . $many_sp_calendar . '" id="see_more' . $id . '" style="text-decoration:none;" href="' . add_query_arg(array('action' => 'spidercalendarbig', 'theme_id' => $theme_id, 'calendar_id' => $id, 'eventID' => $ev_id, 'widget' => $widget, 'date' => $year . '-' . $month . '-' . $day, 'TB_iframe' => 1, 'tbWidth' => $popup_width, 'tbHeight' => $popup_height), get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php') . '" >' . __('See more', 'sp_calendar') . '</a></div>'; } } echo '<div style="padding-top:6px"><hr id="divider' . $id . '"/></div>'; $j++; echo '</div>'; } $ev++; } } } ?> <?php echo '</div>'; // After widget // echo $after_widget; }
$dates[$ev->id][] = date('Y-m-d', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); } else { $mon = date('F', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); $year = date('Y', strtotime('+' . $ev->repeat . ' year', strtotime($dates[$ev->id][$i]))); $dates[$ev->id][] = date('Y-m-d', strtotime('' . num_to_str($ev->monthly_list) . ' ' . $ev->month_week . ' of ' . $mon . ' ' . $year . '')); } } } sort($dates[$ev->id]); } foreach ($dates as $ev_id => $date) { //echo compare_str_to_array($st_date,$date,$en_date). ' '; $gag[$ev_id] = compare_str_to_array($st_date, $date, $en_date); } if ($ordering == 0 or $ordering1 == 0) { $dates = sorrt($st_date, $dates, $en_date); } $i = 1; $j = 0; $p = 0; foreach ($dates as $ev_id => $date) { if (compare_str_to_array($st_date, $date, $en_date) == '') { continue; } if (compare_str_to_array($st_date, $date, $en_date) != '') { $order_event_current_day = JTable::getInstance('spidercalendar_event', 'Table'); $order_event_current_day->load($ev_id); $event_id = $order_event_current_day->id; $event_title = $order_event_current_day->title; $event_date = compare_str_to_array($st_date, $date, $en_date); $event_end_date = $order_event_current_day->date_end;