コード例 #1
0
 /**
  * The init function for this class, adds actions and filters.
  *
  */
 public static function init()
 {
     if (is_admin()) {
         if (!Tribe__Main::instance()->doing_ajax()) {
             // Logic for sorting events by event category or tags
             add_filter('posts_clauses', array(__CLASS__, 'sort_by_tax'), 10, 2);
             // Logic for sorting events by start or end date
             add_filter('posts_clauses', array(__CLASS__, 'sort_by_event_date'), 11, 2);
             add_filter('posts_fields', array(__CLASS__, 'events_search_fields'), 10, 2);
             // Pagination
             add_filter('post_limits', array(__CLASS__, 'events_search_limits'), 10, 2);
             add_filter('tribe_apm_headers_' . Tribe__Events__Main::POSTTYPE, array(__CLASS__, 'column_headers_check'));
             add_filter('views_edit-tribe_events', array(__CLASS__, 'update_event_counts'));
         }
         /**
          * The following actions will need to be fired on AJAX calls, the logic above is required.
          *
          * Registers custom event columns category/start date/end date
          */
         add_action('manage_posts_custom_column', array(__CLASS__, 'custom_columns'), 10, 2);
         add_filter('manage_' . Tribe__Events__Main::POSTTYPE . '_posts_columns', array(__CLASS__, 'column_headers'));
         // Registers event start/end date as sortable columns
         add_action('manage_edit-' . Tribe__Events__Main::POSTTYPE . '_sortable_columns', array(__CLASS__, 'register_sortable_columns'), 10, 2);
     }
 }
コード例 #2
0
ファイル: Abstract.php プロジェクト: nullify005/shcc-website
 /**
  * Compile the schema.org event data into an array
  */
 public function get_data($post = null, $args = array())
 {
     if (!$post instanceof WP_Post) {
         $post = Tribe__Main::post_id_helper($post);
     }
     $post = get_post($post);
     if (!$post instanceof WP_Post) {
         return array();
     }
     $data = (object) array();
     // We may need to prevent the context to be triggered
     if (!isset($args['context']) || false !== $args['context']) {
         $data->{'@context'} = 'http://schema.org';
     }
     $data->{'@type'} = $this->type;
     $data->name = esc_js(get_the_title($post));
     $data->description = esc_js(tribe_events_get_the_excerpt($post));
     if (has_post_thumbnail($post)) {
         $data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
     }
     $data->url = esc_url_raw(get_permalink($post));
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     return array($post->ID => $data);
 }
コード例 #3
0
 /**
  * Create a clean way of fetching API variables
  *
  * @return stdClass|WP_Error
  */
 public function api()
 {
     // Make it an Object
     $api = (object) $this->api;
     if (defined('EVENT_AGGREGATOR_API_BASE_URL')) {
         $api->domain = EVENT_AGGREGATOR_API_BASE_URL;
     }
     // Since we don't need to fetch this key elsewhere
     $api->key = get_option('pue_install_key_event_aggregator');
     /**
      * Creates a clean way to filter and redirect to another API domain/path
      * @var stdClass
      */
     $api = (object) apply_filters('tribe_aggregator_api', $api);
     // The user doesn't have a license key
     if (empty($api->key)) {
         return tribe_error('core:aggregator:invalid-service-key');
     }
     $aggregator = Tribe__Events__Aggregator::instance();
     $plugin_name = $aggregator->filter_pue_plugin_name('', 'event-aggregator');
     $pue_notices = Tribe__Main::instance()->pue_notices();
     $has_notice = $pue_notices->has_notice($plugin_name);
     // The user doesn't have a valid license key
     if (empty($api->key) || $has_notice) {
         return tribe_error('core:aggregator:invalid-service-key');
     }
     return $api;
 }
コード例 #4
0
 /**
  * Event date & upcoming filters should not be removed when the query is being done via AJAX
  *
  * We have to segregate the AJAX tests because we're going to twiddle the DOING_AJAX constant
  *
  * @test
  */
 public function it_should_not_remove_date_filters_when_doing_ajax()
 {
     Tribe__Main::instance()->doing_ajax(true);
     $query = new WP_Query();
     $query->parse_query(['post_type' => Tribe__Events__Main::POSTTYPE]);
     $this->assertFalse(Tribe__Events__Query::should_remove_date_filters($query), 'Date filters should not be removed when doing AJAX stuff');
     Tribe__Main::instance()->doing_ajax(false);
 }
コード例 #5
0
 /**
  * A private method to prevent it to be created twice.
  * It will add the methods and setup any dependencies
  */
 private function __construct()
 {
     add_filter('admin_title', array($this, 'filter_admin_title'), 10, 2);
     // Configure the Base Tabs
     $this->register('Tribe__Events__Aggregator__Tabs__New');
     $this->register('Tribe__Events__Aggregator__Tabs__Scheduled');
     $this->register('Tribe__Events__Aggregator__Tabs__History');
     if (!empty($_GET['id']) || Tribe__Main::instance()->doing_ajax()) {
         $this->register('Tribe__Events__Aggregator__Tabs__Edit');
     }
 }
