/**
  * Setup all the hooks and filters
  *
  * @return void
  */
 private function __construct()
 {
     $plugin = Tribe__Events__Main::instance();
     // Hook the AJAX methods
     add_action('wp_ajax_tribe_convert_legacy_facebook_settings', array($this, 'ajax_convert_facebook_settings'));
     add_action('wp_ajax_tribe_convert_legacy_ical_settings', array($this, 'ajax_convert_ical_settings'));
     // Hook the Notice for the Migration
     tribe_notice('tribe-aggregator-migrate-legacy-settings', array($this, 'notice'), 'type=warning');
     // Register Assets
     tribe_asset($plugin, 'tribe-migrate-legacy-settings', 'aggregator-admin-legacy-settings.js', array('jquery'), 'admin_enqueue_scripts');
 }
Example #2
0
 public function init()
 {
     $plugin = Tribe__Events__Main::instance();
     $localize_data = array('name' => 'tribe_aggregator', 'data' => array('csv_column_mapping' => array('events' => get_option('tribe_events_import_column_mapping_events', array()), 'organizer' => get_option('tribe_events_import_column_mapping_organizers', array()), 'venue' => get_option('tribe_events_import_column_mapping_venues', array())), 'l10n' => array('all_day' => __('All Day', 'the-events-calendar'), 'am' => _x('AM', 'Meridian: am', 'the-events-calendar'), 'pm' => _x('PM', 'Meridian: pm', 'the-events-calendar'), 'preview_timeout' => __('The preview is taking longer than expected. Please try again in a moment.', 'the-events-calendar'), 'preview_fetch_error_prefix' => __('There was an error fetching the results from your import:', 'the-events-calendar'), 'import_all' => __('Import All (%d)', 'the-events-calendar'), 'import_all_no_number' => __('Import All', 'the-events-calendar'), 'import_checked' => __('Import Checked (%d)', 'the-events-calendar'), 'create_schedule' => __('Save Scheduled Import', 'the-events-calendar'), 'edit_save' => __('Save Changes', 'the-events-calendar'), 'events_required_for_manual_submit' => __('Your import must include at least one event', 'the-events-calendar'), 'no_results' => __('Your preview doesn\'t have any records to import.', 'the-events-calendar'), 'verify_schedule_delete' => __('Removing this scheduled import will stop automatic imports from the source. No events will be deleted.', 'the-events-calendar'), 'view_filters' => __('View Filters', 'the-events-calendar'), 'hide_filters' => __('Hide Filters', 'the-events-calendar'), 'preview_polling' => array(__('Please wait while your preview is fetched.', 'the-events-calendar'), __('Please continue to wait while your preview is generated.', 'the-events-calendar'), __('If all goes according to plan, you will have your preview in a few moments.', 'the-events-calendar'), __('Your preview is taking a bit longer than expected, but it <i>is</i> still being generated.', 'the-events-calendar')), 'debug' => defined('WP_DEBUG') && true === WP_DEBUG), 'default_settings' => Tribe__Events__Aggregator__Settings::instance()->get_all_default_settings()));
     /**
      * Filters the CSV column mapping output
      *
      * @param array $mapping Mapping data indexed by CSV import type
      */
     $localize_data['data']['csv_column_mapping'] = apply_filters('tribe_aggregator_csv_column_mapping', $localize_data['data']['csv_column_mapping']);
     // Load these on all the pages
     tribe_assets($plugin, array(array('tribe-ea-fields', 'aggregator-fields.js', array('jquery', 'tribe-datatables', 'underscore', 'tribe-bumpdown', 'tribe-dependency', 'tribe-events-select2', 'tribe-ea-facebook-login')), array('tribe-ea-page', 'aggregator-page.css', array('datatables-css'))), 'admin_enqueue_scripts', array('conditionals' => array(array($this, 'is_screen')), 'localize' => (object) $localize_data));
     tribe_asset($plugin, 'tribe-ea-facebook-login', 'aggregator-facebook-login.js', array('jquery', 'underscore', 'tribe-dependency'), 'admin_enqueue_scripts');
 }
 /**
  * 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');
 }
 public function action_assets()
 {
     $plugin = Tribe__Events__Main::instance();
     $localize = array();
     if (!empty($_GET['post']) && self::instance()->can_ignore($_GET['post'])) {
         $post = get_post($_GET['post']);
         if (self::$ignored_status === $post->post_status) {
             $localize['single'] = array('link_text' => esc_html__('Delete Permanently', 'the-events-calendar'), 'link_title' => esc_attr__('Ignored events that are deleted will be removed permanently. They can be recreated via import.', 'the-events-calendar'), 'link_nonce' => wp_create_nonce('delete-post_' . $post->ID), 'link_post' => $post->ID, 'link_status' => esc_html__('Ignored', 'the-events-calendar'));
         } else {
             $localize['single'] = array('link_text' => esc_html__('Hide & Ignore', 'the-events-calendar'), 'link_title' => esc_attr__('Ignored events do not show on the calendar but can be updated with future imports', 'the-events-calendar'));
         }
     }
     if (isset($_GET['post_status']) && self::$ignored_status === $_GET['post_status']) {
         $localize['archive'] = array('delete_label' => esc_html__('Delete Permanently', 'the-events-calendar'));
     }
     $args = array('localize' => array('name' => 'tribe_ignore_events', 'data' => $localize));
     tribe_asset($plugin, 'tribe-ignored-events', 'admin-ignored-events.js', array('jquery'), 'admin_enqueue_scripts', $args);
 }
Example #5
0
 /**
  * Registers resources that can/should be enqueued
  */
 public function load_assets()
 {
     // These ones are only registred
     tribe_assets($this, array(array('tribe-clipboard', 'vendor/clipboard/clipboard.js'), array('datatables', 'vendor/datatables/media/js/jquery.dataTables.js', array('jquery')), array('datatables-css', 'datatables.css'), array('datatables-responsive', 'vendor/datatables/extensions/Responsive/js/dataTables.responsive.js', array('jquery', 'datatables')), array('datatables-responsive-css', 'vendor/datatables/extensions/Responsive/css/responsive.dataTables.css'), array('datatables-select', 'vendor/datatables/extensions/Select/js/dataTables.select.js', array('jquery', 'datatables')), array('datatables-select-css', 'vendor/datatables/extensions/Select/css/select.dataTables.css'), array('datatables-scroller', 'vendor/datatables/extensions/Scroller/js/dataTables.scroller.js', array('jquery', 'datatables')), array('datatables-scroller-css', 'vendor/datatables/extensions/Scroller/css/scroller.dataTables.css'), array('datatables-fixedheader', 'vendor/datatables/extensions/FixedHeader/js/dataTables.fixedHeader.js', array('jquery', 'datatables')), array('datatables-fixedheader-css', 'vendor/datatables/extensions/FixedHeader/css/fixedHeader.dataTables.css'), array('tribe-datatables', 'tribe-datatables.js', array('datatables', 'datatables-select')), array('tribe-bumpdown', 'bumpdown.js', array('jquery', 'underscore', 'hoverIntent')), array('tribe-bumpdown-css', 'bumpdown.css')));
     // These ones will be enqueued on `admin_enqueue_scripts` if the conditional method on filter is met
     tribe_assets($this, array(array('tribe-common-admin', 'tribe-common-admin.css', array('tribe-dependency-style', 'tribe-bumpdown-css')), array('tribe-dependency', 'dependency.js', array('jquery', 'underscore')), array('tribe-dependency-style', 'dependency.css'), array('tribe-pue-notices', 'pue-notices.js', array('jquery')), array('tribe-jquery-ui-theme', 'vendor/jquery/ui.theme.css'), array('tribe-jquery-ui-datepicker', 'vendor/jquery/ui.datepicker.css')), 'admin_enqueue_scripts', array('filter' => array(Tribe__Admin__Helpers::instance(), 'is_post_type_screen'), 'localize' => (object) array('name' => 'tribe_system_info', 'data' => array('sysinfo_optin_nonce' => wp_create_nonce('sysinfo_optin_nonce'), 'clipboard_btn_text' => __('Copy to clipboard', 'tribe-common'), 'clipboard_copied_text' => __('System info copied', 'tribe-common'), 'clipboard_fail_text' => __('Press "Cmd + C" to copy', 'tribe-common')))));
     tribe_asset($this, 'tribe-common', 'tribe-common.js', array('tribe-clipboard'), 'admin_enqueue_scripts', array('localize' => array('name' => 'tribe_l10n_datatables', 'data' => array('aria' => array('sort_ascending' => __(': activate to sort column ascending', 'tribe-common'), 'sort_descending' => __(': activate to sort column descending', 'tribe-common')), 'length_menu' => __('Show _MENU_ entries', 'tribe-common'), 'empty_table' => __('No data available in table', 'tribe-common'), 'info' => __('Showing _START_ to _END_ of _TOTAL_ entries', 'tribe-common'), 'info_empty' => __('Showing 0 to 0 of 0 entries', 'tribe-common'), 'info_filtered' => __('(filtered from _MAX_ total entries)', 'tribe-common'), 'zero_records' => __('No matching records found', 'tribe-common'), 'search' => __('Search:', 'tribe-common'), 'pagination' => array('all' => __('All', 'tribe-common'), 'next' => __('Next', 'tribe-common'), 'previous' => __('Previous', 'tribe-common')), 'select' => array('rows' => array(0 => '', '_' => __(': Selected %d rows', 'tribe-common'), 1 => __(': Selected 1 row', 'tribe-common')))))));
 }
 /**
  * Enqueues all assets and data required by the move tickets dialog.
  */
 protected function dialog_assets()
 {
     // Ensure common admin CSS is enqueued within this screen
     add_filter('tribe_asset_enqueue_tribe-common-admin', '__return_true', 20);
     /**
      * Provides an opportunity to modify the variables passed to the move
      * tickets JS code.
      *
      * @param array $script_data
      */
     $data = apply_filters('tribe_tickets_move_tickets_script_data', array('check' => wp_create_nonce('move_tickets'), 'unexpected_failure' => '<p>' . __('Woops! We could not complete the requested operation due to an unforeseen problem.', 'event-tickets') . '</p>', 'update_post_list_failure' => __('Unable to update the post list. Please refresh the page and try again.', 'event-tickets'), 'no_posts_found' => __('No results found - you may need to widen your search criteria.', 'event-tickets'), 'no_ticket_types_found' => __('No ticket types were found for this post.', 'event-tickets'), 'loading_msg' => __('Loading, please wait&hellip;', 'event-tickets'), 'src_post_id' => isset($_GET['event_id']) ? absint($_GET['event_id']) : absint($_GET['post']), 'ticket_ids' => array_keys($this->attendees), 'provider' => $this->ticket_provider, 'mode' => 'move_tickets'));
     tribe_asset(Tribe__Tickets__Main::instance(), 'tribe-move-tickets-dialog', 'move-tickets-dialog.js', array('jquery'), 'admin_enqueue_scripts', array('localize' => array('name' => 'tribe_move_tickets_data', 'data' => $data)));
 }
