本文整理汇总了PHP中TribeEvents::get_series_start_date方法的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents::get_series_start_date方法的具体用法?PHP TribeEvents::get_series_start_date怎么用?PHP TribeEvents::get_series_start_date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TribeEvents
的用法示例。
在下文中一共展示了TribeEvents::get_series_start_date方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRealStartDate
/**
* Sorts the meta to ensure we are getting the real start date
* @deprecated since 3.4
* @param int $postId
* @return string
*/
public static function getRealStartDate($postId)
{
return TribeEvents::get_series_start_date($postId);
}
示例2: get_series_start_date
/**
* Placed here for compatibility reasons. This can be removed
* when Events Calendar 3.2 or greater is released
*
* @todo Remove this method
*
* @param int $post_id
*
* @return string
* @see TribeEvents::get_series_start_date()
*/
private static function get_series_start_date($post_id)
{
if (method_exists('TribeEvents', 'get_series_start_date')) {
return TribeEvents::get_series_start_date($post_id);
}
$start_dates = tribe_get_recurrence_start_dates($post_id);
return reset($start_dates);
}
示例3: get_series_start_date
/**
* Placed here for compatibility reasons. This can be removed
* when Events Calendar 3.2 or greater is released
*
* @todo Remove this method
* @param int $post_id
* @return string
* @see TribeEvents::get_series_start_date()
*/
private static function get_series_start_date($post_id)
{
if (method_exists('TribeEvents', 'get_series_start_date')) {
return TribeEvents::get_series_start_date($post_id);
}
$start_dates = get_post_meta($post_id, '_EventStartDate', false);
if ($start_dates) {
return min($start_dates);
}
return '';
}
示例4: saveEventMeta
/**
* Used by createEvent and updateEvent - saves all the various event meta
*
* @param int $event_id The event ID we are modifying meta for.
* @param array $data The meta fields we want saved.
* @param WP_Post The event itself.
* @return void
*/
public static function saveEventMeta($event_id, $data, $event = null)
{
$tribe_ecp = TribeEvents::instance();
if (isset($data['EventAllDay']) && ($data['EventAllDay'] == 'yes' || $data['EventAllDay'] == true || !isset($data['EventStartDate']))) {
$data['EventStartDate'] = TribeDateUtils::beginningOfDay($data['EventStartDate']);
$data['EventEndDate'] = TribeDateUtils::endOfDay($data['EventEndDate']);
} else {
delete_post_meta($event_id, '_EventAllDay');
if (isset($data['EventStartMeridian'])) {
$data['EventStartDate'] = date(TribeDateUtils::DBDATETIMEFORMAT, strtotime($data['EventStartDate'] . " " . $data['EventStartHour'] . ":" . $data['EventStartMinute'] . ":00 " . $data['EventStartMeridian']));
$data['EventEndDate'] = date(TribeDateUtils::DBDATETIMEFORMAT, strtotime($data['EventEndDate'] . " " . $data['EventEndHour'] . ":" . $data['EventEndMinute'] . ":00 " . $data['EventEndMeridian']));
} else {
$data['EventStartDate'] = date(TribeDateUtils::DBDATETIMEFORMAT, strtotime($data['EventStartDate'] . " " . $data['EventStartHour'] . ":" . $data['EventStartMinute'] . ":00"));
$data['EventEndDate'] = date(TribeDateUtils::DBDATETIMEFORMAT, strtotime($data['EventEndDate'] . " " . $data['EventEndHour'] . ":" . $data['EventEndMinute'] . ":00"));
}
}
if (!isset($data['EventHideFromUpcoming']) || !$data['EventHideFromUpcoming']) {
delete_post_meta($event_id, '_EventHideFromUpcoming');
}
// sanity check that start date < end date
$startTimestamp = strtotime($data['EventStartDate']);
$endTimestamp = strtotime($data['EventEndDate']);
if ($startTimestamp > $endTimestamp) {
$data['EventEndDate'] = $data['EventStartDate'];
}
$data['EventDuration'] = strtotime($data['EventEndDate']) - $startTimestamp;
$old_data['EventStartDate'] = TribeEvents::get_series_start_date($event_id);
update_post_meta($event_id, '_EventShowMapLink', isset($data['venue']['EventShowMapLink']));
update_post_meta($event_id, '_EventShowMap', isset($data['venue']['EventShowMap']));
if (isset($data['post_status'])) {
$post_status = $data['post_status'];
} else {
//print_r($data);
if (isset($data["Organizer"]["OrganizerID"])) {
$post_status = get_post($data["Organizer"]['OrganizerID'])->post_status;
}
if (isset($data['Venue']["VenueID"])) {
$post_status = get_post($data['Venue']['VenueID'])->post_status;
}
}
if (isset($data["Organizer"])) {
$data['EventOrganizerID'] = TribeEventsAPI::saveEventOrganizer($data["Organizer"], $event, $post_status);
}
if (isset($data["Venue"])) {
$data['EventVenueID'] = TribeEventsAPI::saveEventVenue($data["Venue"], $event, $post_status);
}
$cost = isset($data['EventCost']) ? $data['EventCost'] : '';
$data['EventCost'] = $cost;
do_action('tribe_events_event_save', $event_id);
$cost = isset($data['EventCost']) ? $data['EventCost'] : '';
$data['EventCost'] = $cost;
//update meta fields
foreach ($tribe_ecp->metaTags as $tag) {
$htmlElement = ltrim($tag, '_');
if (isset($data[$htmlElement]) && $tag != TribeEvents::EVENTSERROROPT) {
if (is_string($data[$htmlElement])) {
$data[$htmlElement] = filter_var($data[$htmlElement], FILTER_SANITIZE_STRING);
}
if (isset($old_data[$htmlElement])) {
update_post_meta($event_id, $tag, $data[$htmlElement], $old_data[$htmlElement]);
} else {
update_post_meta($event_id, $tag, $data[$htmlElement]);
}
}
}
// Set sticky state for calendar view.
if (isset($data['EventShowInCalendar']) && $data['EventShowInCalendar'] == 'yes' && $event->menu_order != '-1') {
$update_event = array('ID' => $event_id, 'menu_order' => '-1');
wp_update_post($update_event);
} elseif ((!isset($data['EventShowInCalendar']) || $data['EventShowInCalendar'] != 'yes') && $event->menu_order == '-1') {
$update_event = array('ID' => $event_id, 'menu_order' => '0');
wp_update_post($update_event);
}
do_action('tribe_events_update_meta', $event_id, $data);
}
示例5: doDelete
/**
* Delete view for an event.
*
* @param int $tribe_event_id The event's ID.
* @return string The deletion view.
* @author Nick Ciske
* @since 1.0
*/
public function doDelete($tribe_event_id)
{
$this->default_template_compatibility();
if (isset($_GET['eventDate'])) {
$eventDate = date('Y-m-d', strtotime($_GET['eventDate']));
}
if (isset($_GET['deleteAll'])) {
$deleteAll = true;
}
$current_user = wp_get_current_user();
if (wp_verify_nonce($_GET['_wpnonce'], 'tribe_community_events_delete') && current_user_can('delete_post', $tribe_event_id)) {
//does this event even exist?
$event = get_post($tribe_event_id);
if (isset($event->ID)) {
if (isset($deleteAll) && $deleteAll || !isset($eventDate)) {
if ($this->trashItemsVsDelete) {
wp_trash_post($tribe_event_id);
$this->enqueueOutputMessage(__('Trashed Event #', 'tribe-events-community') . $tribe_event_id);
} else {
wp_delete_post($tribe_event_id, true);
$this->enqueueOutputMessage(__('Deleted Event #', 'tribe-events-community') . $tribe_event_id);
}
} else {
$date = $eventDate;
$startDate = TribeEvents::get_series_start_date($tribe_event_id);
$date = TribeDateUtils::addTimeToDate($date, TribeDateUtils::timeOnly($startDate));
delete_post_meta($tribe_event_id, '_EventStartDate', $date);
$this->enqueueOutputMessage(sprintf(__('Removed occurence %s from Event #', 'tribe-events-community') . $tribe_event_id, $eventDate));
}
} else {
$this->enqueueOutputMessage(sprintf(__('This event (#%s) does not appear to exist.', 'tribe-events-community'), $tribe_event_id));
}
} else {
$this->enqueueOutputMessage(__('You do not have permission to delete this event.', 'tribe-events-community'));
}
$output = '<div id="tribe-community-events" class="delete">';
ob_start();
$this->addScriptsAndStyles();
include TribeEventsTemplates::getTemplateHierarchy('community/modules/delete');
$output .= ob_get_clean();
$output .= '<a href="javascript:history.go(-1);">« ' . _x('Back', 'As in "go back to previous page"', 'tribe-events-community') . '</a>';
$output .= '</div>';
return $output;
}