本文整理汇总了PHP中tribe_is_recurring_event函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_is_recurring_event函数的具体用法?PHP tribe_is_recurring_event怎么用?PHP tribe_is_recurring_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_is_recurring_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: custom_recurrence_description
/**
* Responsible for displaying a user's custom recurrence pattern description.
*
* @deprecated since 3.6
* @param string $meta_id The meta group this is in.
* @return string The custom description.
* @author Timothy Wood
* @since 3.0
*/
public static function custom_recurrence_description($meta_id)
{
global $_tribe_meta_factory;
$post_id = get_the_ID();
$recurrence_meta = TribeEventsRecurrenceMeta::getRecurrenceMeta($post_id);
$recurrence_description = !empty($recurrence_meta['recCustomRecurrenceDescription']) ? $recurrence_meta['recCustomRecurrenceDescription'] : tribe_get_recurrence_text($post_id);
$html = tribe_is_recurring_event($post_id) ? Tribe_Meta_Factory::template($_tribe_meta_factory->meta[$meta_id]['label'], $recurrence_description, $meta_id) : '';
return apply_filters('tribe_event_pro_meta_custom_recurrence_description', $html);
}
示例2: should_filter_permalink
protected function should_filter_permalink($post, $sample)
{
if ($post->post_type != TribeEvents::POSTTYPE) {
return false;
}
if (!tribe_is_recurring_event($post->ID)) {
return false;
}
$unpublished = isset($post->post_status) && in_array($post->post_status, array('draft', 'pending', 'auto-draft'));
if ($unpublished && !$sample) {
return false;
}
return true;
}
示例3: addDateToEventPermalink
public static function addDateToEventPermalink($permalink, $the_post)
{
global $post;
$event = $the_post ? $the_post : $post;
if (tribe_is_recurring_event($post->ID)) {
$events = TribeEvents::instance();
if ('' == get_option('permalink_structure') || false == $events->getOption('useRewriteRules', true)) {
return esc_url(add_query_arg('eventDate', TribeDateUtils::dateOnly($event->EventStartDate), get_permalink($event->ID)));
} else {
return $permalink . TribeDateUtils::dateOnly($event->EventStartDate);
}
} else {
return $permalink;
}
}
示例4: get_output
public function get_output($event_ID, $complete, $show_seconds, $event_date = null)
{
$ret = $complete;
ob_start();
include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/countdown-widget');
$hourformat = ob_get_clean();
// Get the event start date.
$startdate = tribe_is_recurring_event($event_ID) ? $event_date . ' ' . tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBTIMEFORMAT) : tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
// Get the number of seconds remaining until the date in question.
$seconds = strtotime($startdate) - current_time('timestamp');
if ($seconds > 0) {
$ret = $this->generate_countdown_output($seconds, $complete, $hourformat, $event_ID, $event_date);
}
return $ret;
}
示例5: print_all_events_link
public static function print_all_events_link()
{
if (tribe_is_recurring_event()) {
?>
<p class="tribe-events-back tribe-events-loop">
<a href="<?php
echo esc_url(tribe_get_events_link());
?>
"> <?php
printf('« ' . esc_html__('All %s', 'the-events-calendar'), tribe_get_event_label_plural());
?>
</a>
</p>
<?php
}
}
示例6: tribe_get_recurrence_ical_link
/**
* Returns the link to export the whole recurring series in iCal format.
*
* @param int|WP_Pos|null $event_id A event post object, an event post ID or null to use the globally defined post object.
*
* @return string The absolute URL to export the whole recurring series in iCal format.
*/
function tribe_get_recurrence_ical_link($event_id = null)
{
$event_id = Tribe__Events__Main::postIdHelper($event_id);
if (empty($event_id) || !tribe_is_event($event_id)) {
return '';
}
$event = get_post($event_id);
$parent_id = empty($event->post_parent) ? $event_id : $event->post_parent;
$url = get_permalink($parent_id);
$url_vars = array('ical' => '1');
if (tribe_is_recurring_event($parent_id)) {
$child_events_ids = tribe_get_events(array('fields' => 'ids', 'post_parent' => $parent_id));
$event_ids = array_merge(array($parent_id), $child_events_ids);
$url_vars['event_ids'] = implode(',', $event_ids);
}
$url = add_query_arg($url_vars, $url);
return apply_filters('tribe_get_recurrence_ical_link', $url, $event_id);
}
示例7: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @param int $postId (optional) this only works for non recurring events
* @param bool $displayTime If true shows date and time, if false only shows date
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @return string Date
* @todo support $postId for recurring events.
* @since 2.0
*/
function tribe_get_end_date($postId = null, $displayTime = 'true', $dateFormat = '')
{
$postId = TribeEvents::postIdHelper($postId);
if (!$postId || function_exists('tribe_is_recurring_event') && tribe_is_recurring_event($postId)) {
global $post;
} else {
$post = get_post($postId);
}
if (tribe_get_all_day($postId)) {
$displayTime = false;
}
if (empty($post->EventEndDate)) {
$post->EventEndDate = tribe_get_event_meta($postId, '_EventEndDate', true);
}
if (isset($post->EventEndDate)) {
$date = strtotime($post->EventEndDate);
} else {
return;
// '—';
}
return tribe_event_format_date($date, $displayTime, $dateFormat);
}
示例8: maybe_render_multiple_formatted_times
/**
* Alters the provided formatted time to include all recurrence times for the day
*
* @since 4.0.3
*
* @param string $formatted_time Formatted time range for the given event
* @param int $event_id Event ID
*
* @return string
*/
public function maybe_render_multiple_formatted_times($formatted_time, $event_id)
{
if (!tribe_is_recurring_event($event_id)) {
return $formatted_time;
}
$date = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATEFORMAT);
$time_format = get_option('time_format', Tribe__Date_Utils::TIMEFORMAT);
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$events = $this->get_recurring_events_for_date($event_id, $date);
$formatted_time = null;
foreach ($events as $child) {
$start_time = tribe_get_start_date($child->ID, false, $time_format);
$end_time = tribe_get_end_date($child->ID, false, $time_format);
$formatted_time .= '<div class="tribe-recurring-event-time">';
if ($start_time === $end_time) {
$formatted_time .= esc_html($start_time);
} else {
$formatted_time .= esc_html($start_time . $time_range_separator . $end_time);
}
$formatted_time .= '</div>';
}
return $formatted_time;
}
示例9: add_duplicate_action
public function add_duplicate_action($actions, $post)
{
// Not a post? Bail (we aren't using a typehint since some plugins may pass in something a stdClass object etc)
if (!is_a($post, 'WP_Post')) {
return $actions;
}
// Not an event? Don't add the link
if (Tribe__Events__Main::POSTTYPE !== $post->post_type) {
return $actions;
}
// Recurring event? Don't add the link either!
if (function_exists('tribe_is_recurring_event') && tribe_is_recurring_event($post->ID)) {
return $actions;
}
// Form the link
$url = $this->duplication_link_url($post->ID);
$text = __('Duplicate', 'event-rocket');
$date = tribe_get_start_date($post->ID, false, 'Y-m-d\\TH:i:s');
$title = $this->get_duplicate_post_title($post);
$link = '<a href="' . $url . '" class="eventrocket_duplicate" ' . 'data-date="' . $date . '" ' . 'data-title="' . $title . '" ' . '>' . $text . '</a>';
// Add to the list of actions
$actions['duplicate'] = $link;
return $actions;
}
示例10: is_valid_record
/**
* @param array $record
*
* @return bool
*/
public function is_valid_record(array $record)
{
$valid = parent::is_valid_record($record);
if (empty($valid)) {
return false;
}
$event = $this->get_event_from($record);
if (empty($event)) {
return false;
}
if (function_exists('tribe_is_recurring_event')) {
$is_recurring = tribe_is_recurring_event($event->ID);
if ($is_recurring) {
$this->row_message = sprintf(esc_html__('Recurring event tickets are not supported, event %d.', 'event-tickets'), $event->post_title);
}
return !$is_recurring;
}
$this->row_message = false;
return true;
}
示例11: array
<?php
/**
* @var array $events
*/
$columns = array(_x('ID', 'csv-data', 'eventrocket'), _x('Title', 'csv-data', 'eventrocket'), _x('Description', 'csv-data', 'eventrocket'), _x('Start Date', 'csv-data', 'eventrocket'), _x('Start Time', 'csv-data', 'eventrocket'), _x('End Date', 'csv-data', 'eventrocket'), _x('End Time', 'csv-data', 'eventrocket'), _x('Venue', 'csv-data', 'eventrocket'), _x('Organizer', 'csv-data', 'eventrocket'), _x('All Day', 'csv-data', 'eventrocket'), _x('Recurring', 'csv-data', 'eventrocket'));
echo join(', ', $columns) . "\n";
foreach ($events as $event) {
$fields = array(absint($event->ID), get_the_title($event), $event->post_content, tribe_get_start_date($event->ID, false, 'Y-m-d'), tribe_get_start_date($event->ID, false, 'H:i:s'), tribe_get_end_date($event->ID, false, 'Y-m-d'), tribe_get_end_date($event->ID, false, 'H:i:s'), tribe_get_venue($event->ID), tribe_get_organizer($event->ID), tribe_event_is_all_day($event->ID) ? '1' : '0', tribe_is_recurring_event($event->ID) ? '1' : '0');
foreach ($fields as &$csv_field) {
$csv_field = '"' . str_replace('"', '""', $csv_field) . '"';
}
echo join(', ', $fields) . "\n";
}
示例12: add_event_occurrance_to_edit_link
/**
* Add the date to the edit link for recurring events.
*
* @param string $link The current link.
* @param int $eventId The event id.
* @return string The modified link.
*/
public static function add_event_occurrance_to_edit_link($link, $eventId)
{
if (get_query_var('post_type') != TribeEvents::POSTTYPE) {
return $link;
}
// if is a recurring event
if (function_exists('tribe_is_recurring_event') && tribe_is_recurring_event($eventId) && isset(self::$events_list[0])) {
$link = add_query_arg('eventDate', urlencode(TribeDateUtils::dateOnly(self::$events_list[0]->EventStartDate)), $link);
}
return $link;
}
示例13: _e
</a></dd>
<?php
}
?>
<dt class="event-label event-label-updated"><?php
_e('Updated:', 'tribe-events-calendar');
?>
</dt>
<dd class="event-meta event-meta-updated"><span class="date updated"><?php
the_date();
?>
</span></dd>
<?php
if (class_exists('TribeEventsRecurrenceMeta') && function_exists('tribe_get_recurrence_text') && tribe_is_recurring_event()) {
?>
<dt class="event-label event-label-schedule"><?php
_e('Schedule:', 'tribe-events-calendar');
?>
</dt>
<dd class="event-meta event-meta-schedule"><?php
echo tribe_get_recurrence_text();
?>
<?php
if (class_exists('TribeEventsRecurrenceMeta') && function_exists('tribe_all_occurences_link')) {
?>
(<a href='<?php
tribe_all_occurences_link();
?>
'>See all</a>)<?php
示例14: doEventForm
/**
* Event editing form.
*
* @param int $id the event's ID.
* @return string The editing view markup.
* @author Nick Ciske
* @since 1.0
*/
public function doEventForm($id = null)
{
if (class_exists('TribeEventsPro')) {
// venue and organizer defaults- override ECP defaults
add_filter('tribe_get_single_option', array($this, 'filter_default_venue_id'), 10, 3);
add_filter('tribe_get_single_option', array($this, 'filter_default_organizer_id'), 10, 3);
}
add_filter('tribe-post-origin', array($this, 'filterPostOrigin'));
$output = '';
$show_form = true;
$event = null;
if ($id) {
$edit = true;
$tribe_event_id = $id;
} else {
$edit = false;
$tribe_event_id = null;
}
if ($tribe_event_id && class_exists('TribeEventsPro') && tribe_is_recurring_event($tribe_event_id)) {
$this->enqueueOutputMessage(sprintf(__('%sWarning:%s You are editing a recurring event. All changes will be applied to the entire series.', 'tribe-events-community'), '<b>', '</b>'), 'error');
}
// Delete the featured image, if there was a request to do so.
if (isset($_GET['action']) && $_GET['action'] == 'deleteFeaturedImage' && wp_verify_nonce($_GET['_wpnonce'], 'tribe_community_events_featured_image_delete') && current_user_can('edit_post', $tribe_event_id)) {
$featured_image_id = get_post_thumbnail_id($tribe_event_id);
delete_post_meta($tribe_event_id, '_thumbnail_id');
wp_delete_attachment($featured_image_id, true);
}
if ($edit && $tribe_event_id) {
$event = get_post(intval($tribe_event_id));
global $post;
$old_post = $post;
$post = $event;
}
if ($edit && (!$tribe_event_id || !isset($event->ID))) {
$this->enqueueOutputMessage(__('Event not found.', 'tribe-events-community'), 'error');
$output = $this->outputMessage(null, false);
$show_form = false;
}
// login check
if (!$this->allowAnonymousSubmissions && !is_user_logged_in() || $edit && $tribe_event_id && !is_user_logged_in()) {
do_action('tribe_ce_event_submission_login_form');
$output .= $this->login_form(__('Please log in first.', 'tribe-events-community'));
return $output;
}
// security check
if ($edit && $tribe_event_id && !current_user_can('edit_post', $tribe_event_id)) {
$output .= '<p>' . __('You do not have permission to edit this event.', 'tribe-events-community') . '</p>';
return $output;
}
$this->loadScripts = true;
do_action('tribe_ce_before_event_submission_page');
$output .= '<div id="tribe-community-events" class="form">';
if ($this->allowAnonymousSubmissions || is_user_logged_in()) {
$current_user = wp_get_current_user();
if (class_exists('TribeEventsPro')) {
$tribe_ecp = TribeEventsPro::instance();
}
$submission = $this->get_submitted_event();
if (!empty($submission)) {
// show no sympathy for spammers
if (!is_user_logged_in()) {
$this->spam_check($submission);
}
$submission['ID'] = $tribe_event_id;
require_once 'tribe-community-events-submission-scrubber.php';
$scrubber = new TribeCommunityEvents_SubmissionScrubber($submission);
$_POST = $scrubber->scrub();
// update the event
if ($tribe_event_id && $this->validate_submission_has_required_fields($_POST)) {
if ($this->saveEvent($tribe_event_id)) {
$this->enqueueOutputMessage(__('Event updated.', 'tribe-events-community') . $this->get_view_edit_links($tribe_event_id));
$this->enqueueOutputMessage('<a href="' . $this->getUrl('add') . '">' . __('Submit another event', 'tribe-events-community') . '</a>');
delete_transient('tribe_community_events_today_page');
//clear cache
} else {
$this->enqueueOutputMessage($this->get_error_message($_POST, $tribe_event_id), 'error');
}
} else {
// or create a new one
$_POST['post_status'] = $this->defaultStatus;
if ($this->validate_submission_has_required_fields($_POST)) {
$tribe_event_id = $this->createEvent();
}
if ($tribe_event_id) {
$this->enqueueOutputMessage(__('Event submitted.', 'tribe-events-community') . $this->get_view_edit_links($tribe_event_id));
$this->enqueueOutputMessage('<a href="' . $this->getUrl('add') . '">' . __('Submit another event', 'tribe-events-community') . '</a>');
// email alerts
if ($this->emailAlertsEnabled) {
$this->sendEmailAlerts($tribe_event_id);
}
} else {
$this->enqueueOutputMessage($this->get_error_message($_POST, $tribe_event_id), 'error');
//.........这里部分代码省略.........
示例15: tribe_events_recurrence_tooltip
/**
* show the recurring event info in a tooltip
*
* return the details of the start/end date/time
*
* @since 3.5
* @param int $post_id
* @return string
*/
function tribe_events_recurrence_tooltip($post_id = null)
{
if (empty($post_id)) {
$post_id = get_the_ID();
}
$tooltip = '';
if (tribe_is_recurring_event($post_id)) {
$tooltip .= '<div class="recurringinfo">';
$tooltip .= '<div class="event-is-recurring">';
$tooltip .= '<span class="tribe-events-divider">|</span>';
$tooltip .= __('Recurring Event', 'tribe-events-calendar');
$tooltip .= sprintf(' <a href="%s">%s</a>', tribe_all_occurences_link($post_id, false), __('(See all)', 'tribe-events-calendar'));
$tooltip .= '<div id="tribe-events-tooltip-' . $post_id . '" class="tribe-events-tooltip recurring-info-tooltip">';
$tooltip .= '<div class="tribe-events-event-body">';
$tooltip .= tribe_get_recurrence_text($post_id);
$tooltip .= '</div>';
$tooltip .= '<span class="tribe-events-arrow"></span>';
$tooltip .= '</div>';
$tooltip .= '</div>';
$tooltip .= '</div>';
}
$tooltip = apply_filters('tribe_events_event_recurring_info_tooltip', $tooltip);
// for backwards-compat, will be removed
return apply_filters('tribe_events_recurrence_tooltip', $tooltip);
}