Example #1
0
 public static function get_instance()
 {
     if (NULL == self::$instance) {
         self::$instance = new NelioABAboutPage();
         self::$instance->hook_to_wordpress();
     }
     return self::$instance;
 }
 public function init()
 {
     // If the user has been disabled... get out of here
     try {
         $aux = NelioABAccountSettings::check_user_settings();
     } catch (Exception $e) {
         // We do nothing here (if the user is deactivated, proper "ERROR" pages will be shown).
         // However, it is important we add the check here: if the user was deactivated, but it
         // no longer is, then it's important his settings are checked from the admin area.
     }
     // Some relevant global warnings
     // -----------------------------
     // If the current user is NOT admin, do not show the plugin
     if (!nelioab_can_user_manage_plugin()) {
         return;
     }
     require_once NELIOAB_ADMIN_DIR . '/about.php';
     NelioABAboutPage::get_instance();
     $this->process_special_pages();
     // Iconography
     add_action('admin_head', array($this, 'add_custom_styles'));
     // Some hooks
     add_action('wp_count_posts', array($this, 'exclude_alternatives_from_post_count'), 10, 2);
     add_action('pre_get_posts', array($this, 'exclude_alternative_posts_and_pages'));
     add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2);
     // (Super)Settings for multisite
     add_action('network_admin_menu', array($this, 'create_nelioab_site_settings_page'));
     // Regular settings
     add_action('admin_menu', array($this, 'create_nelioab_admin_pages'));
     require_once NELIOAB_ADMIN_DIR . '/views/settings-page.php';
     add_action('admin_init', array('NelioABSettingsPage', 'register_settings'));
     add_action('admin_menu', array($this, 'configure_edit_nelioab_alternative'));
     // AJAX functions
     add_action('wp_ajax_nelioab_get_html_content', array($this, 'generate_html_content'));
     add_action('wp_ajax_nelioab_rated', array($this, 'mark_as_rated'));
     require_once NELIOAB_UTILS_DIR . '/wp-helper.php';
     add_action('wp_ajax_nelioab_post_searcher', array('NelioABWpHelper', 'search_posts'));
     add_action('wp_ajax_nelioab_form_searcher', array('NelioABWpHelper', 'search_forms'));
     add_action('admin_enqueue_scripts', array(&$this, 'load_custom_style_and_scripts'));
     // Footer Message
     add_filter('admin_footer_text', array($this, 'admin_footer_text'), 1);
 }