Skip to content

Commit

Permalink
Merge pull request Automattic#2473 from PatelUtkarsh/fix1302
Browse files Browse the repository at this point in the history
Fix 1302 Sharing: Added dailymotion screenshots to Open Graph meta tags
  • Loading branch information
samhotchkiss committed Aug 25, 2015
2 parents 2947da4 + f2bbc87 commit b604e3c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion class.media-summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static function get( $post_id, $blog_id = 0, $args = array() ) {

if ( !empty( $extract['has']['embed'] ) ) {
foreach( $extract['embed']['url'] as $embed ) {
if ( preg_match( '/((youtube|vimeo)\.com|youtu.be)/', $embed ) ) {
if ( preg_match( '/((youtube|vimeo|dailymotion)\.com|youtu.be)/', $embed ) ) {
if ( 0 == $return['count']['video'] ) {
$return['type'] = 'video';
$return['video'] = 'http://' . $embed;
Expand All @@ -120,6 +120,10 @@ static function get( $post_id, $blog_id = 0, $args = array() ) {
$poster_url_parts = parse_url( $poster_image );
$return['secure']['image'] = 'https://secure-a.vimeocdn.com' . $poster_url_parts['path'];
}
} else if ( false !== strpos( $embed, 'dailymotion' ) ) {
$return['image'] = str_replace( 'dailymotion.com/video/','dailymotion.com/thumbnail/video/', $embed );
$return['image'] = parse_url( $return['image'], PHP_URL_SCHEME ) === null ? 'http://' . $return['image'] : $return['image'];
$return['secure']['image'] = self::https( $return['image'] );
}

}
Expand Down

0 comments on commit b604e3c

Please sign in to comment.