/** * Get the singleton instance of the class. * * @since 1.3.3 * * @return object self::$instance The single instance of the class. */ public static function get_instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
<?php /** * Add the admin action and filter hooks * * @since 1.3.3 * * @package Simmer/Admin/Hooks */ // If this file is called directly, get outa' town. if (!defined('WPINC')) { die; } /**** General Dashboard ****/ // Load the dashboard customizing class. $simmer_dashboard = Simmer_Admin_Dashboard::get_instance(); // Enqueue the custom scripts. add_action('admin_enqueue_scripts', array($simmer_dashboard, 'enqueue_scripts')); // Add the published recipe count to the "At a Glance" dashboard widget. add_filter('dashboard_glance_items', array($simmer_dashboard, 'add_glance_recipe_count')); // Add the plugin list table row "Settings" link. add_action('plugin_action_links_' . SIMMER_PLUGIN_FILE, array($simmer_dashboard, 'add_settings_link')); //Add a Simmer "thank you" link to the admin footer. add_action('admin_footer_text', array($simmer_dashboard, 'add_footer_text'), 20); // Unload the dashboard customizing class from memory. unset($simmer_dashboard); /**** Recipes ****/ // Load the recipes admin class. $simmer_admin_recipes = Simmer_Admin_Recipes::get_instance(); // Add the recipe metaboxes. add_action('add_meta_boxes', array($simmer_admin_recipes, 'add_metaboxes'));