/**
  * Register callbacks for actions and filters
  *
  * @since    1.0.0
  */
 protected function register_hook_callbacks()
 {
     Plugin_Name_Actions_Filters::add_action('admin_menu', $this, 'plugin_menu');
     Plugin_Name_Actions_Filters::add_action('admin_print_scripts-' . static::$hook_suffix, $this, 'enqueue_scripts');
     Plugin_Name_Actions_Filters::add_action('admin_print_styles-' . static::$hook_suffix, $this, 'enqueue_styles');
     Plugin_Name_Actions_Filters::add_action('load-' . static::$hook_suffix, $this, 'register_fields');
     Plugin_Name_Actions_Filters::add_filter('plugin_action_links_' . Plugin_Name::PLUGIN_ID . '/' . Plugin_Name::PLUGIN_ID . '.php', $this, 'add_plugin_action_links');
 }
 /**
  * Register callbacks for actions and filters
  *
  * @since    1.0.0
  */
 protected function register_hook_callbacks()
 {
     Plugin_Name_Actions_Filters::add_action('admin_notices', $this, 'show_admin_notices');
 }
 /**
  * Define the locale for this plugin for internationalization.
  *
  * Uses the Plugin_Name_i18n class in order to set the domain and to register the hook
  * with WordPress.
  *
  * @since    1.0.0.0
  */
 private function set_locale()
 {
     $plugin_i18n = new Plugin_Name_i18n();
     $plugin_i18n->set_domain(Plugin_Name::PLUGIN_ID);
     Plugin_Name_Actions_Filters::add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
 }
 /**
  * Register callbacks for actions and filters
  *
  * @since    1.0.0
  */
 protected function register_hook_callbacks()
 {
     Plugin_Name_Actions_Filters::add_action('wp_enqueue_scripts', $this, 'enqueue_styles');
     Plugin_Name_Actions_Filters::add_action('wp_enqueue_scripts', $this, 'enqueue_scripts');
 }
コード例 #5
0
 /**
  * Define the core functionality of the plugin.
  *
  * Load the dependencies, define the locale, and set the hooks for the admin area and
  * the public-facing side of the site.
  *
  * @since    1.0.0
  */
 public function __construct()
 {
     self::$plugin_path = plugin_dir_path(dirname(__FILE__));
     self::$plugin_url = plugin_dir_url(dirname(__FILE__));
     require_once self::$plugin_path . 'includes/class-' . self::PLUGIN_PREFIX . 'loader.php';
     self::$modules['Plugin_Name_Loader'] = Plugin_Name_Loader::get_instance();
     self::$modules['Plugin_Name_Controller_Public'] = Plugin_Name_Controller_Public::get_instance();
     self::$modules['Plugin_Name_Controller_Admin_Settings'] = Plugin_Name_Controller_Admin_Settings::get_instance();
     self::$modules['Plugin_Name_Controller_Admin_Notices'] = Plugin_Name_Controller_Admin_Notices::get_instance();
     Plugin_Name_Actions_Filters::init_actions_filters();
 }
 /**
  * Add a new filter to the collection to be registered with WordPress.
  *
  * @since    1.0.0
  * @param      string               $hook             The name of the WordPress filter that is being registered.
  * @param      object               $component        A reference to the instance of the object on which the filter is defined.
  * @param      string               $callback         The name of the function definition on the $component.
  * @param      int      Optional    $priority         The priority at which the function should be fired.
  * @param      int      Optional    $accepted_args    The number of arguments that should be passed to the $callback.
  */
 public static function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
 {
     self::$filters = self::add(self::$filters, $hook, $component, $callback, $priority, $accepted_args);
 }
 /**
  * Register callbacks for actions and filters
  *
  * @since    1.0.0
  */
 protected function register_hook_callbacks()
 {
     Plugin_Name_Actions_Filters::add_action('admin_init', $this, 'register_settings');
 }