/** * If the user looking at the Display settings tab, adds live date preview facilities. */ public function listen() { // We are only interested in the "Display" tab if ('display' !== Tribe__Events__Settings::instance()->currentTab) { return; } /** * Add or remove fields which should have live date/time preview facilities. * * @var array $target_fields */ $this->target_fields = (array) apply_filters('tribe_events_settings_date_preview_fields', $this->target_fields); add_filter('tribe_field_div_end', array($this, 'setup_date_previews'), 10, 2); add_action('admin_enqueue_scripts', array($this, 'live_refresh_script')); }
protected function disable_default_settings_page() { remove_action('tribe_events_page_tribe-events-calendar', array(Tribe__Events__Settings::instance(), 'generatePage')); }
/** * Add the network admin options page * * @return void */ public function addNetworkOptionsPage() { $tribe_settings = Tribe__Events__Settings::instance(); add_submenu_page('settings.php', $this->pluginName, $this->pluginName, 'manage_network_options', 'the-events-calendar', array($tribe_settings, 'generatePage')); }
/** * Static Singleton Factory Method * * @return Tribe__Events__Settings */ public static function instance() { if (!isset(self::$instance)) { $className = __CLASS__; self::$instance = new $className(); } return self::$instance; }
/** * If there are venues without geo data, offer the user to fix them. */ public function show_offer_to_fix_notice() { $settings = Tribe__Events__Settings::instance(); $url = apply_filters('tribe_settings_url', add_query_arg(array('post_type' => Tribe__Events__Main::POSTTYPE, 'page' => $settings->adminSlug), admin_url('edit.php'))); ?> <div class="updated"> <p><?php echo sprintf(__("You have venues for which we don't have Geolocation information. <a href='%s'>Click here to generate it</a>.", 'tribe-events-calendar-pro'), esc_url($url) . '#geoloc_fix'); ?> </p> </div> <?php }
/** * If the migration button is clicked, start working * * @return void */ public static function listen_for_migration_button() { if (empty($_REQUEST['amalgamate']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'amalgamate_duplicates')) { return; } $amalgamator = new self(); $amalgamator->merge_duplicates(); // redirect to base settings page $settings = Tribe__Events__Settings::instance(); $url = apply_filters('tribe_settings_url', add_query_arg(array('post_type' => Tribe__Events__Main::POSTTYPE, 'page' => $settings->adminSlug), admin_url('edit.php'))); wp_redirect(esc_url_raw($url)); exit; }
<?php // Don't load directly if (!defined('ABSPATH')) { die('-1'); } $enable_button_label = __('Enable timezone support', 'the-events-calendar'); $enable_button_url = esc_url(wp_nonce_url(add_query_arg('timezone-update', '1', Tribe__Events__Settings::instance()->get_url()), 'timezone-settings')); $enable_button_text = __('Update Timezone Data', 'the-events-calendar'); $enable_button_help = sprintf(__('Click this button to update your database and take advantage of additional timezone capabilities. Please <a href="%s" target="_blank">configure WordPress</a> to use the correct timezone before clicking this button!', 'the-events-calendar'), esc_url(get_admin_url(null, 'options-general.php'))); $enable_button_html = <<<HTML \t<fieldset class="tribe-field tribe-field-html"> \t\t<legend> {$enable_button_label} </legend> \t\t<div class="tribe-field-wrap"> \t\t\t<a href="{$enable_button_url}" class="button"> {$enable_button_text} </a> \t\t\t<p class="tribe-field-indent description"> \t\t\t\t{$enable_button_help} \t\t\t</p> \t\t</div> \t</fieldset> \t<div class="clear"></div> HTML; return array('tribe_events_timezones_title' => array('type' => 'html', 'html' => '<h2>' . __('Timezone Settings', 'the-events-calendar') . '</h2>'), 'tribe_events_enable_timezones' => array('type' => 'html', 'html' => $enable_button_html), 'tribe_events_timezone_mode' => array('type' => 'dropdown', 'label' => __('Timezone mode', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'large', 'options' => array('event' => __('Use the local timezones for each event', 'the-events-calendar'), 'site' => __('Use the sitewide timezone everywhere', 'the-events-calendar'))), 'tribe_events_timezones_show_zone' => array('type' => 'checkbox_bool', 'label' => __('Show timezone', 'the-events-calendar'), 'tooltip' => __('Appends the timezone to the end of event scheduling information – this can be useful when you have events in numerous different timezones.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'));