Skip to content

Commit

Permalink
Jetpack Sync: extract audio shortcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
trakos committed Jul 27, 2024
1 parent 6d4824f commit 2c3ef1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/_inc/lib/class.media-extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Jetpack_Media_Meta_Extractor {
* @var string[]
*/
private static $keeper_shortcodes = array(
'audio',
'youtube',
'vimeo',
'hulu',
Expand Down Expand Up @@ -200,6 +201,9 @@ public static function extract_from_content( $content, $what_to_extract = self::
$id = call_user_func( array( $shortcode_class_name, $shortcode_get_id_method ), $attr );
} elseif ( 'video' === $shortcode ) {
$id = $attr['url'] ?? $attr['mp4'] ?? $attr['m4v'] ?? $attr['webm'] ?? $attr['ogv'] ?? $attr['wmv'] ?? $attr['flv'] ?? null;
} elseif ( 'audio' === $shortcode ) {
preg_match( '#(https?://(?:[^\s"|\']+)\.(?:mp3|ogg|flac|m4a|wav))([ "\'|]|$)#', implode( ' ', $attr ), $matches );
$id = $matches[1] ?? null;
}
if ( ! empty( $id )
&& ( ! isset( $shortcode_details[ $shortcode_name ] ) || ! in_array( $id, $shortcode_details[ $shortcode_name ], true ) ) ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Support video and audio shortcodes in Media Extractor

This file was deleted.

0 comments on commit 2c3ef1b

Please sign in to comment.