/**
  * Setup the class, if it has already been initialized, return the initialized instance.
  *
  * @access public
  * @since 0.7.5
  * @see cnAdminActions()
  */
 public static function init()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
         self::register();
         self::doActions();
     }
 }
 /**
  * Setup the class, if it has already been initialized, return the intialized instance.
  *
  * @see cnAdminFunction()
  *
  * @access public
  * @since  0.7.9
  */
 public static function init()
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     if (!isset(self::$instance)) {
         self::$instance = new self();
         // Initiate admin messages.
         cnMessage::init();
         // Initiate admin actions.
         cnAdminActions::init();
         // If the user changed the base slugs for the permalinks, flush the rewrite rules.
         if (get_option('connections_flush_rewrite')) {
             flush_rewrite_rules();
             delete_option('connections_flush_rewrite');
         }
         /*
          * If the home page has not been set, nag the user to set it.
          */
         $directoryHome = $instance->settings->get('connections', 'connections_home_page', 'page_id');
         if (!$directoryHome) {
             cnMessage::create('notice', 'home_page_set_failed');
         }
         // Check if the db requires updating, display message if it does.
         if (version_compare($instance->options->getDBVersion(), CN_DB_VERSION, '<')) {
             $instance->dbUpgrade = TRUE;
             add_action('current_screen', array(__CLASS__, 'displayDBUpgradeNotice'));
         }
         /*
          * Add admin notices if required directories are not present or not writeable.
          */
         if (!file_exists(CN_IMAGE_PATH)) {
             cnMessage::create('notice', 'image_path_exists_failed');
         }
         if (file_exists(CN_IMAGE_PATH) && !is_writeable(CN_IMAGE_PATH)) {
             cnMessage::create('notice', 'image_path_writeable_failed');
         }
         // if ( ! file_exists( CN_CUSTOM_TEMPLATE_PATH ) ) cnMessage::create( 'notice', 'template_path_exists_failed' );
         // if ( file_exists( CN_CUSTOM_TEMPLATE_PATH ) && ! is_writeable( CN_CUSTOM_TEMPLATE_PATH ) ) cnMessage::create( 'notice', 'template_path_writeable_failed' );
         //if ( ! file_exists( CN_CACHE_PATH ) ) cnMessage::create( 'notice', 'cache_path_exists_failed' );
         //if ( file_exists( CN_CACHE_PATH ) && ! is_writeable( CN_CACHE_PATH ) ) cnMessage::create( 'notice', 'cache_path_writeable_failed' );
         // Add Settings link to the plugin actions
         add_action('plugin_action_links_' . CN_BASE_NAME, array(__CLASS__, 'addActionLinks'));
         // Add FAQ, Support and Donate links
         add_filter('plugin_row_meta', array(__CLASS__, 'addMetaLinks'), 10, 2);
         // Add Changelog table row in the Manage Plugins admin page.
         add_action('in_plugin_update_message-' . CN_BASE_NAME, array(__CLASS__, 'displayUpgradeNotice'), 20, 2);
         // Add the screen layout filter.
         add_filter('screen_layout_columns', array(__CLASS__, 'screenLayout'), 10, 2);
         /*
          * Set priority `9` so this is run before the `current_screen` filter in the
          * Screen Options class by Janis Elsts which registers the screen options panels.
          */
         add_action('current_screen', array(__CLASS__, 'screenOptionsPanel'), 9);
         add_filter('admin_footer_text', array(__CLASS__, 'rateUs'));
     }
 }