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'; }
/** * Adds a link to the shop app to the WP admin bar */ public function add_toolbar_item() { $capability = apply_filters('tribe_events_addon_page_capability', 'install_plugins'); // prevent users who cannot install plugins from seeing addons link if (current_user_can($capability)) { global $wp_admin_bar; $wp_admin_bar->add_menu(array('id' => 'tribe-events-app-shop', 'title' => esc_html__('Event Add-Ons', 'tribe-common'), 'href' => Tribe__Settings::instance()->get_url(array('page' => self::MENU_SLUG)), 'parent' => 'tribe-events-settings-group')); } }
public function add_menu_page() { if (!class_exists('Tribe__Settings') or !method_exists(Tribe__Settings::instance(), 'should_setup_pages') or !Tribe__Settings::instance()->should_setup_pages()) { return; } $page_title = esc_html__('Shortcode', 'ecs'); $menu_title = esc_html__('Shortcode', 'tribe-common'); $capability = apply_filters('ecs_admin_page_capability', 'install_plugins'); $where = Tribe__Settings::instance()->get_parent_slug(); $this->admin_page = add_submenu_page($where, $page_title, $menu_title, $capability, self::MENU_SLUG, array($this, 'do_menu_page')); add_action('admin_print_styles-' . $this->admin_page, array($this, 'enqueue')); add_action('admin_print_styles', array($this, 'enqueue_submenu_style')); }
/** * Hooked to current_screen, this method identifies whether or not fb credentials should be cleared * * @param WP_Screen $screen */ public function maybe_clear_fb_credentials($screen) { if ('tribe_events_page_tribe-common' !== $screen->base) { return; } if (!isset($_GET['tab']) || 'addons' !== $_GET['tab']) { return; } if (!(isset($_GET['action']) && isset($_GET['_wpnonce']) && 'disconnect-facebook' === $_GET['action'] && wp_verify_nonce($_GET['_wpnonce'], 'disconnect-facebook'))) { return; } $this->clear_fb_credentials(); wp_redirect(Tribe__Settings::instance()->get_url(array('tab' => 'addons'))); die; }
/** * 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__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_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')); }
public function update_ui() { // Only display the notice/update UI within the additional fields screen if ('additional-fields' !== Tribe__Settings::instance()->currentTab) { return; } // No updates required? No need to bother anyone if (!$this->are_updates_needed()) { return; } // Setup our supporting JS $this->update_js(); $update_url = add_query_arg(array('do_additional_fields_update' => wp_create_nonce('custom_meta_tools:updater'))); $prompt = $this->rerun_needed ? __('Some additional field data still needs to be updated (unfortunately, we were unable to continue to update things automatically).', 'tribe-events-calendar-pro') : __('We need to update the additional field data for some of your events.', 'tribe-events-calendar-pro'); $message = $prompt . ' <span class="update-text"> <a href="' . $update_url . '">' . _x('Click here to run the updater.', 'additional fields update trigger', 'tribe-events-calendar-pro') . '</a> </span>'; echo "<div id='tribe-additional-field-update' class='notice notice-warning'> <p> {$message} </p> </div>"; }
/** * Configures an admin bar object adding menus, groups and nodes to it. * * @param WP_Admin_Bar $wp_admin_bar * * @return array An array of menus to add to the admin bar. */ public function configure(WP_Admin_Bar $wp_admin_bar) { $main = Tribe__Events__Main::instance(); $wp_admin_bar->add_menu(array('id' => 'tribe-events', 'title' => '<span class="ab-icon dashicons-before dashicons-calendar"></span>' . sprintf(__('%s', 'the-events-calendar'), $main->plural_event_label), 'href' => $main->getLink('home'))); $wp_admin_bar->add_group(array('id' => 'tribe-events-group', 'parent' => 'tribe-events')); $wp_admin_bar->add_group(array('id' => 'tribe-events-add-ons-group', 'parent' => 'tribe-events')); $wp_admin_bar->add_group(array('id' => 'tribe-events-settings-group', 'parent' => 'tribe-events')); if (current_user_can('edit_tribe_events')) { $wp_admin_bar->add_group(array('id' => 'tribe-events-import-group', 'parent' => 'tribe-events-add-ons-group')); } $wp_admin_bar->add_menu(array('id' => 'tribe-events-view-calendar', 'title' => esc_html__('View Calendar', 'the-events-calendar'), 'href' => $main->getLink('home'), 'parent' => 'tribe-events-group')); if (current_user_can('edit_tribe_events')) { $wp_admin_bar->add_menu(array('id' => 'tribe-events-add-event', 'title' => sprintf(esc_html__('Add %s', 'the-events-calendar'), $main->singular_event_label), 'href' => trailingslashit(get_admin_url()) . 'post-new.php?post_type=' . Tribe__Events__Main::POSTTYPE, 'parent' => 'tribe-events-group')); } if (current_user_can('edit_tribe_events')) { $wp_admin_bar->add_menu(array('id' => 'tribe-events-edit-events', 'title' => sprintf(esc_html__('Edit %s', 'the-events-calendar'), $main->plural_event_label), 'href' => trailingslashit(get_admin_url()) . 'edit.php?post_type=' . Tribe__Events__Main::POSTTYPE, 'parent' => 'tribe-events-group')); } if (current_user_can('publish_tribe_events')) { $import_node = $wp_admin_bar->get_node('tribe-events-import'); if (!is_object($import_node)) { $wp_admin_bar->add_node(array('id' => 'tribe-events-import', 'title' => esc_html__('Import', 'the-events-calendar'), 'parent' => 'tribe-events-import-group', 'href' => esc_url(add_query_arg(array('post_type' => Tribe__Events__Main::POSTTYPE, 'page' => 'aggregator'), admin_url('edit.php'))))); } } if (current_user_can('manage_options')) { $hide_all_settings = Tribe__Settings_Manager::get_network_option('allSettingsTabsHidden', '0'); if ($hide_all_settings == '0') { $wp_admin_bar->add_menu(array('id' => 'tribe-events-settings', 'title' => esc_html__('Settings', 'the-events-calendar'), 'href' => Tribe__Settings::instance()->get_url(), 'parent' => 'tribe-events-settings-group')); } // Only show help link if it's not blocked in network admin. $hidden_settings_tabs = Tribe__Settings_Manager::get_network_option('hideSettingsTabs', array()); if (!in_array('help', $hidden_settings_tabs)) { $href = esc_url(add_query_arg(array('post_type' => Tribe__Events__Main::POSTTYPE, 'page' => 'tribe-help'), admin_url('edit.php'))); $wp_admin_bar->add_menu(array('id' => 'tribe-events-help', 'title' => esc_html__('Help', 'the-events-calendar'), 'href' => $href, 'parent' => 'tribe-events-settings-group')); } } }
/** * If we are within the Filter Bar settings tab, render a helpful notice prompting the user to * update their additional field data. */ public static function notify_update_msg() { // Only display the notice/update UI within the Filter Bar settings tab if ('filter-view' !== Tribe__Settings::instance()->currentTab) { return; } $additional_field_tab = esc_url(add_query_arg('tab', 'additional-fields')); $message = sprintf(__('Please visit the settings screen for %1$sAdditional Fields%2$s and use the provided update link or you will not be able to use Additional Field-based filters.', 'tribe-events-filter-view'), '<a href="' . $additional_field_tab . '">', '</a>'); echo "<div id='tribe-additional-field-update' class='notice notice-warning'> <p> {$message} </p> </div>"; }
</td> <td><?php echo $notes; ?> </td> </tr> <?php // Meetup status section $indicator = 'good'; $notes = ' '; $text = __('API key entered', 'the-events-calendar'); $meetup_api_key = tribe_get_option('meetup_api_key'); if (!$meetup_api_key) { $indicator = 'warning'; $text = __('You have not entered a Meetup API key', 'the-events-calendar'); $notes = '<a href="' . esc_url(Tribe__Settings::instance()->get_url(array('tab' => 'addons'))) . '">'; $notes .= esc_html__('Enter your API key', 'the-events-calendar'); $notes .= '</a>'; } ?> <tr> <td class="label"> <img src="<?php echo tribe_events_resource_url('images/aggregator/meetup.png'); ?> " /><span><?php esc_html_e('Meetup', 'the-events-calendar'); ?> </span> </td> <td class="indicator <?php
protected function disable_default_settings_page() { remove_action('tribe_events_page_' . Tribe__Settings::$parent_slug, array(Tribe__Settings::instance(), 'generatePage')); }
if (Tribe__Events__Aggregator::is_service_active()) { $global = array('import-defaults' => array('type' => 'html', 'html' => '<h3 id="tribe-import-global-settings">' . esc_html__('Global Import Settings', 'the-events-calendar') . '</h3>'), 'tribe_aggregator_default_post_status' => array('type' => 'dropdown', 'label' => esc_html__('Default Status', 'the-events-calendar'), 'tooltip' => esc_html__('The default post status for events', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'publish', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $post_statuses), 'tribe_aggregator_default_category' => array('type' => 'dropdown', 'label' => esc_html__('Default Event Category', 'the-events-calendar'), 'tooltip' => esc_html__('The default event category for events', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $categories), 'tribe_aggregator_default_show_map' => array('type' => 'dropdown', 'label' => esc_html__('Show Google Map', 'the-events-calendar'), 'tooltip' => esc_html__('Show Google Map by default on imported event and venues', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'no', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $show_map_options)); $ical = array('ical-defaults' => array('type' => 'html', 'html' => '<h3 id="tribe-import-ical-settings">' . esc_html__('iCalendar Import Settings', 'the-events-calendar') . '</h3>'), 'tribe_aggregator_default_ical_post_status' => array('type' => 'dropdown', 'label' => esc_html__('Default Status', 'the-events-calendar'), 'tooltip' => esc_html__('The default post status for events imported via iCalendar', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_post_statuses), 'tribe_aggregator_default_ical_category' => array('type' => 'dropdown', 'label' => esc_html__('Default Event Category', 'the-events-calendar'), 'tooltip' => esc_html__('The default event category for events imported via iCalendar', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_categories), 'tribe_aggregator_default_ical_show_map' => array('type' => 'dropdown', 'label' => esc_html__('Show Google Map', 'the-events-calendar'), 'tooltip' => esc_html__('Show Google Map by default on imported event and venues', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'no', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_show_map_options)); $ics = array('ics-defaults' => array('type' => 'html', 'html' => '<h3 id="tribe-import-ics-settings">' . esc_html__('ICS File Import Settings', 'the-events-calendar') . '</h3>'), 'tribe_aggregator_default_ics_post_status' => array('type' => 'dropdown', 'label' => esc_html__('Default Status', 'the-events-calendar'), 'tooltip' => esc_html__('The default post status for events imported via .ics files', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_post_statuses), 'tribe_aggregator_default_ics_category' => array('type' => 'dropdown', 'label' => esc_html__('Default Event Category', 'the-events-calendar'), 'tooltip' => esc_html__('The default event category for events imported via .ics files', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_categories), 'tribe_aggregator_default_ics_show_map' => array('type' => 'dropdown', 'label' => esc_html__('Show Google Map', 'the-events-calendar'), 'tooltip' => esc_html__('Show Google Map by default on imported event and venues', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'no', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_show_map_options)); $facebook = array('facebook-defaults' => array('type' => 'html', 'html' => '<h3 id="tribe-import-facebook-settings">' . esc_html__('Facebook Import Settings', 'the-events-calendar') . '</h3>'), 'tribe_aggregator_default_facebook_post_status' => array('type' => 'dropdown', 'label' => esc_html__('Default Status', 'the-events-calendar'), 'tooltip' => esc_html__('The default post status for events imported via Facebook', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_post_statuses), 'tribe_aggregator_default_facebook_category' => array('type' => 'dropdown', 'label' => esc_html__('Default Event Category', 'the-events-calendar'), 'tooltip' => esc_html__('The default event category for events imported via Facebook', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_categories), 'tribe_aggregator_default_facebook_show_map' => array('type' => 'dropdown', 'label' => esc_html__('Show Google Map', 'the-events-calendar'), 'tooltip' => esc_html__('Show Google Map by default on imported event and venues', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'no', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_show_map_options)); $gcal = array('gcal-defaults' => array('type' => 'html', 'html' => '<h3 id="tribe-import-google-settings">' . esc_html__('Google Calendar Import Settings', 'the-events-calendar') . '</h3>'), 'tribe_aggregator_default_gcal_post_status' => array('type' => 'dropdown', 'label' => esc_html__('Default Status', 'the-events-calendar'), 'tooltip' => esc_html__('The default post status for events imported via Google Calendar', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_post_statuses), 'tribe_aggregator_default_gcal_category' => array('type' => 'dropdown', 'label' => esc_html__('Default Event Category', 'the-events-calendar'), 'tooltip' => esc_html__('The default event category for events imported via Google Calendar', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_categories), 'tribe_aggregator_default_gcal_show_map' => array('type' => 'dropdown', 'label' => esc_html__('Show Google Map', 'the-events-calendar'), 'tooltip' => esc_html__('Show Google Map by default on imported event and venues', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'no', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_show_map_options)); $meetup = array('meetup-defaults' => array('type' => 'html', 'html' => '<h3 id="tribe-import-meetup-settings">' . esc_html__('Meetup Import Settings', 'the-events-calendar') . '</h3>'), 'meetup-defaults-info' => array('type' => 'html', 'html' => '<p>' . sprintf(esc_html__('To import Meetup events, please be sure to add your Meetup API key on %1$sEvents > Settings > APIs%2$s', 'the-events-calendar'), '<a href="' . admin_url(Tribe__Settings::$parent_page . '&page=tribe-common&tab=addons') . '">', '</a>') . '</p>'), 'tribe_aggregator_default_meetup_post_status' => array('type' => 'dropdown', 'label' => esc_html__('Default Status', 'the-events-calendar'), 'tooltip' => esc_html__('The default post status for events imported via Meetup', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_post_statuses), 'tribe_aggregator_default_meetup_category' => array('type' => 'dropdown', 'label' => esc_html__('Default Event Category', 'the-events-calendar'), 'tooltip' => esc_html__('The default event category for events imported via Meetup', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => '', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_categories), 'tribe_aggregator_default_meetup_show_map' => array('type' => 'dropdown', 'label' => esc_html__('Show Google Map', 'the-events-calendar'), 'tooltip' => esc_html__('Show Google Map by default on imported event and venues', 'the-events-calendar'), 'size' => 'medium', 'validation_type' => 'options', 'default' => 'no', 'can_be_empty' => true, 'parent_option' => Tribe__Events__Main::OPTIONNAME, 'options' => $origin_show_map_options)); } $internal = array_merge($change_authority, $global, $csv, $ical, $ics, $facebook, $gcal, $meetup); $internal = apply_filters('tribe_aggregator_fields', $internal); if (Tribe__Events__Aggregator::instance()->is_service_active()) { ob_start(); ?> <p> <?php printf(esc_html__('Use the options below to configure your imports. Global Import Settings apply to all imports, but you can also override the global settings by adjusting the origin-specific options. Check your Event Aggregator Service Status on the %1$s.', 'the-events-calendar'), '<a href="' . Tribe__Settings::instance()->get_url(array('page' => 'tribe-help')) . '#tribe-tribe-aggregator-status">' . esc_html__('Help page', 'the-events-calendar') . '</a>'); ?> </p> <div> <a href="#tribe-import-update-authority"><?php esc_html_e('Update Authority', 'the-events-calendar'); ?> </a> | <a href="#tribe-import-global-settings"><?php esc_html_e('Global', 'the-events-calendar'); ?> </a> | <a href="#tribe-import-csv-settings"><?php esc_html_e('CSV', 'the-events-calendar'); ?> </a> |
/** * Add links to the plugins row * * @param $actions * * @return mixed * @todo move to an admin class */ public function addLinksToPluginActions($actions) { $actions['settings'] = '<a href="' . Tribe__Settings::instance()->get_url() . '">' . esc_html__('Settings', 'the-events-calendar') . '</a>'; $actions['tribe-calendar'] = '<a href="' . $this->getLink() . '">' . esc_html__('Calendar', 'the-events-calendar') . '</a>'; return $actions; }
/** * Extra controls to be displayed between bulk actions and pagination. * * Used for the Print, Email and Export buttons, and for the jQuery based search. * * @param string $which (top|bottom) * @see WP_List_Table::display() */ public function extra_tablenav($which) { $export_url = add_query_arg(array('attendees_csv' => true, 'attendees_csv_nonce' => wp_create_nonce('attendees_csv_nonce'))); /** * Include TB_iframe JS */ add_thickbox(); $email_link = Tribe__Settings::instance()->get_url(array('page' => 'tickets-attendees', 'action' => 'email', 'event_id' => $this->event->ID, 'TB_iframe' => true, 'width' => 410, 'height' => 300, 'parent' => 'admin.php')); $nav = array('left' => array('print' => sprintf('<input type="button" name="print" class="print button action" value="%s">', esc_attr__('Print', 'event-tickets')), 'email' => '<a class="email button action thickbox" href="' . esc_url($email_link) . '">' . esc_attr__('Email', 'event-tickets') . '</a>', 'export' => sprintf('<a href="%s" class="export button action">%s</a>', esc_url($export_url), esc_html__('Export', 'event-tickets'))), 'right' => array()); if ('top' == $which) { $nav['right']['filter_box'] = sprintf('%s: <input type="text" name="filter_attendee" id="filter_attendee" value="">', esc_html__('Filter by purchaser name, ticket #, order # or security code', 'event-tickets')); } $nav = apply_filters('tribe_events_tickets_attendees_table_nav', $nav, $which); ?> <div class="alignleft actions"><?php echo implode($nav['left']); ?> </div> <div class="alignright"><?php echo implode($nav['right']); ?> </div> <?php }
/** * If the migration button is clicked, start working * */ 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__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 $tec = Tribe__Events__Main::instance(); $general_tab_fields = Tribe__Main::array_insert_after_key('info-start', $general_tab_fields, array('upsell-heading' => array('type' => 'heading', 'label' => esc_html__('Finding & extending your calendar.', 'the-events-calendar'), 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'finding-heading' => array('type' => 'heading', 'label' => esc_html__('Finding your calendar.', 'the-events-calendar'), 'conditional' => defined('TRIBE_HIDE_UPSELL') && TRIBE_HIDE_UPSELL), 'view-calendar-link' => array('type' => 'html', 'html' => '<p>' . esc_html__('Where\'s my calendar?', 'the-events-calendar') . ' <a href="' . esc_url(Tribe__Events__Main::instance()->getLink()) . '">' . esc_html__('Right here', 'the-events-calendar') . '</a>.</p>'))); $general_tab_fields = Tribe__Main::array_insert_before_key('debugEvents', $general_tab_fields, array('tribeEventsDisplayThemeTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('General Settings', 'the-events-calendar') . '</h3>'), 'postsPerPage' => array('type' => 'text', 'label' => esc_html__('Number of events to show per page', 'the-events-calendar'), 'size' => 'small', 'default' => get_option('posts_per_page'), 'validation_type' => 'positive_int'), 'liveFiltersUpdate' => array('type' => 'checkbox_bool', 'label' => esc_html__('Use Javascript to control date filtering', 'the-events-calendar'), 'tooltip' => tribe_get_option('tribeDisableTribeBar', false) == true ? esc_html__('This option is disabled when "Disable the Event Search Bar" is checked on the Display settings tab.', 'the-events-calendar') : esc_html__('Enable live ajax for datepicker on front end (User submit not required).', 'the-events-calendar'), 'attributes' => tribe_get_option('tribeDisableTribeBar', false) == true ? array('disabled' => 'disabled') : null, 'default' => true, 'validation_type' => 'boolean', 'class' => tribe_get_option('tribeDisableTribeBar', false) == true ? 'tribe-fieldset-disabled' : null), 'showComments' => array('type' => 'checkbox_bool', 'label' => esc_html__('Show comments', 'the-events-calendar'), 'tooltip' => esc_html__('Enable comments on event pages.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'showEventsInMainLoop' => array('type' => 'checkbox_bool', 'label' => esc_html__('Include events in main blog loop', 'the-events-calendar'), 'tooltip' => esc_html__('Show events with the site\'s other posts. When this box is checked, events will also continue to appear on the default events page.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'unprettyPermalinksUrl' => array('type' => 'html', 'label' => esc_html__('Events URL slug', 'the-events-calendar'), 'html' => '<p>' . sprintf(__('You cannot edit the slug for your events page as you do not have pretty permalinks enabled. The current URL for your events page is <a href="%1$s">%2$s</a>. In order to edit the slug here, <a href="%3$soptions-permalink.php">enable pretty permalinks</a>.', 'the-events-calendar'), esc_url($tec->getLink('home')), $tec->getLink('home '), esc_url(trailingslashit(get_admin_url()))) . '</p>', 'conditional' => '' == get_option('permalink_structure')), 'eventsSlug' => array('type' => 'text', 'label' => esc_html__('Events URL slug', 'the-events-calendar'), 'default' => 'events', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-events-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . esc_html__('The slug used for building the events URL.', 'the-events-calendar') . sprintf(esc_html__('Your current events URL is: %s', 'the-events-calendar'), '<code><a href="' . esc_url(tribe_get_events_link()) . '">' . tribe_get_events_link() . '</a></code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'ical-info' => array('type' => 'html', 'display_callback' => function_exists('tribe_get_ical_link') ? '<p id="ical-link" class="tribe-field-indent tribe-field-description description">' . esc_html__('Here is the iCal feed URL for your events:', 'the-events-calendar') . ' <code>' . tribe_get_ical_link() . '</code></p>' : '', 'conditional' => function_exists('tribe_get_ical_link')), 'singleEventSlug' => array('type' => 'text', 'label' => esc_html__('Single event URL slug', 'the-events-calendar'), 'default' => 'event', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-single-event-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__('The above should ideally be plural, and this singular.<br />Your single event URL is: %s', 'the-events-calendar'), '<code>' . trailingslashit(home_url()) . tribe_get_option('singleEventSlug', 'event') . '/single-post-name/</code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'multiDayCutoff' => array('type' => 'dropdown', 'label' => esc_html__('End of day cutoff', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'small', 'default' => '12:00', 'options' => array('00:00' => '12:00 am', '01:00' => '01:00 am', '02:00' => '02:00 am', '03:00' => '03:00 am', '04:00' => '04:00 am', '05:00' => '05:00 am', '06:00' => '06:00 am', '07:00' => '07:00 am', '08:00' => '08:00 am', '09:00' => '09:00 am', '10:00' => '10:00 am', '11:00' => '11:00 am')), 'multiDayCutoffHelper' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(esc_html__("Have an event that runs past midnight? Select a time after that event's end to avoid showing the event on the next day's calendar.", 'the-events-calendar')) . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'defaultCurrencySymbol' => array('type' => 'text', 'label' => esc_html__('Default currency symbol', 'the-events-calendar'), 'tooltip' => esc_html__('Set the default currency symbol for event costs. Note that this only impacts future events, and changes made will not apply retroactively.', 'the-events-calendar'), 'validation_type' => 'textarea', 'size' => 'small', 'default' => '$'), 'reverseCurrencyPosition' => array('type' => 'checkbox_bool', 'label' => esc_html__('Currency symbol follows value', 'the-events-calendar'), 'tooltip' => esc_html__('The currency symbol normally precedes the value. Enabling this option positions the symbol after the value.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'amalgamateDuplicates' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . esc_html__('Duplicate Venues & Organizers', 'the-events-calendar') . '</legend><div class="tribe-field-wrap">' . Tribe__Events__Amalgamator::migration_button(esc_html__('Merge Duplicates', 'the-events-calendar')) . '<p class="tribe-field-indent description">' . esc_html__('You might find duplicate venues and organizers when updating The Events Calendar from a pre-3.0 version. Click this button to automatically merge identical venues and organizers.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>', 'conditional' => Tribe__Settings_Manager::get_option('organizer_venue_amalgamation', 0) < 1), 'tribeEventsMiscellaneousTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('Miscellaneous Settings', 'the-events-calendar') . '</h3>'))); $general_tab_fields = Tribe__Main::array_insert_after_key('tribeEventsMiscellaneousTitle', $general_tab_fields, array('viewWelcomePage' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . esc_html__('View Welcome Page', 'the-events-calendar') . '</legend><div class="tribe-field-wrap"><a href="' . Tribe__Settings::instance()->get_url(array(Tribe__Events__Main::instance()->activation_page->welcome_slug => 1)) . '" class="button">' . esc_html__('View Welcome Page', 'the-events-calendar') . '</a><p class="tribe-field-indent description">' . esc_html__('View the page that displayed when you initially installed the plugin.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>'), 'viewUpdatePage' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . esc_html__('View Update Page', 'the-events-calendar') . '</legend><div class="tribe-field-wrap"><a href="' . Tribe__Settings::instance()->get_url(array(Tribe__Events__Main::instance()->activation_page->update_slug => 1)) . '" class="button">' . esc_html__('View Update Page', 'the-events-calendar') . '</a><p class="tribe-field-indent description">' . esc_html__('View the page that displayed when you updated the plugin.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>'))); $general_tab_fields = Tribe__Main::array_insert_before_key('tribeEventsMiscellaneousTitle', $general_tab_fields, array('tribeEventsDisplayTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('Map Settings', 'the-events-calendar') . '</h3>'), 'embedGoogleMaps' => array('type' => 'checkbox_bool', 'label' => esc_html__('Enable Google Maps', 'the-events-calendar'), 'tooltip' => esc_html__('Check to enable maps for events and venues.', 'the-events-calendar'), 'default' => true, 'class' => 'google-embed-size', 'validation_type' => 'boolean'), 'embedGoogleMapsZoom' => array('type' => 'text', 'label' => esc_html__('Google Maps default zoom level', 'the-events-calendar'), 'tooltip' => esc_html__('0 = zoomed out; 21 = zoomed in.', 'the-events-calendar'), 'size' => 'small', 'default' => 10, 'class' => 'google-embed-field', 'validation_type' => 'number_or_percent'))); return $general_tab_fields;
/** * Adds a link to the Filter Settings tab in the admin toolbar. */ public function add_toolbar_item() { global $wp_admin_bar; $parent = 'tribe-events-settings'; $link = Tribe__Settings::instance()->get_url(array('tab' => 'filter-view')); if (!current_user_can('manage_options') || null === $wp_admin_bar->get_node($parent)) { return; } $wp_admin_bar->add_menu(array('id' => 'tribe-events-filter-settings', 'parent' => $parent, 'href' => $link, 'title' => __('Filter Bar', 'tribe-events-filter-view'))); }
<?php /** * Create a easy way to hook to the Add-ons Tab Fields * @var array */ $internal = array(); $current_url = Tribe__Settings::instance()->get_url(array('tab' => 'addons')); // if there's an Event Aggregator license key, add the Facebook API fields if (get_option('pue_install_key_event_aggregator')) { $fb_token = tribe_get_option('fb_token'); $fb_token_expires = tribe_get_option('fb_token_expires'); $fb_token_scopes = tribe_get_option('fb_token_scopes'); $missing_fb_credentials = !$fb_token || !$fb_token_scopes || !$fb_token_expires || $fb_token_expires <= time(); if (!$missing_fb_credentials) { /** * Allow developers to filter how many seconds they want to be warned about FB token expiring * @param int */ $boundary = apply_filters('tribe_aggregator_facebook_token_expire_notice_boundary', 4 * DAY_IN_SECONDS); // Creates a Boundary for expire warning to appear, before the actual expiring of the token $boundary = $fb_token_expires - $boundary; $diff = human_time_diff(time(), $boundary); $passed = time() - $fb_token_expires; $original = date('Y-m-d H:i:s', $fb_token_expires); $time[] = '<span title="' . esc_attr($original) . '">'; if ($passed > 0) { $time[] = sprintf(esc_html_x('about %s ago', 'human readable time ago', 'the-events-calendar'), $diff); } else { $time[] = sprintf(esc_html_x('in about %s', 'in human readable time', 'the-events-calendar'), $diff); }
/** * Return additional action for the plugin on the plugins page. * * @return array */ public function addLinksToPluginActions($actions) { if (class_exists('Tribe__Events__Main')) { $actions['settings'] = '<a href="' . Tribe__Settings::instance()->get_url() . '">' . esc_html__('Settings', 'tribe-events-calendar-pro') . '</a>'; } return $actions; }
data-width-rule="all-triggers" ></span> <span class="tribe-bumpdown-trigger tribe-bumpdown-permanent tribe-bumpdown-nohover tribe-ea-help dashicons dashicons-editor-help tribe-dependent" data-bumpdown="<?php echo esc_attr($scheduled_save_help); ?> " data-depends="#tribe-ea-field-facebook_import_type" data-condition="schedule" data-width-rule="all-triggers" ></span> <p class="tribe-timezone-message"> <?php echo sprintf(esc_html__('Events will be imported with the timezone defined by the source. If no time zone is specified, events will be assigned your site\'s default timezone (see %1$sSettings > General%2$s).', 'the-events-calendar'), '<a href="' . esc_url(Tribe__Settings::instance()->get_url()) . '#tribe-field-tribe_events_timezone_mode">', '</a>'); ?> </p> </div> <?php echo Tribe__Events__Aggregator__Tabs__New::instance()->maybe_display_aggregator_upsell(); $csv_record = Tribe__Events__Aggregator__Records::instance()->get_by_origin('csv'); $post_types = $csv_record->get_import_post_types(); foreach ($post_types as $post_type) { $type = str_replace('tribe_', '', $post_type->name); ?> <script id="tribe-csv-column-map-<?php echo esc_attr($type); ?> " type="text/html"> <?php
/** * Deactivates the regular settings screen (the splash screen will display * in the Events > Settings slot instead, for this request only). */ protected function disable_default_settings_page() { remove_action(Tribe__Settings::instance()->admin_page, array(Tribe__Settings::instance(), 'generatePage')); }
public function notice_facebook_token_expired() { if (!Tribe__Admin__Helpers::instance()->is_screen()) { return false; } $expires = tribe_get_option('fb_token_expires'); // Empty Token if (empty($expires)) { return false; } /** * Allow developers to filter how many seconds they want to be warned about FB token expiring * @param int */ $boundary = apply_filters('tribe_aggregator_facebook_token_expire_notice_boundary', 4 * DAY_IN_SECONDS); // Creates a Boundary for expire warning to appear, before the actual expiring of the token $boundary = $expires - $boundary; if (time() < $boundary) { return false; } $diff = human_time_diff(time(), $boundary); $passed = time() - $expires; $original = date('Y-m-d H:i:s', $expires); $time[] = '<span title="' . esc_attr($original) . '">'; if ($passed > 0) { $time[] = sprintf(esc_html_x('about %s ago', 'human readable time ago', 'the-events-calendar'), $diff); } else { $time[] = sprintf(esc_html_x('in about %s', 'in human readable time', 'the-events-calendar'), $diff); } $time[] = '</span>'; $time = implode('', $time); ob_start(); ?> <p> <?php if ($passed > 0) { echo sprintf(__('Your Event Aggregator Facebook token has expired %s.', 'the-events-calendar'), $time); } else { echo sprintf(__('Your Event Aggregator Facebook token will expire %s.', 'the-events-calendar'), $time); } ?> </p> <p> <a href="<?php echo esc_url(Tribe__Settings::instance()->get_url(array('tab' => 'addons'))); ?> " class="tribe-license-link"><?php esc_html_e('Renew your Event Aggregator Facebook token', 'the-events-calendar'); ?> </a> </p> <?php $html = ob_get_clean(); return Tribe__Admin__Notices::instance()->render('tribe-aggregator-facebook-token-expired', $html); }
public function add_action_links($links) { $mylinks = array(); if (class_exists('Tribe__Settings') and method_exists(Tribe__Settings::instance(), 'should_setup_pages') and Tribe__Settings::instance()->should_setup_pages()) { $mylinks[] = '<a href="' . admin_url('edit.php?post_type=tribe_events&page=ecs-admin') . '">Settings</a>'; } $mylinks[] = '<a target="_blank" style="color:#3db634; font-weight: bold;" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode/?utm_source=plugin-list&utm_medium=upgrade-link&utm_campaign=plugin-list&utm_content=action-link">Upgrade</a>'; return array_merge($links, $mylinks); }
/** * create the main option page * * @return void */ public function addPage() { if (!$this->should_setup_pages()) { return; } if (!is_multisite() || is_multisite() && '0' == Tribe__Settings_Manager::get_network_option('allSettingsTabsHidden', '0')) { if (post_type_exists('tribe_events')) { self::$parent_page = 'edit.php?post_type=tribe_events'; } else { self::$parent_page = 'admin.php?page=tribe-common'; add_menu_page(esc_html__('Events', 'tribe-common'), esc_html__('Events', 'tribe-common'), apply_filters('tribe_common_event_page_capability', 'manage_options'), self::$parent_slug, null, 'dashicons-calendar', 6); } $this->admin_page = add_submenu_page($this->get_parent_slug(), esc_html__('Events Settings', 'tribe-common'), esc_html__('Settings', 'tribe-common'), $this->requiredCap, self::$parent_slug, array($this, 'generatePage')); } }
/** * If there are venues without geo data, offer the user to fix them. */ public function show_offer_to_fix_notice() { $settings = Tribe__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 }
public function handle_facebook_credentials() { /** * Verify that we are dealing with a FB token Request */ if (!isset($_GET['ea-fb-token'])) { return false; } /** * @todo include a way to handle errors on the Send back URL */ $api = Tribe__Events__Aggregator__Service::instance()->api(); $response = Tribe__Events__Aggregator__Service::instance()->get_facebook_token(); $type = $_GET['ea-fb-token']; if (is_wp_error($response)) { return false; } if (empty($response->data)) { return false; } if (empty($response->data->expires) || empty($response->data->token) || empty($response->data->scopes)) { return false; } $url_map = array('new' => Tribe__Events__Aggregator__Page::instance()->get_url(array('tab' => $this->get_slug(), 'ea-auth' => 'facebook')), 'settings' => Tribe__Settings::instance()->get_url(array('tab' => 'addons', 'ea-auth' => 'facebook'))); if (!isset($url_map[$type])) { return false; } // Calculate when will this Token Expire $expires = absint(trim(preg_replace('/[^0-9]/', '', $response->data->expires))); $expires += time(); // Save the Options tribe_update_option('fb_token', trim(preg_replace('/[^a-zA-Z0-9]/', '', $response->data->token))); tribe_update_option('fb_token_expires', $expires); tribe_update_option('fb_token_scopes', trim(preg_replace('/[^a-zA-Z0-9\\,_-]/', '', $response->data->scopes))); // Send it back to the Given Url wp_redirect($url_map[$type]); exit; }
/** * Add the network admin options page * * @return void */ public static function add_network_options_page() { $tribe_settings = Tribe__Settings::instance(); add_submenu_page('settings.php', $tribe_settings->menuName, $tribe_settings->menuName, 'manage_network_options', 'tribe-common', array($tribe_settings, 'generatePage')); }
<?php // Don't load directly if (!defined('ABSPATH')) { die('-1'); } $enable_button_label = esc_html__('Enable timezone support', 'the-events-calendar'); $enable_button_url = esc_url(wp_nonce_url(add_query_arg('timezone-update', '1', Tribe__Settings::instance()->get_url()), 'timezone-settings')); $enable_button_text = esc_html__('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' => '<h3>' . esc_html__('Timezone Settings', 'the-events-calendar') . '</h3>'), 'tribe_events_enable_timezones' => array('type' => 'html', 'html' => $enable_button_html), 'tribe_events_timezone_mode' => array('type' => 'dropdown', 'label' => esc_html__('Timezone mode', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'large', 'options' => array('event' => esc_html__('Use the local timezones for each event', 'the-events-calendar'), 'site' => esc_html__('Use the sitewide timezone everywhere', 'the-events-calendar'))), 'tribe_events_timezones_show_zone' => array('type' => 'checkbox_bool', 'label' => esc_html__('Show timezone', 'the-events-calendar'), 'tooltip' => esc_html__('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'));
?> "> <?php if ($missing_meetup_credentials) { ?> <input type="hidden" name="has-credentials" id="tribe-has-meetup-credentials" value="0"> <div class="tribe-message tribe-credentials-prompt"> <span class="dashicons dashicons-warning"></span> <?php printf(esc_html__('Enter your Meetup API key to import Meetup events. %1$sClick here to get your Meetup API key%2$s. You only need to do this once, it will be saved under %3$sEvents > Settings > APIs%4$s', 'the-events-calendar'), '<a href="https://secure.meetup.com/meetup_api/key/">', '</a>', '<a href="' . esc_url(Tribe__Settings::instance()->get_url(array('tab' => 'addons'))) . '">', '</a>'); ?> </div> <div class="tribe-message tribe-credentials-success"> <span class="dashicons dashicons-yes"></span> <?php printf(esc_html__('Your Meetup API key has been saved to %1$sEvents > Settings > APIs%2$s', 'the-events-calendar'), '<a href="' . esc_url(Tribe__Settings::instance()->get_url(array('tab' => 'addons'))) . '">', '</a>'); ?> </div> <div class="tribe-fieldset"> <?php wp_nonce_field('tribe-save-meetup-credentials'); ?> <input type="hidden" name="tribe_credentials_which" value="meetup"> <label for="meetup_api_key"><?php esc_html_e('Meetup API Key:', 'the-events-calendar'); ?> </label> <input type="text" name="meetup_api_key" id="meetup_api_key" value="<?php echo esc_attr($meetup_api_key); ?> ">