/** * 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; } }