本文整理汇总了PHP中Tribe__Events__Main类的典型用法代码示例。如果您正苦于以下问题:PHP Tribe__Events__Main类的具体用法?PHP Tribe__Events__Main怎么用?PHP Tribe__Events__Main使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tribe__Events__Main类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor!
*/
protected function __construct()
{
$this->main = Tribe__Events__Main::instance();
$this->register_default_linked_post_types();
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
}
示例2: setup
protected function setup()
{
Tribe__Events__Main::instance()->displaying = 'day';
$this->shortcode->prepare_default();
Tribe__Events__Pro__Template_Factory::asset_package('ajax-dayview');
$this->shortcode->set_template_object(new Tribe__Events__Template__Day($this->shortcode->get_query_args()));
}
示例3: __construct
/**
* Sets up and renders the event meta box for the specified existing event
* or for a new event (if $event === null).
*
* @param null $event
*/
public function __construct($event = null)
{
$this->tribe = Tribe__Events__Main::instance();
$this->get_event($event);
$this->setup_data();
$this->do_meta_box();
}
示例4: 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';
}
示例5: filter_tribe_events_rewrite_i18n_slugs_raw
/**
* Filters the bases used to generate TEC rewrite rules to use WPML managed translations.
*
* @param array $bases
* @param string $method
* @param array $domains
*
* @return array An array of bases each with its (optional) WPML managed translations set.
*/
public function filter_tribe_events_rewrite_i18n_slugs_raw($bases, $method, $domains)
{
/** @var SitePress $sitepress */
global $sitepress, $sitepress_settings;
if (empty($sitepress) || !is_a($sitepress, 'SitePress')) {
return $bases;
}
$tec = Tribe__Events__Main::instance();
// Grab all languages
$langs = $sitepress->get_active_languages();
if (empty($langs)) {
return $bases;
}
foreach ($langs as $lang) {
$languages[] = $sitepress->get_locale($lang['code']);
}
// Prevent Duplicates and Empty langs
$languages = array_filter(array_unique($languages));
// Query the Current Language
$current_locale = $sitepress->get_locale($sitepress->get_current_language());
// Get the strings on multiple Domains and Languages
// remove WPML filter to avoid the locale being set to the default one
remove_filter('locale', array($sitepress, 'locale_filter'));
$bases = $tec->get_i18n_strings($bases, $languages, $domains, $current_locale);
// re-hook WPML filter
add_filter('locale', array($sitepress, 'locale_filter'));
$string_translation_active = function_exists('wpml_st_load_slug_translation');
$post_slug_translation_on = !empty($sitepress_settings['posts_slug_translation']['on']);
if ($string_translation_active && $post_slug_translation_on) {
$bases = $this->translate_single_slugs($bases);
}
return $bases;
}
示例6: getOption
/**
* Get value for a specific option
*
* @param string $optionName name of option
* @param string $default default value
*
* @return mixed results of option query
*/
public static function getOption($optionName, $default = '')
{
if (!$optionName) {
return null;
}
$value = Tribe__Events__Main::getOption($optionName, $default);
return apply_filters('tribe-import-setting-' . $optionName, $value, $default);
}
示例7: wpv_tribe_single_gmap
function wpv_tribe_single_gmap()
{
$the_id = tribe_get_venue_id($GLOBALS['wpv_single_event_id']);
$the_address = Tribe__Events__Main::instance()->fullAddressString($the_id);
if (get_post_meta($GLOBALS['wpv_single_event_id'], '_EventShowMap', true) == '1') {
echo WPV_Gmap::shortcode(array('address' => $the_address, 'height' => 500, 'html' => $the_address, 'popup' => true, 'scrollwheel' => false));
}
}
示例8: test_get_constant_update_callbacks
public function test_get_constant_update_callbacks()
{
$current_version = Tribe__Events__Main::VERSION;
$updater = Tribe__Events__Main::instance()->updater();
$contant_updates = $updater->get_constant_update_callbacks();
foreach ($contant_updates as $contant_update_callable) {
$this->assertTrue(is_callable($contant_update_callable), 'checking constant update function is callable');
}
}
示例9: setup
protected function setup()
{
Tribe__Events__Main::instance()->displaying = 'list';
$this->shortcode->set_current_page();
$this->shortcode->prepare_default();
Tribe__Events__Template_Factory::asset_package('ajax-list');
$this->template = new Tribe__Events__Template__List($this->shortcode->get_query_args());
$this->shortcode->set_template_object($this->template);
}
示例10: maybe_add_admin_notice
/**
* Hooks the action to show an admin notice if a page with the `/events` slug exists on the site.
*/
public function maybe_add_admin_notice()
{
$this->archive_slug = Tribe__Events__Main::instance()->getOption('eventsSlug', 'events');
$page = get_page_by_path($this->archive_slug);
if (!$page || $page->post_status == 'trash') {
return;
}
$this->page = $page;
add_action('admin_notices', array($this, 'notice'));
}
示例11: tribe_venue_upcoming_events
/**
* Output the upcoming events associated with a venue
*
* @return string|null
*/
function tribe_venue_upcoming_events($post_id = false)
{
$post_id = Tribe__Events__Main::postIdHelper($post_id);
if ($post_id) {
$args = array('venue' => $post_id, 'eventDisplay' => 'list', 'posts_per_page' => apply_filters('tribe_events_single_venue_posts_per_page', 100));
$html = tribe_include_view_list($args);
return apply_filters('tribe_venue_upcoming_events', $html);
}
return null;
}
示例12: setup
protected function setup()
{
Tribe__Events__Main::instance()->displaying = 'photo';
$this->shortcode->set_current_page();
$this->shortcode->prepare_default();
Tribe__Events__Pro__Main::instance()->enqueue_pro_scripts();
Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css');
Tribe__Events__Pro__Template_Factory::asset_package('ajax-photoview');
$this->shortcode->set_template_object(new Tribe__Events__Pro__Templates__Photo($this->shortcode->get_query_args()));
}
示例13: 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 = Tribe__Events__Main::instance();
$tec_rewrite_slug = trailingslashit($tec->rewriteSlug);
// create new rule for the agenda view
$newRules = array($tec_rewrite_slug . 'agenda/?$' => 'index.php?post_type=' . Tribe__Events__Main::POSTTYPE . '&eventDisplay=agenda');
// Add the new rule to the global rewrite rules array
$wp_rewrite->rules = $newRules + $wp_rewrite->rules;
}
示例14: 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.
*
*/
public static function saveEventMeta($event_id, $data, $event = null)
{
$tec = Tribe__Events__Main::instance();
$data = self::prepare_event_date_meta($event_id, $data);
if (empty($data['EventHideFromUpcoming'])) {
delete_metadata('post', $event_id, '_EventHideFromUpcoming');
}
update_metadata('post', $event_id, '_EventShowMapLink', isset($data['venue']['EventShowMapLink']));
update_metadata('post', $event_id, '_EventShowMap', isset($data['venue']['EventShowMap']));
if (isset($data['post_status'])) {
$post_status = $data['post_status'];
} else {
$post_status = get_post_status($event_id);
}
// Handle the submission of linked post type posts (like venue and organizer)
Tribe__Events__Linked_Posts::instance()->handle_submission($event_id, $data);
// Ordinarily there is a single cost value for each event, but addons (ie, ticketing plugins) may need
// to record a number of different pricepoints for the same event
$event_cost = isset($data['EventCost']) ? (array) $data['EventCost'] : array();
$data['EventCost'] = (array) apply_filters('tribe_events_event_costs', $event_cost, $event_id);
if (isset($data['FeaturedImage']) && !empty($data['FeaturedImage'])) {
update_metadata('post', $event_id, '_thumbnail_id', $data['FeaturedImage']);
unset($data['FeaturedImage']);
}
do_action('tribe_events_event_save', $event_id);
//update meta fields
foreach ($tec->metaTags as $tag) {
$htmlElement = ltrim($tag, '_');
if (isset($data[$htmlElement]) && $tag != Tribe__Events__Main::EVENTSERROROPT) {
if (is_string($data[$htmlElement])) {
$data[$htmlElement] = filter_var($data[$htmlElement], FILTER_SANITIZE_STRING);
}
// Fields with multiple values per key
if (is_array($data[$htmlElement])) {
delete_metadata('post', $event_id, $tag);
foreach ($data[$htmlElement] as $value) {
add_metadata('post', $event_id, $tag, $value);
}
} else {
update_metadata('post', $event_id, $tag, $data[$htmlElement]);
}
}
}
// Set sticky state for calendar view.
if ($event instanceof WP_Post) {
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);
}
示例15: embed_head
/**
* Adds content to the embed head tag
*
* The embed header DOES NOT have wp_head() executed inside of it. Instead, any scripts/styles
* are explicitly output
*/
public function embed_head()
{
$css_path = Tribe__Events__Template_Factory::getMinFile(Tribe__Events__Main::instance()->plugin_url . 'src/resources/css/tribe-events-embed.css', true);
$css_path = add_query_arg('ver', Tribe__Events__Main::VERSION, $css_path);
?>
<link rel="stylesheet" id="tribe-events-embed-css" href="<?php
echo esc_url($css_path);
?>
" type="text/css" media="all">
<?php
}