From aef0d3be591ad27493281956fa7315d2b05fcd99 Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 06:00:21 +0100 Subject: [PATCH 01/24] Closes #7065: Add a filter to change the output --- .../Media/Fonts/Frontend/Controller.php | 54 +++++++++++++++++-- inc/Engine/Media/Fonts/ServiceProvider.php | 4 ++ 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index 82bdc47644..adf4bfed9a 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -6,6 +6,7 @@ use WP_Rocket\Engine\Media\Fonts\Context\Context; use WP_Rocket\Engine\Optimization\RegexTrait; use WP_Rocket\Logger\Logger; +use WP_Filesystem_Direct; class Controller { use RegexTrait; @@ -24,14 +25,27 @@ class Controller { */ private $base_url; + + /** + * WordPress filesystem. + * + * @var WP_Filesystem_Direct + */ + private $filesystem; + + private $base_path; + /** * Constructor. * - * @param Context $context Context instance. + * @param Context $context Context instance. + * @param WP_Filesystem_Direct $filesystem WordPress filesystem. */ - public function __construct( Context $context ) { - $this->context = $context; - $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/' . get_current_blog_id() . '/'; + public function __construct( Context $context, WP_Filesystem_Direct $filesystem ) { + $this->context = $context; + $this->base_path = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_PATH', '' ) . 'fonts/' . get_current_blog_id() . '/'; + $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/' . get_current_blog_id() . '/'; + $this->filesystem = $filesystem; } /** @@ -104,6 +118,15 @@ protected function get_optimized_markup( string $hash, string $original_url ): s $gf_parameters = wp_parse_url( $original_url, PHP_URL_QUERY ); + $internal_styling = wpm_apply_filters_typed( 'boolean', 'rocket_internal_fonts_styling', false ); + if ( $internal_styling ) { + $raw_path = $this->base_path . $path . '.css'; + $internal_style = $this->set_font_internal_style( $gf_parameters, $raw_path ); + if ( $internal_style ) { + return $internal_style; + } + } + return sprintf( '', // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet $url, @@ -125,4 +148,27 @@ public function disable_google_fonts_preload( $disable ): bool { return true; } + + /** + * Sets the font internal style. + * + * @param string $css_path CSS file path. + * + * @return string|bool + */ + private function set_font_internal_style( string $gf_parameters, string $css_path ) { + if ( ! $css_path ) { + return false; + } + + if ( ! $this->filesystem->exists( $css_path ) ) { + return false; + } + + return sprintf( + '', + $gf_parameters, + $this->filesystem->get_contents( $css_path ) + ); + } } diff --git a/inc/Engine/Media/Fonts/ServiceProvider.php b/inc/Engine/Media/Fonts/ServiceProvider.php index 746ddf61f9..b979fca134 100644 --- a/inc/Engine/Media/Fonts/ServiceProvider.php +++ b/inc/Engine/Media/Fonts/ServiceProvider.php @@ -9,6 +9,7 @@ use WP_Rocket\Engine\Media\Fonts\Context\Context; use WP_Rocket\Engine\Media\Fonts\Frontend\Controller as FrontendController; use WP_Rocket\Engine\Media\Fonts\Frontend\Subscriber as FrontendSubscriber; +use WP_Filesystem_Direct; class ServiceProvider extends AbstractServiceProvider { /** @@ -46,6 +47,8 @@ public function provides( string $id ): bool { */ public function register(): void { $this->getContainer()->add( 'media_fonts_settings', Settings::class ); + $this->getContainer()->add( 'wp_direct_filesystem', WP_Filesystem_Direct::class ) + ->addArgument( [] ); $this->getContainer()->addShared( 'media_fonts_admin_subscriber', AdminSubscriber::class ) ->addArgument( 'media_fonts_settings' ); @@ -55,6 +58,7 @@ public function register(): void { ->addArguments( [ $this->getContainer()->get( 'media_fonts_context' ), + $this->getContainer()->get( 'wp_direct_filesystem' ), ] ); $this->getContainer()->add( 'media_fonts_frontend_subscriber', FrontendSubscriber::class ) From 8578b5fdfaee567a2713a38f098c6b39342cd4d8 Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 06:33:05 +0100 Subject: [PATCH 02/24] Fix tests --- inc/Engine/Media/Fonts/Frontend/Controller.php | 7 ++++--- .../Media/Fonts/Frontend/Controller/rewriteFonts.php | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index adf4bfed9a..31be93e18c 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -39,13 +39,14 @@ class Controller { * Constructor. * * @param Context $context Context instance. - * @param WP_Filesystem_Direct $filesystem WordPress filesystem. + * @param WP_Filesystem_Direct|null $filesystem WordPress filesystem. */ - public function __construct( Context $context, WP_Filesystem_Direct $filesystem ) { + public function __construct(Context $context, ?WP_Filesystem_Direct $filesystem ) { $this->context = $context; $this->base_path = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_PATH', '' ) . 'fonts/' . get_current_blog_id() . '/'; $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/' . get_current_blog_id() . '/'; - $this->filesystem = $filesystem; + $this->filesystem = ! empty( $filesystem ) ? $filesystem : rocket_direct_filesystem(); + } /** diff --git a/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php b/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php index d2bf5940c9..10525629c0 100644 --- a/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php +++ b/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php @@ -8,6 +8,7 @@ use WP_Rocket\Engine\Media\Fonts\Frontend\Controller; use WP_Rocket\Engine\Media\Fonts\Context\Context; use WP_Rocket\Tests\Unit\FilesystemTestCase; +use WP_Filesystem_Direct; /** * @group HostFontsLocally @@ -17,13 +18,16 @@ class TestRewriteFonts extends FilesystemTestCase { private $context; private $controller; + protected $filesystem; + public function set_up() { parent::set_up(); Functions\when( 'get_current_blog_id' )->justReturn( 1 ); $this->context = Mockery::mock( Context::class ); - $this->controller = new Controller( $this->context ); + $this->filesystem = Mockery::mock( WP_Filesystem_Direct::class ); + $this->controller = new Controller( $this->context, $this->filesystem ); $this->stubWpParseUrl(); } From 44f7d033eb9af24c5e56f17db4e00264d634c8bc Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 10:07:09 +0100 Subject: [PATCH 03/24] Fix linters --- inc/Engine/Media/Fonts/Frontend/Controller.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index 31be93e18c..a3c3a1e440 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -38,15 +38,14 @@ class Controller { /** * Constructor. * - * @param Context $context Context instance. + * @param Context $context Context instance. * @param WP_Filesystem_Direct|null $filesystem WordPress filesystem. */ - public function __construct(Context $context, ?WP_Filesystem_Direct $filesystem ) { + public function __construct( Context $context, ?WP_Filesystem_Direct $filesystem ) { $this->context = $context; $this->base_path = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_PATH', '' ) . 'fonts/' . get_current_blog_id() . '/'; $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/' . get_current_blog_id() . '/'; - $this->filesystem = ! empty( $filesystem ) ? $filesystem : rocket_direct_filesystem(); - + $this->filesystem = ! empty( $filesystem ) ? $filesystem : rocket_direct_filesystem(); } /** From 64ee2bc5b128ee320e9ac02432b115926e8fb654 Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 10:08:34 +0100 Subject: [PATCH 04/24] Fix Stan --- .../Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php b/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php index 10525629c0..bc4fcf9657 100644 --- a/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php +++ b/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php @@ -18,7 +18,7 @@ class TestRewriteFonts extends FilesystemTestCase { private $context; private $controller; - protected $filesystem; + protected $file_system; public function set_up() { parent::set_up(); @@ -26,8 +26,8 @@ public function set_up() { Functions\when( 'get_current_blog_id' )->justReturn( 1 ); $this->context = Mockery::mock( Context::class ); - $this->filesystem = Mockery::mock( WP_Filesystem_Direct::class ); - $this->controller = new Controller( $this->context, $this->filesystem ); + $this->file_system = Mockery::mock( WP_Filesystem_Direct::class ); + $this->controller = new Controller( $this->context, $this->file_system ); $this->stubWpParseUrl(); } From dc047e99d7668bb55ea51727bf478b6bbe58b74f Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 13:02:24 +0100 Subject: [PATCH 05/24] Fix Linter --- inc/Engine/Media/Fonts/Frontend/Controller.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index a3c3a1e440..405b07b84b 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -33,6 +33,11 @@ class Controller { */ private $filesystem; + /** + * Base path. + * + * @var string + */ private $base_path; /** @@ -152,6 +157,7 @@ public function disable_google_fonts_preload( $disable ): bool { /** * Sets the font internal style. * + * @param string $gf_parameters Google Fonts parameters. * @param string $css_path CSS file path. * * @return string|bool From b9a03b985edde8e63d01bab5ceaff0a81d60046b Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 14:09:06 +0100 Subject: [PATCH 06/24] Add Integration Tests --- .../Frontend/Subscriber/HTML/expected_v1.php | 33 ++++++++++ .../Subscriber/HTML/expected_v1_style_tag.php | 33 ++++++++++ .../Subscriber/HTML/expected_v1_v2.php | 41 ++++++++++++ .../Frontend/Subscriber/HTML/expected_v2.php | 33 ++++++++++ .../Frontend/Subscriber/HTML/input_v1.php | 33 ++++++++++ .../Frontend/Subscriber/HTML/input_v1_v2.php | 41 ++++++++++++ .../Frontend/Subscriber/HTML/input_v2.php | 33 ++++++++++ .../Frontend/Subscriber/rewriteFonts.php | 66 +++++++++++++++++++ .../Frontend/Subscriber/rewriteFonts.php | 61 +++++++++++++++++ 9 files changed, 374 insertions(+) create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_style_tag.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_v2.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v2.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1_v2.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v2.php create mode 100644 tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php create mode 100644 tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php new file mode 100644 index 0000000000..2662753c5a --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php @@ -0,0 +1,33 @@ + + + + + + + + Google Font V1 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_style_tag.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_style_tag.php new file mode 100644 index 0000000000..bcbcee1f97 --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_style_tag.php @@ -0,0 +1,33 @@ + + + + + + + + Google Font V1 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_v2.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_v2.php new file mode 100644 index 0000000000..d88d7dfe75 --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1_v2.php @@ -0,0 +1,41 @@ + + + + + + + + Google Font V1 and V2 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+

