/**
  * Returns an instantiated controller.
  *
  * @param string $class A class name
  *
  * @return Controller
  */
 protected function instantiateController($class)
 {
     $instance = Plugin::getInstance()->make($class);
     if (!$instance instanceof Controller) {
         throw new InvalidArgumentException(sprintf('Class "%s" is not an instance of %s.', $class, 'Nstaeger\\CmsPluginFramework\\Controller'));
     }
     return $instance;
 }
 public function build(Plugin $plugin)
 {
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\AssetBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressAssetBroker');
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\DatabaseBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressDatabaseBroker');
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\EventBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressEventBroker');
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\MenuBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressMenuBroker');
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\PermissionBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressPermissionBroker');
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\OptionBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressOptionsBroker');
     $plugin->singleton('Nstaeger\\CmsPluginFramework\\Broker\\RestBroker', 'Nstaeger\\CmsPluginFramework\\Broker\\Wordpress\\WordpressRestBroker');
 }
 function __construct(Configuration $configuration, Creator $creator)
 {
     parent::__construct($configuration, $creator);
     $this->menu()->registerAdminMenuItem('WP Post Email Notification')->withAction('AdminPageController@optionsPage')->withAsset('js/bundle/admin-options.js');
     $this->ajax()->delete('job')->resolveWith('AdminJobController@delete')->onlyWithPermission('can_manage');
     $this->ajax()->get('job')->resolveWith('AdminJobController@get')->onlyWithPermission('can_manage');
     $this->ajax()->get('option')->resolveWith('AdminOptionController@get')->onlyWithPermission('can_manage');
     $this->ajax()->put('option')->resolveWith('AdminOptionController@update')->onlyWithPermission('can_manage');
     $this->ajax()->post('subscribe')->resolveWith('FrontendSubscriberController@post')->enableForUnauthorized(true);
     $this->ajax()->delete('subscriber')->resolveWith('AdminSubscriberController@delete')->onlyWithPermission('can_manage');
     $this->ajax()->get('subscriber')->resolveWith('AdminSubscriberController@get')->onlyWithPermission('can_manage');
     $this->ajax()->post('subscriber')->resolveWith('AdminSubscriberController@post')->onlyWithPermission('can_manage');
     $this->events()->on('loaded', array($this, 'sendNotifications'));
     $this->events()->on('post-published', array($this, 'postPublished'));
     $this->events()->on('post-unpublished', array($this, 'postUnpublished'));
 }
 public function withTemplate($template, $parameters = [])
 {
     $this->content = Plugin::getInstance()->renderer()->render($template, $parameters);
     return $this;
 }