Example #1
0
 /**
  * Instantiate the class and determine which remote retrieval method we can use before
  * passing of to the parent constructor.
  *
  * @param array  $vid     The video array with all the data.
  * @param array  $old_vid The video array with all the data of the previous "fetch", if available.
  *
  * @return \WPSEO_Video_Details_Funnyordie
  */
 public function __construct($vid, $old_vid = array())
 {
     if (isset($vid['url'])) {
         // Fix it as FoD oembed does not work with embed urls
         $vid['url'] = str_replace('funnyordie.com/embed/', 'funnyordie.com/videos/', $vid['url']);
     }
     parent::__construct($vid, $old_vid);
 }
Example #2
0
 /**
  * Deal with potentially wrong ids from short id url format and instantiate the class
  *
  * @param array  $vid     The video array with all the data.
  * @param array  $old_vid The video array with all the data of the previous "fetch", if available.
  *
  * @return \WPSEO_Video_Details_Ted
  */
 public function __construct($vid, $old_vid = array())
 {
     // Check for wrongly set short id as id
     if (!empty($vid['id']) && preg_match('`^[0-9]+$`', $vid['id'])) {
         $vid['short_id'] = $vid['id'];
         unset($vid['id']);
     }
     parent::__construct($vid, $old_vid);
 }
Example #3
0
 /**
  * Instantiate the class
  *
  * Adjust the video url before passing off to the parent constructor
  *
  * @param array  $vid     The video array with all the data.
  * @param array  $old_vid The video array with all the data of the previous "fetch", if available.
  *
  * @return \WPSEO_Video_Details_Animoto
  */
 public function __construct($vid, $old_vid = array())
 {
     if (!empty($vid['url'])) {
         if (preg_match('`http://static\\.animoto\\.com/swf/.*?&f=([^&]+)`', $vid['url'], $match)) {
             $vid['url'] = sprintf($this->url_template, rawurlencode($match[1]));
         }
     }
     parent::__construct($vid, $old_vid);
 }
 /**
  * Instantiate the class
  *
  * Retrieve the Embedly API key if there is any and prevent unnecessary API calls if there
  * isn't one and Embedly has started to cut off the ip address
  *
  * @param array  $vid     The video array with all the data.
  * @param array  $old_vid The video array with all the data of the previous "fetch", if available.
  *
  * @return \WPSEO_Video_Details_Embedly
  */
 public function __construct($vid, $old_vid = array())
 {
     if (empty(self::$api_key)) {
         // Grab Embedly api key if it's set
         $options = get_option('wpseo_video');
         if ($options['embedly_api_key'] !== '') {
             self::$api_key = $options['embedly_api_key'];
         }
     }
     if (!empty(self::$api_key)) {
         $this->remote_url['pattern'] .= '&key=' . self::$api_key;
     }
     // Prevent further API calls if the user has been cut off by Embedly
     if (self::$functional === true) {
         parent::__construct($vid, $old_vid);
     } else {
         // @todo [JRF -> Yoast] Why not use (merge with) oldvid data here if available ?
         $this->vid = $vid;
     }
 }
Example #5
0
 /**
  * Instantiate the class and determine which remote retrieval method we can use before
  * passing of to the parent constructor.
  *
  * @param array  $vid     The video array with all the data.
  * @param array  $old_vid The video array with all the data of the previous "fetch", if available.
  *
  * @return \WPSEO_Video_Details_Blip
  */
 public function __construct($vid, $old_vid = array())
 {
     if (isset($vid['url'])) {
         $this->retrieve_method = 'oembed';
     } elseif (isset($vid['embedlookup'])) {
         $vid['url'] = 'http://blip.tv/play/' . $vid['embedlookup'];
         $this->retrieve_method = 'oembed';
     } elseif (isset($vid['id'])) {
         $this->retrieve_method = 'rss';
     }
     if (isset($this->remotes[$this->retrieve_method])) {
         $this->remote_url = $this->remotes[$this->retrieve_method];
     }
     parent::__construct($vid, $old_vid);
 }