Esempio n. 1
0
 /**
  * Make sure ical link has the date in the URL instead of "today" on day view
  *
  * @param $link
  *
  * @return string
  */
 public static function day_view_ical_link($link)
 {
     if (tribe_is_day()) {
         global $wp_query;
         $day = $wp_query->get('start_date');
         $link = trailingslashit(esc_url(trailingslashit(tribe_get_day_link($day)) . '?ical=1'));
     }
     return $link;
 }
Esempio n. 2
0
 /**
  * Output an html link to a day
  *
  * @param string $date 'previous day', 'next day', 'yesterday', 'tomorrow', or any date string that strtotime() can parse
  * @param string $text text for the link
  * @return void
  * @since 3.0
  **/
 function tribe_the_day_link($date = null, $text = null)
 {
     try {
         if (is_null($text)) {
             $text = tribe_get_the_day_link_label($date);
         }
         $date = tribe_get_the_day_link_date($date);
         $link = tribe_get_day_link($date);
         $html = '<a href="' . $link . '" data-day="' . $date . '" rel="prev">' . $text . '</a>';
     } catch (OverflowException $e) {
         $html = '';
     }
     echo apply_filters('tribe_the_day_link', $html);
 }
Esempio n. 3
0
 /**
  * Output an html link to a day
  *
  * @category Events
  * @param string $date 'previous day', 'next day', 'yesterday', 'tomorrow', or any date string that strtotime() can parse
  * @param string $text text for the link
  *
  **/
 function tribe_the_day_link($date = null, $text = null)
 {
     $html = '';
     try {
         if (is_null($text)) {
             $text = tribe_get_the_day_link_label($date);
         }
         $date = tribe_get_the_day_link_date($date);
         $link = tribe_get_day_link($date);
         $earliest = tribe_events_earliest_date(Tribe__Date_Utils::DBDATEFORMAT);
         $latest = tribe_events_latest_date(Tribe__Date_Utils::DBDATEFORMAT);
         if ($date >= $earliest && $date <= $latest) {
             $html = '<a href="' . esc_url($link) . '" data-day="' . $date . '" rel="prev">' . $text . '</a>';
         }
     } catch (OverflowException $e) {
     }
     echo apply_filters('tribe_the_day_link', $html);
 }