/**
 * Function to include more the one asset, based on `tribe_asset`
 *
 * @param  object   $origin     The main Object for the plugin you are enqueueing the script/style for
 * @param  array    $assets     {
 *    Indexed array, don't use any associative key.
 *    E.g.: array( 'slug-my-script', 'my/own/path.js', array( 'jquery' ) )
 *
 *    @type  string   $slug       Slug to save the asset
 *    @type  string   $file       Which file will be loaded, either CSS or JS
 *    @type  array    $deps       (optional) Dependencies
 * }
 * @param  string   $action     A WordPress Action, needs to happen after: `wp_enqueue_scripts`, `admin_enqueue_scripts`, or `login_enqueue_scripts`
 * @param  array    $arguments  Look at `Tribe__Assets::register()` for more info
 *
 * @return array             Which Assets were registered
 */
function tribe_assets($origin, $assets, $action = null, $arguments = array())
{
    $registered = array();
    foreach ($assets as $asset) {
        if (!is_array($asset)) {
            continue;
        }
        $slug = reset($asset);
        if (empty($asset[1])) {
            continue;
        }
        $file = $asset[1];
        $deps = !empty($asset[2]) ? $asset[2] : array();
        $registered[] = tribe_asset($origin, $slug, $file, $deps, $action, $arguments);
    }
    return $registered;
}