PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 2.9.7
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v2.9.7
3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 2.6.1 All 56 releases
← All changes | includes/classes/class-load-fonts.php +25 -15 2.3.02.9.7 View file →
@@ -16,10 +16,10 @@
16 16 * Constructor
17 17 * return void
18 18 */
19 19 public function __construct() {
20 - add_action( 'wp_enqueue_scripts', [ $this, 'fonts_loader' ] );
21 - add_action( 'admin_enqueue_scripts', [ $this, 'fonts_loader' ] );
20 + add_action( 'wp_enqueue_scripts', [ $this, 'fonts_loader' ], 10);
21 + add_action( 'admin_enqueue_scripts', [ $this, 'fonts_loader' ], 10 );
22 22 add_action('gutsliders_render_block', [ $this, 'font_generator' ]);
23 23 }
24 24
25 25 /**
@@ -34,8 +34,10 @@
34 34 if ( ! empty( $value ) && strpos( $key, 'gutsliders_' ) === 0 && strpos( $key, 'FontFamily' ) !== false ) {
35 35 self::$all_fonts[] = $value;
36 36 }
37 37 }
38 +
39 + $this->fonts_loader();
38 40 }
39 41 }
40 42
41 43 /**
@@ -67,22 +69,30 @@
67 69 $gfonts .= str_replace( ' ', '+', trim( $font ) ) . $gfonts_attr . '|';
68 70 }
69 71 }
70 72
71 - if ( ! empty( $gfonts ) ) {
73 + if (!empty($gfonts)) {
74 + $font_array = explode('|', $gfonts);
75 +
76 + foreach ($font_array as $font) {
77 + if (empty($font)) {
78 + continue;
79 + }
72 80
73 - $query_args = [ 'family' => $gfonts ];
74 -
75 - wp_register_style(
76 - 'gutsliders-fonts',
77 - add_query_arg( $query_args, '//fonts.googleapis.com/css' ),
78 - [],
79 - GUTSLIDER_VERSION,
80 - 'all'
81 - );
82 -
83 - wp_enqueue_style( 'gutsliders-fonts', false, [], GUTSLIDER_VERSION, 'all' );
84 - }
81 + $query_args = ['family' => $font];
82 + $font_handle = 'gutsliders-font-' . sanitize_title($font);
83 +
84 + wp_register_style(
85 + $font_handle,
86 + add_query_arg($query_args, '//fonts.googleapis.com/css'),
87 + [],
88 + GUTSLIDER_VERSION,
89 + 'all'
90 + );
91 +
92 + wp_enqueue_style($font_handle);
93 + }
94 + }
85 95
86 96 // Reset.
87 97 $gfonts = '';
88 98 }