Esempio n. 4
0
<?php 
if ($day['date'] != 'previous' && $day['date'] != 'next') {
    ?>

	<!-- Day Header -->
	<div id="tribe-events-daynum-<?php 
    echo $day['daynum'];
    ?>
">

		<?php 
    if ($day['total_events'] > 0 && tribe_events_is_view_enabled('day')) {
        ?>
			<a href="<?php 
        echo tribe_get_day_link($day['date']);
        ?>
"><?php 
        echo $day['daynum'];
        ?>
</a>
		<?php 
    } else {
        ?>
			<?php 
        echo $day['daynum'];
        ?>
		<?php 
    }
    ?>
 /**
  * Get the view more link
  *
  * @param integer $date
  *
  * @return string
  */
 private static function view_more_link($date)
 {
     $day_link = tribe_get_day_link($date);
     $tribe_bar_args = self::get_tribe_bar_args();
     if (!empty($tribe_bar_args)) {
         $day_link = add_query_arg($tribe_bar_args, $day_link);
     }
     return esc_url_raw($day_link);
 }
Esempio n. 6
0
$day = tribe_events_get_current_month_day();
?>



<!-- Events List -->
<div class="tribe-month-single-day">
	<div class="tribe-month-daynumber" id="tribe-events-daynum-<?php 
echo trim($day['daynum']);
?>
">
		<?php 
if ($day['total_events'] > 0 && tribe_events_is_view_enabled('day')) {
    ?>
			<a href="<?php 
    echo esc_url(tribe_get_day_link($day['date']));
    ?>
"><?php 
    echo trim($day['daynum']);
    ?>
</a>
		<?php 
} else {
    ?>
			<a> <?php 
    echo trim($day['daynum']);
    ?>
</a>
		<?php 
}
?>
Esempio n. 7
0
 /**
  * Output an html link to a day
  *
  * @param $date 'previous day', 'next day', 'yesterday', 'tomorrow', or any date string that strtotime() can parse
  * @param $text text for the link
  * @param $term bool whether to show the link with the tribe event taxonomy
  * @return void
  * @since 3.0
  **/
 function tribe_the_day_link($date = null, $text = null, $term = true)
 {
     global $wp_query;
     if (is_null($text)) {
         switch (strtolower($date)) {
             case null:
                 $text = __('Today', 'tribe-events-calendar-pro');
                 break;
             case 'previous day':
                 $text = __('&laquo; Previous Day', 'tribe-events-calendar-pro');
                 break;
             case 'next day':
                 $text = __('Next Day &raquo;', 'tribe-events-calendar-pro');
                 break;
             case 'yesterday':
                 $text = __('Yesterday', 'tribe-events-calendar-pro');
                 break;
             case 'tomorrow':
                 $text = __('Tomorrow', 'tribe-events-calendar-pro');
                 break;
             default:
                 $text = date_i18n('Y-m-d', strtotime($date));
                 break;
         }
     }
     switch ($date) {
         case null:
             $date = TribeEventsPro::instance()->todaySlug;
             break;
         case 'previous day':
             $date = Date('Y-m-d', strtotime($wp_query->get('start_date') . " -1 day"));
             break;
         case 'next day':
             $date = Date('Y-m-d', strtotime($wp_query->get('start_date') . " +1 day"));
             break;
     }
     $link = tribe_get_day_link($date);
     $html = '<a href="' . $link . '" data-day="' . $date . '" rel="prev">' . $text . '</a>';
     echo apply_filters('tribe_the_day_link', $html);
 }
Esempio n. 8
0
 /**
  * Get the view more link
  *
  * @param int $date
  * @param array $args
  * @return string
  */
 private static function view_more_link($date, $args)
 {
     if (!empty(self::$event_daily_counts[$date]) && (int) self::$event_daily_counts[$date] > self::$posts_per_page_limit) {
         $day_link = tribe_get_day_link($date);
         if (!empty($args)) {
             $day_link = add_query_arg($args, $day_link);
         }
         return $day_link;
     }
     return '';
 }
Esempio n. 9
0
 /**
  * Get the link to download the ical version of day view
  * @param $link
  *
  * @return string
  */
 public function ical_link($link)
 {
     global $wp_query;
     $day = $wp_query->get('start_date');
     return trailingslashit(esc_url(trailingslashit(tribe_get_day_link($day)) . '?ical=1'));
 }
Esempio n. 10
0
 /**
  * Add day view to the views selector in the tribe events bar.
  *
  * @param array $views The current array of views registered to the tribe bar.
  *
  * @return array The views registered with day view added.
  */
 public function setup_dayview_in_bar($views)
 {
     $views[] = array('displaying' => 'day', 'anchor' => __('Day', 'the-events-calendar'), 'event_bar_hook' => 'tribe_events_before_template', 'url' => tribe_get_day_link());
     return $views;
 }
Esempio n. 11
0
        }
    } elseif ($current_month > $month && $current_year == $year || $current_year > $year) {
        $ppf = ' tribe-events-past';
    } elseif ($current_month < $month && $current_year == $year || $current_year < $year) {
        $ppf = ' tribe-events-future';
    } else {
        $ppf = false;
    }
    echo "<li class='tribe-events-thismonth" . $ppf . "'>";
    //echo tribe_mini_display_day( $day, $monthView, $month, $date ) . "\n";
    echo "<div class='daynum tribe-events-event' id='daynum_{$day}'>";
    $abbrMonth = $tribe_ecp->monthsShort[date('M', $date)];
    echo "<span class='tribe-month-name'>{$abbrMonth}</span>";
    if (count($monthView[$day])) {
        $dateLink = tribe_get_start_date('', false, 'Y-m-' . $day . '');
        echo "<a href='" . tribe_get_day_link($dateLink) . "' class='tribe-events-mini-has-event'>";
        echo $day;
        echo "</a>";
    } else {
        echo $day;
    }
    echo "</div>";
    echo "</li>";
}
// skip next month
while ($day + $offset <= $rows * 7) {
    echo "<li class='tribe-events-othermonth'></li>";
    $day++;
}
?>
	</ul>
Esempio n. 12
0
 /**
  * Return the text used in week day headers wrapped in a <span> tag and data attribute needed for mobile js.
  *
  * @return string
  */
 function tribe_events_week_day_header()
 {
     $day = tribe_events_week_get_current_day();
     $html = '<span data-full-date="' . $day['formatted_date'] . '">' . $day['formatted_date'] . '</span>';
     // if day view is enabled and there are events on the day, make it a link to the day
     if (tribe_events_is_view_enabled('day') && $day['has_events']) {
         $html = '<a href="' . tribe_get_day_link(tribe_events_week_get_the_date(false)) . '" rel="bookmark">' . $html . '</span></a>';
     }
     return apply_filters('tribe_events_week_day_header', $html);
 }
Esempio n. 13
0
</span>
		</div>
		<div class="tribe-grid-content-wrap">
			<?php 
while (tribe_events_week_have_days()) {
    tribe_events_week_the_day();
    ?>
			<div title="<?php 
    tribe_events_week_get_the_date();
    ?>
" class="column <?php 
    echo tribe_events_week_is_current_today() ? 'tribe-week-today' : '';
    ?>
">
				<a href="<?php 
    echo tribe_get_day_link(tribe_events_week_get_the_date(false));
    ?>
" rel="bookmark"><?php 
    tribe_events_week_get_the_day_display();
    ?>
</a>
			</div><!-- header column -->
			<?php 
}
?>
		</div><!-- .tribe-grid-content-wrap -->
	</div><!-- .tribe-grid-header -->
	<?php 
