Example #1
0
 /**
  * The class singleton constructor.
  *
  * @param Tribe__Tickets_Plus__Commerce__Loader $commerce_loader
  *
  * @return Tribe__Tickets_Plus__CSV_Importer__Rows
  */
 public static function instance(Tribe__Tickets_Plus__Commerce__Loader $commerce_loader)
 {
     if (empty(self::$instance)) {
         self::$instance = new self($commerce_loader);
     }
     return self::$instance;
 }
Example #2
0
 /**
  * Setup integration with The Events Calendar's CSV import facilities.
  *
  * Expects to run during the init action - we don't want to set this up
  * too early otherwise the commerce loader may not be able to reliably
  * determine the version numbers of any active ecommerce plugins.
  */
 public function csv_import_support()
 {
     // CSV import is not a concern unless The Events Calendar is also running
     if (!class_exists('Tribe__Events__Main')) {
         return;
     }
     $commerce_loader = $this->commerce_loader();
     if (!$commerce_loader->has_commerce_providers()) {
         return;
     }
     $column_names_filter = Tribe__Tickets_Plus__CSV_Importer__Column_Names::instance($commerce_loader);
     $importer_rows_filter = Tribe__Tickets_Plus__CSV_Importer__Rows::instance($commerce_loader);
     add_filter('tribe_events_import_options_rows', array($importer_rows_filter, 'filter_import_options_rows'));
     if ($commerce_loader->is_woocommerce_active()) {
         add_filter('tribe_event_import_tickets_woo_column_names', array($column_names_filter, 'filter_tickets_woo_column_names'));
         add_filter('tribe_events_import_tickets_woo_importer', array('Tribe__Tickets_Plus__CSV_Importer__Tickets_Importer', 'woo_instance'), 10, 2);
     }
     add_filter('tribe_events_import_type_titles_map', array($column_names_filter, 'filter_import_type_titles_map'));
 }