コード例 #1
0
 /**
  * A private method to prevent it to be created twice.
  * It will add the methods and setup any dependencies
  *
  * Note: This should load on `plugins_loaded@P10`
  */
 private function __construct()
 {
     /**
      * As previously seen by other major features some users would rather have it not active
      * @var bool
      */
     $should_load = (bool) apply_filters('tribe_aggregator_should_load', true);
     // You shall not Load!
     if (false === $should_load) {
         return;
     }
     // Loads the Required Classes and saves them as proprieties
     $this->meta_box = Tribe__Events__Aggregator__Meta_Box::instance();
     $this->migrate = Tribe__Events__Aggregator__Migrate::instance();
     $this->page = Tribe__Events__Aggregator__Page::instance();
     $this->service = Tribe__Events__Aggregator__Service::instance();
     $this->settings = Tribe__Events__Aggregator__Settings::instance();
     $this->records = Tribe__Events__Aggregator__Records::instance();
     $this->cron = Tribe__Events__Aggregator__Cron::instance();
     $this->queue_processor = new Tribe__Events__Aggregator__Record__Queue_Processor();
     $this->queue_realtime = new Tribe__Events__Aggregator__Record__Queue_Realtime(null, null, $this->queue_processor);
     $this->errors = Tribe__Events__Aggregator__Errors::instance();
     $this->pue_checker = new Tribe__PUE__Checker('http://tri.be/', 'event-aggregator', array('context' => 'service'));
     // Initializes the Classes related to the API
     $this->api();
     // Flags that the Aggregator has been fully loaded
     $this->is_loaded = true;
     // Register the Aggregator Endpoint
     add_action('tribe_events_pre_rewrite', array($this, 'action_endpoint_configuration'));
     // Intercept the Endpoint and trigger actions
     add_action('parse_request', array($this, 'action_endpoint_parse_request'));
     // Add endpoint query vars
     add_filter('query_vars', array($this, 'filter_endpoint_query_vars'));
     // Filter the "plugin name" for Event Aggregator
     add_filter('pue_get_plugin_name', array($this, 'filter_pue_plugin_name'), 10, 2);
     // To make sure that meaningful cache is purged when settings are changed
     add_action('updated_option', array($this, 'action_purge_transients'));
     // Remove aggregator records from ET
     add_filter('tribe_tickets_settings_post_types', array($this, 'filter_remove_record_post_type'));
     // Notify users about expiring Facebook Token if oauth is enabled
     add_action('plugins_loaded', array($this, 'setup_notices'), 11);
     // Let's prevent events-importer-ical from DESTROYING its saved recurring imports when it gets deactivated
     if (class_exists('Tribe__Events__Ical_Importer__Main')) {
         remove_action('deactivate_' . plugin_basename(Tribe__Events__Ical_Importer__Main::$plugin_path . 'the-events-calendar-ical-importer.php'), 'tribe_events_ical_deactivate');
     }
     add_action('admin_init', array($this, 'add_status_to_help'));
 }
コード例 #2
0
 /**
  * Static Singleton Factory Method
  *
  * @return self
  */
 public static function instance()
 {
     return self::$instance ? self::$instance : (self::$instance = new self());
 }