/** * Constructor * * @param string $version * @param string $file */ public function __construct($version, $file) { // set version $this->version = $version; // Pimple Container construct parent::__construct(); // register file service $this['file'] = function () use($file) { return new File($file); }; // register services early since some add-ons need 'm $this->register_services(); // this complete plugin is pretty much admin only if (is_admin()) { // alias for Pimple container $c = $this; // enqueue CSS add_action('admin_enqueue_scripts', function () use($c) { wp_enqueue_style('wpcm_admin', $c['file']->plugin_url('/assets/css/wp-notification-center.css'), array(), $c->get_version()); }); // catch admin notices $this['admin_notice_handler']->catch_admin_notices(); // setup admin bar $admin_bar = new AdminBar(); $admin_bar->setup(); // setup plugin links $plugin_links = new PluginLinks(); $plugin_links->setup(); } }
/** * Constructor * * @param string $version * @param string $file */ public function __construct($version, $file) { // set version $this->version = $version; // Pimple Container construct parent::__construct(); // setup custom database tables $this->setup_db_tables(); // register file service $this['file'] = function () use($file) { return new File($file); }; // register services early since some add-ons need 'm $this->register_services(); // load the plugin $this->load(); }