コード例 #6
0
 /**
  * Render the debug logging to the php error log. This can be over-ridden by removing the filter.
  *
  * @param string      $title  - message to display in log
  * @param string|bool $data   - optional data to display
  * @param string      $format - optional format (log|warning|error|notice)
  *
  * @return void
  */
 public static function render($title, $data = false, $format = 'log')
 {
     $format = ucfirst($format);
     if (Tribe__Settings_Manager::instance()->get_option('debugEvents')) {
         $plugin = basename(dirname(Tribe__Main::instance()->plugin_path));
         error_log("{$plugin}/common -  {$format}: {$title}");
         if ($data && $data != '') {
             error_log("{$plugin}/common - {$format}: " . print_r($data, true));
         }
     }
 }
コード例 #7
0
/**
 * Sets up the textdomain stuff
 */
function event_tickets_plus_setup_textdomain()
{
    tribe_init_tickets_plus_autoloading();
    $mopath = trailingslashit(basename(dirname(__FILE__))) . 'lang/';
    $domain = 'event-tickets-plus';
    // If we don't have Common classes load the old fashioned way
    if (!class_exists('Tribe__Main')) {
        load_plugin_textdomain($domain, false, $mopath);
    } else {
        // This will load `wp-content/languages/plugins` files first
        Tribe__Main::instance()->load_text_domain($domain, $mopath);
    }
    define('EVENT_TICKETS_PLUS_TEXTDOMAIN_LOADED', true);
}
コード例 #8
0
 /**
  * Adds timezone settings to the *General* settings tab.
  *
  * When it is determined that timezone data still needs to be generated for one or more
  * events then only the update tool will be exposed in this area, in all other cases this
  * is not exposed and the ordinary timezone settings will be visible.
  *
  * @param array $general_settings
  *
  * @return array
  */
 public function settings_ui(array $general_settings)
 {
     $updater = new Tribe__Events__Admin__Timezone_Updater();
     // Load all timezone settings
     $timezone_settings = $this->get_settings_array();
     // Remove unneeded options: until timezone data has been updated, users should only see the update
     // button - after that point, they should see the "real" settings but not the update button
     if ($updater->update_needed()) {
         unset($timezone_settings['tribe_events_timezone_mode']);
         unset($timezone_settings['tribe_events_timezones_show_zone']);
     } else {
         unset($timezone_settings['tribe_events_enable_timezones']);
     }
     // Add the new section just before the settings form is closed
     return Tribe__Main::array_insert_before_key('tribe-form-content-end', $general_settings, $timezone_settings);
 }
コード例 #9
0
 /**
  * Register the Methods in the correct places
  */
 private function __construct()
 {
     // Not in the admin we don't even care
     if (!is_admin()) {
         return;
     }
     // Before we bail on the
     add_action('wp_ajax_tribe_notice_dismiss', array($this, 'maybe_dismiss'));
     // Doing AJAX? bail.
     if (Tribe__Main::instance()->doing_ajax()) {
         return;
     }
     // Hook the actual rendering of notices
     add_action('current_screen', array($this, 'hook'), 20);
     // Add our notice dismissal script
     tribe_asset(Tribe__Main::instance(), 'tribe-notice-dismiss', 'notice-dismiss.js', array('jquery'), 'admin_enqueue_scripts');
 }
コード例 #10
0
/**
 * Shows message if the plugin can't load due to TEC not being installed.
 */
function tribe_show_fail_message()
{
    if (!current_user_can('activate_plugins')) {
        return;
    }
    $mopath = trailingslashit(basename(dirname(__FILE__))) . 'lang/';
    $domain = 'tribe-events-calendar-pro';
    // If we don't have Common classes load the old fashioned way
    if (!class_exists('Tribe__Main')) {
        load_plugin_textdomain($domain, false, $mopath);
    } else {
        // This will load `wp-content/languages/plugins` files first
        Tribe__Main::instance()->load_text_domain($domain, $mopath);
    }
    $url = 'plugin-install.php?tab=plugin-information&plugin=the-events-calendar&TB_iframe=true';
    $title = __('The Events Calendar', 'tribe-events-calendar-pro');
    echo '<div class="error"><p>' . sprintf(__('To begin using Events Calendar PRO, please install the latest version of <a href="%s" class="thickbox" title="%s">The Events Calendar</a>.', 'tribe-events-calendar-pro'), esc_url($url), $title) . '</p></div>';
}
コード例 #11
0
 /**
  * Returns the currently enabled logging object or null if it is not
  * available.
  *
  * @return Tribe__Log__Logger|null
  */
 protected function current_logger()
 {
     return Tribe__Main::instance()->log()->get_current_logger();
 }
