public function api()
 {
     $throwable = NULL;
     try {
         $argv = func_get_args();
         return call_user_func_array(array('parent', 'api'), $argv);
     } catch (WP_FacebookApiException $exception) {
         if (self::OAUTHEXCEPTION === $exception->getType()) {
             Ai1ec_Importer_Plugin_Helper::get_instance()->get_plugin_instance('Ai1ecFacebookConnectorPlugin')->do_facebook_logout();
         }
         $throwable = $exception;
     }
     throw $throwable;
 }
 /**
  * get_instance function
  *
  * Return singleton instance
  *
  * @return object
  **/
 static function get_instance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 /**
  * Get the access token for a page from the id
  * 
  * @param string $id
  * @throws Exception
  */
 private function get_facebook_page_access_token_from_id($id)
 {
     try {
         $ai1ec_plugin_helper = Ai1ec_Importer_Plugin_Helper::get_instance();
         $facebook_plugin = $ai1ec_plugin_helper->get_plugin_instance('Ai1ecFacebookConnectorPlugin');
         return $facebook_plugin->get_facebook_page_token_from_id($id);
     } catch (Exception $e) {
         throw $e;
     }
 }
// Set up the Routing Factory
Ai1ec_Routing_Factory::set_ai1ec_settings($ai1ec_settings);
// ================================
// = Initialize and setup HELPERS =
// ================================
global $ai1ec_view_helper, $ai1ec_settings_helper, $ai1ec_calendar_helper, $ai1ec_app_helper, $ai1ec_events_helper, $ai1ec_importer_helper, $ai1ec_exporter_helper, $ai1ec_platform_helper, $ai1ec_localization_helper, $ai1ec_importer_plugin_helper, $ai1ec_events_list_helper;
$ai1ec_view_helper = Ai1ec_View_Helper::get_instance();
$ai1ec_settings_helper = Ai1ec_Settings_Helper::get_instance();
$ai1ec_calendar_helper = Ai1ec_Calendar_Helper::get_instance();
$ai1ec_app_helper = Ai1ec_App_Helper::get_instance();
$ai1ec_events_helper = Ai1ec_Events_Helper::get_instance();
$ai1ec_importer_helper = Ai1ec_Importer_Helper::get_instance();
$ai1ec_exporter_helper = Ai1ec_Exporter_Helper::get_instance();
$ai1ec_platform_helper = Ai1ec_Platform_Helper::get_instance();
$ai1ec_localization_helper = Ai1ec_Localization_Helper::get_instance();
$ai1ec_importer_plugin_helper = Ai1ec_Importer_Plugin_Helper::get_instance();
$ai1ec_events_list_helper = Ai1ec_Events_List_Helper::get_instance();
if ('admin-ajax.php' === basename($_SERVER['SCRIPT_NAME']) && isset($_REQUEST['lang'])) {
    $ai1ec_localization_helper->set_language($_REQUEST['lang']);
}
// ====================================
// = Initialize and setup CONTROLLERS =
// ====================================
global $ai1ec_app_controller, $ai1ec_settings_controller, $ai1ec_events_controller, $ai1ec_calendar_controller, $ai1ec_importer_controller, $ai1ec_exporter_controller, $ai1ec_platform_controller, $ai1ec_duplicate_controller, $ai1ec_oauth_controller, $ai1ec_logging_controller;
$ai1ec_settings_controller = Ai1ec_Settings_Controller::get_instance();
$ai1ec_events_controller = Ai1ec_Events_Controller::get_instance();
$ai1ec_calendar_controller = Ai1ec_Calendar_Controller::get_instance();
$ai1ec_importer_controller = Ai1ec_Importer_Controller::get_instance();
$ai1ec_exporter_controller = Ai1ec_Exporter_Controller::get_instance();
$ai1ec_platform_controller = Ai1ec_Platform_Controller::get_instance();
$ai1ec_duplicate_controller = Ai1ec_Duplicate_Controller::get_instance();