/**
  * Handle the widget data.
  */
 public function handle(ConfigurationRepositoryInterface $configuration)
 {
     $template = $configuration->get('anomaly.extension.xml_feed_widget::template', $this->widget->getId());
     /* @var EditorFieldTypePresenter $presenter */
     $presenter = $template->getFieldTypePresenter('value');
     $this->widget->setContent($presenter->parsed(['widget' => $this->widget]));
 }
 /**
  * Handle the command.
  *
  * @param ConfigurationRepositoryInterface $configuration
  */
 public function handle(ConfigurationRepositoryInterface $configuration)
 {
     /* @var ConfigurationInterface $html */
     $html = $configuration->get('anomaly.extension.html_widget::html', $this->widget->getId());
     /* @var EditorFieldTypePresenter $presenter */
     if ($presenter = $html->getFieldTypePresenter('value')) {
         $this->widget->addData('html', $presenter->parsed());
     }
 }
 /**
  * Handle the widget data.
  */
 public function handle(\SimplePie $rss, Repository $cache, ConfigurationRepositoryInterface $configuration)
 {
     $items = $cache->remember(__METHOD__, 30, function () use($rss, $configuration) {
         // Let Laravel cache everything.
         $rss->enable_cache(false);
         // Hard-code this for now.
         $rss->set_feed_url($configuration->value('anomaly.extension.xml_feed_widget::url', $this->widget->getId(), 'http://www.pyrocms.com/posts/rss.xml'));
         // Make the request.
         $rss->init();
         return $rss->get_items(0, 5);
     });
     // Load the items to the widget's view data.
     $this->widget->addData('items', $items);
 }
 /**
  * Handles getting and loading the content
  */
 public function handle(ConfigurationRepositoryInterface $configuration)
 {
     // First get the location and split it into city & state
     list($city, $state) = explode(',', $configuration->value('daviesgeek.extension.weather_widget::location', $this->widget->getId()));
     // Trim both and slug-ify the city
     $state = trim($state);
     $request_city = str_replace(" ", "_", trim($city));
     // Retrieve the API key
     $key = $configuration->value('daviesgeek.extension.weather_widget::api_key', $this->widget->getId());
     // Build the URL
     $url = 'http://api.wunderground.com/api/' . $key . '/conditions/q/' . $state . '/' . $request_city . '.json';
     // Create a new \GuzzleHttp\Client
     $client = new Client();
     // Make the request
     $res = $client->request('GET', $url);
     // Set the content to the twig template with the decoded JSON as the data
     $this->widget->setContent(view('daviesgeek.extension.weather_widget::template', json_decode($res->getBody(), true)));
 }
예제 #5
0
 /**
  * Handle the output.
  *
  * @param Factory $view
  * @return \Illuminate\Contracts\View\View
  */
 public function handle(Factory $view)
 {
     $extension = $this->widget->getExtension();
     return $view->make($extension->getWrapper(), ['widget' => $this->widget]);
 }
예제 #6
0
 /**
  * Handle the output.
  *
  * @param Factory $view
  * @return \Illuminate\Contracts\View\View
  */
 public function handle(Factory $view)
 {
     $extension = $this->widget->getExtension();
     $this->widget->setContent($view->make($extension->getView(), ['widget' => $this->widget]));
 }