/**
  * List of authors having authored at least one event
  *
  * Returned array contains following keys: user_id, display_name and
  * event_count, respectively referencing author ID, to use as filter
  * argument, his name, and number of events he had authored.
  *
  * @param bool $flush Set to true, to ignore cache [optional=false]
  *
  * @return array List of authors
  */
 public function get_all($flush = false)
 {
     global $ai1ec_settings;
     if (!$ai1ec_settings->use_authors_filter) {
         return array();
     }
     $persistance = Ai1ec_Strategies_Factory::create_persistence_context(__METHOD__);
     $list = NULL;
     if (false === $flush) {
         try {
             $list = $persistance->get_data_from_persistence();
         } catch (Ai1ec_Cache_Not_Set_Exception $exception) {
             $list = NULL;
         }
     }
     if (NULL === $list) {
         $list = $this->_fetch_all();
         try {
             $persistance->write_data_to_persistence($list);
         } catch (Ai1ec_Cache_Not_Set_Exception $wrt_exception) {
             // ignore write failures
         }
     }
     return $list;
 }
 /**
  * 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();
 }
 /**
  * @param string $active_theme_path
  * @param string $default_theme_path
  * @return Ai1ec_Css_Controller
  */
 public static function create_css_controller_instance()
 {
     $aie1c_admin_notices_helper = Ai1ec_Admin_Notices_Helper::get_instance();
     $db_adapter = Ai1ec_Adapters_Factory::create_db_adapter_instance();
     $persistence_context = Ai1ec_Strategies_Factory::create_persistence_context(Ai1ec_Css_Controller::KEY_FOR_PERSISTANCE, AI1EC_CACHE_PATH);
     $lessphp_controller = self::create_lessphp_controller();
     $controller = new Ai1ec_Css_Controller($persistence_context, $lessphp_controller, $db_adapter, self::$preview_mode, Ai1ec_Adapters_Factory::create_template_adapter_instance());
     $controller->set_admin_notices_helper($aie1c_admin_notices_helper);
     return $controller;
 }