本文整理汇总了PHP中Tribe__Events__Main::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Tribe__Events__Main::instance方法的具体用法?PHP Tribe__Events__Main::instance怎么用?PHP Tribe__Events__Main::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribe__Events__Main
的用法示例。
在下文中一共展示了Tribe__Events__Main::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()));
}
示例2: __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'));
}
示例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: 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));
}
}
示例7: 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');
}
}
示例8: 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);
}
示例9: 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'));
}
示例10: 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()));
}
示例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 = 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;
}
示例12: 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);
}
示例13: process_general_form_submission
public static function process_general_form_submission()
{
if (!empty($_POST['tribe-import-general-settings']) && wp_verify_nonce($_POST['tribe-import-general-settings'], 'tribe-import-general-settings')) {
$options = apply_filters('tribe-import-available-options', self::$options);
$core = Tribe__Events__Main::instance();
foreach ($options as $_option) {
$core->setOption($_option, $_POST[$_option]);
}
add_action('tribe-import-under-heading', array(__CLASS__, 'settings_saved_message'));
}
}
示例14: 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
**/
function tribe_events_the_mini_calendar_next_link()
{
$tribe_ecp = Tribe__Events__Main::instance();
$args = tribe_events_get_mini_calendar_args();
try {
$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>';
} catch (OverflowException $e) {
$html = '';
}
echo apply_filters('tribe_events_the_mini_calendar_next_link', $html);
}
示例15: __construct
public function __construct($event = null, $post_type = null)
{
$this->tribe = Tribe__Events__Main::instance();
$this->linked_posts = Tribe__Events__Linked_Posts::instance();
$this->post_type = $post_type;
$this->singular_name = $this->linked_posts->linked_post_types[$this->post_type]['singular_name'];
$this->singular_name_lowercase = $this->linked_posts->linked_post_types[$this->post_type]['singular_name_lowercase'];
$this->get_event($event);
add_action('wp', array($this, 'sticky_form_data'), 50);
// Later than events-admin.js itself is enqueued
}