本文整理汇总了PHP中tribe_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_option函数的具体用法?PHP tribe_get_option怎么用?PHP tribe_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_where_clause
protected function setup_where_clause()
{
/** @var wpdb $wpdb */
global $wpdb;
$clauses = array();
$values = array_map('intval', $this->currentValue);
$values = implode(',', $values);
$eod_cutoff = tribe_get_option('multiDayCutoff', '00:00');
if ($eod_cutoff != '00:00') {
$eod_time_difference = Tribe__Date_Utils::time_between('1/1/2014 00:00:00', "1/1/2014 {$eod_cutoff}:00");
$start_date = "DATE_SUB({$wpdb->postmeta}.meta_value, INTERVAL {$eod_time_difference} SECOND)";
$end_date = "DATE_SUB(tribe_event_end_date.meta_value, INTERVAL {$eod_time_difference} SECOND)";
} else {
$start_date = "{$wpdb->postmeta}.meta_value";
$end_date = 'tribe_event_end_date.meta_value';
}
$clauses[] = "(DAYOFWEEK({$start_date}) IN ({$values}))";
// is it on at least 7 days (first day is 0)
$clauses[] = "(DATEDIFF({$end_date}, {$start_date}) >=6)";
// determine if the start of the nearest matching day is between the start and end dates
$distance_to_day = array();
foreach ($this->currentValue as $day_of_week_index) {
$day_of_week_index = (int) $day_of_week_index;
$distance_to_day[] = "MOD( 7 + {$day_of_week_index} - DAYOFWEEK({$start_date}), 7 )";
}
if (count($distance_to_day) > 1) {
$distance_to_next_matching_day = 'LEAST(' . implode(',', $distance_to_day) . ')';
} else {
$distance_to_next_matching_day = reset($distance_to_day);
}
$clauses[] = "(DATE(DATE_ADD({$start_date}, INTERVAL {$distance_to_next_matching_day} DAY)) < {$end_date})";
$this->whereClause = ' AND (' . implode(' OR ', $clauses) . ')';
}
示例2: render
public function render()
{
$aggregator = Tribe__Events__Aggregator::instance();
$event_id = get_the_ID();
$record = Tribe__Events__Aggregator__Records::instance()->get_by_event_id($event_id);
$last_import = null;
$source = null;
$origin = null;
if (is_wp_error($record)) {
$last_import = get_post_meta($event_id, Tribe__Events__Aggregator__Event::$updated_key, true);
$source = get_post_meta($event_id, Tribe__Events__Aggregator__Event::$source_key, true);
$origin = get_post_meta($event_id, Tribe__Events__Aggregator__Event::$origin_key, true);
} else {
$last_import = $record->post->post_modified;
$source_info = $record->get_source_info();
$source = $source_info['title'];
$origin = $record->origin;
}
$origin = $aggregator->api('origins')->get_name($origin);
$datepicker_format = Tribe__Date_Utils::datepicker_formats(tribe_get_option('datepickerFormat'));
$last_import = $last_import ? tribe_format_date($last_import, true, $datepicker_format . ' h:i a') : null;
$settings_link = Tribe__Settings::instance()->get_url(array('tab' => 'imports'));
$import_setting = tribe_get_option('tribe_aggregator_default_update_authority', Tribe__Events__Aggregator__Settings::$default_update_authority);
include Tribe__Events__Main::instance()->plugin_path . 'src/admin-views/aggregator/meta-box.php';
}
示例3: disabled_bar_after
/**
* Returns the closing tag of the disabled bar wrapper
*
* @return array The new body class array
*/
public function disabled_bar_after($after)
{
if (tribe_get_option('tribeDisableTribeBar', false) == true) {
$after = '</div>';
echo $after;
}
}
示例4: show_related_workshops
function show_related_workshops()
{
if (tribe_get_option('hideRelatedWorkshops', false) == true) {
return false;
}
return true;
}
示例5: queue_import
/**
* Queues the import on the Aggregator service
*/
public function queue_import($args = array())
{
$meetup_api_key = tribe_get_option('meetup_api_key');
$defaults = array('meetup_api_key' => $meetup_api_key);
$args = wp_parse_args($args, $defaults);
return parent::queue_import($args);
}
示例6: __construct
public function __construct($data = array())
{
parent::__construct($data);
if (!isset($data['name'])) {
$this->name = 'eventlist';
}
if (!isset($data['posts'])) {
$event_args = array();
// Get the active plugins.
$active_plugins = get_option('active_plugins');
// We do some guessing here for Tzolkin
if (in_array('tzolkin/tzolkin.php', $active_plugins)) {
$event_args = ['post_type' => 'tz_events'];
}
// Some more guessing for The Events Calendar
if (in_array('the-events-calendar/the-events-calendar.php', $active_plugins)) {
$event_args = ['post_type' => \Tribe__Events__Main::POSTTYPE, 'orderby' => 'event_date', 'order' => 'ASC', 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'tribe_render_context' => 'default'];
}
$eventlist_event_args_filter = $this->name . '_event_args';
$event_args = apply_filters($eventlist_event_args_filter, $event_args);
Atom::add_debug_entry('Filter', $eventlist_event_args_filter);
$this->posts = new \WP_Query($event_args);
}
if (!isset($data['posts-structure'])) {
$posts_structure = ['PostClass' => ['children' => ['image', 'text']], 'image' => ['parts' => ['PostThumbnail']], 'text' => ['parts' => ['EventBadge', 'PostTitleLink', 'EventDate', 'ForceExcerpt', 'PostLink' => 'Read More']]];
$postlist_posts_structure_filter = $this->name . '_posts_structure';
$this->posts_structure = apply_filters($postlist_posts_structure_filter, $posts_structure);
Atom::add_debug_entry('Filter', $postlist_posts_structure_filter);
}
}
示例7: enqueue_calendar_widget_styles
/**
* Enqueue the appropriate CSS for the calendar/advanced list widgets, which share
* the same basic appearance.
*/
public static function enqueue_calendar_widget_styles()
{
// CSS file
$event_file = 'widget-calendar.css';
$event_file_option = 'widget-calendar-theme.css';
$stylesheet_option = tribe_get_option('stylesheetOption', 'tribe');
// Choose the appropriate stylesheet in light of the current styling options
switch ($stylesheet_option) {
case 'skeleton':
case 'full':
$event_file_option = "widget-calendar-{$stylesheet_option}.css";
break;
}
$style_url = tribe_events_pro_resource_url($event_file_option);
$style_url = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $style_url);
$style_override_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/pro/' . $event_file, $style_url);
// Load up stylesheet from theme or plugin
if ($style_url && 'tribe' === $stylesheet_option) {
wp_enqueue_style('widget-calendar-pro-style', tribe_events_pro_resource_url('widget-calendar-full.css'), array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION));
wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION));
} else {
wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION));
}
if ($style_override_url) {
wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '--widget-calendar-pro-override-style', $style_override_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION));
}
}
示例8: ajax_response
/**
* AJAX handler for the Map view
*/
public function ajax_response()
{
$tribe_paged = !empty($_POST['tribe_paged']) ? $_POST['tribe_paged'] : 1;
Tribe__Events__Query::init();
$post_status = array('publish');
if (is_user_logged_in()) {
$post_status[] = 'private';
}
$defaults = array('post_type' => Tribe__Events__Main::POSTTYPE, 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'paged' => $tribe_paged, 'post_status' => $post_status, 'eventDisplay' => 'map', 'tribe_geoloc' => true);
$view_state = 'map';
/* if past view */
if (!empty($_POST['tribe_event_display']) && $_POST['tribe_event_display'] == 'past') {
$view_state = 'past';
$defaults['eventDisplay'] = 'past';
$defaults['order'] = 'DESC';
}
if (isset($_POST['tribe_event_category'])) {
$defaults[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category'];
}
if (isset($_POST[Tribe__Events__Main::TAXONOMY])) {
$defaults[Tribe__Events__Main::TAXONOMY] = $_POST[Tribe__Events__Main::TAXONOMY];
}
$query = Tribe__Events__Query::getEvents($defaults, true);
$have_events = 0 < $query->found_posts;
if ($have_events && Tribe__Events__Pro__Geo_Loc::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;
Tribe__Events__Pro__Geo_Loc::instance()->assign_distance_to_posts($query->posts, $lat, $lng);
} elseif (!$have_events && isset($_POST['tribe-bar-geoloc'])) {
Tribe__Notice::set_notice('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'])) {
Tribe__Notice::set_notice('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-pro'), esc_html($_POST['tribe_event_category'])));
} elseif (!$have_events) {
Tribe__Notice::set_notice('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;
Tribe__Events__Main::instance()->displaying = 'map';
ob_start();
tribe_get_view('pro/map/content');
$response['html'] .= ob_get_clean();
$response['markers'] = Tribe__Events__Pro__Geo_Loc::instance()->generate_markers($data);
} else {
global $wp_query;
$wp_query = $query;
Tribe__Events__Main::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;
}
示例9: queue_import
/**
* Queues the import on the Aggregator service
*/
public function queue_import($args = array())
{
$fb_token = tribe_get_option('fb_token');
$defaults = array('facebook_token' => $fb_token);
$args = wp_parse_args($args, $defaults);
return parent::queue_import($args);
}
示例10: tribe_events_the_mini_calendar_title
/**
* Output a link for the mini calendar month previous nav, includes data attributes needed to update the month with ajax
*
* @return void
**/
function tribe_events_the_mini_calendar_title()
{
$args = tribe_events_get_mini_calendar_args();
$date = strtotime($args['eventDate']);
$date_format = tribe_get_option('monthAndYearFormat', 'M Y');
$title = tribe_event_format_date($date, false, $date_format);
echo apply_filters('tribe_events_the_mini_calendar_title', $title);
}
示例11: filter_tribe_events_google_maps_api
/**
* Adds the browser key api key to the Google Maps JavaScript API url if set by the user.
*
* @param string $js_maps_api_url
*
* @return string
*/
public function filter_tribe_events_google_maps_api($js_maps_api_url)
{
$key = tribe_get_option($this->api_key_option_name);
if (!empty($key)) {
$js_maps_api_url = add_query_arg('key', $key, $js_maps_api_url);
}
return $js_maps_api_url;
}
示例12: is_version_in_db_less_than
private function is_version_in_db_less_than($version)
{
$version_in_db = tribe_get_option('pro-schema-version', 0);
if (version_compare($version, $version_in_db) > 0) {
return TRUE;
}
return FALSE;
}
示例13: get_abbreviation
public static function get_abbreviation()
{
$unit = tribe_get_option('geoloc_default_unit', 'miles');
if ($unit == 'miles') {
return _x('mi', 'Abbreviation for the miles unit of measure', 'the-events-calendar');
} else {
return _x('km', 'Abbreviation for the kilometers unit of measure', 'the-events-calendar');
}
}
示例14: __construct
/**
* constructor
*/
public function __construct()
{
$this->default_venue = (int) tribe_get_option('eventsDefaultVenueID', 0);
$this->default_organizer = (int) tribe_get_option('eventsDefaultOrganizerID', 0);
if (class_exists('TribeCommunityEvents')) {
$community = TribeCommunityEvents::instance();
$this->default_community_venue = (int) $community->getOption('defaultCommunityVenueID', 0);
$this->default_community_organizer = (int) $community->getOption('defaultCommunityOrganizerID', 0);
}
}
示例15: 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]));
}