diff --git a/plugin-name/trunk/includes/class-plugin-name-loader.php b/plugin-name/trunk/includes/class-plugin-name-loader.php new file mode 100644 index 0000000..e70a43a --- /dev/null +++ b/plugin-name/trunk/includes/class-plugin-name-loader.php @@ -0,0 +1,66 @@ + + * @license GPL-2.0+ + * @link http://example.com + * @copyright 2014 Your Name or Company Name + * @since 1.0.0 + */ + +/** + * Define a short description for what this class does. + * + * Define a longer description for the purpose of this class. + * + * @package Plugin_Name + * @subpackage Plugin_Name/includes + * @author Your Name + */ +class Plugin_Name_Loader { + + protected $hooks; + + public function __construct() { + $this->hooks = array(); + } + + public function add( $hook, $component, $callback ) { + + $this->hooks[] = array( + 'hook' => $hook, + 'component' => $component, + 'callback' => $callback + ); + + } + + /** + * Short description. (use period) + * + * Long description. + * + * @since 1.0.0 + */ + public function run() { + + /** + * This function is used to define the various hooks that are shared in the + * both the dashboard and the public-facing areas of the plugin. This is + * achieved via dependency injection by passing an instance of Plugin_Name + * into this class. + * + * Each hook then corresponds to a public function defined within the Plugin_Name_Admin + * class. + */ + foreach ( $this->hooks as $plugin_name => $hook ) { + add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ) ); + } + + } + +}