'
Optional: Only required if you have a CNAME record set up to use a custom domain.
', // 'fields' => array( // 'domain' => array( // 'name' => 'Custom Wistia Domain', // 'type' => 'text', // 'description' => 'Enter the domain corresponding to your CNAME record for Wistia. Ex: videos.example.com' // ) // ) // ); public static function register_provider( $providers ) { $providers[self::service_slug] = new self; return $providers; } // Regex strings public $regexes = array( '#Wistia\.embed\("([0-9a-zA-Z]+)"#', // JavaScript API embedding '#(https?://(?:.+)?(?:wistia\.com|wistia\.net|wi\.st)/(?:medias|embed)/(?:[\+~%\/\.\w\-]*))#', // Embed URL '#(https://wistia\.sslcs\.cdngc\.net/deliveries/[0-9a-zA-Z]+\.jpg)#' // Thumbnail image ); // Thumbnail URL public function get_thumbnail_url( $id ) { // ID is an image URL, return it if ( substr( $id, -4 ) == '.jpg' ) return $id; // ID is actually an ID, convert it to a URL if ( substr( $id, 0, 4 ) != 'http' ) $id = 'http://fast.wistia.net/embed/iframe/' . $id; // ID should now be an embed URL, use oEmbed to find thumbnail URL $id = urlencode( $id ); $request = "http://fast.wistia.com/oembed?url=$id"; $response = wp_remote_get( $request ); if( is_wp_error( $response ) ) { $result = $this->construct_info_retrieval_error( $request, $response ); } else { $result = json_decode( $response['body'] ); $result = $this->drop_url_parameters( $result->thumbnail_url ); } return $result; } // Test cases public static function get_test_cases() { return array( array( 'markup' => '', 'expected' => 'https://embed-ssl.wistia.com/deliveries/6928fcba8355e38de4d95863a659e1de23cb2071.jpg', 'expected_hash' => 'bc4a2cec9ac97e2ccdae2c7387a01cb4', 'name' => __( 'iFrame Embed', 'video-thumbnails' ) ), array( 'markup' => ' ', 'expected' => 'https://embed-ssl.wistia.com/deliveries/a086707fe096e7f3fbefef1d1dcba1488d23a3e9.jpg', 'expected_hash' => '4c63d131604bfc07b5178413ab245813', 'name' => __( 'JavaScript Embed', 'video-thumbnails' ) ), ); } } ?>