-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #921 from Automattic/fix/864-video-widget-youtube-…
…vimeo Fix 'Video' widget for YouTube and Vimeo, simplify 'Gallery' solution
- Loading branch information
Showing
15 changed files
with
391 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Class AMP_Widget_Media_Video | ||
* | ||
* @since 0.7.0 | ||
* @package AMP | ||
*/ | ||
|
||
if ( class_exists( 'WP_Widget_Media_Video' ) ) { | ||
/** | ||
* Class AMP_Widget_Media_Video | ||
* | ||
* @since 0.7.0 | ||
* @package AMP | ||
*/ | ||
class AMP_Widget_Media_Video extends WP_Widget_Media_Video { | ||
|
||
/** | ||
* Overrides the parent callback that strips width and height values. | ||
* | ||
* @param string $html Video shortcode HTML output. | ||
* @return string HTML Output. | ||
*/ | ||
public function inject_video_max_width_style( $html ) { | ||
if ( is_amp_endpoint() ) { | ||
return $html; | ||
} | ||
return parent::inject_video_max_width_style( $html ); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Class AMP_Widget_Text | ||
* | ||
* @since 0.7.0 | ||
* @package AMP | ||
*/ | ||
|
||
if ( class_exists( 'WP_Widget_Text' ) ) { | ||
/** | ||
* Class AMP_Widget_Text | ||
* | ||
* @since 0.7.0 | ||
* @package AMP | ||
*/ | ||
class AMP_Widget_Text extends WP_Widget_Text { | ||
|
||
/** | ||
* Overrides the parent callback that strips width and height attributes. | ||
* | ||
* @param array $matches The matches returned from preg_replace_callback(). | ||
* @return string $html The markup, unaltered. | ||
*/ | ||
public function inject_video_max_width_style( $matches ) { | ||
if ( is_amp_endpoint() ) { | ||
return $matches[0]; | ||
} | ||
return parent::inject_video_max_width_style( $matches ); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.