JFIF $ d d 7 * Z qn )ZP 0 !1 A "#a$2Qr D8 a Ri [f \m I ykI w0 c u F c Rı?lO7 к _f˓ [C $殷WF< _W ԣ s Kc ëI zyQy /_LK ℂ ;C",p F A : /] =H ~ , l s / 9 ć: [=/#f ; ) x { ٛE Q )~ = 𘙲r*2~ a _V = ' ku m F D } KYYC )( { * g& f `툪 r y ` = ^ c J. I ]( * `wq 1dđ #̩ ͑ 0 ; H ] u 搂 @:~ ו K L N s h } O I R* 8 :2 ! lD JV o ( 3 = M ( z Ȱ+i *N A r6K n S l ) ! J J Ӂ* % ݉?|D } d5: eP0 R; {$X' x F @ .ÊB {,WJ uQ ɲRI ;9 Q E琯 6 2fT .DU J ;*c P A\IL Nj! J ۱+ O\ ͔ ] ޒ S J ȧ c%A N ol ՎprU L Zԛe r E2= X D Xg VQeӓ k y P7 U* o m Q I s ,K `) 6\G3t?pgjr m ۛجw luGt f h 9uyP 0D;Uڽ"OXl i f $ ) &|ML 0 Z rm1 [ H XP l P R0 'G=i 2N +0 e 2 ]] 9 VT P O 7 h(F * 癈 ' = Q VZD F,d ߬ ~ T X G[ `le 69C R(!S2! P < 0 x < !1AQ "Raq 02Br #S CTb ? Ζ "]mH5WR 7 k.ۛ ! } Q~ + yԏ z |@ T20 S~ K e k *zF f^2X *( @ 8 r ? C I uI|֓>^Ex LgNU Y+{.R Ѫ τV YT D I 6 2 '8Y2 7'\T P.6 d &˦ @V q i |8 -O Ε ] ʔ U= T L 8= ;6c | !qfF3 a ů& ~$ l} 'NW U s$U k^S V : U#6w + +s &r+n ڐ { @ 29gL u " T Ù M=6 (^ "7 r}=6Yݾ lC u hquymp Ǧ G jhs ǜNl ɻ} o 7 #S6 a w 4 ! OS r D 5 7 % | ?x> L | / nD 6?/8 w # [ ) L 7 +6〼T A T g ! %5 Mm Z /c -{1_Je "| ^$ 'O & ޱմ < H vNqϡQ$ < 6 &Nݛ ֨tǻN (9 n ru~'όN sMG& ,uH Kw *Ī 5@ u6 BԒ i YN * f 0 _ GhKW u lT <nj- 0{ M L~ | /a v\ E = ?1 \ɟuq Ђ Y O a K ޡP q $ H8o Q˼EV ~ k 0 h' L Pp M -M" m^ !6l nմ 쮝C U T . ! :vMǨb h ډ Vc r @~p # !1QAa q ? AL0L x LU 4 d ; x " 16ad0 7.\ߋ 0 = P l v/ " c A Ay A|2pO8"d MV #1] = \ " ˡ ] k v I9 d ۓ & q ) ǐq E ꞅ v "P )q X &Q З non]я u ג./ ; gZ$ M QР 2M ]h ni 0 P $ێ 3CɏGjώy : m c # S_ l@ '_ \m|C 2`K _ 1 cIvGc $? PCQ S+D ? K aײ k Fr b 8 ύ NEدg ĝ U 3 6 #Ik+ v { v i ( ވ ? a e) X xy/*@Q Ǽ Ծ ) $ IWO l c G; !i k{ gOŀ L ('x T rb $ w) R $ & N1E td U3Uȉ1p M"N* (DNy d96.(jQ) X 5 c QɎMy W ? Q *!R > 6=7)Xj 5`J ] e 8%t ! + ' ! 1Q 5 !1 AQaq ё #2 "0BRb ? G t^ ## .l lQ T $ v , ,m 㵜5u bV =sY+ @d { N ! dn O < .- B; _w J t 6;Q Jd. Q c%p{ 1 ,sND dF H I0 Гo X ш e黅X ۢ F :)[ F G X ƹ / w _c MeD ,ʡc c . W D tA $ j@ : ) - #u c1< @ۗ9F ) KJ- hpP] _ x [ q B lb p ʖ w q " LFGd ƶ * s +ډ_Zc " ? % t[I P 6 J ]# =ɺ V v v CGs Gh1 > )6 |e y ? L ӣ m,4 G W Ui ` ] uJVo VDG< SB 6ϏQ @ TiU l y O U 0 kfV ~ ~}S Z @ *WU Ui ## ; s /[ = ! 7}" W N ] ' (L ! ~ y5 g9T̅J kbM' +s :S +B) v @ M j e C f j E 0 Y\Qn z G 1 д~ W o{T 9?` Rm yhsy3 !HAD ] m c1 ~ 2 L S u7x T ;j$ `} 4-> L# vzŏ I L S ֭ T { r jGK C ; b pU= - ` Bs K. S F w4 M q] Z dH S 0 ) tLg
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor embed.
*
* Elementor embed handler class is responsible for Elementor embed functionality.
* The class holds the supported providers with their embed patters, and handles
* their custom properties to create custom HTML with the embedded content.
*
* @since 1.5.0
*/
class Embed {
/**
* Embeddable background video providers.
*
* Holds the list of providers whose background video is rendered as an embedded
* iframe player (.elementor-background-video-embed) rather than a hosted <video>
* element. This is intentionally a SUBSET of the providers recognized by
* get_video_properties() — the frontend background-video handler only mounts
* YouTube/Vimeo players, so other providers must fall through to hosted rendering.
*
* @access private
* @static
*
* @var array Embeddable background video provider slugs.
*/
private static $video_embed_providers = [ 'youtube', 'vimeo' ];
/**
* Provider match masks.
*
* Holds a list of supported providers with their URL structure in a regex format.
*
* @since 1.5.0
* @access private
* @static
*
* @var array Provider URL structure regex.
*/
private static $provider_match_masks = [
'youtube' => '/^.*(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:(?:watch)?\?(?:.*&)?vi?=|(?:embed|v|vi|user|shorts)\/))([^\?&\"\'>]+)/',
'vimeo' => '/^.*vimeo\.com\/(?:[a-z]*\/)*([0-9]{6,11})[?]?.*/',
'dailymotion' => '/^.*dailymotion.com\/(?:video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/',
'videopress' => [
'/^(?:http(?:s)?:\/\/)?videos\.files\.wordpress\.com\/([a-zA-Z\d]{8,})\//i',
'/^(?:http(?:s)?:\/\/)?(?:www\.)?video(?:\.word)?press\.com\/(?:v|embed)\/([a-zA-Z\d]{8,})(.+)?/i',
],
];
/**
* Embed patterns.
*
* Holds a list of supported providers with their embed patters.
*
* @since 1.5.0
* @access private
* @static
*
* @var array Embed patters.
*/
private static $embed_patterns = [
'youtube' => 'https://www.youtube{NO_COOKIE}.com/embed/{VIDEO_ID}?feature=oembed',
'vimeo' => 'https://player.vimeo.com/video/{VIDEO_ID}#t={TIME}',
'dailymotion' => 'https://dailymotion.com/embed/video/{VIDEO_ID}',
'videopress' => 'https://videopress.com/embed/{VIDEO_ID}',
];
/**
* Get video properties.
*
* Retrieve the video properties for a given video URL.
*
* @since 1.5.0
* @access public
* @static
*
* @param string $video_url Video URL.
*
* @return null|array The video properties, or null.
*/
public static function get_video_properties( $video_url ) {
foreach ( self::$provider_match_masks as $provider => $match_mask ) {
if ( ! is_array( $match_mask ) ) {
$match_mask = [ $match_mask ];
}
foreach ( $match_mask as $mask ) {
if ( preg_match( $mask, $video_url, $matches ) ) {
return [
'provider' => $provider,
'video_id' => $matches[1],
];
}
}
}
return null;
}
/**
* Is embeddable background video.
*
* Whether a given video URL belongs to a provider that the frontend
* background-video handler renders as an embedded iframe player.
*
* @param string $video_url Video URL.
*
* @return bool
**/
public static function is_embed_video( $video_url ) {
$video_properties = self::get_video_properties( $video_url );
return null !== $video_properties && in_array( $video_properties['provider'], self::$video_embed_providers, true );
}
/**
* Get embed URL.
*
* Retrieve the embed URL for a given video.
*
* @since 1.5.0
* @access public
* @static
*
* @param string $video_url Video URL.
* @param array $embed_url_params Optional. Embed parameters. Default is an
* empty array.
* @param array $options Optional. Embed options. Default is an
* empty array.
*
* @return null|array The video properties, or null.
*/
public static function get_embed_url( $video_url, array $embed_url_params = [], array $options = [] ) {
$video_properties = self::get_video_properties( $video_url );
if ( ! $video_properties ) {
return null;
}
$embed_pattern = self::$embed_patterns[ $video_properties['provider'] ];
$replacements = [
'{VIDEO_ID}' => $video_properties['video_id'],
];
if ( 'youtube' === $video_properties['provider'] ) {
$replacements['{NO_COOKIE}'] = ! empty( $options['privacy'] ) ? '-nocookie' : '';
} elseif ( 'vimeo' === $video_properties['provider'] ) {
$time_text = '';
if ( ! empty( $options['start'] ) ) {
$time_text = date( 'H\hi\ms\s', $options['start'] ); // PHPCS:Ignore WordPress.DateTime.RestrictedFunctions.date_date
}
$replacements['{TIME}'] = $time_text;
/**
* Handle Vimeo private videos
*
* Vimeo requires an additional parameter when displaying private/unlisted videos. It has two ways of
* passing that parameter:
* * as an endpoint - vimeo.com/{video_id}/{privacy_token}
* OR
* * as a GET parameter named `h` - vimeo.com/{video_id}?h={privacy_token}
*
* The following regex match looks for either of these methods in the Vimeo URL, and if it finds a privacy
* token, it adds it to the embed params array as the `h` parameter (which is how Vimeo can receive it when
* using Oembed).
*/
$h_param = [];
preg_match( '/(?|(?:[\?|\&]h={1})([\w]+)|\d\/([\w]+))/', $video_url, $h_param );
if ( ! empty( $h_param ) ) {
$embed_url_params['h'] = $h_param[1];
}
}
$embed_pattern = str_replace( array_keys( $replacements ), $replacements, $embed_pattern );
return add_query_arg( $embed_url_params, $embed_pattern );
}
/**
* Get embed HTML.
*
* Retrieve the final HTML of the embedded URL.
*
* @since 1.5.0
* @access public
* @static
*
* @param string $video_url Video URL.
* @param array $embed_url_params Optional. Embed parameters. Default is an
* empty array.
* @param array $options Optional. Embed options. Default is an
* empty array.
* @param array $frame_attributes Optional. IFrame attributes. Default is an
* empty array.
*
* @return string The embed HTML.
*/
public static function get_embed_html( $video_url, array $embed_url_params = [], array $options = [], array $frame_attributes = [] ) {
$video_properties = self::get_video_properties( $video_url );
$default_frame_attributes = [
'class' => 'elementor-video-iframe',
'allowfullscreen',
'allow' => 'clipboard-write',
'title' => sprintf(
/* translators: %s: Video provider */
__( '%s Video Player', 'elementor' ),
$video_properties['provider']
),
];
$video_embed_url = self::get_embed_url( $video_url, $embed_url_params, $options );
if ( ! $video_embed_url ) {
return null;
}
if ( ! isset( $options['lazy_load'] ) || ! $options['lazy_load'] ) {
$default_frame_attributes['src'] = $video_embed_url;
} else {
$default_frame_attributes['data-lazy-load'] = $video_embed_url;
}
if ( isset( $embed_url_params['autoplay'] ) ) {
$default_frame_attributes['allow'] = 'autoplay';
}
$frame_attributes = array_merge( $default_frame_attributes, $frame_attributes );
$attributes_for_print = [];
foreach ( $frame_attributes as $attribute_key => $attribute_value ) {
$attribute_value = esc_attr( $attribute_value );
if ( is_numeric( $attribute_key ) ) {
$attributes_for_print[] = $attribute_value;
} else {
$attributes_for_print[] = sprintf( '%1$s="%2$s"', $attribute_key, $attribute_value );
}
}
$attributes_for_print = implode( ' ', $attributes_for_print );
$iframe_html = "<iframe $attributes_for_print></iframe>";
/** This filter is documented in wp-includes/class-oembed.php */
return apply_filters( 'oembed_result', $iframe_html, $video_url, $frame_attributes );
}
/**
* Get oembed data from the cache.
* if not exists in the cache it will fetch from provider and then save to the cache.
*
* @param string $oembed_url
* @param string $cached_post_id
*
* @return array|null
*/
public static function get_oembed_data( $oembed_url, $cached_post_id ) {
$cached_oembed_data = json_decode( get_post_meta( $cached_post_id, '_elementor_oembed_cache', true ), true );
if ( isset( $cached_oembed_data[ $oembed_url ] ) ) {
return $cached_oembed_data[ $oembed_url ];
}
$normalize_oembed_data = self::fetch_oembed_data( $oembed_url );
if ( ! $cached_oembed_data ) {
$cached_oembed_data = [];
}
update_post_meta( $cached_post_id, '_elementor_oembed_cache', wp_json_encode( array_merge(
$cached_oembed_data,
[
$oembed_url => $normalize_oembed_data,
]
) ) );
return $normalize_oembed_data;
}
/**
* Fetch oembed data from oembed provider.
*
* @param string $oembed_url
* @return array|null
*/
public static function fetch_oembed_data( $oembed_url ) {
$oembed_data = _wp_oembed_get_object()->get_data( $oembed_url );
if ( ! $oembed_data ) {
return null;
}
return [
'thumbnail_url' => $oembed_data->thumbnail_url,
'title' => $oembed_data->title,
];
}
/**
* @param string $oembed_url
* @param null|string|int $cached_post_id
*
* @return string|null
*/
public static function get_embed_thumbnail_html( $oembed_url, $cached_post_id = null ) {
$oembed_data = self::get_oembed_data( $oembed_url, $cached_post_id );
if ( ! $oembed_data ) {
return null;
}
return '<div class="elementor-image">' . sprintf( '<img src="%1$s" alt="%2$s" title="%2$s" width="%3$s" loading="lazy" />', $oembed_data['thumbnail_url'], esc_attr( $oembed_data['title'] ), '100%' ) . '</div>';
}
}