-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve handling of YouTube embeds #3358
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
35260fd
Preserve original YouTube iframe title as fallback content
westonruter 2f43691
Add title attribute to amp-youtube in addition to fallback content
westonruter 26faef0
Rename class-amp-youtube-embed.php to class-amp-youtube-embed-handler…
pierlon ceec460
Merge test-amp-youtube-embed.php and test-class-amp-youtube-embed-han…
pierlon 5225f4e
Mock oEmbed responses
pierlon 4e58e82
Make tests compatible with WP 5.1 and below
pierlon 6602800
Bump `oembed` function deprecation version to 1.5.0
pierlon 899603e
HTML entity encoding will be handled by the DOM instead
pierlon 3ea23d7
Remove todo
pierlon e392dcc
Replace the fallback with an image placeholder for the iframe
pierlon 7a97571
Refactor `get_video_id_from_url` function
pierlon 4b0fbd1
Replace ambiguous `$fallback` with `$fallback_for_expected`
pierlon c65db4d
Merge separate regexes used to retrieve props into one
pierlon 6224606
Update doc comment for `get_video_id_from_url`
pierlon 514bfd9
Extract HTML attribute parsing logic into base class, and use for You…
westonruter 97e8db5
Prevent copying empty title/alt in WP<5.2
westonruter fc0e9e0
Add object-fit=contain to amp-youtube placeholder image
westonruter 933c050
Remove empty alt attributes
westonruter 6b92d0a
Replace incorrect usage of esc_url() with esc_url_raw()
westonruter 62e7ee1
Quote variables added to regex pattern
westonruter d45fd59
Re-factor get_html_attribute_pattern as match_element_attributes
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make this reusable, why not include the
preg_match()
call? Something likematch_element_attributes( $tag_name, $attribute_names )
.This way, usage could be simplified:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point. I didn't refactor far enough. See d45fd59.