コード例 #12
0
 /**
  * Determines how to handle this field's creation
  * either calls a callback function or runs this class' course of action
  * logs an error if it fails
  *
  * @return void
  */
 public function do_field()
 {
     if ($this->conditional) {
         if ($this->display_callback && is_callable($this->display_callback)) {
             // if there's a callback, run it
             call_user_func($this->display_callback);
         } elseif (in_array($this->type, $this->valid_field_types)) {
             // the specified type exists, run the appropriate method
             $field = call_user_func(array($this, $this->type));
             // filter the output
             $field = apply_filters('tribe_field_output_' . $this->type, $field, $this->id, $this);
             echo apply_filters('tribe_field_output_' . $this->type . '_' . $this->id, $field, $this->id, $this);
         } else {
             // fail, log the error
             Tribe__Main::debug(esc_html__('Invalid field type specified', 'tribe-common'), $this->type, 'notice');
         }
     }
 }
コード例 #13
0
$tec = Tribe__Events__Main::instance();
$template_options = array('' => esc_html__('Default Events Template', 'the-events-calendar'), 'default' => esc_html__('Default Page Template', 'the-events-calendar'));
$templates = get_page_templates();
ksort($templates);
foreach (array_keys($templates) as $template) {
    $template_options[$templates[$template]] = $template;
}
/**
 * Filter the array of views that are registered for the tribe bar
 * @param array array() {
 *     Array of views, where each view is itself represented by an associative array consisting of these keys:
 *
 *     @type string $displaying         slug for the view
 *     @type string $anchor             display text (i.e. "List" or "Month")
 *     @type string $event_bar_hook     not used
 *     @type string $url                url to the view
 * }
 * @param boolean
 */
