Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     $titles = $this->request->url->getDirectory(1);
     if (!empty($titles)) {
         $url = clone $this->request->url;
         $url->setPath('/w/api.php');
         $url->setParameter('action', 'query');
         $url->setParameter('format', 'json');
         $url->setParameter('continue', '');
         $url->setParameter('titles', $titles);
         //extract images
         $url->setParameter('prop', 'images');
         $api = $this->request->createRequest($url);
         if ($json = $api->getJsonContent()) {
             $this->api->set('images', $json);
         }
         //extract content
         $url->setParameter('prop', 'extracts');
         $url->setParameter('exchars', 1500);
         $api = $this->request->createRequest($url);
         if ($json = $api->getJsonContent()) {
             $this->api->set('extracts', $json);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function run()
 {
     if ($this->request->getHost() === 'gist.github.com') {
         $this->addProvider('gist', new Api\Gist());
     }
     parent::run();
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if ($this->request->match('*/maps/*')) {
         $this->addProvider('google', new Api\GoogleMaps());
     }
     parent::run();
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if ($this->request->getHttpCode() === 429) {
         $this->addProvider('oembed', new Providers\OEmbed());
         return;
     }
     parent::run();
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     $api = $this->request->createRequest($this->request->url->getUrl() . '.json');
     if ($json = $api->getJsonContent()) {
         $this->api->set($json);
     }
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     $api = clone $this->request;
     $api->url->setParameter('output', 'json');
     if ($json = $api->getJsonContent()) {
         $this->api->set($json);
     }
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     if (isset($this->config['soundcloudKey'])) {
         $api = $this->request->createRequest('http://api.soundcloud.com/resolve.json');
         $api->startingUrl->setParameter('client_id', $this->config['soundcloudKey']);
         $api->startingUrl->setParameter('url', $this->request->url->getUrl());
         if ($json = $api->getJsonContent()) {
             $this->api->set($json);
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     if ($id = $this->getId($this->request->startingUrl)) {
         if ($this->config['facebookKey']) {
             $api = $this->request->createRequest('https://graph.facebook.com/' . $id);
             $api->startingUrl->setParameter('access_token', $this->config['facebookKey']);
             if ($json = $api->getJsonContent()) {
                 $this->api->set($json);
             }
         }
         $this->api->set('id', $id);
     }
 }
Ejemplo n.º 9
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('soundcloud', new Api\Soundcloud());
     parent::run();
 }
Ejemplo n.º 10
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('archive', new Api\Archive());
     parent::run();
 }
Ejemplo n.º 11
0
 /**
  * {@inheritdoc}
  */
 protected function run()
 {
     $this->addProvider('wikipedia', new Api\Wikipedia());
     parent::run();
 }
Ejemplo n.º 12
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('facebook', new Api\Facebook());
     parent::run();
 }
Ejemplo n.º 13
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('imageshack', new Api\Imageshack());
     parent::run();
 }