本文整理汇总了PHP中TribeEvents::setNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents::setNotice方法的具体用法?PHP TribeEvents::setNotice怎么用?PHP TribeEvents::setNotice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TribeEvents
的用法示例。
在下文中一共展示了TribeEvents::setNotice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
}
示例2: 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'));
}
}
示例3: 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;
}
示例4: nothing_found_notice
protected function nothing_found_notice()
{
list($search_term, $tax_term, $geographic_term) = $this->get_search_terms();
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)));
} elseif (!empty($tax_term)) {
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'), $tax_term));
} else {
TribeEvents::setNotice('event-search-no-results', __('No results were found for this week. Try searching another week.', 'tribe-events-calendar-pro'));
}
}
示例5: set_notices
/**
* Set the notices used on week view
*
* @since 3.0
* @author tim@imaginesimplicty.com
* @return void
* */
function set_notices()
{
global $wp_query;
// setup a search term for query or via ajax
if (!empty($wp_query->query_vars['s'])) {
$search_term = $wp_query->query_vars['s'];
} else {
if (!empty($_POST['tribe-bar-search'])) {
$search_term = $_POST['tribe-bar-search'];
}
}
if (!empty($search_term) && !have_posts()) {
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)));
}
}
示例6: set_notices
/**
* Set the notices used on month view
*
* @return void
* @since 3.0
**/
public function set_notices()
{
global $wp_query;
// setup a search term for query or via ajax
if (!empty($wp_query->query_vars['s'])) {
$search_term = $wp_query->query_vars['s'];
} else {
if (!empty($_POST['tribe-bar-search'])) {
$search_term = $_POST['tribe-bar-search'];
}
}
$total_counts = array_unique(self::$event_daily_counts);
if (count($total_counts) < 2 && !empty($search_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong> this month. Try searching next month.', 'tribe-events-calendar'), esc_html($search_term)));
}
}
示例7: set_notices
/**
* Set the notices used on month view
*
* @return void
**/
public function set_notices()
{
global $wp_query;
$tribe = TribeEvents::instance();
$search_term = '';
$tax_term = '';
// setup a search term for query or via ajax
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'];
}
if (is_tax($tribe->get_event_taxonomy())) {
$tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy());
$tax_term = esc_html($tax_term->name);
}
// If there are no events we should be able to reduce the event_daily_counts array (the number of events in
// each day this month) to a single element with a value of 0. Where a keyword search returns no events then
// event_daily_counts may simply be empty.
$event_counts = array_unique(self::$event_daily_counts);
$no_events = 1 === count($event_counts) && 0 === current($event_counts) || empty(self::$event_daily_counts);
if ($no_events && !empty($search_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong> this month. Try searching next month.', 'tribe-events-calendar'), esc_html($search_term)));
} elseif (!empty($tax_term) && $no_events) {
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'), $tax_term));
} elseif ($no_events) {
TribeEvents::setNotice('event-search-no-results', __('There were no results found.', 'tribe-events-calendar'));
}
}
示例8: set_notices
/**
* Set up the notices for this template
*
* @return void
* @since 3.0
**/
public function set_notices()
{
global $wp_query;
// Look for a search query
if (!empty($wp_query->query_vars['s'])) {
$search_term = $wp_query->query_vars['s'];
} else {
if (!empty($_POST['tribe-bar-search'])) {
$search_term = $_POST['tribe-bar-search'];
}
}
// Search term based notices
if (!empty($search_term) && !have_posts()) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong>.', 'tribe-events-calendar'), esc_html($search_term)));
} else {
if (empty($search_term) && empty($wp_query->query_vars['s']) && !have_posts()) {
// Messages if currently no events, and no search term
$tribe_ecp = TribeEvents::instance();
$is_cat_message = '';
if (is_tax($tribe_ecp->get_event_taxonomy())) {
$cat = get_term_by('slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy());
if (tribe_is_upcoming()) {
$is_cat_message = sprintf(__('listed under %s. Check out past events for this category or view the full calendar.', 'tribe-events-calendar'), esc_html($cat->name));
} else {
if (tribe_is_past()) {
$is_cat_message = sprintf(__('listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar'), esc_html($cat->name));
}
}
}
if (tribe_is_day()) {
TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n('F d, Y', strtotime(get_query_var('eventDate')))));
} elseif (tribe_is_upcoming()) {
$date = date('Y-m-d', strtotime($tribe_ecp->date));
if ($date == date('Y-m-d')) {
TribeEvents::setNotice('events-not-found', __('No upcoming events ', 'tribe-events-calendar') . $is_cat_message);
} else {
TribeEvents::setNotice('events-not-found', __('No matching events ', 'tribe-events-calendar') . $is_cat_message);
}
} elseif (tribe_is_past()) {
TribeEvents::setNotice('events-past-not-found', __('No previous events ', 'tribe-events-calendar') . $is_cat_message);
}
}
}
}
示例9: nothing_found_notice
protected function nothing_found_notice()
{
list($search_term, $tax_term, $geographic_term) = $this->get_search_terms();
if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) {
TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate')))));
} elseif (empty($search_term) && empty($geographic_term)) {
TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate')))));
} else {
parent::nothing_found_notice();
}
}
示例10: set_notices
/**
* Set up the notices for this template
*
* @return void
**/
public function set_notices()
{
global $wp_query;
$tribe = TribeEvents::instance();
$geographic_term = '';
$search_term = '';
$tax_term = '';
// No need to set notices unless we didn't find anything
if (have_posts()) {
return;
}
// Do we have a keyword or place name search?
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'];
}
if (is_tax($tribe->get_event_taxonomy())) {
$tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy());
$tax_term = $tax_term->name;
}
// No events found on this day
if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) {
TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate')))));
} elseif (empty($search_term) && empty($geographic_term)) {
TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate')))));
} else {
parent::set_notices();
}
}
示例11: set_notices
/**
* Set up the notices for this template
*
* @return void
* @since 3.0
**/
public function set_notices()
{
global $wp_query;
$tribe = TribeEvents::instance();
$geographic_term = '';
$search_term = '';
$tax_term = '';
// By default we only display notices if no events could be found
if (have_posts()) {
return;
}
// Do we have a keyword or place name search?
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'];
}
if (is_tax($tribe->get_event_taxonomy())) {
$tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy());
$tax_term = esc_html($tax_term->name);
}
// Set an appropriate notice
if (!empty($search_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong>.', 'tribe-events-calendar'), 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>.', 'tribe-events-calendar'), esc_html($geographic_term)));
} elseif (!empty($tax_term) && tribe_is_upcoming() && date('Y-m-d') === date('Y-m-d', strtotime($tribe->date))) {
TribeEvents::setNotice('events-not-found', sprintf(__('No upcoming events listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar'), $tax_term));
} elseif (!empty($tax_term) && tribe_is_upcoming()) {
TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar'), $tax_term));
} elseif (!empty($tax_term) && tribe_is_past()) {
TribeEvents::setNotice('events-past-not-found', __('No previous events ', 'tribe-events-calendar'));
} else {
TribeEvents::setNotice('event-search-no-results', __('There were no results found.', 'tribe-events-calendar'));
}
}
示例12: nothing_found_notice
/**
* Sets an appropriate no results found message. This may be overridden in child classes.
*/
protected function nothing_found_notice()
{
list($search_term, $tax_term, $geographic_term) = $this->get_search_terms();
if (!empty($search_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong>.', 'tribe-events-calendar'), 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>.', 'tribe-events-calendar'), esc_html($geographic_term)));
} elseif (!empty($tax_term) && tribe_is_upcoming() && date('Y-m-d') === date('Y-m-d', strtotime($tribe->date))) {
TribeEvents::setNotice('events-not-found', sprintf(__('No upcoming events listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar'), $tax_term));
} elseif (!empty($tax_term) && tribe_is_upcoming()) {
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'), $tax_term));
} elseif (!empty($tax_term) && tribe_is_past()) {
TribeEvents::setNotice('events-past-not-found', __('No previous events ', 'tribe-events-calendar'));
} elseif (!empty($tax_term)) {
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'), $tax_term));
} else {
TribeEvents::setNotice('event-search-no-results', __('There were no results found.', 'tribe-events-calendar'));
}
}
示例13: set_notices
/**
* Set the notices used on month view
*
* @return void
* @since 3.0
**/
public function set_notices()
{
global $wp_query;
$search_term = '';
// setup a search term for query or via ajax
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'];
}
// If there are no events we should be able to reduce the event_daily_counts array (the number of events in
// each day this month) to a single element with a value of 0. Where a keyword search returns no events then
// event_daily_counts may simply be empty.
$event_counts = array_unique(self::$event_daily_counts);
$no_events = 1 === count($event_counts) && 0 === current($event_counts) || empty(self::$event_daily_counts);
if ($no_events && !empty($search_term)) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong> this month. Try searching next month.', 'tribe-events-calendar'), esc_html($search_term)));
} elseif ($no_events) {
TribeEvents::setNotice('event-search-no-results', __('There were no results found.', 'tribe-events-calendar'));
}
}
示例14: set_notices
/**
* Set the notices used on week view
*
* @since 3.0
* @author tim@imaginesimplicty.com
* @return void
* */
function set_notices()
{
global $wp_query;
$tribe = TribeEvents::instance();
$search_term = $geographic_term = '';
$tax_term = '';
// We have events to display, no need for notices!
if (!empty(self::$events->all_day) || !empty(self::$events->hourly)) {
return;
}
if (is_tax($tribe->get_event_taxonomy())) {
$tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy());
$tax_term = esc_html($tax_term->name);
}
// 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)));
} elseif (!empty($tax_term)) {
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'), $tax_term));
} else {
TribeEvents::setNotice('event-search-no-results', __('No results were found for this week. Try searching another week.', 'tribe-events-calendar-pro'));
}
}
示例15: set_notices
/**
* Set up the notices for this template
*
* @return void
* @since 3.0
**/
public function set_notices()
{
parent::set_notices();
global $wp_query;
// Look for a search query
if (!empty($wp_query->query_vars['s'])) {
$search_term = $wp_query->query_vars['s'];
} else {
if (!empty($_POST['tribe-bar-search'])) {
$search_term = $_POST['tribe-bar-search'];
}
}
// Search term based notices
if (!empty($search_term) && !have_posts()) {
TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong> on this day. Try searching another day.', 'tribe-events-calendar-pro'), esc_html($search_term)));
} else {
if (empty($search_term) && empty($wp_query->query_vars['s']) && !have_posts()) {
// Messages if currently no events, and no search term
TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar-pro'), date_i18n('F d, Y', strtotime(get_query_var('eventDate')))));
}
}
}