$views = apply_filters('tribe-events-bar-views', array(), false);
$views_options = array();
foreach ($views as $view) {
    $views_options[$view['displaying']] = $view['anchor'];
}
$display_tab_fields = Tribe__Main::array_insert_before_key('tribe-form-content-start', $display_tab_fields, array('info-start' => array('type' => 'html', 'html' => '<div id="modern-tribe-info">'), 'info-box-title' => array('type' => 'html', 'html' => '<h2>' . __('Display Settings', 'the-events-calendar') . '</h2>'), 'info-box-description' => array('type' => 'html', 'html' => '<p>' . sprintf(__('The settings below control the display of your calendar. If things don\'t look right, try switching between the three style sheet options or pick a page template from your theme.</p><p>There are going to be situations where no out-of-the-box template is 100&#37; perfect. Check out our <a href="%s">our themer\'s guide</a> for instructions on custom modifications.', 'the-events-calendar'), Tribe__Main::$tec_url . 'knowledgebase/themers-guide/?utm_medium=plugin-tec&utm_source=generaltab&utm_campaign=in-app') . '</p>'), 'info-end' => array('type' => 'html', 'html' => '</div>')));
$display_tab_fields = Tribe__Main::array_insert_after_key('dateWithYearFormat', $display_tab_fields, array('dateWithoutYearFormat' => array('type' => 'text', 'label' => esc_html__('Date without year', 'the-events-calendar'), 'tooltip' => esc_html__('Enter the format to use for displaying dates without a year. Used when showing an event from the current year.', 'the-events-calendar'), 'default' => 'F j', 'size' => 'medium', 'validation_type' => 'html'), 'monthAndYearFormat' => array('type' => 'text', 'label' => esc_html__('Month and year format', 'the-events-calendar'), 'tooltip' => esc_html__('Enter the format to use for dates that show a month and year only. Used on month view.', 'the-events-calendar'), 'default' => 'F Y', 'size' => 'medium', 'validation_type' => 'html')));
$display_tab_fields = Tribe__Main::array_insert_after_key('dateTimeSeparator', $display_tab_fields, array('timeRangeSeparator' => array('type' => 'text', 'label' => esc_html__('Time range separator', 'the-events-calendar'), 'tooltip' => esc_html__('Enter the separator that will be used between the start and end time of an event.', 'the-events-calendar'), 'default' => ' - ', 'size' => 'small', 'validation_type' => 'html')));
$display_tab_fields = Tribe__Main::array_insert_before_key('tribeEventsDateFormatSettingsTitle', $display_tab_fields, array('tribeEventsBasicSettingsTitle' => array('type' => 'html', 'html' => '<h3>' . __('Basic Template Settings', 'the-events-calendar') . '</h3>'), 'stylesheetOption' => array('type' => 'radio', 'label' => __('Default stylesheet used for events templates', 'the-events-calendar'), 'default' => 'tribe', 'options' => array('skeleton' => __('Skeleton Styles', 'the-events-calendar') . '<p class=\'description tribe-style-selection\'>' . __('Only includes enough css to achieve complex layouts like calendar and week view.', 'the-events-calendar') . '</p>', 'full' => __('Full Styles', 'the-events-calendar') . '<p class=\'description tribe-style-selection\'>' . __('More detailed styling, tries to grab styles from your theme.', 'the-events-calendar') . '</p>', 'tribe' => __('Tribe Events Styles', 'the-events-calendar') . '<p class=\'description tribe-style-selection\'>' . __('A fully designed and styled theme for your events pages.', 'the-events-calendar') . '</p>'), 'validation_type' => 'options'), 'tribeEventsTemplate' => array('type' => 'dropdown_select2', 'label' => __('Events template', 'the-events-calendar'), 'tooltip' => __('Choose a page template to control the appearance of your calendar and event content.', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'large', 'default' => 'default', 'options' => $template_options), 'tribeEnableViews' => array('type' => 'checkbox_list', 'label' => __('Enable event views', 'the-events-calendar'), 'tooltip' => __('You must select at least one view.', 'the-events-calendar'), 'default' => array_keys($views_options), 'options' => $views_options, 'validation_type' => 'options_multi'), 'viewOption' => array('type' => 'dropdown_select2', 'label' => __('Default view', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'large', 'default' => 'month', 'options' => $views_options), 'tribeDisableTribeBar' => array('type' => 'checkbox_bool', 'label' => __('Disable the Event Search Bar', 'the-events-calendar'), 'tooltip' => __('Check this to use the classic header.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'monthEventAmount' => array('type' => 'text', 'label' => __('Month view events per day', 'the-events-calendar'), 'tooltip' => sprintf(__('Change the default 3 events per day in month view. Please note there may be performance issues if you set this too high. <a href="%s">Read more</a>.', 'the-events-calendar'), 'http://m.tri.be/rh'), 'validation_type' => 'positive_int', 'size' => 'small', 'default' => '3'), 'enable_month_view_cache' => array('type' => 'checkbox_bool', 'label' => __('Enable the Month View Cache', 'the-events-calendar'), 'tooltip' => sprintf(__('Check this to cache your month view HTML in transients, which can help improve calendar speed on sites with many events. <a href="%s">Read more</a>.', 'the-events-calendar'), 'http://m.tri.be/18di'), 'default' => false, 'validation_type' => 'boolean')));
$display_tab_fields = Tribe__Main::array_insert_after_key('datepickerFormat', $display_tab_fields, array('tribeEventsAdvancedSettingsTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('Advanced Template Settings', 'the-events-calendar') . '</h3>'), 'tribeEventsBeforeHTML' => array('type' => 'wysiwyg', 'label' => esc_html__('Add HTML before event content', 'the-events-calendar'), 'tooltip' => esc_html__('If you are familiar with HTML, you can add additional code before the event template. Some themes may require this to help with styling or layout.', 'the-events-calendar'), 'validation_type' => 'html'), 'tribeEventsAfterHTML' => array('type' => 'wysiwyg', 'label' => esc_html__('Add HTML after event content', 'the-events-calendar'), 'tooltip' => esc_html__('If you are familiar with HTML, you can add additional code after the event template. Some themes may require this to help with styling or layout.', 'the-events-calendar'), 'validation_type' => 'html')));
コード例 #14
0
ファイル: Main.php プロジェクト: TakenCdosG/chefs
 /**
  * Finalize the initialization of this plugin
  */
 public function plugins_loaded()
 {
     // It's possible we'll have initialized already (if the plugin has been embedded as a vendor lib
     // within another plugin, for example) in which case we need not repeat the process
     if ($this->has_initialized) {
         return;
     }
     if (class_exists('TribeEvents', false) || class_exists('Tribe__Events__Main') && !version_compare(Tribe__Events__Main::VERSION, self::MIN_TEC_VERSION, '>=')) {
         add_action('admin_notices', array($this, 'tec_compatibility_notice'));
         /**
          * Fires if Event Tickets cannot load due to compatibility or other problems.
          */
         do_action('tribe_tickets_plugin_failed_to_load');
         return;
     }
     $this->init_autoloading();
     // initialize the common libraries
     $this->common();
     Tribe__Main::instance()->load_text_domain('event-tickets', $this->plugin_dir . 'lang/');
     $this->hooks();
     $this->has_initialized = true;
     $this->rsvp();
     $this->user_event_confirmation_list_shortcode();
     // Load the Hooks on JSON_LD
     Tribe__Tickets__JSON_LD__Order::hook();
     /**
      * Fires once Event Tickets has completed basic setup.
      */
     do_action('tribe_tickets_plugin_loaded');
 }
コード例 #15
0
 /**
  * @return Tribe__PUE__Notices
  */
 public function pue_notices()
 {
     if (empty(self::$pue_notices)) {
         self::$pue_notices = new Tribe__PUE__Notices();
     }
     return self::$pue_notices;
 }
コード例 #16
0
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$start_datetime = tribe_get_start_date();
$start_date = tribe_get_start_date(null, false);
$start_time = tribe_get_start_date(null, false, $time_format);
$start_ts = tribe_get_start_date(null, false, Tribe__Date_Utils::DBDATEFORMAT);
$end_datetime = tribe_get_end_date();
$end_date = tribe_get_display_end_date(null, false);
$end_time = tribe_get_end_date(null, false, $time_format);
$end_ts = tribe_get_end_date(null, false, Tribe__Date_Utils::DBDATEFORMAT);
$time_formatted = null;
if ($start_time == $end_time) {
    $time_formatted = esc_html($start_time);
} else {
    $time_formatted = esc_html($start_time . $time_range_separator . $end_time);
}
$event_id = Tribe__Main::post_id_helper();
/**
 * Returns a formatted time for a single event
 *
 * @var string Formatted time string
 * @var int Event post id
 */
$time_formatted = apply_filters('tribe_events_single_event_time_formatted', $time_formatted, $event_id);
/**
 * Returns the title of the "Time" section of event details
 *
 * @var string Time title
 * @var int Event post id
 */
$time_title = apply_filters('tribe_events_single_event_time_title', __('Time:', 'the-events-calendar'), $event_id);
$cost = tribe_get_formatted_cost();
コード例 #17
0
 /**
  * Helper function for getting Post Id. Accepts null or a post id. If no $post object exists, returns false to avoid a PHP NOTICE
  *
  * @param int $postId (optional)
  *
  * @return int post ID
  */
 public static function postIdHelper($postId = null)
 {
     return Tribe__Main::post_id_helper($postId);
 }
コード例 #18
0
ファイル: App_Shop.php プロジェクト: nullify005/shcc-website
 /**
  * Renders the Shop App page
  */
 public function do_menu_page()
 {
     $products = $this->get_all_products();
     include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/app-shop.php';
 }
コード例 #19
0
ファイル: Filters.php プロジェクト: TakenCdosG/chefs
 /**
  * Filters the permalink generated for a recurring event "all" view to remove aberrations.
  *
  * @param string $event_url
  * @param int    $event_id
  *
  * @return string
  */
 public function filter_tribe_events_pro_get_all_link($event_url, $event_id)
 {
     $post = get_post(Tribe__Main::post_id_helper($event_id));
     if (!tribe_is_event($post) || $post->post_parent != 0) {
         return $event_url;
     }
     $post_name = $post->post_name;
     // WPML might replace the post name with `<post_name>/<date>`; we undo that here.
     $event_url = preg_replace('~' . preg_quote($post_name) . '\\/\\d{4}-\\d{2}-\\d{2}~', $post_name, $event_url);
     return $event_url;
 }
コード例 #20
0
 /**
  * Create the help tab
  */
 public function do_help_tab()
 {
     include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/tribe-options-help.php';
 }
コード例 #21
0
 /**
  * Adds setting for hiding subsequent occurrences by default.
  *
  *
  * @param array  $args
  * @param string $id
  *
  * @return array
  */
 public static function inject_settings($args, $id)
 {
     if ($id == 'general') {
         // we want to inject the hiding subsequent occurrences into the general section directly after "Live update AJAX"
         $args = Tribe__Main::array_insert_after_key('liveFiltersUpdate', $args, array('hideSubsequentRecurrencesDefault' => array('type' => 'checkbox_bool', 'label' => __('Recurring event instances', 'tribe-events-calendar-pro'), 'tooltip' => __('Show only the first instance of each recurring event (only affects list-style views).', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'), 'userToggleSubsequentRecurrences' => array('type' => 'checkbox_bool', 'label' => __('Front-end recurring event instances toggle', 'tribe-events-calendar-pro'), 'tooltip' => __('Allow users to decide whether to show all instances of a recurring event.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'), 'recurrenceMaxMonthsBefore' => array('type' => 'text', 'size' => 'small', 'label' => __('Clean up recurring events after', 'tribe-events-calendar-pro'), 'tooltip' => __('Automatically remove recurring event instances older than this', 'tribe-events-calendar-pro'), 'validation_type' => 'positive_int', 'default' => 24), 'recurrenceMaxMonthsAfter' => array('type' => 'text', 'size' => 'small', 'label' => __('Create recurring events in advance for', 'tribe-events-calendar-pro'), 'tooltip' => __('Recurring events will be created this far in advance', 'tribe-events-calendar-pro'), 'validation_type' => 'positive_int', 'default' => 24)));
         add_filter('tribe_field_div_end', array(__CLASS__, 'add_months_to_settings_field'), 100, 2);
     }
     return $args;
 }
コード例 #22
0
// Creates the Extra Help section
$help->add_section('extra-help', __('Getting More Help', 'tribe-common'), 20);
$help->add_section_content('extra-help', __('While the resources above help solve a majority of the issues we see, there are times you might be looking for extra support. If you need assistance using our plugins and would like us to take a look, please follow these steps:', 'tribe-common'), 0);
$help->add_section_content('extra-help', array('type' => 'ol', sprintf(__('%s. All of the common (and not-so-common) answers to questions we see are here. It’s often the fastest path to finding an answer!', 'tribe-common'), '<strong><a href="http://m.tri.be/18j9" target="_blank">' . __('Check our Knowledgebase', 'tribe-common') . '</a></strong>'), sprintf(__('%s. Testing for an existing conflict is the best start for in-depth troubleshooting. We will often ask you to follow these steps when opening a new thread, so doing this ahead of time will be super helpful.', 'tribe-common'), '<strong><a href="http://m.tri.be/18jh" target="_blank">' . __('Test for a theme or plugin conflict', 'tribe-common') . '</a></strong>'), sprintf(__('%s. There are very few issues we haven’t seen and it’s likely another user has already asked your question and gotten an answer from our support staff. While posting to the forums is open only to paid customers, they are open for anyone to search and review.', 'tribe-common'), '<strong><a href="http://m.tri.be/4w/" target="_blank">' . __('Search our support forum', 'tribe-common') . '</a></strong>')), 10);
// By default these three will be gathered
$help->add_section_content('extra-help', __('Please note that all hands-on support is provided via the forums. You can email or tweet at us… ​but we will probably point you back to the forums 😄', 'tribe-common'), 40);
$help->add_section_content('extra-help', '<div style="text-align: right;"><a href="http://m.tri.be/18ji" target="_blank" class="button">' . __('Read more about our support policy', 'tribe-common') . '</a></div>', 40);
// Creates the System Info section
$help->add_section('system-info', __('System Information', 'tribe-common'), 30);
$help->add_section_content('system-info', __('The details of your calendar plugin and settings is often needed for you or our staff to help troubleshoot an issue. Please opt-in below to automatically share your system information with our support team. This will allow us to assist you faster if you post in our forums.', 'tribe-common'), 0);
$help->add_section_content('system-info', Tribe__Support::opt_in(), 10);
$help->add_section_content('system-info', '<div class="system-info-copy"><button data-clipboard-action="copy" class="system-info-copy-btn" data-clipboard-target=".support-stats" ><span class="dashicons dashicons-clipboard license-btn"></span>' . __('Copy to clipboard', 'tribe-common') . '</button></div>', 10);
$help->add_section('template-changes', __('Recent Template Changes', 'tribe-common'), 40);
$help->add_section_content('template-changes', Tribe__Support__Template_Checker_Report::generate());
$help->add_section('event-log', __('Event Log', 'tribe-common'), 50);
$help->add_section_content('event-log', Tribe__Main::instance()->log()->admin()->display_log());
?>

<div id="tribe-help-general">
	<?php 
$help->get_sections();
?>
</div>

<div id="tribe-help-sidebar">
	<?php 
/**
 * Fires at the top of the sidebar on Settings > Help tab
 */
do_action('tribe_help_sidebar_before');
foreach ($plugins as $key => $plugin) {
コード例 #23
0
 /**
  * Asset calls for vendor packages
  *
  * @param string $name
  * @param array  $deps Dependents
  */
 public static function asset_package($name, $deps = array())
 {
     $common = Tribe__Main::instance();
     $prefix = 'tribe-events';
     // setup plugin resources & 3rd party vendor urls
     $vendor_url = trailingslashit($common->plugin_url) . 'vendor/';
     self::handle_asset_package_request($name, $deps, $vendor_url, $prefix, $common);
 }
コード例 #24
0
    /**
     * Renders the notice itself (the provided HTML will be wrapped in a suitable container div).
     *
     * @param string $slug
     * @param string $inner_html
     */
    protected function render_notice($slug, $inner_html)
    {
        $spirit_animal = esc_url(Tribe__Main::instance()->plugin_url . 'src/resources/images/spirit-animal.png');
        $html = '<div class="api-check">
				<div class="tribe-spirit-animal">
					<img src="' . $spirit_animal . '"/>
				</div>
				<div class="notice-content">' . $inner_html . '</div>
			</div>';
        Tribe__Admin__Notices::instance()->render($slug, $html);
    }
コード例 #25
0
 /**
  * Sets up the Javascript needed to facilitate the ajax loop on the frontend.
  */
 public function notice_assets()
 {
     $plugin = Tribe__Main::instance();
     $script = trailingslashit($plugin->plugin_url) . 'src/resources/js/events-admin-timezone-updater.js';
     $handle = 'tribe-events-ajax-timezone-update';
     wp_enqueue_script($handle, $script, array('jquery'), false, true);
     wp_localize_script($handle, 'tribe_timezone_update', array('continue' => $this->update_needed(), 'failure_msg' => __('A problem stopped the timezone update process from completing. Please refresh and try again.', 'the-events-calendar'), 'check' => wp_create_nonce('timezone-settings')));
 }
コード例 #26
0
 /**
  * Returns whether or not the event date & upcoming filters should be removed from the query
  *
  * @since 4.0
  * @param WP_Query $query WP_Query object
  * @return boolean
  */
 public static function should_remove_date_filters($query)
 {
     // if we're doing ajax, let's keep the date filters
     if (Tribe__Main::instance()->doing_ajax()) {
         return false;
     }
     // otherwise, let's remove the date filters if we're in the admin dashboard and the query is
     // and event query on the tribe_events edit page
     return is_admin() && $query->tribe_is_event_query && Tribe__Admin__Helpers::instance()->is_screen('edit-' . Tribe__Events__Main::POSTTYPE);
 }
コード例 #27
0
<?php

/*
Description: An event settings framework for managing shared options
Version: 4.1
Author: Modern Tribe, Inc.
Author URI: http://m.tri.be/1x
Text Domain: tribe-common
License: GPLv2 or later
*/
/*
Copyright 2009-2015 by Modern Tribe Inc and the contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
// the main plugin class
require_once dirname(__FILE__) . '/src/Tribe/Main.php';
Tribe__Main::instance();
<?php

$organizers = Tribe__Events__Main::instance()->get_organizer_info();
$organizer_options = array();
if (is_array($organizers) && !empty($organizers)) {
    $organizer_options[0] = __('No Default', 'tribe-events-calendar-pro');
    foreach ($organizers as $organizer) {
        $organizer_options[$organizer->ID] = $organizer->post_title;
    }
}
$venues = Tribe__Events__Main::instance()->get_venue_info();
$venue_options = array();
if (is_array($venues) && !empty($venues)) {
    $venue_options[0] = __('No Default', 'tribe-events-calendar-pro');
    foreach ($venues as $venue) {
        $venue_options[$venue->ID] = $venue->post_title;
    }
}
$state_options = Tribe__View_Helpers::loadStates();
$state_options = array_merge(array('' => __('Select a State', 'tribe-events-calendar-pro')), $state_options);
$country_options = Tribe__View_Helpers::constructCountries();
$defaultsTab = array('priority' => 30, 'fields' => array('info-start' => array('type' => 'html', 'html' => '<div id="modern-tribe-info">'), 'info-box-title' => array('type' => 'html', 'html' => '<h2>' . __('Default Content', 'tribe-events-calendar-pro') . '</h2>'), 'info-box-description' => array('type' => 'html', 'html' => '<p>' . __('<p>Choose the default venue & organizer. Set default address information to save time when entering a new venue or organizer.</p><p>You can override these settings as you enter a new event.</p>', 'tribe-events-calendar-pro') . '</p>'), 'info-end' => array('type' => 'html', 'html' => '</div>'), 'tribe-form-content-start' => array('type' => 'html', 'html' => '<div class="tribe-settings-form-wrap">'), 'eventsDefaultOrganizerHelperTitle' => array('type' => 'html', 'html' => '<h3>' . __('Organizer', 'tribe-events-calendar-pro') . '</h3>'), 'eventsDefaultOrganizerID' => array('type' => 'dropdown_chosen', 'label' => __('Default organizer', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'options', 'options' => $organizer_options, 'if_empty' => __('No saved organizers yet.', 'tribe-events-calendar-pro'), 'can_be_empty' => true), 'current-default-organizer' => array('type' => 'html', 'display_callback' => 'tribe_display_saved_organizer'), 'eventsDefaultVenueHelperTitle' => array('type' => 'html', 'html' => '<h3>' . __('Venue', 'tribe-events-calendar-pro') . '</h3>'), 'eventsDefaultVenueID' => array('type' => 'dropdown_chosen', 'label' => __('Default venue', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'options', 'options' => $venue_options, 'if_empty' => __('No saved venues yet.', 'tribe-events-calendar-pro'), 'can_be_empty' => true), 'current-default-venue' => array('type' => 'html', 'display_callback' => 'tribe_display_saved_venue'), 'eventsDefaultAddressHelperTitle' => array('type' => 'html', 'html' => '<h3>' . __('Address', 'tribe-events-calendar-pro') . '</h3>'), 'eventsDefaultAddressHelperText' => array('type' => 'html', 'html' => '<p class="description">' . __('You can use this setting to set specific, individual defaults for any new Venue you create (these will not be used for your default venue).', 'tribe-events-calendar-pro') . '</p>'), 'eventsDefaultAddress' => array('type' => 'text', 'label' => __('Default address', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'address', 'can_be_empty' => true), 'current-default-address' => array('type' => 'html', 'class' => 'venue-default-info', 'display_callback' => 'tribe_display_saved_address'), 'eventsDefaultCity' => array('type' => 'text', 'label' => __('Default city', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'city_or_province', 'can_be_empty' => true), 'current-default-city' => array('type' => 'html', 'class' => 'venue-default-info', 'display_callback' => 'tribe_display_saved_city'), 'eventsDefaultState' => array('type' => 'dropdown_chosen', 'label' => __('Default state', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'options', 'options' => $state_options, 'can_be_empty' => true), 'current-default-state' => array('type' => 'html', 'display_callback' => 'tribe_display_saved_state'), 'eventsDefaultProvince' => array('type' => 'text', 'label' => __('Default province', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'city_or_province', 'can_be_empty' => true), 'current-default-province' => array('type' => 'html', 'class' => 'venue-default-info', 'display_callback' => 'tribe_display_saved_province'), 'eventsDefaultZip' => array('type' => 'text', 'label' => __('Default postal code/zip code', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'address', 'can_be_empty' => true), 'current-default-zip' => array('type' => 'html', 'class' => 'venue-default-info', 'display_callback' => 'tribe_display_saved_zip'), 'defaultCountry' => array('type' => 'dropdown_chosen', 'label' => __('Default country', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'options_with_label', 'options' => $country_options, 'can_be_empty' => true), 'current-default-country' => array('type' => 'html', 'display_callback' => 'tribe_display_saved_country'), 'eventsDefaultPhone' => array('type' => 'text', 'label' => __('Default phone', 'tribe-events-calendar-pro'), 'default' => false, 'class' => 'venue-default-info', 'validation_type' => 'phone', 'can_be_empty' => true), 'current-default-phone' => array('type' => 'html', 'class' => 'venue-default-info', 'display_callback' => 'tribe_display_saved_phone'), 'tribeEventsCountries' => array('type' => 'textarea', 'label' => __('Use a custom list of countries', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'country_list', 'tooltip' => __('One country per line in the following format: <br>US, United States <br> UK, United Kingdom. <br> (Replaces the default list.)', 'tribe-events-calendar-pro'), 'can_be_empty' => true), 'tribe-form-content-end' => array('type' => 'html', 'html' => '</div>')));
/**
 * @todo remove in 4.3
 * @deprecated
 */
if (apply_filters('tribe_enable_default_value_replace_checkbox', false)) {
    _deprecated_function("'defaultValueReplace checkbox'", '4.0', 'Built-in WordPress postmeta filters');
    $defaultsTab['fields'] = Tribe__Main::array_insert_before_key('eventsDefaultOrganizerHelperTitle', $defaultsTab['fields'], array('eventsDefaultOptionsHelperTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('Options', 'tribe-events-calendar-pro') . '</h3>'), 'defaultValueReplace' => array('type' => 'checkbox_bool', 'label' => esc_html__('If fields are left empty when they\'re submitted, automatically fill them in with these values.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean')));
}
コード例 #29
0
 /**
  * Matcher for administration pages action
  *
  * @param  string|array|null $action What will be checked to see if we return true or false
  *
  * @return boolean
  */
 public function is_action($action = null)
 {
     global $current_screen;
     // Not in the admin we don't even care
     if (!is_admin()) {
         return false;
     }
     // Doing AJAX? bail.
     if (Tribe__Main::instance()->doing_ajax()) {
         return false;
     }
     // Avoid Notices by checking the object type of WP_Screen
     if (!$current_screen instanceof WP_Screen) {
         return false;
     }
     // Match any of the pages set
     if (!is_scalar($action) && in_array($current_screen->action, (array) $action)) {
         return true;
     }
     // Match a specific page
     if ($current_screen->action === $action) {
         return true;
     }
     return false;
 }
コード例 #30
0
ファイル: general.php プロジェクト: durichitayat/befolio-wp
 /**
  * Receives a float and formats it with a currency symbol
  *
  * @category Cost
  * @param string $cost pricing to format
  * @param null|int $post_id
  * @param null|string $currency_symbol
  * @param null|bool $reverse_position
  *
  * @return string
  */
 function tribe_format_currency($cost, $post_id = null, $currency_symbol = null, $reverse_position = null)
 {
     $post_id = Tribe__Main::post_id_helper($post_id);
     $currency_symbol = apply_filters('tribe_currency_symbol', $currency_symbol, $post_id);
     // if no currency symbol was passed, or we're not looking at a particular event,
     // let's get the default currency symbol
     if (!$post_id || !$currency_symbol) {
         $currency_symbol = tribe_get_option('defaultCurrencySymbol', '$');
     }
     $reverse_position = apply_filters('tribe_reverse_currency_position', $reverse_position, $post_id);
     if (!$reverse_position || !$post_id) {
         $reverse_position = tribe_get_option('reverseCurrencyPosition', false);
     }
     $cost = $reverse_position ? $cost . $currency_symbol : $currency_symbol . $cost;
     return $cost;
 }