Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions fetch-meditation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -492,11 +492,11 @@ private static function render_both_shortcode( string|array $attrs = [] ): strin
$content .= " </ul>\n";
$content .= " <div class=\"meditation-tab-content\">\n";
$content .= " <div class=\"meditation-tab-panel\" role=\"tabpanel\" id=\"meditation-panel-jft-{$instance_counter}\" data-tab-id=\"jft\" aria-labelledby=\"tab-jft\">\n";
$content .= ' <style>' . static::get_inline_theme_css( $jft_theme ) . "</style>\n";
$content .= ' <style>' . static::get_inline_theme_css( $jft_theme, '#meditation-panel-jft-' . $instance_counter ) . "</style>\n";
$content .= $jft_content;
$content .= " </div>\n";
$content .= " <div class=\"meditation-tab-panel\" role=\"tabpanel\" id=\"meditation-panel-spad-{$instance_counter}\" data-tab-id=\"spad\" aria-labelledby=\"tab-spad\" hidden>\n";
$content .= ' <style>' . static::get_inline_theme_css( $spad_theme ) . "</style>\n";
$content .= ' <style>' . static::get_inline_theme_css( $spad_theme, '#meditation-panel-spad-' . $instance_counter ) . "</style>\n";
$content .= $spad_content;
$content .= " </div>\n";
$content .= " </div>\n";
Expand Down Expand Up @@ -529,7 +529,7 @@ private static function render_accordion( int $instance_counter, string $jft_con
$content .= " <span class=\"meditation-accordion-icon\"></span>\n";
$content .= " </button>\n";
$content .= " <div class=\"meditation-accordion-panel active\" id=\"meditation-accordion-jft-{$instance_counter}\">\n";
$content .= ' <style>' . static::get_inline_theme_css( $jft_theme ) . "</style>\n";
$content .= ' <style>' . static::get_inline_theme_css( $jft_theme, '#meditation-accordion-jft-' . $instance_counter ) . "</style>\n";
$content .= $jft_content;
$content .= " </div>\n";
$content .= " </div>\n";
Expand All @@ -541,7 +541,7 @@ private static function render_accordion( int $instance_counter, string $jft_con
$content .= " <span class=\"meditation-accordion-icon\"></span>\n";
$content .= " </button>\n";
$content .= " <div class=\"meditation-accordion-panel\" id=\"meditation-accordion-spad-{$instance_counter}\" hidden>\n";
$content .= ' <style>' . static::get_inline_theme_css( $spad_theme ) . "</style>\n";
$content .= ' <style>' . static::get_inline_theme_css( $spad_theme, '#meditation-accordion-spad-' . $instance_counter ) . "</style>\n";
$content .= $spad_content;
$content .= " </div>\n";
$content .= " </div>\n";
Expand Down Expand Up @@ -689,15 +689,19 @@ 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',
default => 'fetch-meditation.css',
};
$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 '';
}
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down