From eb9cdcb7122a1764c474b8b13a24a9c012a0ac2c Mon Sep 17 00:00:00 2001 From: Patrick Joyce Date: Fri, 30 Jan 2026 11:48:54 -0500 Subject: [PATCH] Scope --- fetch-meditation.php | 18 +++++++++++------- readme.txt | 6 +++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fetch-meditation.php b/fetch-meditation.php index e6e999a..98e5674 100644 --- a/fetch-meditation.php +++ b/fetch-meditation.php @@ -6,7 +6,7 @@ * Install: Drop this directory in the "wp-content/plugins/" directory and activate it. You need to specify "[fetch_meditation]", "[jft]", or "[spad]" in the code section of a page or a post. * Contributors: pjaudiomv, bmltenabled * Author: bmltenabled - * Version: 1.4.9 + * Version: 1.5.0 * Requires PHP: 8.1 * Requires at least: 6.2 * License: GPL v2 or later @@ -492,11 +492,11 @@ private static function render_both_shortcode( string|array $attrs = [] ): strin $content .= " \n"; $content .= "
\n"; $content .= "
\n"; - $content .= ' \n"; + $content .= ' \n"; $content .= $jft_content; $content .= "
\n"; $content .= " \n"; $content .= "
\n"; @@ -529,7 +529,7 @@ private static function render_accordion( int $instance_counter, string $jft_con $content .= " \n"; $content .= " \n"; $content .= "
\n"; - $content .= ' \n"; + $content .= ' \n"; $content .= $jft_content; $content .= "
\n"; $content .= " \n"; @@ -541,7 +541,7 @@ private static function render_accordion( int $instance_counter, string $jft_con $content .= " \n"; $content .= " \n"; $content .= " \n"; $content .= " \n"; @@ -689,7 +689,7 @@ private static function enqueue_tabs_assets(): void { * @param string $theme The theme name * @return string CSS content */ - private static function get_inline_theme_css( string $theme ): string { + private static function get_inline_theme_css( string $theme, string $scope_selector = '' ): string { $css_file = match ( strtolower( $theme ) ) { 'jft-style' => 'fetch-meditation-jft.css', 'spad-style' => 'fetch-meditation-spad.css', @@ -697,7 +697,11 @@ private static function get_inline_theme_css( string $theme ): string { }; $css_path = plugin_dir_path( __FILE__ ) . 'css/' . $css_file; if ( file_exists( $css_path ) ) { - return wp_strip_all_tags( file_get_contents( $css_path ) ); + $css = wp_strip_all_tags( file_get_contents( $css_path ) ); + if ( $scope_selector ) { + $css = preg_replace( '/^(\s*)#meditation-/m', '$1' . $scope_selector . ' #meditation-', $css ); + } + return $css; } return ''; } diff --git a/readme.txt b/readme.txt index df34627..a10b0b4 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Plugin URI: https://wordpress.org/plugins/fetch-meditation/ Tags: na, fetch meditation, jft, spad, bmlt Requires PHP: 8.1 Tested up to: 6.9 -Stable tag: 1.4.9 +Stable tag: 1.5.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -57,6 +57,10 @@ MORE INFORMATION == Changelog == += 1.5.0 = + +* Scope JFT and SPAD inline CSS to their respective panels so styles don't conflict in tabbed/accordion mode. + = 1.4.9 = * Fix Italian encoding issues.