diff --git a/CHANGELOG.md b/CHANGELOG.md index ac1d003..4793f44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.9.2 +* Improve the text for screen readers upon activating the embedded content +* Fixed compatibility with other widget plugins +* Fixed handling of videos in Divi + ## 1.9.1 * Fixed an error while uninstalling the plugin * Fixed aspect ratio of embeds embedded via Divi diff --git a/assets/js/divi.js b/assets/js/divi.js new file mode 100644 index 0000000..67160dd --- /dev/null +++ b/assets/js/divi.js @@ -0,0 +1,15 @@ +/** + * Divi functionality + * + * @author Epiphyt + * @license GPL2 + * @package epiphyt\Embed_Privacy + */ +document.addEventListener( 'DOMContentLoaded', () => { + // Generate responsive video wrapper for Embed Privacy container + if ( $.fn.fitVids ) { + $( '#main-content' ).fitVids( { + customSelector: ".embed-privacy-container" + } ); + } +} ); diff --git a/assets/style/scss/divi.scss b/assets/style/scss/divi.scss index 7ce3e99..e4e2921 100644 --- a/assets/style/scss/divi.scss +++ b/assets/style/scss/divi.scss @@ -1,5 +1,10 @@ .embed-privacy-container { line-height: 1.7em; + + .fluid-width-video-wrapper > & { + inset: 0; + position: absolute; + } } // prevent hiding container around Embed Privacy diff --git a/embed-privacy.php b/embed-privacy.php index be7b903..827b594 100644 --- a/embed-privacy.php +++ b/embed-privacy.php @@ -4,7 +4,7 @@ /* Plugin Name: Embed Privacy Description: Embed Privacy prevents from loading external embeds directly and lets the user control which one should be loaded. -Version: 1.9.1 +Version: 1.9.2 Author: Epiphyt Author URI: https://epiph.yt License: GPL2 @@ -29,7 +29,7 @@ // exit if ABSPATH is not defined \defined( 'ABSPATH' ) || exit; -\define( 'EMBED_PRIVACY_VERSION', '1.9.1' ); +\define( 'EMBED_PRIVACY_VERSION', '1.9.2' ); if ( ! \defined( 'EPI_EMBED_PRIVACY_BASE' ) ) { \define( 'EPI_EMBED_PRIVACY_BASE', \WP_PLUGIN_DIR . '/embed-privacy/' ); @@ -58,7 +58,7 @@ function disable_plugin() { /** * Autoload all necessary classes. * - * @param string $class The class name of the autoloaded class + * @param string $class The class name of the auto-loaded class */ \spl_autoload_register( function( $class ) { $path = \explode( '\\', $class ); diff --git a/inc/class-embed-privacy-widget-output-filter.php b/inc/class-embed-privacy-widget-output-filter.php index 3d3be02..a918099 100644 --- a/inc/class-embed-privacy-widget-output-filter.php +++ b/inc/class-embed-privacy-widget-output-filter.php @@ -69,8 +69,7 @@ public static function get_instance() { * Initialize the functionality by registering actions and filters. */ private function __construct() { - // priority of 9 to run before the Widget Logic plugin. - \add_filter( 'dynamic_sidebar_params', [ $this, 'filter_dynamic_sidebar_params' ], 9 ); + \add_filter( 'dynamic_sidebar_params', [ $this, 'filter_dynamic_sidebar_params' ], \PHP_INT_MAX ); } /** diff --git a/inc/class-embed-privacy.php b/inc/class-embed-privacy.php index b431715..0505c60 100644 --- a/inc/class-embed-privacy.php +++ b/inc/class-embed-privacy.php @@ -977,7 +977,7 @@ public function get_output_template( $embed_provider, $embed_provider_lowercase, $footer_content .= ''; $footer_content .= \sprintf( /* translators: content name or 'content' */ - \esc_html__( 'Open %s directly', 'embed-privacy' ), + \esc_html__( 'Open "%s" directly', 'embed-privacy' ), ! empty( $args['embed_title'] ) ? $args['embed_title'] : \__( 'content', 'embed-privacy' ) ); $footer_content .= ''; @@ -994,8 +994,16 @@ public function get_output_template( $embed_provider, $embed_provider_lowercase, } ?>
> - - + +
@@ -1177,7 +1185,7 @@ public function get_single_overlay( $content, $embed_provider, $embed_provider_l } /* translators: embed title */ - $args['embed_title'] = $element->hasAttribute( 'title' ) ? \sprintf( \__( '"%s"', 'embed-privacy' ), $element->getAttribute( 'title' ) ) : ''; + $args['embed_title'] = $element->hasAttribute( 'title' ) ? $element->getAttribute( 'title' ) : ''; $args['embed_url'] = $element->getAttribute( $args['element_attribute'] ); $args['height'] = $element->hasAttribute( 'height' ) ? $element->getAttribute( 'height' ) : 0; $args['width'] = $element->hasAttribute( 'width' ) ? $element->getAttribute( 'width' ) : 0; @@ -1592,6 +1600,7 @@ public function print_assets() { } if ( $this->is_theme( 'Divi' ) ) { + \wp_enqueue_script( 'embed-privacy-divi' ); \wp_enqueue_style( 'embed-privacy-divi' ); } @@ -1696,6 +1705,11 @@ public function register_assets() { \wp_register_style( 'embed-privacy-astra', $css_file_url, [], $file_version ); + $js_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/js/divi' . $suffix . '.js'; + $file_version = $is_debug ? \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/js/divi' . $suffix . '.js' ) : \EMBED_PRIVACY_VERSION; + + \wp_register_script( 'embed-privacy-divi', $js_file_url, [], $file_version, [ 'strategy' => 'defer' ] ); + $css_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/style/divi' . $suffix . '.css'; $file_version = $is_debug ? \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/style/divi' . $suffix . '.css' ) : \EMBED_PRIVACY_VERSION; @@ -1932,7 +1946,7 @@ public function replace_embeds_oembed( $output, $url, $args ) { $embed_provider = ''; $embed_provider_lowercase = ''; - $embed_providers = $this->get_embeds( 'oembed' ); + $embed_providers = $this->get_embeds(); // get embed provider name foreach ( $embed_providers as $provider ) { @@ -1976,7 +1990,7 @@ public function replace_embeds_oembed( $output, $url, $args ) { $embed_title = $this->get_oembed_title( $output ); /* translators: embed title */ - $args['embed_title'] = ! empty( $embed_title ) ? \sprintf( \__( '"%s"', 'embed-privacy' ), $embed_title ) : ''; + $args['embed_title'] = ! empty( $embed_title ) ? $embed_title : ''; $args['embed_url'] = $url; $args['strip_newlines'] = true; diff --git a/readme.txt b/readme.txt index ee7d5b5..2bf1411 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: epiphyt, kittmedia, krafit Tags: oembed, privacy, gutenberg Requires at least: 5.9 -Stable tag: 1.9.1 +Stable tag: 1.9.2 Tested up to: 6.5 Requires PHP: 5.6 License: GPL2 @@ -173,6 +173,11 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro == Changelog == += 1.9.2 = +* Improve the text for screen readers upon activating the embedded content +* Fixed compatibility with other widget plugins +* Fixed handling of videos in Divi + = 1.9.1 = * Fixed an error while uninstalling the plugin * Fixed aspect ratio of embeds embedded via Divi diff --git a/webpack.config.js b/webpack.config.js index 663ef2a..ff6f6ea 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,7 @@ const mode = isProduction ? 'production' : 'development'; const jsFiles = { 'admin/image-upload': path.resolve( process.cwd(), 'assets/js/admin', 'image-upload.js' ), + 'divi': path.resolve( process.cwd(), 'assets/js', 'divi.js' ), 'elementor-video': path.resolve( process.cwd(), 'assets/js', 'elementor-video.js' ), 'embed-privacy': path.resolve( process.cwd(), 'assets/js', 'embed-privacy.js' ), };