/** * In the constructor all action and filter hooks are declared as the constructor is called when the app initialize. We als handle the CROn and the DB Schema. * */ public function __construct() { // We don't use the filesystem as cache as this contains private data. $this->persistance_context = Ai1ec_Strategies_Factory::create_persistence_context(self::KEY_FOR_PERSISTANCE); // Set the AJAX action to dismiss the notice. add_action('wp_ajax_ai1ec_facebook_cron_dismiss', array($this, 'dismiss_notice_ajax')); // Set the AJAX action to refresh Facebook Graph Objects add_action('wp_ajax_ai1ec_refresh_facebook_objects', array($this, 'refresh_facebook_ajax')); // Set AJAX action to remove a subscribed user add_action('wp_ajax_ai1ec_remove_subscribed', array($this, 'remove_subscribed_ajax')); // Set AJAX action to refresh multiselect add_action('wp_ajax_ai1ec_refresh_multiselect', array($this, 'refresh_multiselect')); // Set AJAX action to refresh events add_action('wp_ajax_ai1ec_refresh_events', array($this, 'refresh_events_ajax')); // Add the "Export to facebook" widget. add_action('post_submitbox_misc_actions', array($this, 'render_export_box')); // Ad action to check if app-id / secret where changed add_action('ai1ec-Ai1ecFacebookConnectorPlugin-postsave-setting', array($this, 'if_app_id_or_secret_changed_perform_logout'), 10, 1); // Add action to perform a login to Facebook if needed add_action('ai1ec-post-save-facebook-login', array($this, 'do_facebook_login_if_app_id_and_secret_were_changed')); //allow redirection, even if my theme starts to send output to the browser add_action('init', array($this, 'start_output_buffering')); // I leave all add_action() call in one place since it's easier to understand and mantain $facebook_custom_bulk_action = Ai1ec_Facebook_Factory::get_facebook_custom_bulk_action_instance($this); // Add the select to filter events in the "All events" page add_action('restrict_manage_posts', array($facebook_custom_bulk_action, 'facebook_filter_restrict_manage_posts')); // Add action to handle export to facebook add_action('load-edit.php', array($facebook_custom_bulk_action, 'facebook_custom_bulk_action')); // Add action to filter data add_filter('posts_where', array($facebook_custom_bulk_action, 'facebook_filter_posts_where')); // Install db $this->install_schema(); // Install CRON $this->install_cron(); }