Exemple #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);
 }
Exemple #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);
 }
Exemple #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);
 }
 /**
  * Set the video type
  */
 protected function set_type()
 {
     if (!empty($this->decoded_response->provider_name)) {
         $provider = explode('.', $this->decoded_response->provider_name);
         // when needed, change service.com to service
         $this->vid['type'] = strtolower($provider[0]);
     } else {
         parent::set_type();
     }
 }
Exemple #5
0
 /**
  * Set the video width
  */
 protected function set_width()
 {
     switch ($this->retrieve_method) {
         case 'oembed':
             parent::set_width();
             break;
         case 'rss':
             if (preg_match('`<media:player url=.+?<iframe.+?" width="([0-9]+)"`', $this->decoded_response, $match)) {
                 $this->vid['width'] = $match[1];
             }
             break;
     }
 }