本文整理汇总了PHP中TribeEvents类的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents类的具体用法?PHP TribeEvents怎么用?PHP TribeEvents使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TribeEvents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tribe_get_gcal_link
/**
* Google Calendar Link
*
* Returns an "add to Google Calendar link for a single event. Must be used in the loop
*
* @param int $postId (optional)
*
* @return string URL for google calendar.
* @since 2.0
*/
function tribe_get_gcal_link($postId = null)
{
$postId = TribeEvents::postIdHelper($postId);
$tribe_ecp = TribeEvents::instance();
$output = esc_url($tribe_ecp->googleCalendarLink($postId));
return apply_filters('tribe_get_gcal_link', $output);
}
示例2: init
/**
* Initialize the class and place hooks and styling.
*/
function init()
{
$this->title(__('Tribe', 'tribe-events-calendar'));
remove_action('tribe_debug', array(TribeEvents::instance(), 'renderDebug'), 10, 2);
add_action('tribe_debug', array($this, 'logDebug'), 8, 3);
wp_enqueue_style('tribe-debugger', TribeEvents::instance()->pluginUrl . 'resources/debugger.css');
}
示例3: hack_to_remove_broken_filters
private function hack_to_remove_broken_filters()
{
// a stupid hack for some stupid code
// the callback will automatically replace every Venue title with "Unnamed Venue"
$TribeEvents = TribeEvents::instance();
remove_action('save_post', array($TribeEvents, 'save_venue_data'), 16, 2);
}
示例4: tribe_events_the_mini_calendar_next_link
/**
* Output a link for the mini calendar month next nav, includes data attributes needed to update the month with ajax
*
* @return void
* @since 3.0
* @author Jessica Yazbek
**/
function tribe_events_the_mini_calendar_next_link()
{
$tribe_ecp = TribeEvents::instance();
$args = tribe_events_get_mini_calendar_args();
$html = '<a class="tribe-mini-calendar-nav-link next-month" href="#" data-month="' . $tribe_ecp->nextMonth($args['eventDate']) . '-01" title="' . tribe_get_next_month_text() . '"><span>»</span></a>';
echo apply_filters('tribe_events_the_mini_calendar_prev_link', $html);
}
示例5: tribe_attachment_404_fix
function tribe_attachment_404_fix()
{
if (class_exists('TribeEvents')) {
remove_action('init', array(TribeEvents::instance(), 'init'), 10);
add_action('init', array(TribeEvents::instance(), 'init'), 1);
}
}
示例6: _backend_load_event_of_date
function _backend_load_event_of_date()
{
if (isset($_POST['event_date']) && $_POST['event_date']) {
TribeEventsQuery::init();
$states[] = 'publish';
if (0 < get_current_user_id()) {
$states[] = 'private';
}
$args = array('post_status' => $states, 'eventDate' => $_POST["event_date"], 'eventDisplay' => 'day');
TribeEvents::instance()->displaying = 'day';
$query = TribeEventsQuery::getEvents($args, true);
global $wp_query, $post;
$wp_query = $query;
add_filter('tribe_is_day', '__return_true');
$html = '';
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$html .= '<option value="' . get_the_ID() . '"> ' . get_the_title() . '</option>';
}
wp_reset_postdata();
}
$response = array('html' => $html, 'success' => true, 'total_count' => $query->found_posts, 'view' => 'day');
header('Content-type: application/json');
echo json_encode($response);
die;
}
}
示例7: set_notices
/**
* Set the notices used on week view
*
* @since 3.0
* @author tim@imaginesimplicty.com
* @return void
* */
function set_notices()
{
global $wp_query;
$search_term = $geographic_term = '';
// We have events to display, no need for notices!
if (!empty(self::$events->all_day) || !empty(self::$events->hourly)) {
return;
}
// Was the user searching for a keyword or place?
if (!empty($wp_query->query_vars['s'])) {
$search_term = $wp_query->query_vars['s'];
} elseif (!empty($_REQUEST['tribe-bar-search'])) {
$search_term = $_REQUEST['tribe-bar-search'];
} elseif (!empty($_REQUEST['tribe-bar-geoloc'])) {
$geographic_term = $_REQUEST['tribe-bar-geoloc'];
}
// Set an appropriate notice
if (!empty($search_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong> this week. Try searching another week.', 'tribe-events-calendar-pro'), esc_html($search_term)));
} elseif (!empty($geographic_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('No results were found for events in or near <strong>"%s"</strong> this week. Try searching another week.', 'tribe-events-calendar-pro'), esc_html($geographic_term)));
} else {
TribeEvents::setNotice('event-search-no-results', __('No results were found for this week. Try searching another week.', 'tribe-events-calendar-pro'));
}
}
示例8: form
function form($instance)
{
/* Set up default widget settings. */
$defaults = array('title' => 'Upcoming Events', 'limit' => '5', 'no_upcoming_events' => false);
$instance = wp_parse_args((array) $instance, $defaults);
$tribe_ecp = TribeEvents::instance();
include $tribe_ecp->pluginPath . 'admin-views/widget-admin-list.php';
}
示例9: krafit_event_meta_cats
/**
* Replaces tribe_event_meta_cats();
*/
function krafit_event_meta_cats($label = null, $separator = ', ')
{
if (!$label) {
$label = '';
}
$tribe_ecp = TribeEvents::instance();
$list = apply_filters('krafit_event_meta_cats', get_the_term_list(get_the_ID(), $tribe_ecp->get_event_taxonomy(), '<h3 class="event-preheader">' . $label . '', $separator, '</h3>'));
echo $list;
}
示例10: column_order_status
function column_order_status($item)
{
$icon = "";
if (strtolower($item['order_status']) !== 'completed') {
$tec = TribeEvents::instance();
$icon = sprintf("<span class='warning'><img src='%s'/></span> ", trailingslashit($tec->pluginUrl) . 'resources/warning.png');
}
return $icon . ucwords($item['order_status']);
}
示例11: tribe_events_agenda_add_routes
/**
* Add the agenda view rewrite rule
*
* @param $wp_rewrite the WordPress rewrite rules object
* @return void
**/
function tribe_events_agenda_add_routes($wp_rewrite)
{
// Get the instance of the TribeEvents plugin, and the rewriteSlug that the plugin uses
$tec = TribeEvents::instance();
$tec_rewrite_slug = trailingslashit($tec->rewriteSlug);
// create new rule for the agenda view
$newRules = array($tec_rewrite_slug . 'agenda/?$' => 'index.php?post_type=' . TribeEvents::POSTTYPE . '&eventDisplay=agenda');
// Add the new rule to the global rewrite rules array
$wp_rewrite->rules = $newRules + $wp_rewrite->rules;
}
示例12: set_notices
/**
* Set up the notices for this template
*
* @return void
* @since 3.0
**/
public function set_notices()
{
parent::set_notices();
// Check if event has passed
$gmt_offset = get_option('gmt_offset') >= '0' ? ' +' . get_option('gmt_offset') : " " . get_option('gmt_offset');
$gmt_offset = str_replace(array('.25', '.5', '.75'), array(':15', ':30', ':45'), $gmt_offset);
if (!tribe_is_showing_all() && strtotime(tribe_get_end_date(get_the_ID(), false, 'Y-m-d G:i') . $gmt_offset) <= time()) {
TribeEvents::setNotice('event-past', __('This event has passed.', 'tribe-events-calendar'));
}
}
示例13: test_previous_ecp_versions_saving
/**
* Check to make sure that 'previous_ecp_versions' is saving correctly.
*
* @since 2.0.5
* @author Paul Hughes
*/
function test_previous_ecp_versions_saving()
{
$tribe_ecp = TribeEvents::instance();
$tribe_ecp->init();
$tribe_ecp->setOption('latest_ecp_version', '1.6.5');
$tribe_ecp->init();
$previous_ecp_versions = tribe_get_option('previous_ecp_versions');
$this->assertEquals('0', $previous_ecp_versions[0]);
$this->assertEquals('1.6.5', $previous_ecp_versions[1]);
$this->assertFalse(isset($previous_ecp_versions[2]));
}
示例14: attendees_page_load_css_js
/**
* Enqueues the JS and CSS for the attendees page in the admin
* @param $hook
*/
public function attendees_page_load_css_js($hook)
{
if ($hook != $this->attendees_page) {
return;
}
$ecp = TribeEvents::instance();
wp_enqueue_style(TribeEventsTicketsPro::$attendees_slug, trailingslashit($ecp->pluginUrl) . 'resources/tickets-attendees.css', array(), apply_filters('tribe_events_css_version', TribeEvents::VERSION));
wp_enqueue_style(TribeEventsTicketsPro::$attendees_slug . '-print', trailingslashit($ecp->pluginUrl) . 'resources/tickets-attendees-print.css', array(), apply_filters('tribe_events_css_version', TribeEvents::VERSION), 'print');
wp_enqueue_script(TribeEventsTicketsPro::$attendees_slug, trailingslashit($ecp->pluginUrl) . 'resources/tickets-attendees.js', array('jquery'), apply_filters('tribe_events_js_version', TribeEvents::VERSION));
$mail_data = array('nonce' => wp_create_nonce('email-attendee-list'), 'required' => __('You need to select a user or type a valid email address', 'tribe-events-calendar'), 'sending' => __('Sending...', 'tribe-events-calendar'), 'checkin_nonce' => wp_create_nonce('checkin'), 'uncheckin_nonce' => wp_create_nonce('uncheckin'));
wp_localize_script(TribeEventsTicketsPro::$attendees_slug, 'Attendees', $mail_data);
}
示例15: ajax_response
/**
* AJAX handler for the Map view
*/
function ajax_response()
{
$tribe_paged = !empty($_POST['tribe_paged']) ? $_POST['tribe_paged'] : 1;
TribeEventsQuery::init();
$defaults = array('post_type' => TribeEvents::POSTTYPE, 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'paged' => $tribe_paged, 'post_status' => array('publish'), 'eventDisplay' => 'map');
$view_state = 'map';
/* if past view */
if (!empty($_POST['tribe_event_display']) && $_POST['tribe_event_display'] == 'past') {
$view_state = 'past';
$defaults['eventDisplay'] = 'past';
}
if (isset($_POST['tribe_event_category'])) {
$defaults[TribeEvents::TAXONOMY] = $_POST['tribe_event_category'];
}
$query = TribeEventsQuery::getEvents($defaults, true);
$have_events = 0 < $query->found_posts;
if ($have_events && TribeEventsGeoLoc::instance()->is_geoloc_query()) {
$lat = isset($_POST['tribe-bar-geoloc-lat']) ? $_POST['tribe-bar-geoloc-lat'] : 0;
$lng = isset($_POST['tribe-bar-geoloc-lng']) ? $_POST['tribe-bar-geoloc-lng'] : 0;
TribeEventsGeoLoc::instance()->assign_distance_to_posts($query->posts, $lat, $lng);
} elseif (!$have_events && isset($_POST['tribe-bar-geoloc'])) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('No results were found for events in or near <strong>"%s"</strong>.', 'tribe-events-calendar-pro'), esc_html($_POST['tribe-bar-geoloc'])));
} elseif (!$have_events && isset($_POST['tribe_event_category'])) {
TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s. Please try viewing the full calendar for a complete list of events.', 'tribe-events-calendar'), esc_html($_POST['tribe_event_category'])));
} elseif (!$have_events) {
TribeEvents::setNotice('event-search-no-results', __('There were no results found.', 'tribe-events-calendar-pro'));
}
$response = array('html' => '', 'markers' => array(), 'success' => true, 'tribe_paged' => $tribe_paged, 'max_pages' => $query->max_num_pages, 'total_count' => $query->found_posts, 'view' => $view_state);
// @TODO: clean this up / refactor the following conditional
if ($have_events) {
global $wp_query, $post;
$data = $query->posts;
$post = $query->posts[0];
$wp_query = $query;
TribeEvents::instance()->displaying = 'map';
ob_start();
tribe_get_view('pro/map/content');
$response['html'] .= ob_get_clean();
$response['markers'] = TribeEventsGeoLoc::instance()->generate_markers($data);
} else {
global $wp_query;
$wp_query = $query;
TribeEvents::instance()->setDisplay();
ob_start();
tribe_get_view('pro/map/content');
$response['html'] .= ob_get_clean();
}
$response = apply_filters('tribe_events_ajax_response', $response);
header('Content-type: application/json');
echo json_encode($response);
exit;
}