]+>.+?http://www\.dailymotion\.com/swf/video/([A-Za-z0-9]+).+?#s', // Dailymotion flash '#//www\.dailymotion\.com/embed/video/([A-Za-z0-9]+)#', // Dailymotion iframe '#(?:https?://)?(?:www\.)?dailymotion\.com/video/([A-Za-z0-9]+)#' // Dailymotion URL ); // Thumbnail URL public function get_thumbnail_url( $id ) { $request = "https://api.dailymotion.com/video/$id?fields=thumbnail_url"; $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 = $result->thumbnail_url; } return $result; } // Test cases public static function get_test_cases() { return array( array( 'markup' => '
Adam Yauch of the Beastie Boys Dies at 47 by associatedpress', 'expected' => 'http://s1.dmcdn.net/AMjdy.jpg', 'expected_hash' => '077888b97839254892a377f51c06e642', 'name' => __( 'iFrame Embed', 'video-thumbnails' ) ), array( 'markup' => '
Adam Yauch of the Beastie Boys Dies at 47 by associatedpress', 'expected' => 'http://s1.dmcdn.net/AMjdy.jpg', 'expected_hash' => '077888b97839254892a377f51c06e642', 'name' => __( 'Flash Embed', 'video-thumbnails' ) ), ); } } ?>