get_by_name( Providers::sanitize_name( $provider ) ); } /** * Filter the overlay arguments. * * @deprecated 1.10.0 Use embed_privacy_template_arguments instead * @since 1.9.0 * * @param array $attributes Template arguments * @param string $provider The embed provider * @param string $provider_name The embed provider without spaces and in lowercase * @param string $output The output before replacing it */ $attributes = (array) \apply_filters_deprecated( 'embed_privacy_overlay_args', [ $attributes, $provider, $provider->get_name(), $output, ], '1.10.0', 'embed_privacy_template_arguments' ); /** * Filter the template attributes. * * @since 1.10.0 * * @param array $attributes Template attributes * @param string $provider The embed provider * @param string $output The output before replacing it */ $attributes = (array) \apply_filters( 'embed_privacy_template_attributes', $attributes, $provider, $output ); if ( ! empty( $attributes['post_id'] ) ) { $embed_post = \get_post( $attributes['post_id'] ); if ( Providers::is_disabled( $embed_post ) ) { return $output; } } else if ( ! empty( $attributes['provider'] ) ) { if ( $attributes['provider'] instanceof Provider && $attributes['provider']->is_disabled() ) { return $output; } } else { $embed_post = null; } if ( $provider->is( 'youtube' ) ) { $output = \str_replace( 'youtube.com', 'youtube-nocookie.com', $output ); } $embed_class = 'embed-' . ( ! empty( $provider->get_name() ) ? $provider->get_name() : 'default' ); $embed_classes = $embed_class; $style = new Style( $provider->get_name(), $embed_post, $attributes ); if ( ! empty( $attributes['align'] ) ) { $embed_classes .= ' align' . $attributes['align']; } if ( ! empty( $attributes['assets'] ) ) { $output = Assets::get_static( $attributes['assets'], $provider->get_name() ) . $output; } $embed_md5 = \md5( $output . \wp_generate_uuid4() ); $checkbox_id = 'embed-privacy-store-' . $provider->get_name() . '-' . $embed_md5; /** * Fires before the template output is generated. * * @since 1.10.0 * * @param \epiphyt\Embed_Privacy\embed\Provider $provider The embed provider * @param \epiphyt\Embed_Privacy\embed\Style $style The overlay style object * @param array $attributes Additional attributes */ \do_action( 'embed_privacy_before_template_output', $provider, $style, $attributes ); \ob_start(); ?>
get_name() ) ) {
if ( $embed_post || ! empty( $provider->get_description() ) ) {
$allowed_tags = [
'a' => [
'href',
'target',
],
];
if ( $embed_post ) {
echo $embed_post->post_content . \PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$privacy_policy = \get_post_meta( $embed_post->ID, 'privacy_policy_url', true );
}
else {
echo $provider->get_description() . \PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$privacy_policy = $provider->get_privacy_policy_url();
}
if ( $privacy_policy ) {
?>
tag to the privacy policy, 3: closing */
\printf( \wp_kses( \__( 'Learn more in %1$s’s %2$sprivacy policy%3$s.', 'embed-privacy' ), $allowed_tags ), \esc_html( $provider->get_title() ), '', '' );
}
}
else {
/* translators: embed provider */
\printf( \esc_html__( 'Click here to display content from %s', 'embed-privacy' ), \esc_html( $provider->get_title() ) );
}
}
else {
\esc_html_e( 'Click here to display content from an external service.', 'embed-privacy' );
}
?>