Beispiel #1
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_Wistia
  */
 public function __construct($vid, $old_vid = array())
 {
     if (isset($vid['id'])) {
         $vid['url'] = sprintf($this->url_template, rawurlencode($vid['id']));
     }
     parent::__construct($vid, $old_vid);
 }
Beispiel #2
0
 /**
  * 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_Vippy
  */
 public function __construct($vid, $old_vid = array())
 {
     if (!class_exists('Vippy')) {
         // @todo [JRF -> Yoast] Why not use (merge with) oldvid data here if available ? Old data might still be better than none.
         $this->vid = $vid;
     } else {
         parent::__construct($vid, $old_vid);
     }
 }
Beispiel #3
0
 /**
  * Instantiate the class
  *
  * Retrieve the EVS location and only pass of to the parent constructor if we find one
  *
  * @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_Evs
  */
 public function __construct($vid, $old_vid = array())
 {
     $this->evs_location = get_option('evs_location');
     if ($this->evs_location) {
         parent::__construct($vid, $old_vid);
     } else {
         // @todo [JRF -> Yoast] Why not use (merge with) oldvid data here if available ? The api key might be removed, but old data might still be better than none.
         $this->vid = $vid;
     }
 }
Beispiel #4
0
 /**
  * Deal with potentially wrong ids from short 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_Flickr
  */
 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']);
     }
     // Make sure we use the short id if it's available and there's no id
     if (empty($vid['id']) && !empty($vid['short_id'])) {
         $this->remote_url['replace_key'] = 'short_id';
     }
     parent::__construct($vid, $old_vid);
 }
Beispiel #5
0
 /**
  * Instantiate the class, main routine.
  *
  * @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_23video
  */
 public function __construct($vid, $old_vid = array())
 {
     // @todo Deal with custom domains
     parent::__construct($vid, $old_vid);
 }
Beispiel #6
0
 /**
  * Instantiate the class
  *
  * Retrieve the Brightcove token and only pass of to the parent constructor if we find one
  *
  * @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_Brightcove
  */
 public function __construct($vid, $old_vid = array())
 {
     // grab Brightcove api key from wp_options
     $this->bc_token = get_option('bc_api_key');
     if (!empty($this->bc_token)) {
         $this->remote_url['pattern'] .= '&token=' . $this->bc_token;
         // Set the class properties before the parent constructor so they're available to maybe_use_old...()
         $vid = (array) $vid;
         $this->vid = array_merge($this->vid, array_filter($vid));
         if (is_array($old_vid) && $old_vid !== array()) {
             $this->old_vid = $old_vid;
         }
         // bail out as early as possible to avoid extra API call
         $this->maybe_use_old_video_data();
         parent::__construct($this->vid, $this->old_vid);
     } else {
         // @todo [JRF -> Yoast] Why not use (merge with) oldvid data here if available ? The api key might be removed, but old data might still be better than none.
         $this->vid = $vid;
     }
 }
Beispiel #7
0
 /**
  * Instantiate the class
  *
  * Overwrite the vzaar base domain if needed 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_Vzaar
  */
 public function __construct($vid, $old_vid = array())
 {
     $options = get_option('wpseo_video');
     if (isset($options['vzaar_domain']) && $options['vzaar_domain'] !== '') {
         $this->base_url = 'http://' . rawurlencode($options['vzaar_domain']) . '/';
         $this->id_regex = str_replace('#CUSTOM_URL#', '|' . preg_quote($options['vzaar_domain'], '`'), $this->id_regex);
     } else {
         $this->id_regex = str_replace('#CUSTOM_URL#', '', $this->id_regex);
     }
     parent::__construct($vid, $old_vid);
 }
Beispiel #8
0
 /**
  * Instantiate the class, main routine.
  *
  * @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_Localfile
  */
 public function __construct($vid, $old_vid = array())
 {
     if ($this->could_be_local_video_file($vid) === true) {
         parent::__construct($vid, $old_vid);
     } else {
         // @todo [JRF -> Yoast] Why not use (merge with) oldvid data here if available ? The api key might be removed, but old data might still be better than none.
         $this->vid = $vid;
     }
 }
Beispiel #9
0
 /**
  * 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_Videopress
  */
 public function __construct($vid, $old_vid = array())
 {
     // Pre-adjust the remote url
     $host = parse_url(home_url(), PHP_URL_HOST);
     $this->remote_url['pattern'] = $this->remote_url['pattern'] . $host;
     parent::__construct($vid, $old_vid);
 }