location = plugins_url( self::SLUG ); $this->load_files(); $this->add_actions(); } /** * Loads the plugin files. * * @return void */ public function load_files() { foreach ( $this->classes as $class ) { include_once __DIR__ . "/class-{$class}.php"; } } /** * Adds the plugin actions. * * @return void */ public function add_actions() { add_action( 'init', array( $this, 'textdomain' ) ); add_action( 'widgets_init', array( $this, 'register_widget' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ) ); } /** * Loads the plugin's textdomain. * * @return void */ public function textdomain() { load_plugin_textdomain( self::SLUG ); } /** * Register the plugin's widget. * * @return void */ public function register_widget() { register_widget( __NAMESPACE__ . '\\' . self::WIDGET_CLASS ); } /** * Enqueue the widget stylesheet. * * @return void */ public function enqueue_style() { wp_enqueue_style( self::STYLE, $this->location . '/css/' . self::STYLE . '.css', array(), self::VERSION ); } }