This is a subtitle

+

Enjoy your stay

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v2.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v2.php new file mode 100644 index 0000000000..8dcf11ad68 --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v2.php @@ -0,0 +1,33 @@ + + + + + + + + Google Font V2 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1.php new file mode 100644 index 0000000000..e49961654e --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1.php @@ -0,0 +1,33 @@ + + + + + + + + Google Font V1 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1_v2.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1_v2.php new file mode 100644 index 0000000000..34be74bed6 --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v1_v2.php @@ -0,0 +1,41 @@ + + + + + + + + Google Font V1 and V2 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+

This is a subtitle

+

Enjoy your stay

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v2.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v2.php new file mode 100644 index 0000000000..2abf18db1b --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/input_v2.php @@ -0,0 +1,33 @@ + + + + + + + + Google Font V2 Template + + + + + +
+
+
+

Hello World

+

Welcome to the world

+
+
+
+ + diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php new file mode 100644 index 0000000000..3c11b263aa --- /dev/null +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php @@ -0,0 +1,66 @@ + [ + 'testShouldReturnOriginalWhenNoGoogleFonts' => [ + 'config' => [ + 'html' => '', + 'host_fonts_locally' => true, + 'internal_fonts_styling' => false, + 'css_files' => [] + ], + + 'expected' => [ + 'html' => '' + ], + ], + 'testShouldRewriteV1Font' => [ + 'config' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/input_v1.php' ), + 'host_fonts_locally' => true, + 'internal_fonts_styling' => false, + 'css_files' => [] + ], + 'expected' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/expected_v1.php' ), + ], + ], + 'testShouldRewriteV2Font' => [ + 'config' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/input_v2.php' ), + 'host_fonts_locally' => true, + 'internal_fonts_styling' => false, + 'css_files' => [] + ], + 'expected' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/expected_v2.php' ), + ], + ], + 'testShouldRewriteV1AndV2Fonts' => [ + 'config' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/input_v1_v2.php' ), + 'host_fonts_locally' => true, + 'internal_fonts_styling' => false, + 'css_files' => [] + ], + 'expected' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/expected_v1_v2.php' ), + ], + ], + 'testShouldRewriteFontV1PathInStyleTag' => [ + 'config' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/input_v1.php' ), + 'host_fonts_locally' => true, + 'css_files' => [ + 'wp-content/cache/fonts/1/e/b/c/173c0fc97eef86a6e51ada56c5a9a.css' => 'body { font-family: "Roboto"; }', + 'wp-content/cache/fonts/1/5/9/5/cb6ccb56826a802ed411cef875f0e.css' => 'body { font-family: "Open-San"; }', + ], + 'internal_fonts_styling' => true, + ], + 'expected' => [ + 'html' => file_get_contents( __DIR__ . '/HTML/expected_v1_style_tag.php' ), + ], + ] + ], + +]; diff --git a/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php b/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php new file mode 100644 index 0000000000..5fb1eee1ab --- /dev/null +++ b/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php @@ -0,0 +1,61 @@ +unregisterAllCallbacksExcept('rocket_buffer', 'rewrite_fonts', 18); + add_filter( 'pre_get_rocket_option_host_fonts_locally', [ $this, 'host_fonts_locally' ] ); + add_filter( 'rocket_internal_fonts_styling', [ $this, 'internal_fonts_styling' ] ); + + + } + + public function tear_down() { + remove_filter('pre_get_rocket_option_host_fonts_locally', [$this, 'host_fonts_locally']); + remove_filter('rocket_internal_fonts_styling', [$this, 'internal_fonts_styling']); + $this->restoreWpHook('rocket_buffer'); + parent::tear_down(); + } + + /** + * @dataProvider providerTestData + */ + public function testShouldReturnAsExpected( $config, $expected ) { + $this->config = $config; + + foreach ($config['css_files'] as $path => $file) { + rocket_mkdir_p(dirname($path), $this->filesystem); + $this->filesystem->put_contents($path, $file); + } + + $this->assertSame( + $expected['html'], + apply_filters('rocket_buffer', $config['html']) + ); + } + + public function host_fonts_locally() { + return $this->config['host_fonts_locally']; + } + + public function internal_fonts_styling() { + return $this->config['internal_fonts_styling']; + } +} From d6b0833060ff72e7c62b041eb361544b88f7ef0e Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 15:44:39 +0100 Subject: [PATCH 07/24] Fix feedback --- .../Media/Fonts/Frontend/Controller.php | 19 +++++++++++++------ .../Frontend/Subscriber/rewriteFonts.php | 10 +++++----- .../Frontend/Subscriber/rewriteFonts.php | 8 ++++---- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index 405b07b84b..a3c9cbb605 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -123,12 +123,19 @@ protected function get_optimized_markup( string $hash, string $original_url ): s $gf_parameters = wp_parse_url( $original_url, PHP_URL_QUERY ); - $internal_styling = wpm_apply_filters_typed( 'boolean', 'rocket_internal_fonts_styling', false ); - if ( $internal_styling ) { - $raw_path = $this->base_path . $path . '.css'; - $internal_style = $this->set_font_internal_style( $gf_parameters, $raw_path ); - if ( $internal_style ) { - return $internal_style; + /** + * Filters to enable the inline css output. + * + * @since 3.18 + * + * @param bool $enable Tells if we are enabling or not the inline css output. + */ + $inline_fonts_css = wpm_apply_filters_typed( 'boolean', 'rocket_host_fonts_locally_inline_css', false ); + if ( $inline_fonts_css ) { + $raw_path = $this->base_path . $path . '.css'; + $inline_css = $this->set_font_internal_style( $gf_parameters, $raw_path ); + if ( $inline_css ) { + return $inline_css; } } diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php index 3c11b263aa..a71174d9db 100644 --- a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php @@ -6,7 +6,7 @@ 'config' => [ 'html' => '', 'host_fonts_locally' => true, - 'internal_fonts_styling' => false, + 'locally_inline_css' => false, 'css_files' => [] ], @@ -18,7 +18,7 @@ 'config' => [ 'html' => file_get_contents( __DIR__ . '/HTML/input_v1.php' ), 'host_fonts_locally' => true, - 'internal_fonts_styling' => false, + 'locally_inline_css' => false, 'css_files' => [] ], 'expected' => [ @@ -29,7 +29,7 @@ 'config' => [ 'html' => file_get_contents( __DIR__ . '/HTML/input_v2.php' ), 'host_fonts_locally' => true, - 'internal_fonts_styling' => false, + 'locally_inline_css' => false, 'css_files' => [] ], 'expected' => [ @@ -40,7 +40,7 @@ 'config' => [ 'html' => file_get_contents( __DIR__ . '/HTML/input_v1_v2.php' ), 'host_fonts_locally' => true, - 'internal_fonts_styling' => false, + 'locally_inline_css' => false, 'css_files' => [] ], 'expected' => [ @@ -55,7 +55,7 @@ 'wp-content/cache/fonts/1/e/b/c/173c0fc97eef86a6e51ada56c5a9a.css' => 'body { font-family: "Roboto"; }', 'wp-content/cache/fonts/1/5/9/5/cb6ccb56826a802ed411cef875f0e.css' => 'body { font-family: "Open-San"; }', ], - 'internal_fonts_styling' => true, + 'locally_inline_css' => true, ], 'expected' => [ 'html' => file_get_contents( __DIR__ . '/HTML/expected_v1_style_tag.php' ), diff --git a/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php b/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php index 5fb1eee1ab..991b2464fe 100644 --- a/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php +++ b/tests/Integration/inc/Engine/Media/Fronts/Frontend/Subscriber/rewriteFonts.php @@ -22,14 +22,14 @@ public function set_up() $this->unregisterAllCallbacksExcept('rocket_buffer', 'rewrite_fonts', 18); add_filter( 'pre_get_rocket_option_host_fonts_locally', [ $this, 'host_fonts_locally' ] ); - add_filter( 'rocket_internal_fonts_styling', [ $this, 'internal_fonts_styling' ] ); + add_filter( 'rocket_host_fonts_locally_inline_css', [ $this, 'locally_inline_css' ] ); } public function tear_down() { remove_filter('pre_get_rocket_option_host_fonts_locally', [$this, 'host_fonts_locally']); - remove_filter('rocket_internal_fonts_styling', [$this, 'internal_fonts_styling']); + remove_filter('rocket_host_fonts_locally_inline_css', [$this, 'locally_inline_css']); $this->restoreWpHook('rocket_buffer'); parent::tear_down(); } @@ -55,7 +55,7 @@ public function host_fonts_locally() { return $this->config['host_fonts_locally']; } - public function internal_fonts_styling() { - return $this->config['internal_fonts_styling']; + public function locally_inline_css() { + return $this->config['locally_inline_css']; } } From 2be21c3f2272d0d2b15536a9899d99ee90998084 Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 15:45:40 +0100 Subject: [PATCH 08/24] Rename function --- inc/Engine/Media/Fonts/Frontend/Controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index a3c9cbb605..34e9a4944a 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -133,7 +133,7 @@ protected function get_optimized_markup( string $hash, string $original_url ): s $inline_fonts_css = wpm_apply_filters_typed( 'boolean', 'rocket_host_fonts_locally_inline_css', false ); if ( $inline_fonts_css ) { $raw_path = $this->base_path . $path . '.css'; - $inline_css = $this->set_font_internal_style( $gf_parameters, $raw_path ); + $inline_css = $this->get_font_inline_css( $gf_parameters, $raw_path ); if ( $inline_css ) { return $inline_css; } @@ -169,7 +169,7 @@ public function disable_google_fonts_preload( $disable ): bool { * * @return string|bool */ - private function set_font_internal_style( string $gf_parameters, string $css_path ) { + private function get_font_inline_css( string $gf_parameters, string $css_path ) { if ( ! $css_path ) { return false; } From 7351ff4e4fe31581bde707c9a3c959fdcb11c87e Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Thu, 14 Nov 2024 15:49:32 +0100 Subject: [PATCH 09/24] Change doc --- inc/Engine/Media/Fonts/Frontend/Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index 34e9a4944a..1cf607ae65 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -162,7 +162,7 @@ public function disable_google_fonts_preload( $disable ): bool { } /** - * Sets the font internal style. + * Gets the font inline css. * * @param string $gf_parameters Google Fonts parameters. * @param string $css_path CSS file path. From 764aa1da4bf94ac0e0fb04c28880dd6ceebb806f Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Fri, 15 Nov 2024 05:51:24 +0100 Subject: [PATCH 10/24] Add new filesystem structure --- inc/Engine/Common/AbstractFileSystem.php | 46 +++++++++++++++++++ .../Media/Fonts/Controller/Filesystem.php | 38 +++++++++++++++ .../Media/Fonts/Frontend/Controller.php | 11 +++-- inc/Engine/Media/Fonts/ServiceProvider.php | 11 ++++- 4 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 inc/Engine/Common/AbstractFileSystem.php create mode 100644 inc/Engine/Media/Fonts/Controller/Filesystem.php diff --git a/inc/Engine/Common/AbstractFileSystem.php b/inc/Engine/Common/AbstractFileSystem.php new file mode 100644 index 0000000000..bf871bfa20 --- /dev/null +++ b/inc/Engine/Common/AbstractFileSystem.php @@ -0,0 +1,46 @@ +filesystem = $filesystem ?? rocket_direct_filesystem(); + } + + /** + * Checks if a given path exists in the filesystem. + * + * @param string $path The path to check. + * @return bool True if the path exists, false otherwise. + */ + public function exists( string $path ): bool { + return $this->filesystem->exists( $path ); + } + + /** + * Retrieves the contents of a file at the given path. + * + * @param string $path The path to the file. + * @return string|false The file contents on success, false on failure. + */ + public function get_contents( string $path ) { + return $this->filesystem->get_contents( $path ); + } +} diff --git a/inc/Engine/Media/Fonts/Controller/Filesystem.php b/inc/Engine/Media/Fonts/Controller/Filesystem.php new file mode 100644 index 0000000000..ba0df95a52 --- /dev/null +++ b/inc/Engine/Media/Fonts/Controller/Filesystem.php @@ -0,0 +1,38 @@ +path = $base_path . get_current_blog_id() . '/'; + } +} diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index 1cf607ae65..86de5f83a6 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -4,6 +4,7 @@ namespace WP_Rocket\Engine\Media\Fonts\Frontend; use WP_Rocket\Engine\Media\Fonts\Context\Context; +use WP_Rocket\Engine\Media\Fonts\Controller\Filesystem; use WP_Rocket\Engine\Optimization\RegexTrait; use WP_Rocket\Logger\Logger; use WP_Filesystem_Direct; @@ -29,7 +30,7 @@ class Controller { /** * WordPress filesystem. * - * @var WP_Filesystem_Direct + * @var WP_Rocket\Engine\Media\Fonts\Controller\Filesystem; */ private $filesystem; @@ -43,10 +44,10 @@ class Controller { /** * Constructor. * - * @param Context $context Context instance. - * @param WP_Filesystem_Direct|null $filesystem WordPress filesystem. + * @param Context $context Context instance. + * @param WP_Rocket\Engine\Media\Fonts\Controller\Filesystem|null $filesystem WordPress filesystem. */ - public function __construct( Context $context, ?WP_Filesystem_Direct $filesystem ) { + public function __construct( Context $context, ?Filesystem $filesystem ) { $this->context = $context; $this->base_path = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_PATH', '' ) . 'fonts/' . get_current_blog_id() . '/'; $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/' . get_current_blog_id() . '/'; @@ -130,7 +131,7 @@ protected function get_optimized_markup( string $hash, string $original_url ): s * * @param bool $enable Tells if we are enabling or not the inline css output. */ - $inline_fonts_css = wpm_apply_filters_typed( 'boolean', 'rocket_host_fonts_locally_inline_css', false ); + $inline_fonts_css = wpm_apply_filters_typed( 'boolean', 'rocket_host_fonts_locally_inline_css', true ); if ( $inline_fonts_css ) { $raw_path = $this->base_path . $path . '.css'; $inline_css = $this->get_font_inline_css( $gf_parameters, $raw_path ); diff --git a/inc/Engine/Media/Fonts/ServiceProvider.php b/inc/Engine/Media/Fonts/ServiceProvider.php index b979fca134..1b2b095e86 100644 --- a/inc/Engine/Media/Fonts/ServiceProvider.php +++ b/inc/Engine/Media/Fonts/ServiceProvider.php @@ -10,6 +10,7 @@ use WP_Rocket\Engine\Media\Fonts\Frontend\Controller as FrontendController; use WP_Rocket\Engine\Media\Fonts\Frontend\Subscriber as FrontendSubscriber; use WP_Filesystem_Direct; +use WP_Rocket\Engine\Media\Fonts\Controller\Filesystem; class ServiceProvider extends AbstractServiceProvider { /** @@ -27,6 +28,7 @@ class ServiceProvider extends AbstractServiceProvider { 'media_fonts_context', 'media_fonts_frontend_controller', 'media_fonts_frontend_subscriber', + 'media_fonts_filesystem', ]; /** @@ -49,6 +51,13 @@ public function register(): void { $this->getContainer()->add( 'media_fonts_settings', Settings::class ); $this->getContainer()->add( 'wp_direct_filesystem', WP_Filesystem_Direct::class ) ->addArgument( [] ); + $this->getContainer()->add( 'media_fonts_filesystem', Filesystem::class ) + ->addArguments( + [ + wpm_apply_filters_typed( 'string', 'rocket_host_font_cache_root', 'fonts/' . get_current_blog_id() ), + 'wp_direct_filesystem', + ] + ); $this->getContainer()->addShared( 'media_fonts_admin_subscriber', AdminSubscriber::class ) ->addArgument( 'media_fonts_settings' ); @@ -58,7 +67,7 @@ public function register(): void { ->addArguments( [ $this->getContainer()->get( 'media_fonts_context' ), - $this->getContainer()->get( 'wp_direct_filesystem' ), + $this->getContainer()->get( 'media_fonts_filesystem' ), ] ); $this->getContainer()->add( 'media_fonts_frontend_subscriber', FrontendSubscriber::class ) From 6051fadbdec00dbd714da5fcccc99f505a29683d Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Fri, 15 Nov 2024 09:48:15 +0100 Subject: [PATCH 11/24] Fix Unit Test --- inc/Engine/Media/Fonts/Frontend/Controller.php | 2 +- .../Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index 86de5f83a6..b1491d602a 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -131,7 +131,7 @@ protected function get_optimized_markup( string $hash, string $original_url ): s * * @param bool $enable Tells if we are enabling or not the inline css output. */ - $inline_fonts_css = wpm_apply_filters_typed( 'boolean', 'rocket_host_fonts_locally_inline_css', true ); + $inline_fonts_css = wpm_apply_filters_typed( 'boolean', 'rocket_host_fonts_locally_inline_css', false ); if ( $inline_fonts_css ) { $raw_path = $this->base_path . $path . '.css'; $inline_css = $this->get_font_inline_css( $gf_parameters, $raw_path ); diff --git a/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php b/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php index bc4fcf9657..d65ac59c4d 100644 --- a/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php +++ b/tests/Unit/inc/Engine/Media/Fonts/Frontend/Controller/rewriteFonts.php @@ -8,7 +8,7 @@ use WP_Rocket\Engine\Media\Fonts\Frontend\Controller; use WP_Rocket\Engine\Media\Fonts\Context\Context; use WP_Rocket\Tests\Unit\FilesystemTestCase; -use WP_Filesystem_Direct; +use WP_Rocket\Engine\Media\Fonts\Controller\Filesystem; /** * @group HostFontsLocally @@ -26,7 +26,7 @@ public function set_up() { Functions\when( 'get_current_blog_id' )->justReturn( 1 ); $this->context = Mockery::mock( Context::class ); - $this->file_system = Mockery::mock( WP_Filesystem_Direct::class ); + $this->file_system = Mockery::mock( Filesystem::class ); $this->controller = new Controller( $this->context, $this->file_system ); $this->stubWpParseUrl(); From 626c3598521342110adcec471370d02e210842c4 Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Fri, 15 Nov 2024 10:01:09 +0100 Subject: [PATCH 12/24] Fix stan --- inc/Engine/Media/Fonts/Controller/Filesystem.php | 8 -------- inc/Engine/Media/Fonts/Frontend/Controller.php | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/inc/Engine/Media/Fonts/Controller/Filesystem.php b/inc/Engine/Media/Fonts/Controller/Filesystem.php index ba0df95a52..06714b7fb4 100644 --- a/inc/Engine/Media/Fonts/Controller/Filesystem.php +++ b/inc/Engine/Media/Fonts/Controller/Filesystem.php @@ -5,7 +5,6 @@ namespace WP_Rocket\Engine\Media\Fonts\Controller; use WP_Rocket\Engine\Common\AbstractFileSystem; -use WP_Rocket\Logger\Logger; use WP_Filesystem_Direct; class Filesystem extends AbstractFileSystem { @@ -17,13 +16,6 @@ class Filesystem extends AbstractFileSystem { */ private $path; // @phpstan-ignore-line - /** - * Version of the fonts. - * - * @var int - */ - private $version; - /** * Instantiate the class * diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index b1491d602a..a6850b0b75 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -30,7 +30,7 @@ class Controller { /** * WordPress filesystem. * - * @var WP_Rocket\Engine\Media\Fonts\Controller\Filesystem; + * @var Filesystem|WP_Filesystem_Direct */ private $filesystem; @@ -45,7 +45,7 @@ class Controller { * Constructor. * * @param Context $context Context instance. - * @param WP_Rocket\Engine\Media\Fonts\Controller\Filesystem|null $filesystem WordPress filesystem. + * @param Filesystem|null $filesystem WordPress filesystem. */ public function __construct( Context $context, ?Filesystem $filesystem ) { $this->context = $context; From 19aa5d0d97766bb1c1552ad047bb97048624367e Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Fri, 15 Nov 2024 10:11:31 +0100 Subject: [PATCH 13/24] Fix phpcs --- inc/Engine/Media/Fonts/Frontend/Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index a6850b0b75..b316615e20 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -44,7 +44,7 @@ class Controller { /** * Constructor. * - * @param Context $context Context instance. + * @param Context $context Context instance. * @param Filesystem|null $filesystem WordPress filesystem. */ public function __construct( Context $context, ?Filesystem $filesystem ) { From 8fa8aa9e38925288166e0f4c965728b331c1e84d Mon Sep 17 00:00:00 2001 From: Gael Robin Date: Fri, 15 Nov 2024 13:49:19 +0100 Subject: [PATCH 14/24] Change path of the font file stored locally --- inc/Engine/Media/Fonts/Frontend/Controller.php | 4 ++-- .../Media/Fonts/Frontend/Controller/HTML/expected_v1.php | 4 ++-- .../Media/Fonts/Frontend/Controller/HTML/expected_v1_v2.php | 4 ++-- .../Media/Fonts/Frontend/Controller/HTML/expected_v2.php | 4 ++-- .../Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php | 4 ++-- .../Media/Fonts/Frontend/Subscriber/HTML/expected_v1_v2.php | 4 ++-- .../Media/Fonts/Frontend/Subscriber/HTML/expected_v2.php | 4 ++-- .../Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/inc/Engine/Media/Fonts/Frontend/Controller.php b/inc/Engine/Media/Fonts/Frontend/Controller.php index b316615e20..f242f37596 100644 --- a/inc/Engine/Media/Fonts/Frontend/Controller.php +++ b/inc/Engine/Media/Fonts/Frontend/Controller.php @@ -49,8 +49,8 @@ class Controller { */ public function __construct( Context $context, ?Filesystem $filesystem ) { $this->context = $context; - $this->base_path = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_PATH', '' ) . 'fonts/' . get_current_blog_id() . '/'; - $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/' . get_current_blog_id() . '/'; + $this->base_path = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_PATH', '' ) . 'fonts/google-fonts/' . get_current_blog_id() . '/'; + $this->base_url = rocket_get_constant( 'WP_ROCKET_CACHE_ROOT_URL', '' ) . 'fonts/google-fonts/' . get_current_blog_id() . '/'; $this->filesystem = ! empty( $filesystem ) ? $filesystem : rocket_direct_filesystem(); } diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Controller/HTML/expected_v1.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Controller/HTML/expected_v1.php index 2662753c5a..860a52418f 100644 --- a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Controller/HTML/expected_v1.php +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Controller/HTML/expected_v1.php @@ -9,8 +9,8 @@ Google Font V1 Template - - + + ', $gf_parameters, - $this->filesystem->get_contents( $css_path ) + $content ); } } From dc3fadb1502dea96b84f114eabd06a0a52a7d873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 15 Nov 2024 17:17:56 -0500 Subject: [PATCH 18/24] fix instantiation --- inc/Engine/Media/Fonts/ServiceProvider.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/inc/Engine/Media/Fonts/ServiceProvider.php b/inc/Engine/Media/Fonts/ServiceProvider.php index 9c2416d849..7448a84198 100644 --- a/inc/Engine/Media/Fonts/ServiceProvider.php +++ b/inc/Engine/Media/Fonts/ServiceProvider.php @@ -10,8 +10,6 @@ use WP_Rocket\Engine\Media\Fonts\Context\Context; use WP_Rocket\Engine\Media\Fonts\Frontend\Controller as FrontendController; use WP_Rocket\Engine\Media\Fonts\Frontend\Subscriber as FrontendSubscriber; -use WP_Filesystem_Direct; -use WP_Rocket\Engine\Media\Fonts\Controller\Filesystem; /** * Service provider for the WP Rocket Font Optimization @@ -33,7 +31,6 @@ class ServiceProvider extends AbstractServiceProvider { 'media_fonts_context', 'media_fonts_frontend_controller', 'media_fonts_frontend_subscriber', - 'media_fonts_filesystem', ]; /** @@ -58,15 +55,6 @@ public function register(): void { ->addArgument( rocket_direct_filesystem() ); $this->getContainer()->add( 'media_fonts_settings', Settings::class ); - $this->getContainer()->add( 'wp_direct_filesystem', WP_Filesystem_Direct::class ) - ->addArgument( [] ); - $this->getContainer()->add( 'media_fonts_filesystem', Filesystem::class ) - ->addArguments( - [ - wpm_apply_filters_typed( 'string', 'rocket_host_font_cache_root', 'fonts/' . get_current_blog_id() ), - 'wp_direct_filesystem', - ] - ); $this->getContainer()->addShared( 'media_fonts_admin_subscriber', AdminSubscriber::class ) ->addArgument( 'media_fonts_settings' ); From 5f0cc91b63d9dd4439ee43f8be8341509c932db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 15 Nov 2024 17:18:01 -0500 Subject: [PATCH 19/24] update tests --- .../Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php | 4 ++-- .../Media/Fonts/Frontend/Subscriber/HTML/expected_v1_v2.php | 4 ++-- .../Media/Fonts/Frontend/Subscriber/HTML/expected_v2.php | 4 ++-- .../Engine/Media/Fonts/Frontend/Subscriber/rewriteFonts.php | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php index 860a52418f..8c1fbb7b89 100644 --- a/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php +++ b/tests/Fixtures/inc/Engine/Media/Fonts/Frontend/Subscriber/HTML/expected_v1.php @@ -9,8 +9,8 @@ Google Font V1 Template - - + +