From b59118bc5d362f876899d17873848a648dfd517b Mon Sep 17 00:00:00 2001
From: "transifex-integration[bot]"
<43880903+transifex-integration[bot]@users.noreply.github.com>
Date: Tue, 7 May 2024 18:40:58 +0000
Subject: [PATCH 001/192] Translate languages/rocket.pot in pt_BR
100% translated source file: 'languages/rocket.pot'
on 'pt_BR'.
---
languages/rocket-pt_BR.po | 78 +++++++++++++++++++++++++--------------
1 file changed, 50 insertions(+), 28 deletions(-)
diff --git a/languages/rocket-pt_BR.po b/languages/rocket-pt_BR.po
index 233e371ac4..b246d1fdae 100644
--- a/languages/rocket-pt_BR.po
+++ b/languages/rocket-pt_BR.po
@@ -10,9 +10,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: WP Rocket 3.16-alpha1\n"
-"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-rocket\n"
-"POT-Creation-Date: 2024-04-29T20:40:45+00:00\n"
+"Project-Id-Version: WP Rocket 3.16-alpha2\n"
+"Report-Msgid-Bugs-To: http://wp-rocket.me/\n"
+"POT-Creation-Date: 2024-05-06T13:28:35+03:00\n"
"PO-Revision-Date: 2019-08-26 15:14+0000\n"
"Last-Translator: Fabio Fava , 2024\n"
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/wp-media/teams/18133/pt_BR/)\n"
@@ -22,7 +22,7 @@ msgstr ""
"Language: pt_BR\n"
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
"X-Domain: rocket\n"
-"X-Generator: WP-CLI 2.4.0\n"
+"X-Generator: WP-CLI 2.7.1\n"
#. Plugin Name of the plugin
msgid "WP Rocket"
@@ -672,8 +672,8 @@ msgstr "%s: Cache de usuário limpo."
msgid "Dismiss this notice"
msgstr "Descartar essa notificação"
-#: inc/admin/ui/notices.php:682 inc/Engine/Saas/Admin/AdminBar.php:80
-#: inc/Engine/Saas/Admin/AdminBar.php:198
+#: inc/admin/ui/notices.php:682 inc/Engine/Saas/Admin/AdminBar.php:84
+#: inc/Engine/Saas/Admin/AdminBar.php:202
msgid "Clear Used CSS"
msgstr "Limpar CSS usado"
@@ -1140,7 +1140,7 @@ msgid "Preload"
msgstr "Pré-Carregar"
#: inc/deprecated/deprecated.php:1786
-#: inc/Engine/Admin/Settings/Subscriber.php:170
+#: inc/Engine/Admin/Settings/Subscriber.php:171
#: views/settings/page-sections/tools.php:33
msgid "Tools"
msgstr "Ferramentas"
@@ -2578,6 +2578,20 @@ msgctxt "Sucuri"
msgid "Find your API key"
msgstr "Encontre a sua chave da API"
+#. translators: %1$s: opening strong tag, %2$s: closing strong tag, %3$s:
+#. opening a tag, %4$s: option a tag, %5$s: opening a tag.
+#: inc/Engine/Admin/Settings/Page.php:2295
+msgid ""
+"%1$sWP Rocket:%2$s the plugin has been updated to the 3.16 version. Our "
+"brand new feature %3$sOptimize critical images%5$s is automatically "
+"activated now! Also, the Cache tab was removed but the existing features "
+"will remain working, %4$ssee more here%5$s."
+msgstr ""
+"%1$sWP Rocket:%2$s o plugin foi atualizado para a versão 3.16. Nosso "
+"novíssimo recurso %3$sOtimizar imagens críticas%5$s já foi automaticamente "
+"ativado! Além disso, a aba Cache foi removida mas os recursos existentes "
+"continuarão funcionando, %4$ssaiba mais aqui%5$s."
+
#: inc/Engine/Admin/Settings/Settings.php:361
msgid ""
"Sucuri Add-on: The API key for the Sucuri firewall must be in format "
@@ -2595,25 +2609,25 @@ msgstr ""
"foi salva porque ela desativa o armazenamento em cache e as otimizações para"
" cada página do seu site."
-#: inc/Engine/Admin/Settings/Subscriber.php:171
+#: inc/Engine/Admin/Settings/Subscriber.php:172
msgid "Import, Export, Rollback"
msgstr "Importar, Exportar, Reverter"
-#: inc/Engine/Admin/Settings/Subscriber.php:196
+#: inc/Engine/Admin/Settings/Subscriber.php:197
#: views/settings/page-sections/imagify.php:14
msgid "Image Optimization"
msgstr "Otimizar Imagens"
-#: inc/Engine/Admin/Settings/Subscriber.php:197
+#: inc/Engine/Admin/Settings/Subscriber.php:198
msgid "Compress your images"
msgstr "Comprima as suas imagens"
-#: inc/Engine/Admin/Settings/Subscriber.php:214
+#: inc/Engine/Admin/Settings/Subscriber.php:215
#: views/settings/page-sections/tutorials.php:48
msgid "Tutorials"
msgstr "Tutoriais"
-#: inc/Engine/Admin/Settings/Subscriber.php:215
+#: inc/Engine/Admin/Settings/Subscriber.php:216
msgid "Getting started and how to videos"
msgstr "Comece a usar e vídeos didáticos"
@@ -2827,15 +2841,15 @@ msgstr ""
"Acelere o seu site com a RocketCDN, a Rede de Distribuição de Conteúdo do WP"
" Rocket!"
-#: inc/Engine/Common/JobManager/Cron/Subscriber.php:180
+#: inc/Engine/Common/JobManager/Cron/Subscriber.php:185
msgid "WP Rocket process pending jobs"
msgstr "O WP Rocket processa os jobs pendentes"
-#: inc/Engine/Common/JobManager/Cron/Subscriber.php:194
+#: inc/Engine/Common/JobManager/Cron/Subscriber.php:204
msgid "WP Rocket clear failed jobs"
msgstr "O WP Rocket limpa os jobs que falharem"
-#: inc/Engine/Common/JobManager/Cron/Subscriber.php:206
+#: inc/Engine/Common/JobManager/Cron/Subscriber.php:221
msgid "WP Rocket process on submit jobs"
msgstr "O WP Rocket processa os jobs no envio"
@@ -3343,6 +3357,14 @@ msgstr ""
msgid "%1$s: Critical images cleared!"
msgstr "%1$s: Imagens críticas esvaziadas!"
+#: inc/Engine/Media/AboveTheFold/AJAX/Controller.php:131
+msgid "Script error"
+msgstr "Erro de script"
+
+#: inc/Engine/Media/AboveTheFold/AJAX/Controller.php:134
+msgid "Script timeout"
+msgstr "Tempo-limite do script"
+
#: inc/Engine/Media/Lazyload/AdminSubscriber.php:62
msgid "LazyLoad for images"
msgstr "LazyLoad para imagens"
@@ -3447,24 +3469,24 @@ msgstr "Trabalhos pendentes do Pré-carregamento do WP Rocket"
msgid "WP Rocket Preload revert stuck failed jobs"
msgstr "O pré-carregamento do WP Rocket reverte jobs empacados que falharam"
-#: inc/Engine/Saas/Admin/AdminBar.php:73
-#: inc/Engine/Saas/Admin/AdminBar.php:194
+#: inc/Engine/Saas/Admin/AdminBar.php:77
+#: inc/Engine/Saas/Admin/AdminBar.php:198
msgid "Clear Critical Images"
msgstr "Esvaziar Imagens Críticas"
-#: inc/Engine/Saas/Admin/AdminBar.php:160
+#: inc/Engine/Saas/Admin/AdminBar.php:164
msgid "Clear Critical Images of this URL"
msgstr "Esvaziar as Imagens Críticas deste URL"
-#: inc/Engine/Saas/Admin/AdminBar.php:163
+#: inc/Engine/Saas/Admin/AdminBar.php:167
msgid "Clear Used CSS of this URL"
msgstr "Limpar o CSS usado deste URL"
-#: inc/Engine/Saas/Admin/AdminBar.php:193
+#: inc/Engine/Saas/Admin/AdminBar.php:197
msgid "Critical Images Cache"
msgstr "Cache de Imagens Críticas"
-#: inc/Engine/Saas/Admin/AdminBar.php:197
+#: inc/Engine/Saas/Admin/AdminBar.php:201
msgid "Remove Used CSS Cache"
msgstr "Remover o cache de CSS usado"
@@ -3489,18 +3511,18 @@ msgstr ""
"\t\t\t O WP Rocket continuará gerando CSS Usado para até %2$s URLs a cada %3$s segundo(s)."
#. translators: %1$s = opening link tag, %2$s = closing link tag.
-#: inc/Engine/Saas/Admin/Notices.php:160
+#: inc/Engine/Saas/Admin/Notices.php:170
msgid "We suggest enabling %1$sPreload%2$s for the fastest results."
msgstr ""
"Sugerimos ativar o %1$sPré-carregamento%2$s para resultados mais rápidos."
#. translators: %1$s = opening link tag, %2$s = closing link tag.
-#: inc/Engine/Saas/Admin/Notices.php:170
+#: inc/Engine/Saas/Admin/Notices.php:180
msgid "To learn more about the process check our %1$sdocumentation%2$s."
msgstr ""
"Para aprender mais sobre o processo veja a nossa %1$sdocumentação%2$s."
-#: inc/Engine/Saas/Admin/Notices.php:236
+#: inc/Engine/Saas/Admin/Notices.php:246
msgid ""
"We couldn't generate the used CSS because you're using a nulled version of "
"WP Rocket. You need an active license to use the Remove Unused CSS feature "
@@ -3512,13 +3534,13 @@ msgstr ""
"seu site."
#. translators: %1$s = promo percentage.
-#: inc/Engine/Saas/Admin/Notices.php:239
+#: inc/Engine/Saas/Admin/Notices.php:249
msgid "Click here to get a WP Rocket single license at %1$s off!"
msgstr ""
"Clique aqui para obter uma licença única do WP Rocket com %1$s de desconto!"
#. translators: %1$s = open tag, %2$s = closing tag.
-#: inc/Engine/Saas/Admin/Notices.php:292
+#: inc/Engine/Saas/Admin/Notices.php:302
msgid ""
"It seems a security plugin or the server's firewall prevents WP Rocket from "
"accessing the SaaS features. IPs listed %1$shere in our documentation%2$s "
@@ -3528,11 +3550,11 @@ msgstr ""
" WP Rocket de acessar os recursos SaaS. Os IPs listados %1$saqui em nossa "
"documentação%2$s devem ser adicionados à sua lista de permitidos:"
-#: inc/Engine/Saas/Admin/Notices.php:297
+#: inc/Engine/Saas/Admin/Notices.php:307
msgid "- In the security plugin, if you are using one"
msgstr "- No plugin de segurança, se estiver usando um."
-#: inc/Engine/Saas/Admin/Notices.php:298
+#: inc/Engine/Saas/Admin/Notices.php:308
msgid "- In the server's firewall. Your host can help you with this"
msgstr ""
"- No firewall do servidor. Sua compania de hospedagem poderá te ajudar com "
From 09afb5580d7ae7701956b659a8c153b2758645c0 Mon Sep 17 00:00:00 2001
From: "transifex-integration[bot]"
<43880903+transifex-integration[bot]@users.noreply.github.com>
Date: Mon, 13 May 2024 08:04:40 +0000
Subject: [PATCH 002/192] Translate languages/rocket.pot in fa_IR
100% translated source file: 'languages/rocket.pot'
on 'fa_IR'.
---
languages/rocket-fa_IR.po | 77 +++++++++++++++++++++++++--------------
1 file changed, 49 insertions(+), 28 deletions(-)
diff --git a/languages/rocket-fa_IR.po b/languages/rocket-fa_IR.po
index 9a88faab94..b334d6bf46 100644
--- a/languages/rocket-fa_IR.po
+++ b/languages/rocket-fa_IR.po
@@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: WP Rocket 3.16-alpha1\n"
-"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-rocket\n"
-"POT-Creation-Date: 2024-04-29T20:40:45+00:00\n"
+"Project-Id-Version: WP Rocket 3.16-alpha2\n"
+"Report-Msgid-Bugs-To: http://wp-rocket.me/\n"
+"POT-Creation-Date: 2024-05-06T13:28:35+03:00\n"
"PO-Revision-Date: 2019-08-26 15:14+0000\n"
"Last-Translator: Mohammad Yousefzadeh , 2024\n"
"Language-Team: Persian (Iran) (https://app.transifex.com/wp-media/teams/18133/fa_IR/)\n"
@@ -17,7 +17,7 @@ msgstr ""
"Language: fa_IR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Domain: rocket\n"
-"X-Generator: WP-CLI 2.4.0\n"
+"X-Generator: WP-CLI 2.7.1\n"
#. Plugin Name of the plugin
msgid "WP Rocket"
@@ -640,8 +640,8 @@ msgstr "%s: کش کاربر پاک شد."
msgid "Dismiss this notice"
msgstr "نادیده گرفتن این پیام."
-#: inc/admin/ui/notices.php:682 inc/Engine/Saas/Admin/AdminBar.php:80
-#: inc/Engine/Saas/Admin/AdminBar.php:198
+#: inc/admin/ui/notices.php:682 inc/Engine/Saas/Admin/AdminBar.php:84
+#: inc/Engine/Saas/Admin/AdminBar.php:202
msgid "Clear Used CSS"
msgstr "پاکسازی CSSهای استفاده شده"
@@ -1095,7 +1095,7 @@ msgid "Preload"
msgstr "پیش بارگذاری"
#: inc/deprecated/deprecated.php:1786
-#: inc/Engine/Admin/Settings/Subscriber.php:170
+#: inc/Engine/Admin/Settings/Subscriber.php:171
#: views/settings/page-sections/tools.php:33
msgid "Tools"
msgstr "ابزارها"
@@ -2499,6 +2499,19 @@ msgctxt "Sucuri"
msgid "Find your API key"
msgstr "پیدا کردن کلید API شما"
+#. translators: %1$s: opening strong tag, %2$s: closing strong tag, %3$s:
+#. opening a tag, %4$s: option a tag, %5$s: opening a tag.
+#: inc/Engine/Admin/Settings/Page.php:2295
+msgid ""
+"%1$sWP Rocket:%2$s the plugin has been updated to the 3.16 version. Our "
+"brand new feature %3$sOptimize critical images%5$s is automatically "
+"activated now! Also, the Cache tab was removed but the existing features "
+"will remain working, %4$ssee more here%5$s."
+msgstr ""
+"%1$sراکت وردپرس:%2$sافزونه به نسخه 3.16 بروزرسانی شد. ویژگی جدید ما%3$sبهینه"
+" سازی تصاویر بحرانی است.%5$sکه به صورت خودکار فعال می باشد! همچنین تب کش حذف"
+" شده اما همچنان عملکردش باقی مانده است%4$sاطلاعات بیشتر%5$s."
+
#: inc/Engine/Admin/Settings/Settings.php:361
msgid ""
"Sucuri Add-on: The API key for the Sucuri firewall must be in format "
@@ -2515,25 +2528,25 @@ msgstr ""
"متاسفیم! افزودن/(.*) در قوانین پیشرفته > هرگز کش نکن URL(s) ذخیره نشد به "
"دلیل اینکه کش و بهینه سازی برای هر برگه در سایت شما غیرفعال است."
-#: inc/Engine/Admin/Settings/Subscriber.php:171
+#: inc/Engine/Admin/Settings/Subscriber.php:172
msgid "Import, Export, Rollback"
msgstr "درونریزی، برونریزی، عقبگرد"
-#: inc/Engine/Admin/Settings/Subscriber.php:196
+#: inc/Engine/Admin/Settings/Subscriber.php:197
#: views/settings/page-sections/imagify.php:14
msgid "Image Optimization"
msgstr "بهینهسازی تصویر"
-#: inc/Engine/Admin/Settings/Subscriber.php:197
+#: inc/Engine/Admin/Settings/Subscriber.php:198
msgid "Compress your images"
msgstr "تصاویر خود را فشرده کنید"
-#: inc/Engine/Admin/Settings/Subscriber.php:214
+#: inc/Engine/Admin/Settings/Subscriber.php:215
#: views/settings/page-sections/tutorials.php:48
msgid "Tutorials"
msgstr "آموزشها"
-#: inc/Engine/Admin/Settings/Subscriber.php:215
+#: inc/Engine/Admin/Settings/Subscriber.php:216
msgid "Getting started and how to videos"
msgstr "شروع به کار و نحوه فیلمبرداری"
@@ -2733,15 +2746,15 @@ msgid ""
msgstr ""
"با RocketCDN، شبکه تحویل محتوای WP Rocket سرعت سایت خود را افزایش دهید!"
-#: inc/Engine/Common/JobManager/Cron/Subscriber.php:180
+#: inc/Engine/Common/JobManager/Cron/Subscriber.php:185
msgid "WP Rocket process pending jobs"
msgstr "WP Rocket کارهای معلق را پردازش می کند"
-#: inc/Engine/Common/JobManager/Cron/Subscriber.php:194
+#: inc/Engine/Common/JobManager/Cron/Subscriber.php:204
msgid "WP Rocket clear failed jobs"
msgstr "WP Rocket کارهای ناموفق را پاک کرد"
-#: inc/Engine/Common/JobManager/Cron/Subscriber.php:206
+#: inc/Engine/Common/JobManager/Cron/Subscriber.php:221
msgid "WP Rocket process on submit jobs"
msgstr "فرآیند WP Rocket در ارسال کارها"
@@ -3229,6 +3242,14 @@ msgstr ""
msgid "%1$s: Critical images cleared!"
msgstr "%1$s:تصاویر بحرانی حذف شدند!"
+#: inc/Engine/Media/AboveTheFold/AJAX/Controller.php:131
+msgid "Script error"
+msgstr "خطای اسکریپت"
+
+#: inc/Engine/Media/AboveTheFold/AJAX/Controller.php:134
+msgid "Script timeout"
+msgstr "وقفه اسکریپت"
+
#: inc/Engine/Media/Lazyload/AdminSubscriber.php:62
msgid "LazyLoad for images"
msgstr "باگذاری با تاخیر تصاویر"
@@ -3332,24 +3353,24 @@ msgstr "کارهای معلق پیش بارگذاری"
msgid "WP Rocket Preload revert stuck failed jobs"
msgstr "پیش بارگذاری برگرداندن کارهای ناموفق گیر کرده است"
-#: inc/Engine/Saas/Admin/AdminBar.php:73
-#: inc/Engine/Saas/Admin/AdminBar.php:194
+#: inc/Engine/Saas/Admin/AdminBar.php:77
+#: inc/Engine/Saas/Admin/AdminBar.php:198
msgid "Clear Critical Images"
msgstr "پاکسازی تصاویر بحرانی"
-#: inc/Engine/Saas/Admin/AdminBar.php:160
+#: inc/Engine/Saas/Admin/AdminBar.php:164
msgid "Clear Critical Images of this URL"
msgstr "پاکسازی تصاویر این url"
-#: inc/Engine/Saas/Admin/AdminBar.php:163
+#: inc/Engine/Saas/Admin/AdminBar.php:167
msgid "Clear Used CSS of this URL"
msgstr "پاکسازی CSS استفاده شده برای این URL"
-#: inc/Engine/Saas/Admin/AdminBar.php:193
+#: inc/Engine/Saas/Admin/AdminBar.php:197
msgid "Critical Images Cache"
msgstr "کش تصاویر بحرانی"
-#: inc/Engine/Saas/Admin/AdminBar.php:197
+#: inc/Engine/Saas/Admin/AdminBar.php:201
msgid "Remove Used CSS Cache"
msgstr "حذف کش CSS استفاده شده"
@@ -3373,16 +3394,16 @@ msgstr ""
"\t\t\tWP Rocket به تولید CSS استفاده شده تا حداکثر ادامه خواهد داد%2$surlها هر%3$sثانیه()."
#. translators: %1$s = opening link tag, %2$s = closing link tag.
-#: inc/Engine/Saas/Admin/Notices.php:160
+#: inc/Engine/Saas/Admin/Notices.php:170
msgid "We suggest enabling %1$sPreload%2$s for the fastest results."
msgstr "ما پیشنهاد می کنیم %1$sپیش بارگذاری%2$s برای نتایج سریعتر فعال کنید."
#. translators: %1$s = opening link tag, %2$s = closing link tag.
-#: inc/Engine/Saas/Admin/Notices.php:170
+#: inc/Engine/Saas/Admin/Notices.php:180
msgid "To learn more about the process check our %1$sdocumentation%2$s."
msgstr "برای یادگیری پروسه %1$sمستندات%2$s مارا بخوانید."
-#: inc/Engine/Saas/Admin/Notices.php:236
+#: inc/Engine/Saas/Admin/Notices.php:246
msgid ""
"We couldn't generate the used CSS because you're using a nulled version of "
"WP Rocket. You need an active license to use the Remove Unused CSS feature "
@@ -3393,12 +3414,12 @@ msgstr ""
"بیشتر عملکرد وب سایت خود، به یک مجوز فعال نیاز دارید."
#. translators: %1$s = promo percentage.
-#: inc/Engine/Saas/Admin/Notices.php:239
+#: inc/Engine/Saas/Admin/Notices.php:249
msgid "Click here to get a WP Rocket single license at %1$s off!"
msgstr "برای دریافت لایسنس %1$sتخفیفی اینجا کلیک کنید!"
#. translators: %1$s = open tag, %2$s = closing tag.
-#: inc/Engine/Saas/Admin/Notices.php:292
+#: inc/Engine/Saas/Admin/Notices.php:302
msgid ""
"It seems a security plugin or the server's firewall prevents WP Rocket from "
"accessing the SaaS features. IPs listed %1$shere in our documentation%2$s "
@@ -3408,11 +3429,11 @@ msgstr ""
"های SaaS جلوگیری می کند. لیست آیپی ها%1$sمستندات اینجا%2$sباید به لیست "
"مجازتان اضافله شود:"
-#: inc/Engine/Saas/Admin/Notices.php:297
+#: inc/Engine/Saas/Admin/Notices.php:307
msgid "- In the security plugin, if you are using one"
msgstr "- در افزونه امنیت، اگر شما از یکی از آن ها استفاده کنید"
-#: inc/Engine/Saas/Admin/Notices.php:298
+#: inc/Engine/Saas/Admin/Notices.php:308
msgid "- In the server's firewall. Your host can help you with this"
msgstr "- در فایروال سرور. شرکت هاست شما کمکتان می کند"
From bf2b6142ff52cfd6b9ca3759c36be28cd320b7e2 Mon Sep 17 00:00:00 2001
From: "transifex-integration[bot]"
<43880903+transifex-integration[bot]@users.noreply.github.com>
Date: Wed, 15 May 2024 08:19:26 +0000
Subject: [PATCH 003/192] Translate languages/rocket.pot in fr_FR
100% translated source file: 'languages/rocket.pot'
on 'fr_FR'.
---
languages/rocket-fr_FR.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/languages/rocket-fr_FR.po b/languages/rocket-fr_FR.po
index 2e0d07ff4a..00ecd02e79 100644
--- a/languages/rocket-fr_FR.po
+++ b/languages/rocket-fr_FR.po
@@ -3497,7 +3497,7 @@ msgstr "Nettoyer le CSS utilisé pour cet URL"
#: inc/Engine/Saas/Admin/AdminBar.php:197
msgid "Critical Images Cache"
-msgstr "Cache des images essentielles"
+msgstr "Cache des images citiques"
#: inc/Engine/Saas/Admin/AdminBar.php:201
msgid "Remove Used CSS Cache"
From f2ec51b462d8fadd2155be34f5f71b5eebdc723d Mon Sep 17 00:00:00 2001
From: "transifex-integration[bot]"
<43880903+transifex-integration[bot]@users.noreply.github.com>
Date: Wed, 15 May 2024 08:20:01 +0000
Subject: [PATCH 004/192] Translate languages/rocket.pot in fr_FR
100% translated source file: 'languages/rocket.pot'
on 'fr_FR'.
---
languages/rocket-fr_FR.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/languages/rocket-fr_FR.po b/languages/rocket-fr_FR.po
index 00ecd02e79..f459387caf 100644
--- a/languages/rocket-fr_FR.po
+++ b/languages/rocket-fr_FR.po
@@ -3485,7 +3485,7 @@ msgstr ""
#: inc/Engine/Saas/Admin/AdminBar.php:77
#: inc/Engine/Saas/Admin/AdminBar.php:198
msgid "Clear Critical Images"
-msgstr "Effacer les images critiques"
+msgstr "Réinitialiser les images critiques"
#: inc/Engine/Saas/Admin/AdminBar.php:164
msgid "Clear Critical Images of this URL"
From 54fba35bb8303ada3595c27051efe9d3782d59eb Mon Sep 17 00:00:00 2001
From: "transifex-integration[bot]"
<43880903+transifex-integration[bot]@users.noreply.github.com>
Date: Wed, 15 May 2024 08:20:12 +0000
Subject: [PATCH 005/192] Translate languages/rocket.pot in fr_FR
100% translated source file: 'languages/rocket.pot'
on 'fr_FR'.
---
languages/rocket-fr_FR.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/languages/rocket-fr_FR.po b/languages/rocket-fr_FR.po
index f459387caf..c0303e87fc 100644
--- a/languages/rocket-fr_FR.po
+++ b/languages/rocket-fr_FR.po
@@ -3489,7 +3489,7 @@ msgstr "Réinitialiser les images critiques"
#: inc/Engine/Saas/Admin/AdminBar.php:164
msgid "Clear Critical Images of this URL"
-msgstr "Effacer les images critiques pour cette URL"
+msgstr "Réinitialiser les images critiques pour cette URL"
#: inc/Engine/Saas/Admin/AdminBar.php:167
msgid "Clear Used CSS of this URL"
From 4d46cfb6f5a4bbd36e8187333ca369b0a4e7a1e3 Mon Sep 17 00:00:00 2001
From: Michael Lee <38788055+jeawhanlee@users.noreply.github.com>
Date: Tue, 16 Jul 2024 12:25:09 +0100
Subject: [PATCH 006/192] Closes #6777: 3.17 Sub tasks - Factories Creation
(#6787)
---
.../PerformanceHints/AbstractFactory.php | 26 +++++++++++
inc/Engine/Media/AboveTheFold/Factory.php | 45 +++++++++++++++++++
.../Media/AboveTheFold/ServiceProvider.php | 3 ++
3 files changed, 74 insertions(+)
create mode 100644 inc/Engine/Common/PerformanceHints/AbstractFactory.php
create mode 100644 inc/Engine/Media/AboveTheFold/Factory.php
diff --git a/inc/Engine/Common/PerformanceHints/AbstractFactory.php b/inc/Engine/Common/PerformanceHints/AbstractFactory.php
new file mode 100644
index 0000000000..829bc08591
--- /dev/null
+++ b/inc/Engine/Common/PerformanceHints/AbstractFactory.php
@@ -0,0 +1,26 @@
+getContainer()->addShared( 'warmup_subscriber', WarmUpSubscriber::class )
->addArgument( $this->getContainer()->get( 'warmup_controller' ) );
+
+ $this->getContainer()->addShared( 'atf_factory', Factory::class );
}
}
From 4eb5b13fddc5c053d11f7e133a6ca61a2b19b3a9 Mon Sep 17 00:00:00 2001
From: Michael Lee
Date: Tue, 16 Jul 2024 13:30:39 +0100
Subject: [PATCH 007/192] Changed filename and interface name
---
.../{AbstractFactory.php => FactoryInterface.php} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename inc/Engine/Common/PerformanceHints/{AbstractFactory.php => FactoryInterface.php} (100%)
diff --git a/inc/Engine/Common/PerformanceHints/AbstractFactory.php b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
similarity index 100%
rename from inc/Engine/Common/PerformanceHints/AbstractFactory.php
rename to inc/Engine/Common/PerformanceHints/FactoryInterface.php
From 405c468eb545958de4f94a767321777752452218 Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Thu, 18 Jul 2024 04:04:01 +0200
Subject: [PATCH 008/192] Adds PerformanceHints interfaces for database
---
.../PerformanceHints/Database/Queries.php | 33 +++++++++++++++++++
.../PerformanceHints/Database/Table.php | 20 +++++++++++
.../Media/AboveTheFold/Admin/Controller.php | 2 +-
.../Database/Queries/AboveTheFold.php | 4 ++-
.../Database/Tables/AboveTheFold.php | 5 +--
5 files changed, 60 insertions(+), 4 deletions(-)
create mode 100644 inc/Engine/Common/PerformanceHints/Database/Queries.php
create mode 100644 inc/Engine/Common/PerformanceHints/Database/Table.php
diff --git a/inc/Engine/Common/PerformanceHints/Database/Queries.php b/inc/Engine/Common/PerformanceHints/Database/Queries.php
new file mode 100644
index 0000000000..eefc50572c
--- /dev/null
+++ b/inc/Engine/Common/PerformanceHints/Database/Queries.php
@@ -0,0 +1,33 @@
+table->truncate_atf_table();
+ $this->table->truncate_table();
/**
* Fires after clearing lcp & atf data.
diff --git a/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php b/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php
index 02230da8f7..013665f816 100644
--- a/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php
+++ b/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php
@@ -4,10 +4,12 @@
namespace WP_Rocket\Engine\Media\AboveTheFold\Database\Queries;
use WP_Rocket\Engine\Common\Database\Queries\AbstractQuery;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\Queries;
+
use WP_Rocket\Engine\Media\AboveTheFold\Database\Schemas\AboveTheFold as AboveTheFoldSchema;
use WP_Rocket\Engine\Media\AboveTheFold\Database\Rows\AboveTheFold as AboveTheFoldRow;
-class AboveTheFold extends AbstractQuery {
+class AboveTheFold extends AbstractQuery implements Queries {
/**
* Name of the database table to query.
diff --git a/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php b/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php
index 01f40efa6d..8a807bff79 100644
--- a/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php
+++ b/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php
@@ -4,8 +4,9 @@
namespace WP_Rocket\Engine\Media\AboveTheFold\Database\Tables;
use WP_Rocket\Engine\Common\Database\Tables\AbstractTable;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\Table;
-class AboveTheFold extends AbstractTable {
+class AboveTheFold extends AbstractTable implements Table {
/**
* Table name
*
@@ -61,7 +62,7 @@ class AboveTheFold extends AbstractTable {
*
* @return bool
*/
- public function truncate_atf_table(): bool {
+ public function truncate_table(): bool {
if ( ! $this->exists() ) {
return false;
}
From 78790177bb129f64691f15b86f06700b83396786 Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Thu, 18 Jul 2024 04:04:26 +0200
Subject: [PATCH 009/192] Apply linter
---
inc/Engine/Common/PerformanceHints/Database/Queries.php | 1 -
inc/Engine/Common/PerformanceHints/Database/Table.php | 4 +---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/inc/Engine/Common/PerformanceHints/Database/Queries.php b/inc/Engine/Common/PerformanceHints/Database/Queries.php
index eefc50572c..819c856fce 100644
--- a/inc/Engine/Common/PerformanceHints/Database/Queries.php
+++ b/inc/Engine/Common/PerformanceHints/Database/Queries.php
@@ -2,7 +2,6 @@
/**
* The Queries interface defines the contract for database query operations.
- *
*/
namespace WP_Rocket\Engine\Common\PerformanceHints\Database;
diff --git a/inc/Engine/Common/PerformanceHints/Database/Table.php b/inc/Engine/Common/PerformanceHints/Database/Table.php
index f0aad05261..78fdf0f3cb 100644
--- a/inc/Engine/Common/PerformanceHints/Database/Table.php
+++ b/inc/Engine/Common/PerformanceHints/Database/Table.php
@@ -2,7 +2,6 @@
/**
* The Table interface defines the contract for database table operations.
- *
*/
namespace WP_Rocket\Engine\Common\PerformanceHints\Database;
@@ -15,6 +14,5 @@ interface Table {
*
* @return bool Returns a boolean value indicating the success or failure of the operation.
*/
- public function truncate_table() : bool;
-
+ public function truncate_table(): bool;
}
From 199921952cb31b160e670800f52fff66b19c472f Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Thu, 18 Jul 2024 04:07:39 +0200
Subject: [PATCH 010/192] Fix tests
---
.../Engine/Media/AboveTheFold/Admin/Controller/truncateAtf.php | 2 +-
.../Media/AboveTheFold/Admin/Controller/truncateOnUpdate.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateAtf.php b/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateAtf.php
index 261b687299..71212cbe54 100644
--- a/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateAtf.php
+++ b/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateAtf.php
@@ -51,7 +51,7 @@ public function testShouldDoExpected( $config, $expected ) {
->method( 'remove_all_completed_rows' );
} elseif ( 'truncate' === $expected ) {
$this->table->expects( $this->once() )
- ->method( 'truncate_atf_table' );
+ ->method( 'truncate_table' );
}
}
diff --git a/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateOnUpdate.php b/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateOnUpdate.php
index 3ac24197c4..e01ee1d638 100644
--- a/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateOnUpdate.php
+++ b/tests/Unit/inc/Engine/Media/AboveTheFold/Admin/Controller/truncateOnUpdate.php
@@ -48,7 +48,7 @@ public function testShouldDoExpected( $config, $expected ) {
->willReturn( $config['not_completed'] );
$this->table->expects( $this->once() )
- ->method( 'truncate_atf_table' );
+ ->method( 'truncate_table' );
}
$this->controller->truncate_on_update( $config['new_version'], $config['old_version'] );
From 764175656482c9c15890e0e306c625bb2aed5c4a Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Thu, 18 Jul 2024 04:13:24 +0200
Subject: [PATCH 011/192] Update FactoryInterface
---
.../Common/PerformanceHints/FactoryInterface.php | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/inc/Engine/Common/PerformanceHints/FactoryInterface.php b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
index 829bc08591..17b4eb1a03 100644
--- a/inc/Engine/Common/PerformanceHints/FactoryInterface.php
+++ b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
@@ -3,6 +3,9 @@
namespace WP_Rocket\Engine\Common\PerformanceHints;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\Queries;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\Table;
+
interface AbstractFactory {
/**
* Provides an Ajax interface.
@@ -16,11 +19,15 @@ public function frontend(); // To return Frontend interface when created.
/**
* Provides a Table interface.
+ *
+ * @return Table
*/
- public function table(); // To return Table interface when created.
+ public function table() : Table;
/**
* Provides a Queries interface.
+ *
+ * @return Queries
*/
- public function queries(); // To return Queries interface when created.
+ public function queries() : Queries;
}
From 7e93c87194d3973f16e6c333c70b82ed0b85f3d9 Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Thu, 18 Jul 2024 04:26:39 +0200
Subject: [PATCH 012/192] Update linter
---
inc/Engine/Common/PerformanceHints/FactoryInterface.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inc/Engine/Common/PerformanceHints/FactoryInterface.php b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
index 17b4eb1a03..61bb701076 100644
--- a/inc/Engine/Common/PerformanceHints/FactoryInterface.php
+++ b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
@@ -22,12 +22,12 @@ public function frontend(); // To return Frontend interface when created.
*
* @return Table
*/
- public function table() : Table;
+ public function table(): Table;
/**
* Provides a Queries interface.
*
* @return Queries
*/
- public function queries() : Queries;
+ public function queries(): Queries;
}
From cb18ab2bc48ead1530961c444de016ea87f1d6a4 Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Fri, 19 Jul 2024 01:20:57 +0200
Subject: [PATCH 013/192] Comply feedback
---
.../Database/{Queries.php => QueriesInterface.php} | 2 +-
.../Database/{Table.php => TableInterface.php} | 2 +-
.../Common/PerformanceHints/FactoryInterface.php | 14 +++++++-------
3 files changed, 9 insertions(+), 9 deletions(-)
rename inc/Engine/Common/PerformanceHints/Database/{Queries.php => QueriesInterface.php} (97%)
rename inc/Engine/Common/PerformanceHints/Database/{Table.php => TableInterface.php} (93%)
diff --git a/inc/Engine/Common/PerformanceHints/Database/Queries.php b/inc/Engine/Common/PerformanceHints/Database/QueriesInterface.php
similarity index 97%
rename from inc/Engine/Common/PerformanceHints/Database/Queries.php
rename to inc/Engine/Common/PerformanceHints/Database/QueriesInterface.php
index 819c856fce..c33fcbda14 100644
--- a/inc/Engine/Common/PerformanceHints/Database/Queries.php
+++ b/inc/Engine/Common/PerformanceHints/Database/QueriesInterface.php
@@ -5,7 +5,7 @@
*/
namespace WP_Rocket\Engine\Common\PerformanceHints\Database;
-interface Queries {
+interface QueriesInterface {
/**
* Marks a job as completed.
diff --git a/inc/Engine/Common/PerformanceHints/Database/Table.php b/inc/Engine/Common/PerformanceHints/Database/TableInterface.php
similarity index 93%
rename from inc/Engine/Common/PerformanceHints/Database/Table.php
rename to inc/Engine/Common/PerformanceHints/Database/TableInterface.php
index 78fdf0f3cb..57cc07cd38 100644
--- a/inc/Engine/Common/PerformanceHints/Database/Table.php
+++ b/inc/Engine/Common/PerformanceHints/Database/TableInterface.php
@@ -5,7 +5,7 @@
*/
namespace WP_Rocket\Engine\Common\PerformanceHints\Database;
-interface Table {
+interface TableInterface {
/**
* Truncates the database table.
diff --git a/inc/Engine/Common/PerformanceHints/FactoryInterface.php b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
index 61bb701076..b83db2605d 100644
--- a/inc/Engine/Common/PerformanceHints/FactoryInterface.php
+++ b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
@@ -3,10 +3,10 @@
namespace WP_Rocket\Engine\Common\PerformanceHints;
-use WP_Rocket\Engine\Common\PerformanceHints\Database\Queries;
-use WP_Rocket\Engine\Common\PerformanceHints\Database\Table;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\QueriesInterface;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\TableInterface;
-interface AbstractFactory {
+interface FactoryInterface {
/**
* Provides an Ajax interface.
*/
@@ -20,14 +20,14 @@ public function frontend(); // To return Frontend interface when created.
/**
* Provides a Table interface.
*
- * @return Table
+ * @return TableInterface
*/
- public function table(): Table;
+ public function table(): TableInterface;
/**
* Provides a Queries interface.
*
- * @return Queries
+ * @return QueriesInterface
*/
- public function queries(): Queries;
+ public function queries(): QueriesInterface;
}
From 54f023ddd4a4592f14887b58367527f640514202 Mon Sep 17 00:00:00 2001
From: Gael Robin
Date: Fri, 19 Jul 2024 01:26:41 +0200
Subject: [PATCH 014/192] Comply feedback
---
.../Media/AboveTheFold/Database/Queries/AboveTheFold.php | 4 ++--
.../Media/AboveTheFold/Database/Tables/AboveTheFold.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php b/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php
index 013665f816..3d7f5bd0e5 100644
--- a/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php
+++ b/inc/Engine/Media/AboveTheFold/Database/Queries/AboveTheFold.php
@@ -4,12 +4,12 @@
namespace WP_Rocket\Engine\Media\AboveTheFold\Database\Queries;
use WP_Rocket\Engine\Common\Database\Queries\AbstractQuery;
-use WP_Rocket\Engine\Common\PerformanceHints\Database\Queries;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\QueriesInterface;
use WP_Rocket\Engine\Media\AboveTheFold\Database\Schemas\AboveTheFold as AboveTheFoldSchema;
use WP_Rocket\Engine\Media\AboveTheFold\Database\Rows\AboveTheFold as AboveTheFoldRow;
-class AboveTheFold extends AbstractQuery implements Queries {
+class AboveTheFold extends AbstractQuery implements QueriesInterface {
/**
* Name of the database table to query.
diff --git a/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php b/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php
index 8a807bff79..25421073dc 100644
--- a/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php
+++ b/inc/Engine/Media/AboveTheFold/Database/Tables/AboveTheFold.php
@@ -4,9 +4,9 @@
namespace WP_Rocket\Engine\Media\AboveTheFold\Database\Tables;
use WP_Rocket\Engine\Common\Database\Tables\AbstractTable;
-use WP_Rocket\Engine\Common\PerformanceHints\Database\Table;
+use WP_Rocket\Engine\Common\PerformanceHints\Database\TableInterface;
-class AboveTheFold extends AbstractTable implements Table {
+class AboveTheFold extends AbstractTable implements TableInterface {
/**
* Table name
*
From 12dc04846d4d6f3696ac6b7c69f8e1f1856c8d5a Mon Sep 17 00:00:00 2001
From: Michael Lee <38788055+jeawhanlee@users.noreply.github.com>
Date: Fri, 19 Jul 2024 03:48:44 +0100
Subject: [PATCH 015/192] Closes #6776: 3.17 - Refactor AJAX Process (#6796)
---
.../AJAX/ControllerInterface.php | 20 ++++++
.../PerformanceHints/AJAX/Subscriber.php | 62 +++++++++++++++++++
.../PerformanceHints/FactoryInterface.php | 10 ++-
.../PerformanceHints/ServiceProvider.php | 52 ++++++++++++++++
.../Media/AboveTheFold/AJAX/Controller.php | 9 +--
.../Media/AboveTheFold/AJAX/Subscriber.php | 56 -----------------
inc/Engine/Media/AboveTheFold/Factory.php | 28 ++++++---
.../Media/AboveTheFold/ServiceProvider.php | 6 +-
inc/Plugin.php | 4 +-
.../AJAX/Subscriber/addData.php} | 0
.../AJAX/Subscriber/checkData.php} | 0
.../{addLcpData.php => addData.php} | 0
.../AJAX/Subscriber/addData.php} | 8 +--
.../AJAX/Subscriber/checkData.php} | 8 +--
.../{addLcpData.php => addData.php} | 2 +-
15 files changed, 180 insertions(+), 85 deletions(-)
create mode 100644 inc/Engine/Common/PerformanceHints/AJAX/ControllerInterface.php
create mode 100644 inc/Engine/Common/PerformanceHints/AJAX/Subscriber.php
create mode 100644 inc/Engine/Common/PerformanceHints/ServiceProvider.php
delete mode 100644 inc/Engine/Media/AboveTheFold/AJAX/Subscriber.php
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold/AJAX/Subscriber/addLcpData.php => Common/PerformanceHints/AJAX/Subscriber/addData.php} (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold/AJAX/Subscriber/checkLcpData.php => Common/PerformanceHints/AJAX/Subscriber/checkData.php} (100%)
rename tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Controller/{addLcpData.php => addData.php} (100%)
rename tests/Integration/inc/Engine/{Media/AboveTheFold/AJAX/Subscriber/addLcpData.php => Common/PerformanceHints/AJAX/Subscriber/addData.php} (82%)
rename tests/Integration/inc/Engine/{Media/AboveTheFold/AJAX/Subscriber/checkLcpData.php => Common/PerformanceHints/AJAX/Subscriber/checkData.php} (80%)
rename tests/Unit/inc/Engine/Media/AboveTheFold/AJAX/Controller/{addLcpData.php => addData.php} (98%)
diff --git a/inc/Engine/Common/PerformanceHints/AJAX/ControllerInterface.php b/inc/Engine/Common/PerformanceHints/AJAX/ControllerInterface.php
new file mode 100644
index 0000000000..98499ec76d
--- /dev/null
+++ b/inc/Engine/Common/PerformanceHints/AJAX/ControllerInterface.php
@@ -0,0 +1,20 @@
+factories = $factories;
+ }
+
+ /**
+ * Return an array of events that this subscriber listens to.
+ *
+ * @return array
+ */
+ public static function get_subscribed_events(): array {
+ return [
+ 'wp_ajax_rocket_lcp' => 'add_data',
+ 'wp_ajax_nopriv_rocket_lcp' => 'add_data',
+ 'wp_ajax_rocket_check_lcp' => 'check_data',
+ 'wp_ajax_nopriv_rocket_check_lcp' => 'check_data',
+ ];
+ }
+
+ /**
+ * Callback for data received from beacon script
+ *
+ * @return void
+ */
+ public function add_data() {
+ foreach ( $this->factories as $factory ) {
+ $factory->get_ajax_controller()->add_data();
+ }
+ }
+
+ /**
+ * Callback for checking data
+ *
+ * @return void
+ */
+ public function check_data() {
+ foreach ( $this->factories as $factory ) {
+ $factory->get_ajax_controller()->check_data();
+ }
+ }
+}
diff --git a/inc/Engine/Common/PerformanceHints/FactoryInterface.php b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
index 829bc08591..4f69bc4d48 100644
--- a/inc/Engine/Common/PerformanceHints/FactoryInterface.php
+++ b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
@@ -3,16 +3,20 @@
namespace WP_Rocket\Engine\Common\PerformanceHints;
-interface AbstractFactory {
+use WP_Rocket\Engine\Common\PerformanceHints\AJAX\ControllerInterface as AjaxControllerInterface;
+
+interface FactoryInterface {
/**
* Provides an Ajax interface.
+ *
+ * @return AjaxControllerInterface
*/
- public function ajax(); // To return Ajax interface when created.
+ public function get_ajax_controller(): AjaxControllerInterface; // To return Ajax interface when created.
/**
* Provides a Frontend interface.
*/
- public function frontend(); // To return Frontend interface when created.
+ public function get_frontend_controller(); // To return Frontend interface when created.
/**
* Provides a Table interface.
diff --git a/inc/Engine/Common/PerformanceHints/ServiceProvider.php b/inc/Engine/Common/PerformanceHints/ServiceProvider.php
new file mode 100644
index 0000000000..ac63da8c8e
--- /dev/null
+++ b/inc/Engine/Common/PerformanceHints/ServiceProvider.php
@@ -0,0 +1,52 @@
+provides, true );
+ }
+
+ /**
+ * Registers the classes in the container
+ *
+ * @return void
+ */
+ public function register(): void {
+
+ $factories = [
+ $this->getContainer()->get( 'atf_factory' ),
+ ];
+
+ $this->getContainer()->addShared( 'performance_hints_ajax_subscriber', AjaxSubscriber::class )
+ ->addArguments(
+ [
+ $factories,
+ ]
+ );
+ }
+}
diff --git a/inc/Engine/Media/AboveTheFold/AJAX/Controller.php b/inc/Engine/Media/AboveTheFold/AJAX/Controller.php
index ed5d60526c..2998824127 100644
--- a/inc/Engine/Media/AboveTheFold/AJAX/Controller.php
+++ b/inc/Engine/Media/AboveTheFold/AJAX/Controller.php
@@ -6,8 +6,9 @@
use WP_Rocket\Engine\Media\AboveTheFold\Database\Queries\AboveTheFold as ATFQuery;
use WP_Rocket\Engine\Common\Context\ContextInterface;
use WP_Rocket\Engine\Optimization\UrlTrait;
+use WP_Rocket\Engine\Common\PerformanceHints\AJAX\ControllerInterface;
-class Controller {
+class Controller implements ControllerInterface {
use UrlTrait;
/**
@@ -47,9 +48,9 @@ public function __construct( ATFQuery $query, ContextInterface $context ) {
/**
* Add LCP data to the database
*
- * @return bool
+ * @return void
*/
- public function add_lcp_data() {
+ public function add_data(): void {
check_ajax_referer( 'rocket_lcp', 'rocket_lcp_nonce' );
if ( ! $this->context->is_allowed() ) {
@@ -248,7 +249,7 @@ private function sanitize_image_url( string $url ) {
*
* @return void
*/
- public function check_lcp_data() {
+ public function check_data(): void {
check_ajax_referer( 'rocket_lcp', 'rocket_lcp_nonce' );
if ( ! $this->context->is_allowed() ) {
diff --git a/inc/Engine/Media/AboveTheFold/AJAX/Subscriber.php b/inc/Engine/Media/AboveTheFold/AJAX/Subscriber.php
deleted file mode 100644
index 6a070c454b..0000000000
--- a/inc/Engine/Media/AboveTheFold/AJAX/Subscriber.php
+++ /dev/null
@@ -1,56 +0,0 @@
-controller = $controller;
- }
-
- /**
- * Array of events this subscriber listens to
- *
- * @return array
- */
- public static function get_subscribed_events() {
- return [
- 'wp_ajax_rocket_lcp' => 'add_lcp_data',
- 'wp_ajax_nopriv_rocket_lcp' => 'add_lcp_data',
- 'wp_ajax_rocket_check_lcp' => 'check_lcp_data',
- 'wp_ajax_nopriv_rocket_check_lcp' => 'check_lcp_data',
- ];
- }
-
- /**
- * Callback for data received from lcp script
- *
- * @return void
- */
- public function add_lcp_data() {
- $this->controller->add_lcp_data();
- }
-
- /**
- * Callback for checking lcp data
- *
- * @return void
- */
- public function check_lcp_data() {
- $this->controller->check_lcp_data();
- }
-}
diff --git a/inc/Engine/Media/AboveTheFold/Factory.php b/inc/Engine/Media/AboveTheFold/Factory.php
index f233931fc9..67d2970307 100644
--- a/inc/Engine/Media/AboveTheFold/Factory.php
+++ b/inc/Engine/Media/AboveTheFold/Factory.php
@@ -4,28 +4,40 @@
namespace WP_Rocket\Engine\Media\AboveTheFold;
-use WP_Rocket\Engine\Common\PerformanceHints\AbstractFactory;
+use WP_Rocket\Engine\Common\PerformanceHints\FactoryInterface;
+use WP_Rocket\Engine\Common\PerformanceHints\AJAX\ControllerInterface as AjaxControllerInterface;
-class Factory implements AbstractFactory {
+class Factory implements FactoryInterface {
+
+ /**
+ * Ajax Controller.
+ *
+ * @var AjaxControllerInterface
+ */
+ protected $ajax_controller;
/**
* Instatiate the class.
+ *
+ * @param AjaxControllerInterface $ajax_controller ATF AJAX Controller.
*/
- public function __construct() {
- // Assign objects to their properties.
+ public function __construct( AjaxControllerInterface $ajax_controller ) {
+ $this->ajax_controller = $ajax_controller;
}
/**
- * Provides an Ajax object.
+ * Provides an Ajax controller object.
+ *
+ * @return AjaxControllerInterface
*/
- public function ajax() {
- // Return Ajax object.
+ public function get_ajax_controller(): AjaxControllerInterface {
+ return $this->ajax_controller;
}
/**
* Provides a Frontend object.
*/
- public function frontend() {
+ public function get_frontend_controller() {
// Return Fontend object.
}
diff --git a/inc/Engine/Media/AboveTheFold/ServiceProvider.php b/inc/Engine/Media/AboveTheFold/ServiceProvider.php
index 480ce279a4..3c2e7b017e 100644
--- a/inc/Engine/Media/AboveTheFold/ServiceProvider.php
+++ b/inc/Engine/Media/AboveTheFold/ServiceProvider.php
@@ -101,9 +101,6 @@ public function register(): void {
]
);
- $this->getContainer()->addShared( 'atf_ajax_subscriber', AJAXSubscriber::class )
- ->addArgument( $this->getContainer()->get( 'atf_ajax_controller' ) );
-
$this->getContainer()->add( 'warmup_apiclient', APIClient::class )
->addArgument( $this->getContainer()->get( 'options' ) );
@@ -122,6 +119,7 @@ public function register(): void {
$this->getContainer()->addShared( 'warmup_subscriber', WarmUpSubscriber::class )
->addArgument( $this->getContainer()->get( 'warmup_controller' ) );
- $this->getContainer()->addShared( 'atf_factory', Factory::class );
+ $this->getContainer()->addShared( 'atf_factory', Factory::class )
+ ->addArgument( $this->getContainer()->get( 'atf_ajax_controller' ) );
}
}
diff --git a/inc/Plugin.php b/inc/Plugin.php
index 104258d8ce..6509468bae 100644
--- a/inc/Plugin.php
+++ b/inc/Plugin.php
@@ -51,6 +51,7 @@
use WP_Rocket\ThirdParty\Themes\ThemeResolver;
use WP_Rocket\Engine\Debug\Resolver as DebugResolver;
use WP_Rocket\Engine\Debug\ServiceProvider as DebugServiceProvider;
+use WP_Rocket\Engine\Common\PerformanceHints\ServiceProvider as PerformanceHintsServiceProvider;
/**
* Plugin Manager.
@@ -304,6 +305,7 @@ private function init_common_subscribers() {
$this->container->addServiceProvider( new ATFServiceProvider() );
$this->container->addServiceProvider( new JobManagerServiceProvider() );
$this->container->addServiceProvider( new SaasAdminServiceProvider() );
+ $this->container->addServiceProvider( new PerformanceHintsServiceProvider() );
$common_subscribers = [
'license_subscriber',
@@ -387,13 +389,13 @@ private function init_common_subscribers() {
'atf_subscriber',
'cron_subscriber',
'atf_admin_subscriber',
- 'atf_ajax_subscriber',
'contactform7',
'debug_subscriber',
'rucss_cron_subscriber',
'atf_cron_subscriber',
'saas_admin_subscriber',
'warmup_subscriber',
+ 'performance_hints_ajax_subscriber',
];
$host_type = HostResolver::get_host_service();
diff --git a/tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/addLcpData.php b/tests/Fixtures/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/addData.php
similarity index 100%
rename from tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/addLcpData.php
rename to tests/Fixtures/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/addData.php
diff --git a/tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/checkLcpData.php b/tests/Fixtures/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/checkData.php
similarity index 100%
rename from tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/checkLcpData.php
rename to tests/Fixtures/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/checkData.php
diff --git a/tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Controller/addLcpData.php b/tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Controller/addData.php
similarity index 100%
rename from tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Controller/addLcpData.php
rename to tests/Fixtures/inc/Engine/Media/AboveTheFold/AJAX/Controller/addData.php
diff --git a/tests/Integration/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/addLcpData.php b/tests/Integration/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/addData.php
similarity index 82%
rename from tests/Integration/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/addLcpData.php
rename to tests/Integration/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/addData.php
index 3dda20d1e9..c2927dd5c1 100644
--- a/tests/Integration/inc/Engine/Media/AboveTheFold/AJAX/Subscriber/addLcpData.php
+++ b/tests/Integration/inc/Engine/Common/PerformanceHints/AJAX/Subscriber/addData.php
@@ -1,15 +1,15 @@
justReturn( $config['filetype'] );
}
- $this->controller->add_lcp_data();
+ $this->controller->add_data();
}
}
From 4149dc25221e09a7debd6288062e17f855633683 Mon Sep 17 00:00:00 2001
From: Michael Lee <38788055+jeawhanlee@users.noreply.github.com>
Date: Mon, 22 Jul 2024 17:56:50 +0100
Subject: [PATCH 016/192] Subtask/6778 3.17 refactor frontend process (#6804)
---
.../PerformanceHints/FactoryInterface.php | 15 +-
.../Frontend/ControllerInterface.php | 25 ++
.../PerformanceHints/Frontend/Processor.php | 217 ++++++++++++++++++
.../PerformanceHints/Frontend/Subscriber.php | 49 ++++
.../PerformanceHints/ServiceProvider.php | 30 ++-
inc/Engine/Media/AboveTheFold/Factory.php | 43 +++-
.../AboveTheFold/Frontend/Controller.php | 139 ++---------
.../AboveTheFold/Frontend/Subscriber.php | 15 +-
.../Media/AboveTheFold/ServiceProvider.php | 8 +-
inc/Plugin.php | 1 +
.../Frontend/Subscriber/HTML/input.html | 0
...nput_lcp_bg_responsive_imgset_template.php | 0
...nput_lcp_bg_responsive_webkit_template.php | 0
.../Subscriber/HTML/input_lcp_image.html | 0
.../Subscriber/HTML/input_lcp_layered_bg.php | 0
.../Subscriber/HTML/input_lcp_picture.php | 0
.../Subscriber/HTML/input_lcp_picture_2.php | 0
.../Subscriber/HTML/input_lcp_picture_3.php | 0
.../Subscriber/HTML/input_lcp_picture_4.php | 0
.../Subscriber/HTML/input_lcp_responsive.php | 0
.../Subscriber/HTML/input_lcp_single_bg.php | 0
.../HTML/input_lcp_with_fetchpriority.html | 0
.../HTML/input_lcp_with_markup_comment.html | 0
.../Subscriber/HTML/input_w_bg_image_lcp.html | 0
.../Subscriber/HTML/input_w_img_lcp.html | 0
.../HTML/input_w_picture_img_lcp.html | 0
.../HTML/input_with_absolute_img_lcp.html | 0
.../HTML/input_with_relative_img_lcp.html | 0
.../Frontend/Subscriber/HTML/output.html | 0
...tput_lcp_bg_responsive_imgset_template.php | 0
...tput_lcp_bg_responsive_webkit_template.php | 0
.../Subscriber/HTML/output_lcp_image.php | 0
.../Subscriber/HTML/output_lcp_layered_bg.php | 0
.../Subscriber/HTML/output_lcp_picture.php | 0
.../Subscriber/HTML/output_lcp_picture_2.php | 0
.../Subscriber/HTML/output_lcp_picture_3.php | 0
.../Subscriber/HTML/output_lcp_picture_4.php | 0
.../Subscriber/HTML/output_lcp_responsive.php | 0
.../Subscriber/HTML/output_lcp_single_bg.php | 0
.../HTML/output_lcp_with_fetchpriority.html | 0
.../HTML/output_lcp_with_markup_comment.html | 0
.../Subscriber/HTML/output_w_beacon.html | 2 +-
.../HTML/output_w_bg_image_lcp.html | 0
.../Subscriber/HTML/output_w_img_lcp.html | 0
.../HTML/output_w_picture_img_lcp.html | 0
.../Subscriber/HTML/output_w_preload.html | 0
.../HTML/output_with_absolute_img_lcp.php | 0
.../HTML/output_with_relative_img_lcp.php | 0
.../Subscriber/maybe_apply_optimizations.php} | 0
.../Subscriber/maybe_apply_optimizations.php} | 16 +-
.../Frontend/Controller/addExclusions.php | 3 +-
51 files changed, 405 insertions(+), 158 deletions(-)
create mode 100644 inc/Engine/Common/PerformanceHints/Frontend/ControllerInterface.php
create mode 100644 inc/Engine/Common/PerformanceHints/Frontend/Processor.php
create mode 100644 inc/Engine/Common/PerformanceHints/Frontend/Subscriber.php
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_bg_responsive_imgset_template.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_bg_responsive_webkit_template.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_image.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_layered_bg.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_picture.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_picture_2.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_picture_3.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_picture_4.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_responsive.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_single_bg.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_with_fetchpriority.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_lcp_with_markup_comment.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_w_bg_image_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_w_img_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_w_picture_img_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_with_absolute_img_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/input_with_relative_img_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_bg_responsive_imgset_template.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_bg_responsive_webkit_template.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_image.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_layered_bg.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_picture.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_picture_2.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_picture_3.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_picture_4.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_responsive.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_single_bg.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_with_fetchpriority.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_lcp_with_markup_comment.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_w_beacon.html (62%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_w_bg_image_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_w_img_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_w_picture_img_lcp.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_w_preload.html (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_with_absolute_img_lcp.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold => Common/PerformanceHints}/Frontend/Subscriber/HTML/output_with_relative_img_lcp.php (100%)
rename tests/Fixtures/inc/Engine/{Media/AboveTheFold/Frontend/Subscriber/lcp.php => Common/PerformanceHints/Frontend/Subscriber/maybe_apply_optimizations.php} (100%)
rename tests/Integration/inc/Engine/{Media/AboveTheFold/Frontend/Subscriber/lcp.php => Common/PerformanceHints/Frontend/Subscriber/maybe_apply_optimizations.php} (55%)
diff --git a/inc/Engine/Common/PerformanceHints/FactoryInterface.php b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
index 4f69bc4d48..278f8650d1 100644
--- a/inc/Engine/Common/PerformanceHints/FactoryInterface.php
+++ b/inc/Engine/Common/PerformanceHints/FactoryInterface.php
@@ -4,6 +4,8 @@
namespace WP_Rocket\Engine\Common\PerformanceHints;
use WP_Rocket\Engine\Common\PerformanceHints\AJAX\ControllerInterface as AjaxControllerInterface;
+use WP_Rocket\Engine\Common\PerformanceHints\Frontend\ControllerInterface as FrontendControllerInterface;
+use WP_Rocket\Engine\Common\Context\ContextInterface;
interface FactoryInterface {
/**
@@ -11,12 +13,14 @@ interface FactoryInterface {
*
* @return AjaxControllerInterface
*/
- public function get_ajax_controller(): AjaxControllerInterface; // To return Ajax interface when created.
+ public function get_ajax_controller(): AjaxControllerInterface;
/**
* Provides a Frontend interface.
+ *
+ * @return FrontendControllerInterface
*/
- public function get_frontend_controller(); // To return Frontend interface when created.
+ public function get_frontend_controller(): FrontendControllerInterface;
/**
* Provides a Table interface.
@@ -27,4 +31,11 @@ public function table(); // To return Table interface when created.
* Provides a Queries interface.
*/
public function queries(); // To return Queries interface when created.
+
+ /**
+ * Provides a Context interface
+ *
+ * @return ContextInterface
+ */
+ public function get_context(): ContextInterface;
}
diff --git a/inc/Engine/Common/PerformanceHints/Frontend/ControllerInterface.php b/inc/Engine/Common/PerformanceHints/Frontend/ControllerInterface.php
new file mode 100644
index 0000000000..882f35192a
--- /dev/null
+++ b/inc/Engine/Common/PerformanceHints/Frontend/ControllerInterface.php
@@ -0,0 +1,25 @@
+factories = $factories;
+ $this->options = $options;
+ $this->query = $query; // Should removed when the database products are returned in the concrete factory.
+ $this->filesystem = $filesystem ?: rocket_direct_filesystem();
+ }
+
+ /**
+ * Apply Performance Hints Optimizations.
+ *
+ * @param string $html HTML content.
+ * @return string
+ */
+ public function maybe_apply_optimizations( string $html ): string {
+ if ( empty( $this->factories ) ) {
+ return $html;
+ }
+
+ global $wp;
+
+ $url = untrailingslashit( home_url( add_query_arg( [], $wp->request ) ) );
+ $is_mobile = $this->is_mobile();
+
+ $row = $this->query->get_row( $url, $is_mobile );
+ if ( empty( $row ) ) {
+ return $this->inject_beacon( $html, $url, $is_mobile );
+ }
+
+ // The DB row check above will need to be updated during the database refactor to something below.
+
+ // phpcs:disable Squiz.Commenting.InlineComment.InvalidEndChar
+ // $html_optimized = null;
+ // foreach ( $this->factories as $factory ) {
+ // $row = $factory->queries()->get_row( $url, $is_mobile );
+ // if ( empty( $row ) ) {
+ // return $this->inject_beacon( $html, $url, $is_mobile );
+ // }
+
+ // $html = $html_optimized ?? $html;
+ // $html_optimized = $factory->get_frontend_controller()->optimize( $html, $row );
+ // }
+
+ // phpcs:enable Squiz.Commenting.InlineComment.InvalidEndChar
+ foreach ( $this->factories as $factory ) {
+ $html = $html_optimized ?? $html;
+ $html_optimized = $factory->get_frontend_controller()->optimize( $html, $row );
+ }
+
+ return $html_optimized;
+ }
+
+ /**
+ * The `inject_beacon` function is used to inject a JavaScript beacon into the HTML content
+ *
+ * @param string $html The HTML content where the beacon will be injected.
+ * @param string $url The current URL.
+ * @param bool $is_mobile True for mobile device, false otherwise.
+ *
+ * @return string The modified HTML content with the beacon script injected just before the closing body tag.
+ */
+ private function inject_beacon( $html, $url, $is_mobile ): string {
+ $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
+
+ if ( ! $this->filesystem->exists( rocket_get_constant( 'WP_ROCKET_ASSETS_JS_PATH' ) . 'lcp-beacon' . $min . '.js' ) ) {
+ return $html;
+ }
+
+ $default_width_threshold = $is_mobile ? 393 : 1600;
+ $default_height_threshold = $is_mobile ? 830 : 700;
+ /**
+ * Filters the width threshold for the LCP beacon.
+ *
+ * @param int $width_threshold The width threshold. Default is 393 for mobile and 1920 for others.
+ * @param bool $is_mobile True if the current device is mobile, false otherwise.
+ * @param string $url The current URL.
+ *
+ * @return int The filtered width threshold.
+ */
+ $width_threshold = rocket_apply_filter_and_deprecated(
+ 'rocket_performance_hints_optimization_width_threshold',
+ [ $default_width_threshold, $is_mobile, $url ],
+ '3.17',
+ 'rocket_lcp_width_threshold'
+ );
+
+ /**
+ * Filters the height threshold for the LCP beacon.
+ *
+ * @param int $height_threshold The height threshold. Default is 830 for mobile and 1080 for others.
+ * @param bool $is_mobile True if the current device is mobile, false otherwise.
+ * @param string $url The current URL.
+ *
+ * @return int The filtered height threshold.
+ */
+ $height_threshold = rocket_apply_filter_and_deprecated(
+ 'rocket_performance_hints_optimization_height_threshold',
+ [ $default_height_threshold, $is_mobile, $url ],
+ '3.17',
+ 'rocket_lcp_height_threshold'
+ );
+
+ if ( ! is_int( $width_threshold ) ) {
+ $width_threshold = $default_width_threshold;
+ }
+
+ if ( ! is_int( $height_threshold ) ) {
+ $height_threshold = $default_height_threshold;
+ }
+
+ $default_delay = 500;
+
+ /**
+ * Filters the delay before the LCP beacon is triggered.
+ *
+ * @param int $delay The delay in milliseconds. Default is 500.
+ */
+ $delay = rocket_apply_filter_and_deprecated(
+ 'rocket_performance_hints_optimization_delay',
+ [ $default_delay ],
+ '3.17',
+ 'rocket_lcp_delay'
+ );
+
+ if ( ! is_int( $delay ) ) {
+ $delay = $default_delay;
+ }
+
+ $data = [
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
+ 'nonce' => wp_create_nonce( 'rocket_lcp' ),
+ 'url' => $url,
+ 'is_mobile' => $is_mobile,
+ 'width_threshold' => $width_threshold,
+ 'height_threshold' => $height_threshold,
+ 'delay' => $delay,
+ 'debug' => rocket_get_constant( 'WP_ROCKET_DEBUG' ),
+ ];
+
+ $data_modified = null;
+ foreach ( $this->factories as $factory ) {
+ $data = $data_modified ?? $data;
+ $data_modified = $factory->get_frontend_controller()->target_elements( $data );
+ }
+
+ $inline_script = '';
+
+ // Get the URL of the script.
+ $script_url = rocket_get_constant( 'WP_ROCKET_ASSETS_JS_URL' ) . 'lcp-beacon' . $min . '.js';
+
+ // Create the script tag.
+ $script_tag = ""; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
+
+ // Append the script tag just before the closing body tag.
+ return str_replace( '
-