function Tribe_Events_Importer_Load() { TribeEventsImporter_Plugin::set_plugin_basename(plugin_basename(__FILE__)); if (is_admin()) { add_action('init', array('TribeEventsImporter_Plugin', 'initialize_admin'), 10, 0); } }
public function render_admin_page_contents() { switch ($this->state) { case 'map': try { $file = new TribeEventsImporter_FileReader(TribeEventsImporter_FileUploader::get_file_path()); } catch (RuntimeException $e) { $this->errors[] = __('The file went away. Please try again.', 'tribe-events-calendar'); $this->state = ''; return $this->render_admin_page_contents(); } $header = $file->get_header(); if (get_option('tribe_events_importer_has_header', 0) == 0) { $letter = 'A'; $size = count($header); $header = array(); for ($i = 0; $i < $size; $i++) { $header[] = $letter++; } } $import_type = get_option('tribe_events_import_type'); $messages = $this->errors; include TribeEventsImporter_Plugin::path('admin-views/columns.php'); break; case 'importing': $messages = $this->messages; include TribeEventsImporter_Plugin::path('admin-views/in-progress.php'); break; case 'complete': $log = get_option('tribe_events_import_log'); $skipped = get_option('tribe_events_import_failed_rows', array()); include TribeEventsImporter_Plugin::path('admin-views/result.php'); break; default: $messages = $this->errors; include TribeEventsImporter_Plugin::path('admin-views/import.php'); break; } }
public static function initialize_admin() { self::$admin = new TribeEventsImporter_AdminPage(); add_action('admin_menu', array(self::$admin, 'register_admin_page')); add_action('load-tribe_events_page_events-importer', array(self::$admin, 'handle_submission')); }