Beispiel #1
0
 /**
  * Register our data source and renderer
  */
 public function register()
 {
     /**
      * Set up the data source for the feed
      */
     $this->app->bind('KoderHut\\RssFeedster\\DataSource', function ($app) {
         $config['page'] = Settings::get('post_page');
         $config['comments_anchor'] = Settings::get('comments_anchor');
         $config['controller'] = new Controller();
         return new PostsSource($config);
     });
     /**
      * Set up the adapter interface between the XML renderer and
      * the blog posts data
      */
     $this->app->bind(IAdapter::DI_NAMESPACE, function () {
         return new BlogPostXmlAdapter();
     });
     /**
      * Set up the feed renderer
      */
     $this->app->bind('KoderHut\\RssFeedster\\Renderer', function ($app) {
         $config = ['description' => Settings::get('feed_description'), 'title' => Settings::get('feed_title'), 'category' => Settings::get('feed_category'), 'copyright' => Settings::get('feed_copyright'), 'language' => Settings::get('feed_language'), 'link' => Url::action('KoderHut\\RssFeedster\\Controllers\\Rss@buildRssFeed')];
         $pluginPath = PluginManager::instance()->getPluginPath(Plugin::KODERHUT_RSSFEEDSTER_NS);
         $xmlTemplate = $pluginPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'feed-template.xml';
         return new XmlRenderer($config, file_get_contents($xmlTemplate), $this->app->make(IAdapter::DI_NAMESPACE));
     });
     return;
 }