tribe_get_template_part('week/loop', 'grid-allday');
?>
	<?php 
Esempio n. 14
0
 /**
  * This Week Query
  *
  *
  *  @return object
  */
 public static function this_week_query($this_week_query_vars)
 {
     //Only Get Private Events if user can view
     $post_status = array('publish');
     if (current_user_can('read_private_tribe_events')) {
         $post_status[] = 'private';
     }
     //Get Events with Hide From Event Listings Checked
     $hide_upcoming_ids = Tribe__Events__Query::getHideFromUpcomingEvents();
     $this_week_widget_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'tax_query' => $this_week_query_vars['tax_query'], 'eventDisplay' => 'custom', 'start_date' => $this_week_query_vars['start_date'], 'end_date' => $this_week_query_vars['end_date'], 'post_status' => $post_status, 'tribeHideRecurrence' => false, 'post__not_in' => $hide_upcoming_ids, 'tribe_render_context' => 'widget', 'posts_per_page' => -1);
     /**
      * Filter This Week Widget args
      *
      * @param array $this_week_widget_args Arguments for This Week Widget
      */
     $this_week_widget_args = apply_filters('tribe_events_pro_this_week_widget_query_args', $this_week_widget_args);
     // Get all the upcoming events for this week
     $events = tribe_get_events($this_week_widget_args, true);
     //Days Array to set events for each day
     $week_days = array();
     //Set First Day
     $day = $this_week_query_vars['start_date'];
     //Get Day Range
     $day_range = self::get_day_range();
     //Todays Date According to WordPress
     $timestamp_today = strtotime(current_time(Tribe__Date_Utils::DBDATEFORMAT));
     //Date Formats from The Events Calendar
     $display_date_format = apply_filters('tribe_events_this_week_date_format', 'jS');
     $display_day_format = apply_filters('tribe_events_this_week_day_format', 'D ');
     // Array used for calculation of php strtotime relative dates
     $weekday_array = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     //Build an Array for Each Day
     foreach ($day_range as $i => $day_number) {
         //If Hide Weekends True then skip those days
         if ($this_week_query_vars['hide_weekends'] === 'true' && ($day_number == 0 || $day_number == 6)) {
             continue;
         }
         // figure out the $date that we're currently looking at
         if ($day_number >= $day_range[0]) {
             // usually we can just get the date for the next day
             $date = date(Tribe__Date_Utils::DBDATEFORMAT, strtotime($day . "+{$i} days"));
         } else {
             //Start Day of week in the Middle and not in typical Sunday or Monday
             $date = date(Tribe__Date_Utils::DBDATEFORMAT, strtotime("Next {$weekday_array[$day_number]}", strtotime($day)));
         }
         $this_week_events_sticky = $this_week_events = array();
         if ($events->have_posts()) {
             //loop through all events and sort based on sticky or not
             foreach ($events->posts as $j => $event) {
                 if (tribe_event_is_on_date($date, $event)) {
                     $event->days_between = tribe_get_days_between($event->EventStartDate, $event->EventEndDate, true);
                     if ($event->menu_order == -1) {
                         $this_week_events_sticky[] = $event;
                     } else {
                         $this_week_events[] = $event;
                     }
                 }
             }
         }
         //Merge the two arrays for the day only if sticky events are included for that day
         if (!empty($this_week_events_sticky) && is_array($this_week_events_sticky) && is_array($this_week_events)) {
             $this_week_events = array_merge($this_week_events_sticky, $this_week_events);
         }
         $formatted_date = date_i18n($display_date_format, strtotime($date));
         $formatted_day = date_i18n($display_day_format, strtotime($date));
         $timestamp_date = strtotime($date);
         // create the "day" element to do display in the template
         $week_days[] = array('date' => $date, 'day_number' => $day_number, 'formatted_date' => $formatted_date, 'formatted_day' => $formatted_day, 'is_today' => $timestamp_date == $timestamp_today ? true : false, 'is_past' => $timestamp_date < $timestamp_today ? true : false, 'is_future' => $timestamp_date > $timestamp_today ? true : false, 'this_week_events' => $this_week_events, 'has_events' => $this_week_events, 'total_events' => count($this_week_events), 'events_limit' => $this_week_query_vars['count'], 'view_more' => count($this_week_events) > $this_week_query_vars['count'] ? esc_url_raw(tribe_get_day_link($date)) : false);
     }
     return $week_days;
 }
Esempio n. 15
0
 /** 
  * Day View Link
  * 
  * Get a link to day view
  *
  * @param string $date
  * @param string $day
  * @return string HTML linked date
  * @since 2.0
  */
 function tribe_get_linked_day($date, $day)
 {
     $return = '';
     $return .= "<a href='" . tribe_get_day_link($date) . "'>";
     $return .= $day;
     $return .= "</a>";
     return apply_filters('tribe_get_linked_day', $return);
 }