/**
  * Retrieve information on a video via a remote API call and prevent further API calls
  * if the user has been cut off.
  */
 protected function get_remote_video_info()
 {
     $response = parent::get_remote_video_info();
     if (!isset($this->remote_response) && wp_remote_retrieve_response_code($response) == 403) {
         // User has been cut off, prevent further calls from this class instance and other instances
         self::$functional = false;
     }
 }
示例#2
0
 /**
  * Retrieve video details
  *
  * @since      1.7.0
  * @see        WPSEO_Video_Details
  *
  * @param  array  $vid  A potential video array with all the data.
  *
  * @todo - Should be changed to visibility protected, but that would cause fatal
  * errors with the fall-back for deprecated methods. Let's wait a few versions.
  *
  * @return array $vid
  */
 public function get_video_details($vid)
 {
     $vid = $this->verify_service_type($vid);
     $class = 'unknown';
     if (isset($vid['type'])) {
         $class = 'WPSEO_Video_Details_' . $vid['type'];
     }
     if (class_exists($class)) {
         $video = new $class($vid, $this->old_vid);
         $vid = $video->get_details();
     } elseif (isset($vid['maybe_local']) && $vid['maybe_local'] === true) {
         $video = new WPSEO_Video_Details_Localfile($vid, $this->old_vid);
         $vid = $video->get_details();
     }
     // Alternatively try to get details via embedly
     if (empty($vid['content_loc']) && empty($vid['player_loc']) && (self::$use_embedly === true && WPSEO_Video_Details_Embedly::$functional !== false) && !empty($vid['url'])) {
         $video = new WPSEO_Video_Details_Embedly($vid, $this->old_vid);
         $vid = $video->get_details();
     }
     return $vid;
 }