/**
  * 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;
 }
Example #2
0
// Add custom bulk 'recipe updated' messages.
add_filter('bulk_post_updated_messages', array($simmer_admin_recipes, 'bulk_updated_messages'), 10, 2);
// Remove the recipe items on recipe deletion.
add_action('delete_post', array($simmer_admin_recipes, 'delete_recipe_items'));
// Unload the recipes admin class from memory.
unset($simmer_admin_recipes);
/**** Bulk-Add ****/
// Load the ingredients/instructions bulk-add class.
$simmer_admin_bulk_add = Simmer_Admin_Bulk_Add::get_instance();
add_action('admin_footer', array($simmer_admin_bulk_add, 'add_modal'));
add_action('wp_ajax_simmer_process_bulk', array($simmer_admin_bulk_add, 'process_ajax'));
// Unload the ingredients/instructions bulk-add class from memory.
unset($simmer_admin_bulk_add);
/**** Shortcode UI ****/
// Load the shortcode UI class.
$simmer_shortcode_ui = Simmer_Admin_Shortcode_UI::get_instance();
// Enqueue the modal script.
add_action('admin_enqueue_scripts', array($simmer_shortcode_ui, 'enqueue_script'));
// Add the 'Add Recipe' button above the main content editor.
add_action('media_buttons', array($simmer_shortcode_ui, 'add_media_button'), 99);
add_action('admin_footer', array($simmer_shortcode_ui, 'add_modal'));
// Unoad the shortcode UI class from memory.
unset($simmer_shortcode_ui);
/**** Settings ****/
// Load the admin settings class.
$simmer_admin_settings = Simmer_Admin_Settings::get_instance();
// Add the settings submenu item.
add_action('admin_menu', array($simmer_admin_settings, 'add_options_page'));
// Register the available settings with the Settings API.
add_action('admin_init', array($simmer_admin_settings, 'register_settings'));
// Enqueue the admin styles.