コード例 #1
0
 /**
  * Rebuild the cache and return true on success, false otherwise
  *
  * @param ProviderInterface $dataProvider
  * @param ContentModel      $contentElement
  *
  * @return bool
  */
 public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement)
 {
     $factory = new Factory($dataProvider);
     if (($video = $factory->createVideo($contentElement->vimeo_videoId)) === null) {
         return false;
     }
     if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($contentElement->vimeo_videoId) === null) {
         return false;
     }
     if ($dataProvider->getVideoImage($contentElement->vimeo_videoId, Config::get('vimeo_imageIndex')) === null) {
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * Get the video
  *
  * @return Video|null
  */
 protected function getVideo()
 {
     $dataProvider = new StandardProvider(new Cache(), Client::getInstance());
     $factory = new Factory($dataProvider);
     if (($video = $factory->createVideo($this->vimeo_videoId)) === null) {
         return null;
     }
     // Set the images
     if (Config::get('vimeo_allImages') && ($images = $dataProvider->getVideoImages($this->vimeo_videoId)) !== null) {
         $video->setPicturesData($images);
     }
     // Set the poster
     if (($image = $dataProvider->getVideoImage($this->vimeo_videoId, Config::get('vimeo_imageIndex'))) !== null) {
         $video->setPoster($image);
     }
     return $video;
 }