Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getImagesUrls()
 {
     $images = parent::getImagesUrls();
     if (!$this->api->get('artwork_url') && ($img = $this->api->get('user', 'avatar_url'))) {
         Utils::unshiftValue($images, ['value' => str_replace('-large.jpg', '-t500x500.jpg', $img), 'providers' => ['api']]);
     }
     return $images;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function getProviderIconsUrls()
 {
     $icons = Utils::getData($this->providers, 'providerIconsUrls', $this->request);
     Utils::unshiftValue($icons, ['value' => $this->request->getAbsolute('/favicon.ico'), 'providers' => ['adapter']]);
     Utils::unshiftValue($icons, ['value' => $this->request->getAbsolute('/favicon.png'), 'providers' => ['adapter']]);
     return $icons;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function getImagesUrls()
 {
     $images = parent::getImagesUrls();
     if ($url = $this->api->get('misc', 'image')) {
         Utils::unshiftValue($images, ['value' => $this->request->url->getAbsolute($url), 'providers' => ['api']]);
     }
     if (is_array($files = $this->api->get('files'))) {
         foreach ($files as $url => $info) {
             Utils::unshiftValue($images, ['value' => $this->request->url->getAbsolute($url), 'providers' => ['api']]);
         }
     }
     return $images;
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function getImagesUrls()
 {
     $images = parent::getImagesUrls();
     if (($cover = $this->api->get('cover')) && !empty($cover['source'])) {
         Utils::unshiftValue($images, ['value' => $cover['source'], 'providers' => ['api']]);
     }
     if ($id = $this->api->get('id')) {
         Utils::unshiftValue($images, ['value' => 'https://graph.facebook.com/' . $id . '/picture', 'providers' => ['api']]);
     }
     return $images;
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function getImagesUrls()
 {
     $images = parent::getImagesUrls();
     $apiImages = $this->api->get('images');
     if (isset($apiImages['query']['pages'])) {
         $page = current($apiImages['query']['pages']);
         $imgs = [];
         foreach ($page['images'] as $image) {
             switch (strrchr($image['title'], '.')) {
                 case '.png':
                 case '.jpg':
                 case '.gif':
                 case '.jpeg':
                     $imgs[] = $image['title'];
                     break;
             }
         }
         //Get image urls
         if ($imgs) {
             $url = clone $this->request->url;
             $url->setPath('/w/api.php');
             $url->setParameter('action', 'query');
             $url->setParameter('prop', 'imageinfo');
             $url->setParameter('iiprop', 'url');
             $url->setParameter('format', 'json');
             $url->setParameter('continue', '');
             $url->setParameter('titles', implode('|', $imgs));
             $json = $this->request->createRequest($url)->getJsonContent();
             if (isset($json['query']['pages'])) {
                 foreach ($json['query']['pages'] as $page) {
                     if (isset($page['imageinfo'][0]['url'])) {
                         Utils::unshiftValue($images, ['value' => $page['imageinfo'][0]['url'], 'providers' => ['api']]);
                     }
                 }
             }
         }
     }
     return $images;
 }