Changeset 2977143
- Timestamp:
- 10/10/2023 05:02:18 PM (2 years ago)
- Location:
- litespeed-cache
- Files:
-
- 334 added
- 25 edited
-
tags/5.7 (added)
-
tags/5.7/LICENSE (added)
-
tags/5.7/assets (added)
-
tags/5.7/assets/css (added)
-
tags/5.7/assets/css/fonts (added)
-
tags/5.7/assets/css/fonts/litespeedfont.eot (added)
-
tags/5.7/assets/css/fonts/litespeedfont.svg (added)
-
tags/5.7/assets/css/fonts/litespeedfont.ttf (added)
-
tags/5.7/assets/css/fonts/litespeedfont.woff (added)
-
tags/5.7/assets/css/iziModal.min.css (added)
-
tags/5.7/assets/css/litespeed-legacy.css (added)
-
tags/5.7/assets/css/litespeed.css (added)
-
tags/5.7/assets/img (added)
-
tags/5.7/assets/img/Litespeed.icon.svg (added)
-
tags/5.7/assets/img/iconlscwp.svg (added)
-
tags/5.7/assets/img/icons (added)
-
tags/5.7/assets/img/icons/all.svg (added)
-
tags/5.7/assets/img/icons/all_transients.svg (added)
-
tags/5.7/assets/img/icons/auto_draft.svg (added)
-
tags/5.7/assets/img/icons/cross_icon.svg (added)
-
tags/5.7/assets/img/icons/db.svg (added)
-
tags/5.7/assets/img/icons/empty-cache.svg (added)
-
tags/5.7/assets/img/icons/expired_transient.svg (added)
-
tags/5.7/assets/img/icons/img_optm.svg (added)
-
tags/5.7/assets/img/icons/img_optm_disabled.svg (added)
-
tags/5.7/assets/img/icons/img_webp.svg (added)
-
tags/5.7/assets/img/icons/img_webp_disabled.svg (added)
-
tags/5.7/assets/img/icons/optimize_tables.svg (added)
-
tags/5.7/assets/img/icons/purge-403.svg (added)
-
tags/5.7/assets/img/icons/purge-404.svg (added)
-
tags/5.7/assets/img/icons/purge-500.svg (added)
-
tags/5.7/assets/img/icons/purge-all.svg (added)
-
tags/5.7/assets/img/icons/purge-cssjs.svg (added)
-
tags/5.7/assets/img/icons/purge-front.svg (added)
-
tags/5.7/assets/img/icons/purge-object.svg (added)
-
tags/5.7/assets/img/icons/purge-opcache.svg (added)
-
tags/5.7/assets/img/icons/purge-pages.svg (added)
-
tags/5.7/assets/img/icons/revision.svg (added)
-
tags/5.7/assets/img/icons/spam_comment.svg (added)
-
tags/5.7/assets/img/icons/success_icon.svg (added)
-
tags/5.7/assets/img/icons/trackback-pingback.svg (added)
-
tags/5.7/assets/img/icons/trash_comment.svg (added)
-
tags/5.7/assets/img/icons/trash_post.svg (added)
-
tags/5.7/assets/img/lscwp-logo_90x90.png (added)
-
tags/5.7/assets/img/lscwp_blue_font-icon_22px.svg (added)
-
tags/5.7/assets/img/lscwp_font-icon_32px.svg (added)
-
tags/5.7/assets/img/lscwp_gray-yellow_font-icon_22px.svg (added)
-
tags/5.7/assets/img/lscwp_gray_font-icon_22px.svg (added)
-
tags/5.7/assets/img/lscwp_grayscale_font-icon_22px.svg (added)
-
tags/5.7/assets/img/quic-cloud-icon-16x16.svg (added)
-
tags/5.7/assets/img/quic-cloud-logo-light_stack_300px.png (added)
-
tags/5.7/assets/img/quic-cloud-logo.svg (added)
-
tags/5.7/assets/img/slack-logo.png (added)
-
tags/5.7/assets/js (added)
-
tags/5.7/assets/js/babel.min.js (added)
-
tags/5.7/assets/js/component.cdn.js (added)
-
tags/5.7/assets/js/component.crawler.js (added)
-
tags/5.7/assets/js/css_async.js (added)
-
tags/5.7/assets/js/css_async.min.js (added)
-
tags/5.7/assets/js/guest.docref.js (added)
-
tags/5.7/assets/js/guest.docref.min.js (added)
-
tags/5.7/assets/js/guest.js (added)
-
tags/5.7/assets/js/guest.min.js (added)
-
tags/5.7/assets/js/instant_click.min.js (added)
-
tags/5.7/assets/js/instant_click.ori.js (added)
-
tags/5.7/assets/js/iziModal.min.js (added)
-
tags/5.7/assets/js/js_delay.js (added)
-
tags/5.7/assets/js/js_delay.min.js (added)
-
tags/5.7/assets/js/lazyload.init.js (added)
-
tags/5.7/assets/js/lazyload.lib.js (added)
-
tags/5.7/assets/js/lazyload.min.js (added)
-
tags/5.7/assets/js/litespeed-cache-admin.js (added)
-
tags/5.7/assets/js/react.min.js (added)
-
tags/5.7/assets/js/webfontloader.js (added)
-
tags/5.7/assets/js/webfontloader.min.js (added)
-
tags/5.7/autoload.php (added)
-
tags/5.7/cli (added)
-
tags/5.7/cli/debug.cls.php (added)
-
tags/5.7/cli/image.cls.php (added)
-
tags/5.7/cli/online.cls.php (added)
-
tags/5.7/cli/option.cls.php (added)
-
tags/5.7/cli/presets.cls.php (added)
-
tags/5.7/cli/purge.cls.php (added)
-
tags/5.7/data (added)
-
tags/5.7/data/.htaccess (added)
-
tags/5.7/data/const.default.ini (added)
-
tags/5.7/data/const.network_default.ini (added)
-
tags/5.7/data/css_excludes.txt (added)
-
tags/5.7/data/esi.nonce.txt (added)
-
tags/5.7/data/esi.nonces.txt (added)
-
tags/5.7/data/js_defer_excludes.txt (added)
-
tags/5.7/data/js_excludes.txt (added)
-
tags/5.7/data/optm_uri_exc.txt (added)
-
tags/5.7/data/preset (added)
-
tags/5.7/data/preset/advanced.data (added)
-
tags/5.7/data/preset/aggressive.data (added)
-
tags/5.7/data/preset/basic.data (added)
-
tags/5.7/data/preset/essentials.data (added)
-
tags/5.7/data/preset/extreme.data (added)
-
tags/5.7/data/ucss_whitelist.txt (added)
-
tags/5.7/guest.vary.php (added)
-
tags/5.7/inc (added)
-
tags/5.7/inc/object.lib.php (added)
-
tags/5.7/lang (added)
-
tags/5.7/lang/litespeed-cache.pot (added)
-
tags/5.7/lib (added)
-
tags/5.7/lib/css-min (added)
-
tags/5.7/lib/css-min/colors.cls.php (added)
-
tags/5.7/lib/css-min/minifier.cls.php (added)
-
tags/5.7/lib/css-min/urirewriter.cls.php (added)
-
tags/5.7/lib/css-min/utils.cls.php (added)
-
tags/5.7/lib/guest.cls.php (added)
-
tags/5.7/lib/html-min.cls.php (added)
-
tags/5.7/lib/jsmin.cls.php (added)
-
tags/5.7/lib/jsmin_data (added)
-
tags/5.7/lib/jsmin_data/keywords_after.txt (added)
-
tags/5.7/lib/jsmin_data/keywords_before.txt (added)
-
tags/5.7/lib/jsmin_data/keywords_reserved.txt (added)
-
tags/5.7/lib/jsmin_data/operators.txt (added)
-
tags/5.7/lib/jsmin_data/operators_after.txt (added)
-
tags/5.7/lib/jsmin_data/operators_before.txt (added)
-
tags/5.7/lib/object-cache.php (added)
-
tags/5.7/lib/php-compatibility.func.php (added)
-
tags/5.7/litespeed-cache.php (added)
-
tags/5.7/qc-ping.txt (added)
-
tags/5.7/readme.txt (added)
-
tags/5.7/src (added)
-
tags/5.7/src/activation.cls.php (added)
-
tags/5.7/src/admin-display.cls.php (added)
-
tags/5.7/src/admin-settings.cls.php (added)
-
tags/5.7/src/admin.cls.php (added)
-
tags/5.7/src/api.cls.php (added)
-
tags/5.7/src/avatar.cls.php (added)
-
tags/5.7/src/base.cls.php (added)
-
tags/5.7/src/cdn (added)
-
tags/5.7/src/cdn-setup.cls.php (added)
-
tags/5.7/src/cdn.cls.php (added)
-
tags/5.7/src/cdn/cloudflare.cls.php (added)
-
tags/5.7/src/cdn/quic.cls.php (added)
-
tags/5.7/src/cloud.cls.php (added)
-
tags/5.7/src/conf.cls.php (added)
-
tags/5.7/src/control.cls.php (added)
-
tags/5.7/src/core.cls.php (added)
-
tags/5.7/src/crawler-map.cls.php (added)
-
tags/5.7/src/crawler.cls.php (added)
-
tags/5.7/src/css.cls.php (added)
-
tags/5.7/src/data.cls.php (added)
-
tags/5.7/src/data.upgrade.func.php (added)
-
tags/5.7/src/data_structure (added)
-
tags/5.7/src/data_structure/avatar.sql (added)
-
tags/5.7/src/data_structure/crawler.sql (added)
-
tags/5.7/src/data_structure/crawler_blacklist.sql (added)
-
tags/5.7/src/data_structure/img_optm.sql (added)
-
tags/5.7/src/data_structure/img_optming.sql (added)
-
tags/5.7/src/data_structure/url.sql (added)
-
tags/5.7/src/data_structure/url_file.sql (added)
-
tags/5.7/src/db-optm.cls.php (added)
-
tags/5.7/src/debug2.cls.php (added)
-
tags/5.7/src/doc.cls.php (added)
-
tags/5.7/src/error.cls.php (added)
-
tags/5.7/src/esi.cls.php (added)
-
tags/5.7/src/file.cls.php (added)
-
tags/5.7/src/gui.cls.php (added)
-
tags/5.7/src/health.cls.php (added)
-
tags/5.7/src/htaccess.cls.php (added)
-
tags/5.7/src/img-optm.cls.php (added)
-
tags/5.7/src/import.cls.php (added)
-
tags/5.7/src/instance.cls.php (added)
-
tags/5.7/src/lang.cls.php (added)
-
tags/5.7/src/localization.cls.php (added)
-
tags/5.7/src/media.cls.php (added)
-
tags/5.7/src/metabox.cls.php (added)
-
tags/5.7/src/object-cache.cls.php (added)
-
tags/5.7/src/object.lib.php (added)
-
tags/5.7/src/optimize.cls.php (added)
-
tags/5.7/src/optimizer.cls.php (added)
-
tags/5.7/src/placeholder.cls.php (added)
-
tags/5.7/src/preset.cls.php (added)
-
tags/5.7/src/purge.cls.php (added)
-
tags/5.7/src/report.cls.php (added)
-
tags/5.7/src/rest.cls.php (added)
-
tags/5.7/src/root.cls.php (added)
-
tags/5.7/src/router.cls.php (added)
-
tags/5.7/src/str.cls.php (added)
-
tags/5.7/src/tag.cls.php (added)
-
tags/5.7/src/task.cls.php (added)
-
tags/5.7/src/tool.cls.php (added)
-
tags/5.7/src/ucss.cls.php (added)
-
tags/5.7/src/utility.cls.php (added)
-
tags/5.7/src/vary.cls.php (added)
-
tags/5.7/src/vpi.cls.php (added)
-
tags/5.7/thirdparty (added)
-
tags/5.7/thirdparty/aelia-currencyswitcher.cls.php (added)
-
tags/5.7/thirdparty/amp.cls.php (added)
-
tags/5.7/thirdparty/autoptimize.cls.php (added)
-
tags/5.7/thirdparty/avada.cls.php (added)
-
tags/5.7/thirdparty/bbpress.cls.php (added)
-
tags/5.7/thirdparty/beaver-builder.cls.php (added)
-
tags/5.7/thirdparty/caldera-forms.cls.php (added)
-
tags/5.7/thirdparty/divi-theme-builder.cls.php (added)
-
tags/5.7/thirdparty/elementor.cls.php (added)
-
tags/5.7/thirdparty/entry.inc.php (added)
-
tags/5.7/thirdparty/facetwp.cls.php (added)
-
tags/5.7/thirdparty/gravity-forms.cls.php (added)
-
tags/5.7/thirdparty/litespeed-check.cls.php (added)
-
tags/5.7/thirdparty/nextgengallery.cls.php (added)
-
tags/5.7/thirdparty/perfmatters.cls.php (added)
-
tags/5.7/thirdparty/theme-my-login.cls.php (added)
-
tags/5.7/thirdparty/user-switching.cls.php (added)
-
tags/5.7/thirdparty/wc-pdf-product-vouchers.cls.php (added)
-
tags/5.7/thirdparty/wcml.cls.php (added)
-
tags/5.7/thirdparty/woo-paypal.cls.php (added)
-
tags/5.7/thirdparty/woocommerce.cls.php (added)
-
tags/5.7/thirdparty/woocommerce.content.tpl.php (added)
-
tags/5.7/thirdparty/woocommerce.tab.tpl.php (added)
-
tags/5.7/thirdparty/wp-polls.cls.php (added)
-
tags/5.7/thirdparty/wp-postratings.cls.php (added)
-
tags/5.7/thirdparty/wpdiscuz.cls.php (added)
-
tags/5.7/thirdparty/wplister.cls.php (added)
-
tags/5.7/thirdparty/wpml.cls.php (added)
-
tags/5.7/thirdparty/wptouch.cls.php (added)
-
tags/5.7/thirdparty/yith-wishlist.cls.php (added)
-
tags/5.7/tpl (added)
-
tags/5.7/tpl/banner (added)
-
tags/5.7/tpl/banner/ajax.php (added)
-
tags/5.7/tpl/banner/cloud_news.tpl.php (added)
-
tags/5.7/tpl/banner/cloud_promo.tpl.php (added)
-
tags/5.7/tpl/banner/new_version.php (added)
-
tags/5.7/tpl/banner/new_version_dev.tpl.php (added)
-
tags/5.7/tpl/banner/score.php (added)
-
tags/5.7/tpl/banner/slack.php (added)
-
tags/5.7/tpl/cache (added)
-
tags/5.7/tpl/cache/entry.tpl.php (added)
-
tags/5.7/tpl/cache/entry_network.tpl.php (added)
-
tags/5.7/tpl/cache/more_settings_tip.tpl.php (added)
-
tags/5.7/tpl/cache/network_settings-advanced.tpl.php (added)
-
tags/5.7/tpl/cache/network_settings-browser.tpl.php (added)
-
tags/5.7/tpl/cache/network_settings-cache.tpl.php (added)
-
tags/5.7/tpl/cache/network_settings-excludes.tpl.php (added)
-
tags/5.7/tpl/cache/network_settings-object.tpl.php (added)
-
tags/5.7/tpl/cache/network_settings-purge.tpl.php (added)
-
tags/5.7/tpl/cache/settings-advanced.tpl.php (added)
-
tags/5.7/tpl/cache/settings-browser.tpl.php (added)
-
tags/5.7/tpl/cache/settings-cache.tpl.php (added)
-
tags/5.7/tpl/cache/settings-esi.tpl.php (added)
-
tags/5.7/tpl/cache/settings-excludes.tpl.php (added)
-
tags/5.7/tpl/cache/settings-object.tpl.php (added)
-
tags/5.7/tpl/cache/settings-purge.tpl.php (added)
-
tags/5.7/tpl/cache/settings-ttl.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.browser.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.cache_dropquery.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.cache_favicon.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.cache_mobile.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.cache_resources.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.exclude_cookies.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.exclude_useragent.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.login_cookie.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.object.tpl.php (added)
-
tags/5.7/tpl/cache/settings_inc.purge_on_upgrade.tpl.php (added)
-
tags/5.7/tpl/cdn (added)
-
tags/5.7/tpl/cdn/auto_setup.tpl.php (added)
-
tags/5.7/tpl/cdn/entry.tpl.php (added)
-
tags/5.7/tpl/cdn/manage.tpl.php (added)
-
tags/5.7/tpl/cdn/settings.tpl.php (added)
-
tags/5.7/tpl/crawler (added)
-
tags/5.7/tpl/crawler/blacklist.tpl.php (added)
-
tags/5.7/tpl/crawler/entry.tpl.php (added)
-
tags/5.7/tpl/crawler/map.tpl.php (added)
-
tags/5.7/tpl/crawler/settings-general.tpl.php (added)
-
tags/5.7/tpl/crawler/settings-simulation.tpl.php (added)
-
tags/5.7/tpl/crawler/settings-sitemap.tpl.php (added)
-
tags/5.7/tpl/crawler/summary.tpl.php (added)
-
tags/5.7/tpl/dash (added)
-
tags/5.7/tpl/dash/dashboard.tpl.php (added)
-
tags/5.7/tpl/dash/entry.tpl.php (added)
-
tags/5.7/tpl/dash/network_dash.tpl.php (added)
-
tags/5.7/tpl/db_optm (added)
-
tags/5.7/tpl/db_optm/entry.tpl.php (added)
-
tags/5.7/tpl/db_optm/manage.tpl.php (added)
-
tags/5.7/tpl/db_optm/settings.tpl.php (added)
-
tags/5.7/tpl/esi.tpl.php (added)
-
tags/5.7/tpl/esi_widget_edit.php (added)
-
tags/5.7/tpl/general (added)
-
tags/5.7/tpl/general/entry.tpl.php (added)
-
tags/5.7/tpl/general/network_settings.tpl.php (added)
-
tags/5.7/tpl/general/settings.tpl.php (added)
-
tags/5.7/tpl/general/settings_inc.auto_upgrade.tpl.php (added)
-
tags/5.7/tpl/general/settings_inc.guest.tpl.php (added)
-
tags/5.7/tpl/general/settings_tuning.tpl.php (added)
-
tags/5.7/tpl/img_optm (added)
-
tags/5.7/tpl/img_optm/entry.tpl.php (added)
-
tags/5.7/tpl/img_optm/network_settings.tpl.php (added)
-
tags/5.7/tpl/img_optm/settings.media_webp.tpl.php (added)
-
tags/5.7/tpl/img_optm/settings.tpl.php (added)
-
tags/5.7/tpl/img_optm/summary.tpl.php (added)
-
tags/5.7/tpl/inc (added)
-
tags/5.7/tpl/inc/admin_footer.php (added)
-
tags/5.7/tpl/inc/api_key.php (added)
-
tags/5.7/tpl/inc/check_cache_disabled.php (added)
-
tags/5.7/tpl/inc/check_if_network_disable_all.php (added)
-
tags/5.7/tpl/inc/disabled_all.php (added)
-
tags/5.7/tpl/inc/in_upgrading.php (added)
-
tags/5.7/tpl/inc/metabox.php (added)
-
tags/5.7/tpl/inc/modal.footer.php (added)
-
tags/5.7/tpl/inc/modal.header.php (added)
-
tags/5.7/tpl/inc/show_display_installed.php (added)
-
tags/5.7/tpl/inc/show_error_cookie.php (added)
-
tags/5.7/tpl/inc/show_rule_conflict.php (added)
-
tags/5.7/tpl/page_optm (added)
-
tags/5.7/tpl/page_optm/entry.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_css.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_html.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_js.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_localization.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_media.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_media_exc.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_tuning.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_tuning_css.tpl.php (added)
-
tags/5.7/tpl/page_optm/settings_vpi.tpl.php (added)
-
tags/5.7/tpl/presets (added)
-
tags/5.7/tpl/presets/entry.tpl.php (added)
-
tags/5.7/tpl/presets/standard.tpl.php (added)
-
tags/5.7/tpl/toolbox (added)
-
tags/5.7/tpl/toolbox/beta_test.tpl.php (added)
-
tags/5.7/tpl/toolbox/edit_htaccess.tpl.php (added)
-
tags/5.7/tpl/toolbox/entry.tpl.php (added)
-
tags/5.7/tpl/toolbox/heartbeat.tpl.php (added)
-
tags/5.7/tpl/toolbox/import_export.tpl.php (added)
-
tags/5.7/tpl/toolbox/log_viewer.tpl.php (added)
-
tags/5.7/tpl/toolbox/purge.tpl.php (added)
-
tags/5.7/tpl/toolbox/report.tpl.php (added)
-
tags/5.7/tpl/toolbox/settings-debug.tpl.php (added)
-
trunk/assets/css/litespeed.css (modified) (1 diff)
-
trunk/assets/img/quic-cloud-logo-light_stack_300px.png (added)
-
trunk/assets/img/quic-cloud-logo.svg (added)
-
trunk/data/const.default.ini (modified) (2 diffs)
-
trunk/lang/litespeed-cache.pot (modified) (35 diffs)
-
trunk/lib/guest.cls.php (modified) (12 diffs)
-
trunk/litespeed-cache.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/admin-settings.cls.php (modified) (17 diffs)
-
trunk/src/base.cls.php (modified) (2 diffs)
-
trunk/src/cdn.cls.php (modified) (1 diff)
-
trunk/src/cdn/quic.cls.php (modified) (6 diffs)
-
trunk/src/cloud.cls.php (modified) (3 diffs)
-
trunk/src/control.cls.php (modified) (1 diff)
-
trunk/src/crawler.cls.php (modified) (1 diff)
-
trunk/src/doc.cls.php (modified) (1 diff)
-
trunk/src/esi.cls.php (modified) (57 diffs)
-
trunk/src/htaccess.cls.php (modified) (2 diffs)
-
trunk/src/img-optm.cls.php (modified) (3 diffs)
-
trunk/src/lang.cls.php (modified) (1 diff)
-
trunk/src/media.cls.php (modified) (1 diff)
-
trunk/src/optimize.cls.php (modified) (6 diffs)
-
trunk/thirdparty/litespeed-check.cls.php (modified) (9 diffs)
-
trunk/thirdparty/woocommerce.cls.php (modified) (36 diffs)
-
trunk/thirdparty/woocommerce.content.tpl.php (modified) (2 diffs)
-
trunk/tpl/dash/dashboard.tpl.php (modified) (1 diff)
-
trunk/tpl/page_optm/settings_html.tpl.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
litespeed-cache/trunk/assets/css/litespeed.css
r2954001 r2977143 298 298 .litespeed-left20 { 299 299 margin-left: 20px; 300 } 301 302 .litespeed-wrap .litespeed-bg-quic-cloud { 303 background: linear-gradient(rgba(230,242,242,1) 10%, rgba(250,255,255,1) 30%); 300 304 } 301 305 -
litespeed-cache/trunk/data/const.default.ini
r2846360 r2977143 35 35 Pingdom 36 36 bot 37 spider 37 38 PTST 38 39 HeadlessChrome' … … 391 392 optm-dns_prefetch_ctrl = false 392 393 394 ; O_OPTM_DNS_PRECONNECT 395 optm-dns_preconnect = '' 396 393 397 optm-exc = '' 394 398 -
litespeed-cache/trunk/lang/litespeed-cache.pot
r2954001 r2977143 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: LiteSpeed Cache 5. 6\n"5 "Project-Id-Version: LiteSpeed Cache 5.7\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n" 7 "POT-Creation-Date: 2023- 07-26 13:52:36+00:00\n"7 "POT-Creation-Date: 2023-10-10 13:10:37+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=UTF-8\n" … … 72 72 msgstr "" 73 73 74 #: src/admin-display.cls.php:135 src/lang.cls.php:24 374 #: src/admin-display.cls.php:135 src/lang.cls.php:244 75 75 msgid "Crawler" 76 76 msgstr "" … … 110 110 #: src/admin-display.cls.php:238 src/admin-display.cls.php:900 111 111 #: src/admin-display.cls.php:929 src/admin-display.cls.php:980 112 #: src/doc.cls.php:3 1tpl/cache/settings-cache.tpl.php:19112 #: src/doc.cls.php:32 tpl/cache/settings-cache.tpl.php:19 113 113 #: tpl/cache/settings_inc.cache_mobile.tpl.php:71 tpl/cdn/settings.tpl.php:49 114 114 #: tpl/page_optm/settings_css.tpl.php:189 … … 206 206 #: src/admin-display.cls.php:1180 tpl/cache/settings-esi.tpl.php:95 207 207 #: tpl/page_optm/settings_css.tpl.php:192 208 #: tpl/page_optm/settings_html.tpl.php: 85208 #: tpl/page_optm/settings_html.tpl.php:106 209 209 #: tpl/page_optm/settings_media.tpl.php:245 210 210 #: tpl/page_optm/settings_media_exc.tpl.php:26 … … 240 240 msgstr "" 241 241 242 #: src/admin-display.cls.php:1198 src/doc.cls.php:9 6242 #: src/admin-display.cls.php:1198 src/doc.cls.php:98 243 243 msgid "One per line." 244 244 msgstr "" … … 260 260 msgstr "" 261 261 262 #: src/admin-settings.cls.php:2 45 src/admin-settings.cls.php:279262 #: src/admin-settings.cls.php:270 src/admin-settings.cls.php:305 263 263 msgid "Options saved." 264 264 msgstr "" … … 327 327 msgstr "" 328 328 329 #: src/cdn-setup.cls.php:322 src/cloud.cls.php:82 0 src/cloud.cls.php:828330 #: src/cloud.cls.php:123 5329 #: src/cdn-setup.cls.php:322 src/cloud.cls.php:822 src/cloud.cls.php:830 330 #: src/cloud.cls.php:1237 331 331 msgid "Message from QUIC.cloud server" 332 332 msgstr "" 333 333 334 334 #: src/cloud.cls.php:394 src/cloud.cls.php:407 src/cloud.cls.php:452 335 #: src/cloud.cls.php:477 src/cloud.cls.php:62 5 src/cloud.cls.php:1204335 #: src/cloud.cls.php:477 src/cloud.cls.php:627 src/cloud.cls.php:1206 336 336 msgid "Cloud Error" 337 337 msgstr "" … … 345 345 msgstr "" 346 346 347 #: src/cloud.cls.php:58 4347 #: src/cloud.cls.php:585 348 348 msgid "In order to use QC services, need a real domain name, cannot use an IP." 349 349 msgstr "" 350 350 351 #: src/cloud.cls.php:62 5351 #: src/cloud.cls.php:627 352 352 msgid "Please try after %1$s for service %2$s." 353 353 msgstr "" 354 354 355 #: src/cloud.cls.php:71 5 src/cloud.cls.php:736355 #: src/cloud.cls.php:717 src/cloud.cls.php:738 356 356 msgid "Failed to request via WordPress" 357 357 msgstr "" 358 358 359 #: src/cloud.cls.php:75 5359 #: src/cloud.cls.php:757 360 360 msgid "" 361 361 "Cloud server refused the current request due to unpulled images. Please pull " … … 363 363 msgstr "" 364 364 365 #: src/cloud.cls.php:76 0365 #: src/cloud.cls.php:762 366 366 msgid "" 367 367 "Your domain_key has been temporarily blocklisted to prevent abuse. You may " … … 369 369 msgstr "" 370 370 371 #: src/cloud.cls.php:76 7371 #: src/cloud.cls.php:769 372 372 msgid "" 373 373 "Cloud server refused the current request due to rate limiting. Please try " … … 375 375 msgstr "" 376 376 377 #: src/cloud.cls.php:77 5377 #: src/cloud.cls.php:777 378 378 msgid "Redetected node" 379 379 msgstr "" 380 380 381 #: src/cloud.cls.php:78 3381 #: src/cloud.cls.php:785 382 382 msgid "" 383 383 "We are working hard to improve your online service experience. The service " … … 385 385 msgstr "" 386 386 387 #: src/cloud.cls.php:83 6387 #: src/cloud.cls.php:838 388 388 msgid "Good news from QUIC.cloud server" 389 389 msgstr "" 390 390 391 #: src/cloud.cls.php:84 5391 #: src/cloud.cls.php:847 392 392 msgid "%1$s plugin version %2$s required for this action." 393 393 msgstr "" 394 394 395 #: src/cloud.cls.php:90 2 src/cloud.cls.php:1224395 #: src/cloud.cls.php:904 src/cloud.cls.php:1226 396 396 msgid "Failed to communicate with QUIC.cloud server" 397 397 msgstr "" 398 398 399 #: src/cloud.cls.php:94 5399 #: src/cloud.cls.php:947 400 400 msgid "" 401 401 "Site not recognized. Domain Key has been automatically removed. Please " … … 403 403 msgstr "" 404 404 405 #: src/cloud.cls.php:94 6src/error.cls.php:48405 #: src/cloud.cls.php:948 src/error.cls.php:48 406 406 msgid "Click here to set." 407 407 msgstr "" 408 408 409 #: src/cloud.cls.php:101 4409 #: src/cloud.cls.php:1016 410 410 msgid "Cannot request REST API, no token saved." 411 411 msgstr "" 412 412 413 #: src/cloud.cls.php:104 0413 #: src/cloud.cls.php:1042 414 414 msgid "Cloud REST Error" 415 415 msgstr "" 416 416 417 #: src/cloud.cls.php:106 0417 #: src/cloud.cls.php:1062 418 418 msgid "Unknown error." 419 419 msgstr "" 420 420 421 #: src/cloud.cls.php:106 4421 #: src/cloud.cls.php:1066 422 422 msgid "Contact QUIC.cloud support" 423 423 msgstr "" 424 424 425 #: src/cloud.cls.php:106 6425 #: src/cloud.cls.php:1068 426 426 msgid "Cloud REST API returned error: " 427 427 msgstr "" 428 428 429 #: src/cloud.cls.php:124 3429 #: src/cloud.cls.php:1245 430 430 msgid "" 431 431 "Applied for Domain Key successfully. Please wait for result. Domain Key will " … … 433 433 msgstr "" 434 434 435 #: src/cloud.cls.php:1 299435 #: src/cloud.cls.php:1301 436 436 msgid "" 437 437 "Congratulations, your Domain Key has been approved! The setting has been " … … 439 439 msgstr "" 440 440 441 #: src/cloud.cls.php:1 395441 #: src/cloud.cls.php:1400 442 442 msgid "QUIC.cloud account has been created and successfully linked." 443 443 msgstr "" 444 444 445 #: src/cloud.cls.php:1 396445 #: src/cloud.cls.php:1401 446 446 msgid "QUIC.cloud account has been successfully linked." 447 447 msgstr "" 448 448 449 #: src/cloud.cls.php:140 4449 #: src/cloud.cls.php:1409 450 450 msgid "Domain Key hash mismatch" 451 451 msgstr "" 452 452 453 #: src/cloud.cls.php:153 0453 #: src/cloud.cls.php:1535 454 454 msgid "Sync credit allowance with Cloud Server successfully." 455 455 msgstr "" … … 573 573 msgstr "" 574 574 575 #: src/doc.cls.php:3 1576 msgid "This setting is passively %1$s due to %2$s!"577 msgstr "" 578 579 #: src/doc.cls.php:4 4575 #: src/doc.cls.php:32 576 msgid "This setting is %1$s for certain qualifying requests due to %2$s!" 577 msgstr "" 578 579 #: src/doc.cls.php:46 580 580 msgid "This setting will regenerate crawler list and clear the disabled list!" 581 581 msgstr "" 582 582 583 #: src/doc.cls.php:5 6583 #: src/doc.cls.php:58 584 584 msgid "" 585 585 "This site utilizes caching in order to facilitate a faster response time and " … … 593 593 msgstr "" 594 594 595 #: src/doc.cls.php:5 7595 #: src/doc.cls.php:59 596 596 msgid "Please see %s for more details." 597 597 msgstr "" 598 598 599 #: src/doc.cls.php:7 4 src/doc.cls.php:128tpl/cdn/manage.tpl.php:67599 #: src/doc.cls.php:76 src/doc.cls.php:130 tpl/cdn/manage.tpl.php:67 600 600 #: tpl/dash/dashboard.tpl.php:46 tpl/img_optm/summary.tpl.php:48 601 601 #: tpl/inc/check_cache_disabled.php:42 … … 603 603 msgstr "" 604 604 605 #: src/doc.cls.php:11 2605 #: src/doc.cls.php:114 606 606 msgid "Both full and partial strings can be used." 607 607 msgstr "" 608 608 609 #: src/doc.cls.php:11 4609 #: src/doc.cls.php:116 610 610 msgid "Both full URLs and partial strings can be used." 611 611 msgstr "" 612 612 613 #: src/doc.cls.php:12 7613 #: src/doc.cls.php:129 614 614 msgid "This setting will edit the .htaccess file." 615 615 msgstr "" 616 616 617 #: src/doc.cls.php:14 1617 #: src/doc.cls.php:143 618 618 msgid "" 619 619 "For online services to work correctly, you must allowlist all %s server IPs." 620 620 msgstr "" 621 621 622 #: src/doc.cls.php:14 2622 #: src/doc.cls.php:144 623 623 msgid "" 624 624 "Before generating key, please verify all IPs on this list are allowlisted" 625 625 msgstr "" 626 626 627 #: src/doc.cls.php:14 3tpl/general/settings.tpl.php:89627 #: src/doc.cls.php:145 tpl/general/settings.tpl.php:89 628 628 msgid "Current Online Server IPs" 629 629 msgstr "" 630 630 631 #: src/doc.cls.php:15 6631 #: src/doc.cls.php:158 632 632 msgid "The queue is processed asynchronously. It may take time." 633 633 msgstr "" … … 878 878 msgstr "" 879 879 880 #: src/gui.cls.php:556 src/gui.cls.php:716 src/lang.cls.php:17 5880 #: src/gui.cls.php:556 src/gui.cls.php:716 src/lang.cls.php:176 881 881 #: tpl/presets/standard.tpl.php:42 tpl/toolbox/purge.tpl.php:106 882 882 msgid "Gravatar Cache" … … 980 980 msgstr "" 981 981 982 #: src/img-optm.cls.php:12 09982 #: src/img-optm.cls.php:1215 983 983 msgid "Destroy all optimization data successfully." 984 984 msgstr "" 985 985 986 #: src/img-optm.cls.php:127 0 src/img-optm.cls.php:1332986 #: src/img-optm.cls.php:1278 src/img-optm.cls.php:1340 987 987 msgid "Rescanned successfully." 988 988 msgstr "" 989 989 990 #: src/img-optm.cls.php:13 32990 #: src/img-optm.cls.php:1340 991 991 msgid "Rescanned %d images successfully." 992 992 msgstr "" 993 993 994 #: src/img-optm.cls.php:1 397994 #: src/img-optm.cls.php:1405 995 995 msgid "Calculated backups successfully." 996 996 msgstr "" 997 997 998 #: src/img-optm.cls.php:14 89998 #: src/img-optm.cls.php:1497 999 999 msgid "Removed backups successfully." 1000 1000 msgstr "" 1001 1001 1002 #: src/img-optm.cls.php:16 741002 #: src/img-optm.cls.php:1682 1003 1003 msgid "Switched images successfully." 1004 1004 msgstr "" 1005 1005 1006 #: src/img-optm.cls.php:17 19 src/img-optm.cls.php:17651006 #: src/img-optm.cls.php:1727 src/img-optm.cls.php:1773 1007 1007 msgid "Switched to optimized file successfully." 1008 1008 msgstr "" 1009 1009 1010 #: src/img-optm.cls.php:17 381010 #: src/img-optm.cls.php:1746 1011 1011 msgid "Disabled WebP file successfully." 1012 1012 msgstr "" 1013 1013 1014 #: src/img-optm.cls.php:17 431014 #: src/img-optm.cls.php:1751 1015 1015 msgid "Enabled WebP file successfully." 1016 1016 msgstr "" 1017 1017 1018 #: src/img-optm.cls.php:17 591018 #: src/img-optm.cls.php:1767 1019 1019 msgid "Restored original file successfully." 1020 1020 msgstr "" 1021 1021 1022 #: src/img-optm.cls.php:18 161022 #: src/img-optm.cls.php:1824 1023 1023 msgid "Reset the optimized data successfully." 1024 1024 msgstr "" … … 1357 1357 1358 1358 #: src/lang.cls.php:158 1359 msgid "DNS Preconnect" 1360 msgstr "" 1361 1362 #: src/lang.cls.php:159 1359 1363 msgid "CSS Excludes" 1360 1364 msgstr "" 1361 1365 1362 #: src/lang.cls.php:1 591366 #: src/lang.cls.php:160 1363 1367 msgid "JS Delayed Includes" 1364 1368 msgstr "" 1365 1369 1366 #: src/lang.cls.php:16 01370 #: src/lang.cls.php:161 1367 1371 msgid "JS Excludes" 1368 1372 msgstr "" 1369 1373 1370 #: src/lang.cls.php:16 11374 #: src/lang.cls.php:162 1371 1375 msgid "Remove Query Strings" 1372 1376 msgstr "" 1373 1377 1374 #: src/lang.cls.php:16 21378 #: src/lang.cls.php:163 1375 1379 msgid "Load Google Fonts Asynchronously" 1376 1380 msgstr "" 1377 1381 1378 #: src/lang.cls.php:16 31382 #: src/lang.cls.php:164 1379 1383 msgid "Remove Google Fonts" 1380 1384 msgstr "" 1381 1385 1382 #: src/lang.cls.php:16 41386 #: src/lang.cls.php:165 1383 1387 msgid "Critical CSS Rules" 1384 1388 msgstr "" 1385 1389 1386 #: src/lang.cls.php:16 51390 #: src/lang.cls.php:166 1387 1391 msgid "Separate CCSS Cache Post Types" 1388 1392 msgstr "" 1389 1393 1390 #: src/lang.cls.php:16 61394 #: src/lang.cls.php:167 1391 1395 msgid "Separate CCSS Cache URIs" 1392 1396 msgstr "" 1393 1397 1394 #: src/lang.cls.php:16 71398 #: src/lang.cls.php:168 1395 1399 msgid "JS Deferred / Delayed Excludes" 1396 1400 msgstr "" 1397 1401 1398 #: src/lang.cls.php:16 81402 #: src/lang.cls.php:169 1399 1403 msgid "Guest Mode JS Excludes" 1400 1404 msgstr "" 1401 1405 1402 #: src/lang.cls.php:1 69tpl/presets/standard.tpl.php:441406 #: src/lang.cls.php:170 tpl/presets/standard.tpl.php:44 1403 1407 msgid "Remove WordPress Emoji" 1404 1408 msgstr "" 1405 1409 1406 #: src/lang.cls.php:17 0tpl/presets/standard.tpl.php:451410 #: src/lang.cls.php:171 tpl/presets/standard.tpl.php:45 1407 1411 msgid "Remove Noscript Tags" 1408 1412 msgstr "" 1409 1413 1410 #: src/lang.cls.php:17 11414 #: src/lang.cls.php:172 1411 1415 msgid "URI Excludes" 1412 1416 msgstr "" 1413 1417 1414 #: src/lang.cls.php:17 21418 #: src/lang.cls.php:173 1415 1419 msgid "Optimize for Guests Only" 1416 1420 msgstr "" 1417 1421 1418 #: src/lang.cls.php:17 31422 #: src/lang.cls.php:174 1419 1423 msgid "Role Excludes" 1420 1424 msgstr "" 1421 1425 1422 #: src/lang.cls.php:17 61426 #: src/lang.cls.php:177 1423 1427 msgid "Gravatar Cache Cron" 1424 1428 msgstr "" 1425 1429 1426 #: src/lang.cls.php:17 71430 #: src/lang.cls.php:178 1427 1431 msgid "Gravatar Cache TTL" 1428 1432 msgstr "" 1429 1433 1430 #: src/lang.cls.php:1 791434 #: src/lang.cls.php:180 1431 1435 msgid "Lazy Load Images" 1432 1436 msgstr "" 1433 1437 1434 #: src/lang.cls.php:18 01438 #: src/lang.cls.php:181 1435 1439 msgid "Lazy Load Image Excludes" 1436 1440 msgstr "" 1437 1441 1438 #: src/lang.cls.php:18 11442 #: src/lang.cls.php:182 1439 1443 msgid "Lazy Load Image Class Name Excludes" 1440 1444 msgstr "" 1441 1445 1442 #: src/lang.cls.php:18 21446 #: src/lang.cls.php:183 1443 1447 msgid "Lazy Load Image Parent Class Name Excludes" 1444 1448 msgstr "" 1445 1449 1446 #: src/lang.cls.php:18 31450 #: src/lang.cls.php:184 1447 1451 msgid "Lazy Load Iframe Class Name Excludes" 1448 1452 msgstr "" 1449 1453 1450 #: src/lang.cls.php:18 41454 #: src/lang.cls.php:185 1451 1455 msgid "Lazy Load Iframe Parent Class Name Excludes" 1452 1456 msgstr "" 1453 1457 1454 #: src/lang.cls.php:18 51458 #: src/lang.cls.php:186 1455 1459 msgid "Lazy Load URI Excludes" 1456 1460 msgstr "" 1457 1461 1458 #: src/lang.cls.php:18 61462 #: src/lang.cls.php:187 1459 1463 msgid "LQIP Excludes" 1460 1464 msgstr "" 1461 1465 1462 #: src/lang.cls.php:18 71466 #: src/lang.cls.php:188 1463 1467 msgid "Basic Image Placeholder" 1464 1468 msgstr "" 1465 1469 1466 #: src/lang.cls.php:18 81470 #: src/lang.cls.php:189 1467 1471 msgid "Responsive Placeholder" 1468 1472 msgstr "" 1469 1473 1470 #: src/lang.cls.php:1 891474 #: src/lang.cls.php:190 1471 1475 msgid "Responsive Placeholder Color" 1472 1476 msgstr "" 1473 1477 1474 #: src/lang.cls.php:19 01478 #: src/lang.cls.php:191 1475 1479 msgid "Responsive Placeholder SVG" 1476 1480 msgstr "" 1477 1481 1478 #: src/lang.cls.php:19 11482 #: src/lang.cls.php:192 1479 1483 msgid "LQIP Cloud Generator" 1480 1484 msgstr "" 1481 1485 1482 #: src/lang.cls.php:19 21486 #: src/lang.cls.php:193 1483 1487 msgid "LQIP Quality" 1484 1488 msgstr "" 1485 1489 1486 #: src/lang.cls.php:19 31490 #: src/lang.cls.php:194 1487 1491 msgid "LQIP Minimum Dimensions" 1488 1492 msgstr "" 1489 1493 1490 #: src/lang.cls.php:19 51494 #: src/lang.cls.php:196 1491 1495 msgid "Generate LQIP In Background" 1492 1496 msgstr "" 1493 1497 1494 #: src/lang.cls.php:19 61498 #: src/lang.cls.php:197 1495 1499 msgid "Lazy Load Iframes" 1496 1500 msgstr "" 1497 1501 1498 #: src/lang.cls.php:19 71502 #: src/lang.cls.php:198 1499 1503 msgid "Add Missing Sizes" 1500 1504 msgstr "" 1501 1505 1502 #: src/lang.cls.php:19 8src/metabox.cls.php:31 src/metabox.cls.php:321506 #: src/lang.cls.php:199 src/metabox.cls.php:31 src/metabox.cls.php:32 1503 1507 #: tpl/page_optm/settings_vpi.tpl.php:12 1504 1508 msgid "Viewport Images" 1505 1509 msgstr "" 1506 1510 1507 #: src/lang.cls.php: 1991511 #: src/lang.cls.php:200 1508 1512 msgid "Viewport Images Cron" 1509 1513 msgstr "" 1510 1514 1511 #: src/lang.cls.php:20 11515 #: src/lang.cls.php:202 1512 1516 msgid "Auto Request Cron" 1513 1517 msgstr "" 1514 1518 1515 #: src/lang.cls.php:20 21519 #: src/lang.cls.php:203 1516 1520 msgid "Auto Pull Cron" 1517 1521 msgstr "" 1518 1522 1519 #: src/lang.cls.php:20 31523 #: src/lang.cls.php:204 1520 1524 msgid "Optimize Original Images" 1521 1525 msgstr "" 1522 1526 1523 #: src/lang.cls.php:20 41527 #: src/lang.cls.php:205 1524 1528 msgid "Remove Original Backups" 1525 1529 msgstr "" 1526 1530 1527 #: src/lang.cls.php:20 51531 #: src/lang.cls.php:206 1528 1532 msgid "Image WebP Replacement" 1529 1533 msgstr "" 1530 1534 1531 #: src/lang.cls.php:20 61535 #: src/lang.cls.php:207 1532 1536 msgid "Optimize Losslessly" 1533 1537 msgstr "" 1534 1538 1535 #: src/lang.cls.php:20 71539 #: src/lang.cls.php:208 1536 1540 msgid "Preserve EXIF/XMP data" 1537 1541 msgstr "" 1538 1542 1539 #: src/lang.cls.php:20 81543 #: src/lang.cls.php:209 1540 1544 msgid "WebP Attribute To Replace" 1541 1545 msgstr "" 1542 1546 1543 #: src/lang.cls.php:2 091547 #: src/lang.cls.php:210 1544 1548 msgid "WebP For Extra srcset" 1545 1549 msgstr "" 1546 1550 1547 #: src/lang.cls.php:21 01551 #: src/lang.cls.php:211 1548 1552 msgid "WordPress Image Quality Control" 1549 1553 msgstr "" 1550 1554 1551 #: src/lang.cls.php:21 1tpl/esi_widget_edit.php:361555 #: src/lang.cls.php:212 tpl/esi_widget_edit.php:36 1552 1556 msgid "Enable ESI" 1553 1557 msgstr "" 1554 1558 1555 #: src/lang.cls.php:21 21559 #: src/lang.cls.php:213 1556 1560 msgid "Cache Admin Bar" 1557 1561 msgstr "" 1558 1562 1559 #: src/lang.cls.php:21 31563 #: src/lang.cls.php:214 1560 1564 msgid "Cache Comment Form" 1561 1565 msgstr "" 1562 1566 1563 #: src/lang.cls.php:21 41567 #: src/lang.cls.php:215 1564 1568 msgid "ESI Nonces" 1565 1569 msgstr "" 1566 1570 1567 #: src/lang.cls.php:21 5tpl/page_optm/settings_css.tpl.php:1211571 #: src/lang.cls.php:216 tpl/page_optm/settings_css.tpl.php:121 1568 1572 #: tpl/page_optm/settings_css.tpl.php:238 tpl/page_optm/settings_vpi.tpl.php:67 1569 1573 msgid "Vary Group" 1570 1574 msgstr "" 1571 1575 1572 #: src/lang.cls.php:21 61576 #: src/lang.cls.php:217 1573 1577 msgid "Purge All Hooks" 1574 1578 msgstr "" 1575 1579 1576 #: src/lang.cls.php:21 71580 #: src/lang.cls.php:218 1577 1581 msgid "Improve HTTP/HTTPS Compatibility" 1578 1582 msgstr "" 1579 1583 1580 #: src/lang.cls.php:21 81584 #: src/lang.cls.php:219 1581 1585 msgid "Instant Click" 1582 1586 msgstr "" 1583 1587 1584 #: src/lang.cls.php:2 191588 #: src/lang.cls.php:220 1585 1589 msgid "Do Not Cache Cookies" 1586 1590 msgstr "" 1587 1591 1588 #: src/lang.cls.php:22 01592 #: src/lang.cls.php:221 1589 1593 msgid "Do Not Cache User Agents" 1590 1594 msgstr "" 1591 1595 1592 #: src/lang.cls.php:22 11596 #: src/lang.cls.php:222 1593 1597 msgid "Login Cookie" 1594 1598 msgstr "" 1595 1599 1596 #: src/lang.cls.php:22 31600 #: src/lang.cls.php:224 1597 1601 msgid "Frontend Heartbeat Control" 1598 1602 msgstr "" 1599 1603 1600 #: src/lang.cls.php:22 41604 #: src/lang.cls.php:225 1601 1605 msgid "Frontend Heartbeat TTL" 1602 1606 msgstr "" 1603 1607 1604 #: src/lang.cls.php:22 51608 #: src/lang.cls.php:226 1605 1609 msgid "Backend Heartbeat Control" 1606 1610 msgstr "" 1607 1611 1608 #: src/lang.cls.php:22 61612 #: src/lang.cls.php:227 1609 1613 msgid "Backend Heartbeat TTL" 1610 1614 msgstr "" 1611 1615 1612 #: src/lang.cls.php:22 71616 #: src/lang.cls.php:228 1613 1617 msgid "Editor Heartbeat" 1614 1618 msgstr "" 1615 1619 1616 #: src/lang.cls.php:22 81620 #: src/lang.cls.php:229 1617 1621 msgid "Editor Heartbeat TTL" 1618 1622 msgstr "" 1619 1623 1620 #: src/lang.cls.php:23 01624 #: src/lang.cls.php:231 1621 1625 msgid "QUIC.cloud CDN" 1622 1626 msgstr "" 1623 1627 1624 #: src/lang.cls.php:23 11628 #: src/lang.cls.php:232 1625 1629 msgid "Use CDN Mapping" 1626 1630 msgstr "" 1627 1631 1628 #: src/lang.cls.php:23 21632 #: src/lang.cls.php:233 1629 1633 msgid "CDN URL" 1630 1634 msgstr "" 1631 1635 1632 #: src/lang.cls.php:23 31636 #: src/lang.cls.php:234 1633 1637 msgid "Include Images" 1634 1638 msgstr "" 1635 1639 1636 #: src/lang.cls.php:23 41640 #: src/lang.cls.php:235 1637 1641 msgid "Include CSS" 1638 1642 msgstr "" 1639 1643 1640 #: src/lang.cls.php:23 51644 #: src/lang.cls.php:236 1641 1645 msgid "Include JS" 1642 1646 msgstr "" 1643 1647 1644 #: src/lang.cls.php:23 6tpl/cdn/settings.tpl.php:1021648 #: src/lang.cls.php:237 tpl/cdn/settings.tpl.php:102 1645 1649 msgid "Include File Types" 1646 1650 msgstr "" 1647 1651 1648 #: src/lang.cls.php:23 71652 #: src/lang.cls.php:238 1649 1653 msgid "HTML Attribute To Replace" 1650 1654 msgstr "" 1651 1655 1652 #: src/lang.cls.php:23 81656 #: src/lang.cls.php:239 1653 1657 msgid "Original URLs" 1654 1658 msgstr "" 1655 1659 1656 #: src/lang.cls.php:2 391660 #: src/lang.cls.php:240 1657 1661 msgid "Included Directories" 1658 1662 msgstr "" 1659 1663 1660 #: src/lang.cls.php:24 01664 #: src/lang.cls.php:241 1661 1665 msgid "Exclude Path" 1662 1666 msgstr "" 1663 1667 1664 #: src/lang.cls.php:24 11668 #: src/lang.cls.php:242 1665 1669 msgid "Cloudflare API" 1666 1670 msgstr "" 1667 1671 1668 #: src/lang.cls.php:24 41672 #: src/lang.cls.php:245 1669 1673 msgid "Delay" 1670 1674 msgstr "" 1671 1675 1672 #: src/lang.cls.php:24 51676 #: src/lang.cls.php:246 1673 1677 msgid "Run Duration" 1674 1678 msgstr "" 1675 1679 1676 #: src/lang.cls.php:24 61680 #: src/lang.cls.php:247 1677 1681 msgid "Interval Between Runs" 1678 1682 msgstr "" 1679 1683 1680 #: src/lang.cls.php:24 71684 #: src/lang.cls.php:248 1681 1685 msgid "Crawl Interval" 1682 1686 msgstr "" 1683 1687 1684 #: src/lang.cls.php:24 81688 #: src/lang.cls.php:249 1685 1689 msgid "Threads" 1686 1690 msgstr "" 1687 1691 1688 #: src/lang.cls.php:2 491692 #: src/lang.cls.php:250 1689 1693 msgid "Timeout" 1690 1694 msgstr "" 1691 1695 1692 #: src/lang.cls.php:25 01696 #: src/lang.cls.php:251 1693 1697 msgid "Server Load Limit" 1694 1698 msgstr "" 1695 1699 1696 #: src/lang.cls.php:25 11700 #: src/lang.cls.php:252 1697 1701 msgid "Role Simulation" 1698 1702 msgstr "" 1699 1703 1700 #: src/lang.cls.php:25 21704 #: src/lang.cls.php:253 1701 1705 msgid "Cookie Simulation" 1702 1706 msgstr "" 1703 1707 1704 #: src/lang.cls.php:25 31708 #: src/lang.cls.php:254 1705 1709 msgid "Custom Sitemap" 1706 1710 msgstr "" 1707 1711 1708 #: src/lang.cls.php:25 41712 #: src/lang.cls.php:255 1709 1713 msgid "Drop Domain from Sitemap" 1710 1714 msgstr "" 1711 1715 1712 #: src/lang.cls.php:25 51716 #: src/lang.cls.php:256 1713 1717 msgid "Sitemap Timeout" 1714 1718 msgstr "" 1715 1719 1716 #: src/lang.cls.php:25 7tpl/inc/disabled_all.php:51720 #: src/lang.cls.php:258 tpl/inc/disabled_all.php:5 1717 1721 msgid "Disable All Features" 1718 1722 msgstr "" 1719 1723 1720 #: src/lang.cls.php:25 8tpl/toolbox/log_viewer.tpl.php:111724 #: src/lang.cls.php:259 tpl/toolbox/log_viewer.tpl.php:11 1721 1725 msgid "Debug Log" 1722 1726 msgstr "" 1723 1727 1724 #: src/lang.cls.php:2 591728 #: src/lang.cls.php:260 1725 1729 msgid "Admin IPs" 1726 1730 msgstr "" 1727 1731 1728 #: src/lang.cls.php:26 01732 #: src/lang.cls.php:261 1729 1733 msgid "Debug Level" 1730 1734 msgstr "" 1731 1735 1732 #: src/lang.cls.php:26 11736 #: src/lang.cls.php:262 1733 1737 msgid "Log File Size Limit" 1734 1738 msgstr "" 1735 1739 1736 #: src/lang.cls.php:26 21740 #: src/lang.cls.php:263 1737 1741 msgid "Log Cookies" 1738 1742 msgstr "" 1739 1743 1740 #: src/lang.cls.php:26 31744 #: src/lang.cls.php:264 1741 1745 msgid "Collapse Query Strings" 1742 1746 msgstr "" 1743 1747 1744 #: src/lang.cls.php:26 41748 #: src/lang.cls.php:265 1745 1749 msgid "Debug URI Includes" 1746 1750 msgstr "" 1747 1751 1748 #: src/lang.cls.php:26 51752 #: src/lang.cls.php:266 1749 1753 msgid "Debug URI Excludes" 1750 1754 msgstr "" 1751 1755 1752 #: src/lang.cls.php:26 61756 #: src/lang.cls.php:267 1753 1757 msgid "Debug String Excludes" 1754 1758 msgstr "" 1755 1759 1756 #: src/lang.cls.php:26 81760 #: src/lang.cls.php:269 1757 1761 msgid "Revisions Max Number" 1758 1762 msgstr "" 1759 1763 1760 #: src/lang.cls.php:2 691764 #: src/lang.cls.php:270 1761 1765 msgid "Revisions Max Age" 1762 1766 msgstr "" … … 1988 1992 msgstr "" 1989 1993 1990 #: thirdparty/litespeed-check.cls.php: 1111994 #: thirdparty/litespeed-check.cls.php:74 thirdparty/litespeed-check.cls.php:136 1991 1995 msgid "" 1992 1996 "Please consider disabling the following detected plugins, as they may " … … 1994 1998 msgstr "" 1995 1999 1996 #: thirdparty/woocommerce.content.tpl.php:1 62000 #: thirdparty/woocommerce.content.tpl.php:17 1997 2001 msgid "WooCommerce Settings" 1998 2002 msgstr "" 1999 2003 2000 #: thirdparty/woocommerce.content.tpl.php:2 12004 #: thirdparty/woocommerce.content.tpl.php:22 2001 2005 #: tpl/cache/settings-advanced.tpl.php:12 2002 2006 #: tpl/cache/settings_inc.browser.tpl.php:12 tpl/toolbox/heartbeat.tpl.php:14 … … 2005 2009 msgstr "" 2006 2010 2007 #: thirdparty/woocommerce.content.tpl.php:2 22011 #: thirdparty/woocommerce.content.tpl.php:23 2008 2012 msgid "After verifying that the cache works in general, please test the cart." 2009 2013 msgstr "" 2010 2014 2011 #: thirdparty/woocommerce.content.tpl.php:2 32015 #: thirdparty/woocommerce.content.tpl.php:24 2012 2016 msgid "To test the cart, visit the <a %s>FAQ</a>." 2013 2017 msgstr "" 2014 2018 2015 #: thirdparty/woocommerce.content.tpl.php:2 42019 #: thirdparty/woocommerce.content.tpl.php:25 2016 2020 msgid "" 2017 2021 "By default, the My Account, Checkout, and Cart pages are automatically " … … 2020 2024 msgstr "" 2021 2025 2022 #: thirdparty/woocommerce.content.tpl.php:3 12026 #: thirdparty/woocommerce.content.tpl.php:33 2023 2027 msgid "Product Update Interval" 2024 2028 msgstr "" 2025 2029 2026 #: thirdparty/woocommerce.content.tpl.php:3 62030 #: thirdparty/woocommerce.content.tpl.php:38 2027 2031 msgid "Purge product on changes to the quantity or stock status." 2028 2032 msgstr "" 2029 2033 2030 #: thirdparty/woocommerce.content.tpl.php:3 62034 #: thirdparty/woocommerce.content.tpl.php:38 2031 2035 msgid "Purge categories only when stock status changes." 2032 2036 msgstr "" 2033 2037 2034 #: thirdparty/woocommerce.content.tpl.php:3 72038 #: thirdparty/woocommerce.content.tpl.php:39 2035 2039 msgid "Purge product and categories only when the stock status changes." 2036 2040 msgstr "" 2037 2041 2038 #: thirdparty/woocommerce.content.tpl.php: 382042 #: thirdparty/woocommerce.content.tpl.php:40 2039 2043 msgid "Purge product only when the stock status changes." 2040 2044 msgstr "" 2041 2045 2042 #: thirdparty/woocommerce.content.tpl.php: 382046 #: thirdparty/woocommerce.content.tpl.php:40 2043 2047 msgid "Do not purge categories on changes to the quantity or stock status." 2044 2048 msgstr "" 2045 2049 2046 #: thirdparty/woocommerce.content.tpl.php: 392050 #: thirdparty/woocommerce.content.tpl.php:41 2047 2051 msgid "" 2048 2052 "Always purge both product and categories on changes to the quantity or stock " … … 2050 2054 msgstr "" 2051 2055 2052 #: thirdparty/woocommerce.content.tpl.php:5 22056 #: thirdparty/woocommerce.content.tpl.php:54 2053 2057 msgid "" 2054 2058 "Determines how changes in product quantity and product stock status affect " … … 2056 2060 msgstr "" 2057 2061 2062 #: thirdparty/woocommerce.content.tpl.php:62 2063 msgid "Vary for Mini Cart" 2064 msgstr "" 2065 2066 #: thirdparty/woocommerce.content.tpl.php:69 2067 msgid "" 2068 "Generate a separate vary cache copy for the mini cart when the cart is not " 2069 "empty." 2070 msgstr "" 2071 2072 #: thirdparty/woocommerce.content.tpl.php:70 2073 msgid "" 2074 "If your theme does not use JS to update the mini cart, you must enable this " 2075 "option to display the correct cart contents." 2076 msgstr "" 2077 2058 2078 #: thirdparty/woocommerce.tab.tpl.php:3 2059 2079 msgid "WooCommerce" … … 2084 2104 msgstr "" 2085 2105 2086 #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 5. 6) #-#-#-#-#2106 #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 5.7) #-#-#-#-# 2087 2107 #. Plugin Name of the plugin/theme 2088 2108 #: tpl/banner/new_version.php:57 tpl/banner/new_version_dev.tpl.php:12 … … 4853 4873 msgstr "" 4854 4874 4855 #: tpl/page_optm/entry.tpl.php:8 tpl/page_optm/settings_html.tpl.php: 74875 #: tpl/page_optm/entry.tpl.php:8 tpl/page_optm/settings_html.tpl.php:9 4856 4876 msgid "HTML Settings" 4857 4877 msgstr "" … … 4954 4974 4955 4975 #: tpl/page_optm/settings_css.tpl.php:185 4956 #: tpl/page_optm/settings_html.tpl.php:1 29tpl/page_optm/settings_js.tpl.php:734976 #: tpl/page_optm/settings_html.tpl.php:150 tpl/page_optm/settings_js.tpl.php:73 4957 4977 msgid "" 4958 4978 "This can improve your speed score in services like Pingdom, GTmetrix and " … … 5014 5034 msgstr "" 5015 5035 5016 #: tpl/page_optm/settings_html.tpl.php:2 05036 #: tpl/page_optm/settings_html.tpl.php:23 5017 5037 msgid "Minify HTML content." 5018 5038 msgstr "" 5019 5039 5020 #: tpl/page_optm/settings_html.tpl.php:3 35040 #: tpl/page_optm/settings_html.tpl.php:36 5021 5041 msgid "Prefetching DNS can reduce latency for visitors." 5022 5042 msgstr "" 5023 5043 5024 #: tpl/page_optm/settings_html.tpl.php:34 5044 #: tpl/page_optm/settings_html.tpl.php:37 5045 #: tpl/page_optm/settings_html.tpl.php:68 5025 5046 msgid "For example" 5026 5047 msgstr "" 5027 5048 5028 #: tpl/page_optm/settings_html.tpl.php: 495049 #: tpl/page_optm/settings_html.tpl.php:52 5029 5050 msgid "" 5030 5051 "Automatically enable DNS prefetching for all URLs in the document, including " … … 5032 5053 msgstr "" 5033 5054 5034 #: tpl/page_optm/settings_html.tpl.php:5 05055 #: tpl/page_optm/settings_html.tpl.php:53 5035 5056 msgid "This can improve the page loading speed." 5036 5057 msgstr "" 5037 5058 5038 #: tpl/page_optm/settings_html.tpl.php:64 5059 #: tpl/page_optm/settings_html.tpl.php:67 5060 msgid "Preconnecting speeds up future loads from a given origin." 5061 msgstr "" 5062 5063 #: tpl/page_optm/settings_html.tpl.php:83 5039 5064 msgid "Delay rendering off-screen HTML elements by its selector." 5040 5065 msgstr "" 5041 5066 5042 #: tpl/page_optm/settings_html.tpl.php: 795067 #: tpl/page_optm/settings_html.tpl.php:98 5043 5068 msgid "Remove query strings from internal static resources." 5044 5069 msgstr "" 5045 5070 5046 #: tpl/page_optm/settings_html.tpl.php: 825071 #: tpl/page_optm/settings_html.tpl.php:102 5047 5072 msgid "Google reCAPTCHA will be bypassed automatically." 5048 5073 msgstr "" 5049 5074 5050 #: tpl/page_optm/settings_html.tpl.php: 865075 #: tpl/page_optm/settings_html.tpl.php:107 5051 5076 msgid "Append query string %s to the resources to bypass this action." 5052 5077 msgstr "" 5053 5078 5054 #: tpl/page_optm/settings_html.tpl.php:1 005079 #: tpl/page_optm/settings_html.tpl.php:121 5055 5080 msgid "" 5056 5081 "Use Web Font Loader library to load Google Fonts asynchronously while " … … 5058 5083 msgstr "" 5059 5084 5060 #: tpl/page_optm/settings_html.tpl.php:1 015085 #: tpl/page_optm/settings_html.tpl.php:122 5061 5086 msgid "" 5062 5087 "This will also add a preconnect to Google Fonts to establish a connection " … … 5064 5089 msgstr "" 5065 5090 5066 #: tpl/page_optm/settings_html.tpl.php:1 155091 #: tpl/page_optm/settings_html.tpl.php:136 5067 5092 msgid "Prevent Google Fonts from loading on all pages." 5068 5093 msgstr "" 5069 5094 5070 #: tpl/page_optm/settings_html.tpl.php:1 285095 #: tpl/page_optm/settings_html.tpl.php:149 5071 5096 msgid "" 5072 5097 "Stop loading WordPress.org emoji. Browser default emoji will be displayed " … … 5074 5099 msgstr "" 5075 5100 5076 #: tpl/page_optm/settings_html.tpl.php:1 425101 #: tpl/page_optm/settings_html.tpl.php:163 5077 5102 msgid "This option will remove all %s tags from HTML." 5078 5103 msgstr "" -
litespeed-cache/trunk/lib/guest.cls.php
r2574982 r2977143 1 1 <?php 2 2 3 namespace LiteSpeed\Lib; 3 4 … … 7 8 * @since 4.1 8 9 */ 9 class Guest { 10 class Guest 11 { 10 12 const CONF_FILE = '.litespeed_conf.dat'; 11 13 const HASH = 'hash'; // Not set-able … … 26 28 * @since 4.1 27 29 */ 28 public function __construct() { 29 ! defined( 'LSCWP_CONTENT_FOLDER' ) && define( 'LSCWP_CONTENT_FOLDER', dirname( dirname( dirname( __DIR__ ) ) ) ); 30 public function __construct() 31 { 32 !defined('LSCWP_CONTENT_FOLDER') && define('LSCWP_CONTENT_FOLDER', dirname(dirname(dirname(__DIR__)))); 30 33 // Load config 31 $this->_conf = file_get_contents( LSCWP_CONTENT_FOLDER . '/' . self::CONF_FILE);32 if ( $this->_conf) {33 $this->_conf = json_decode( $this->_conf, true);34 $this->_conf = file_get_contents(LSCWP_CONTENT_FOLDER . '/' . self::CONF_FILE); 35 if ($this->_conf) { 36 $this->_conf = json_decode($this->_conf, true); 34 37 } 35 38 36 if ( ! empty( $this->_conf[ self::O_CACHE_LOGIN_COOKIE ] )) {37 self::$_vary_name = $this->_conf[ self::O_CACHE_LOGIN_COOKIE];39 if (!empty($this->_conf[self::O_CACHE_LOGIN_COOKIE])) { 40 self::$_vary_name = $this->_conf[self::O_CACHE_LOGIN_COOKIE]; 38 41 } 39 42 } … … 44 47 * @since 4.0 45 48 */ 46 public function update_guest_vary() { 49 public function update_guest_vary() 50 { 47 51 // This process must not be cached 48 header( 'X-LiteSpeed-Cache-Control: no-cache' ); 52 /** 53 * @reference https://wordpress.org/support/topic/soft-404-from-google-search-on-litespeed-cache-guest-vary-php/#post-16838583 54 */ 55 header('X-Robots-Tag: noindex'); 56 header('X-LiteSpeed-Cache-Control: no-cache'); 49 57 50 if ( $this->always_guest()) {58 if ($this->always_guest()) { 51 59 echo '[]'; 52 60 exit; … … 54 62 55 63 // If contains vary already, don't reload to avoid infinite loop when parent page having browser cache 56 if ( $this->_conf && self::has_vary()) {64 if ($this->_conf && self::has_vary()) { 57 65 echo '[]'; 58 66 exit; … … 61 69 // Send vary cookie 62 70 $vary = 'guest_mode:1'; 63 if ( $this->_conf && empty( $this->_conf[ self::O_DEBUG ] )) {64 $vary = md5( $this->_conf[ self::HASH ] . $vary);71 if ($this->_conf && empty($this->_conf[self::O_DEBUG])) { 72 $vary = md5($this->_conf[self::HASH] . $vary); 65 73 } 66 74 67 75 $expire = time() + 2 * 86400; 68 $is_ssl = ! empty( $this->_conf[ self::O_UTIL_NO_HTTPS_VARY ]) ? false : $this->is_ssl();69 setcookie( self::$_vary_name, $vary, $expire, '/', false, $is_ssl, true);76 $is_ssl = !empty($this->_conf[self::O_UTIL_NO_HTTPS_VARY]) ? false : $this->is_ssl(); 77 setcookie(self::$_vary_name, $vary, $expire, '/', false, $is_ssl, true); 70 78 71 79 // return json 72 echo json_encode( array( 'reload' => 'yes' ));80 echo json_encode(array('reload' => 'yes')); 73 81 exit; 74 82 } … … 79 87 * @since 4.1 80 88 */ 81 private function is_ssl() { 82 if ( isset( $_SERVER['HTTPS'] ) ) { 83 if ( 'on' === strtolower( $_SERVER['HTTPS'] ) ) { 89 private function is_ssl() 90 { 91 if (isset($_SERVER['HTTPS'])) { 92 if ('on' === strtolower($_SERVER['HTTPS'])) { 84 93 return true; 85 94 } 86 95 87 if ( '1' == $_SERVER['HTTPS']) {96 if ('1' == $_SERVER['HTTPS']) { 88 97 return true; 89 98 } 90 } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] )) {99 } elseif (isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'])) { 91 100 return true; 92 101 } … … 100 109 * @access public 101 110 */ 102 public static function has_vary() { 103 if ( empty( $_COOKIE[ self::$_vary_name ] ) ) { 111 public static function has_vary() 112 { 113 if (empty($_COOKIE[self::$_vary_name])) { 104 114 return false; 105 115 } 106 return $_COOKIE[ self::$_vary_name];116 return $_COOKIE[self::$_vary_name]; 107 117 } 108 118 … … 112 122 * @since 4.0 113 123 */ 114 public function always_guest() { 115 if ( empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { 124 public function always_guest() 125 { 126 if (empty($_SERVER['HTTP_USER_AGENT'])) { 116 127 return false; 117 128 } 118 129 119 if ( $this->_conf[ self::O_GUEST_UAS ]) {130 if ($this->_conf[self::O_GUEST_UAS]) { 120 131 $quoted_uas = array(); 121 foreach ( $this->_conf[ self::O_GUEST_UAS ] as $v) {122 $quoted_uas[] = preg_quote( $v, '#');132 foreach ($this->_conf[self::O_GUEST_UAS] as $v) { 133 $quoted_uas[] = preg_quote($v, '#'); 123 134 } 124 $match = preg_match( '#' . implode( '|', $quoted_uas ) . '#i', $_SERVER[ 'HTTP_USER_AGENT' ]);125 if ( $match) {135 $match = preg_match('#' . implode('|', $quoted_uas) . '#i', $_SERVER['HTTP_USER_AGENT']); 136 if ($match) { 126 137 return true; 127 138 } 128 139 } 129 140 130 if ( $this->ip_access( $this->_conf[ self::O_GUEST_IPS ] )) {141 if ($this->ip_access($this->_conf[self::O_GUEST_IPS])) { 131 142 return true; 132 143 } … … 141 152 * @access public 142 153 */ 143 public function ip_access( $ip_list ) { 144 if ( ! $ip_list ) { 154 public function ip_access($ip_list) 155 { 156 if (!$ip_list) { 145 157 return false; 146 158 } 147 if ( ! isset( self::$_ip )) {159 if (!isset(self::$_ip)) { 148 160 self::$_ip = self::get_ip(); 149 161 } … … 155 167 // for($i = 0; $i <= 3; $i++) if($ip[$i] == '*') $ip_list[$key][$i] = $uip[$i]; 156 168 // } 157 return in_array( self::$_ip, $ip_list);169 return in_array(self::$_ip, $ip_list); 158 170 } 159 171 … … 166 178 * @return string 167 179 */ 168 public static function get_ip() { 180 public static function get_ip() 181 { 169 182 $_ip = ''; 170 if ( function_exists( 'apache_request_headers' )) {183 if (function_exists('apache_request_headers')) { 171 184 $apache_headers = apache_request_headers(); 172 $_ip = ! empty( $apache_headers['True-Client-IP']) ? $apache_headers['True-Client-IP'] : false;173 if ( ! $_ip) {174 $_ip = ! empty( $apache_headers['X-Forwarded-For']) ? $apache_headers['X-Forwarded-For'] : false;175 $_ip = explode( ',', $_ip);176 $_ip = $_ip[ 0];185 $_ip = !empty($apache_headers['True-Client-IP']) ? $apache_headers['True-Client-IP'] : false; 186 if (!$_ip) { 187 $_ip = !empty($apache_headers['X-Forwarded-For']) ? $apache_headers['X-Forwarded-For'] : false; 188 $_ip = explode(',', $_ip); 189 $_ip = $_ip[0]; 177 190 } 178 179 191 } 180 192 181 if ( ! $_ip) {182 $_ip = ! empty( $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false;193 if (!$_ip) { 194 $_ip = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false; 183 195 } 184 196 return $_ip; 185 197 } 186 187 188 198 } -
litespeed-cache/trunk/litespeed-cache.php
r2954001 r2977143 5 5 * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration 6 6 * Description: High-performance page caching and site optimization from LiteSpeed 7 * Version: 5. 67 * Version: 5.7 8 8 * Author: LiteSpeed Technologies 9 9 * Author URI: https://www.litespeedtech.com … … 35 35 } 36 36 37 !defined('LSCWP_V') && define('LSCWP_V', '5. 6');37 !defined('LSCWP_V') && define('LSCWP_V', '5.7'); 38 38 39 39 !defined('LSCWP_CONTENT_DIR') && define('LSCWP_CONTENT_DIR', WP_CONTENT_DIR); -
litespeed-cache/trunk/readme.txt
r2954001 r2977143 3 3 Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner 4 4 Requires at least: 4.0 5 Tested up to: 6.3 6 Stable tag: 5. 65 Tested up to: 6.3.1 6 Stable tag: 5.7 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl.html … … 251 251 == Changelog == 252 252 253 = 5.6 - Aug 15 2023 = 253 = 5.7 - Oct 10 2023 = 254 * 🌱**Page Optimize** New option available: Preconnect. (xguiboy/Mukesh Patel) 255 * 🌱**3rd** New Vary for Mini Cart option for Woocommerce. (Ruikai) 256 * **Cloud** Force syncing the configuration to QUIC.cloud if CDN is reenabled. 257 * **Cloud** Force syncing the configuration to QUIC.cloud if domain key is readded. 258 * **Cloud** Limit multi-line fields when posting to QC. 259 * **Cache** Treat HEAD requests as cacheable as GET. (George Wang) 260 * 🐞**ESI** Patched a possible vulnerability issue. (István Márton@Wordfence #841011) 261 * 🐞**ESI** Overwrite SCRIPT_URI to prevent ESI sub request resulting in redirections. (Tobolo) 262 * 🐞**Image Optimize** Bypass unnecessary image processing when images were only partially optimized. (Ruikai) 263 * 🐞**Guest** Guest mode will not enable WebP directly anymore. (Michael Heymann) 264 * **CDN** Auto disable CDN if CDN URL is invalid. (Ruikai) 265 * **CDN** Fixed a null parameter warning for PHP v8.1 (#584) 266 * **API** Added `litespeed_media_add_missing_sizes` filter to allow bypassing Media's "add missing sizes" option (for Guest Optimization and otherwise). (PR #564) 267 * **Guest** Fixed soft 404 and robots.txt report for guest.vary.php. 268 * **Vary** Enabled `litespeed_vary_cookies` for LSWS Enterprise. 269 * **GUI** Stopped WebP tip from wrongly displaying when Guest Mode is off. 270 * **GUI** Added QUIC.cloud promotion postbox on dashboard page. 271 * **3rd** Added `pagespeed ninja` to blocklist due to its bad bahavior. 272 273 = 5.6 - Aug 1 2023 = 254 274 * 🌱**Page Optimize** New JS Delay Includes option. (Mitchell Krog/Gerard Reches/Ignacy Hołoga) 255 275 * **Crawler** Sitemap can use search for URL now. -
litespeed-cache/trunk/src/admin-settings.cls.php
r2761310 r2977143 1 1 <?php 2 2 3 /** 3 4 * The admin settings handler of the plugin. … … 9 10 * @author LiteSpeed Technologies <[email protected]> 10 11 */ 12 11 13 namespace LiteSpeed; 12 defined( 'WPINC' ) || exit; 13 14 class Admin_Settings extends Base { 14 15 defined('WPINC') || exit; 16 17 class Admin_Settings extends Base 18 { 15 19 const ENROLL = '_settings-enroll'; 16 20 … … 25 29 * @access public 26 30 */ 27 public function save( $raw_data ) { 28 Debug2::debug( '[Settings] saving' ); 29 30 if ( empty( $raw_data[ self::ENROLL ] ) ) { 31 exit( 'No fields' ); 32 } 33 34 $raw_data = Admin::cleanup_text( $raw_data ); 31 public function save($raw_data) 32 { 33 Debug2::debug('[Settings] saving'); 34 35 if (empty($raw_data[self::ENROLL])) { 36 exit('No fields'); 37 } 38 39 $raw_data = Admin::cleanup_text($raw_data); 35 40 36 41 // Convert data to config format 37 42 $the_matrix = array(); 38 foreach ( array_unique( $raw_data[ self::ENROLL ] ) as $id) {43 foreach (array_unique($raw_data[self::ENROLL]) as $id) { 39 44 $child = false; 40 45 // Drop array format 41 if ( strpos( $id, '[' ) !== false ) { 42 if ( strpos( $id, self::O_CDN_MAPPING ) === 0 || strpos( $id, self::O_CRAWLER_COOKIES ) === 0 ) { // CDN child | Cookie Crawler settings 43 $child = substr( $id, strpos( $id, '[' ) + 1, strpos( $id, ']' ) - strpos( $id, '[' ) - 1 ); 44 $id = substr( $id, 0, strpos( $id, '[' ) ); // Drop ending []; Compatible with xx[0] way from CLI 45 } 46 else { 47 $id = substr( $id, 0, strpos( $id, '[' ) ); // Drop ending [] 48 } 49 } 50 51 if ( ! array_key_exists( $id, self::$_default_options ) ) { 46 if (strpos($id, '[') !== false) { 47 if (strpos($id, self::O_CDN_MAPPING) === 0 || strpos($id, self::O_CRAWLER_COOKIES) === 0) { // CDN child | Cookie Crawler settings 48 $child = substr($id, strpos($id, '[') + 1, strpos($id, ']') - strpos($id, '[') - 1); 49 $id = substr($id, 0, strpos($id, '[')); // Drop ending []; Compatible with xx[0] way from CLI 50 } else { 51 $id = substr($id, 0, strpos($id, '[')); // Drop ending [] 52 } 53 } 54 55 if (!array_key_exists($id, self::$_default_options)) { 52 56 continue; 53 57 } 54 58 55 59 // Validate $child 56 if ( $id == self::O_CDN_MAPPING) {57 if ( ! in_array($child, array(60 if ($id == self::O_CDN_MAPPING) { 61 if (!in_array($child, array( 58 62 self::CDN_MAPPING_URL, 59 63 self::CDN_MAPPING_INC_IMG, … … 61 65 self::CDN_MAPPING_INC_JS, 62 66 self::CDN_MAPPING_FILETYPE, 63 ) )) {67 ))) { 64 68 continue; 65 69 } 66 70 } 67 if ( $id == self::O_CRAWLER_COOKIES) {68 if ( ! in_array($child, array(71 if ($id == self::O_CRAWLER_COOKIES) { 72 if (!in_array($child, array( 69 73 self::CRWL_COOKIE_NAME, 70 74 self::CRWL_COOKIE_VALS, 71 ) )) {75 ))) { 72 76 continue; 73 77 } … … 76 80 $data = false; 77 81 78 if ( $child ) { 79 $data = ! empty( $raw_data[ $id ][ $child ] ) ? $raw_data[ $id ][ $child ] : false; // []=xxx or [0]=xxx 80 } 81 else { 82 $data = ! empty( $raw_data[ $id ] ) ? $raw_data[ $id ] : false; 82 if ($child) { 83 $data = !empty($raw_data[$id][$child]) ? $raw_data[$id][$child] : false; // []=xxx or [0]=xxx 84 } else { 85 $data = !empty($raw_data[$id]) ? $raw_data[$id] : false; 83 86 } 84 87 … … 86 89 * Sanitize the value 87 90 */ 88 if ( $id == self::O_CDN_MAPPING || $id == self::O_CRAWLER_COOKIES) {91 if ($id == self::O_CDN_MAPPING || $id == self::O_CRAWLER_COOKIES) { 89 92 // Use existing in queue data if existed (Only available when $child != false) 90 $data2 = array_key_exists( $id, $the_matrix ) ? $the_matrix[ $id ] : ( defined( 'WP_CLI' ) && WP_CLI ? $this->conf( $id ) : array());91 } 92 switch ( $id) {93 $data2 = array_key_exists($id, $the_matrix) ? $the_matrix[$id] : (defined('WP_CLI') && WP_CLI ? $this->conf($id) : array()); 94 } 95 switch ($id) { 93 96 case self::O_CDN_MAPPING: 94 97 /** … … 104 107 * cdn-mapping[ 2 ][ url ] = 'xxx2' 105 108 */ 106 if ( $data ) foreach ( $data as $k => $v ) { 107 if ( $child == self::CDN_MAPPING_FILETYPE ) { 108 $v = Utility::sanitize_lines( $v ); 109 } 110 if ( $child == self::CDN_MAPPING_URL ) { 111 $v = trailingslashit( $v ); 112 } 113 if ( in_array( $child, array( 109 if ($data) foreach ($data as $k => $v) { 110 if ($child == self::CDN_MAPPING_FILETYPE) { 111 $v = Utility::sanitize_lines($v); 112 } 113 if ($child == self::CDN_MAPPING_URL) { 114 # If not a valid URL, turn off CDN 115 if (strpos($v, 'https://') !== 0) { 116 self::debug('❌ CDN mapping set to OFF due to invalid URL'); 117 $the_matrix[self::O_CDN] = false; 118 } 119 $v = trailingslashit($v); 120 } 121 if (in_array($child, array( 114 122 self::CDN_MAPPING_INC_IMG, 115 123 self::CDN_MAPPING_INC_CSS, 116 124 self::CDN_MAPPING_INC_JS, 117 ) )) {125 ))) { 118 126 // Because these can't be auto detected in `config->update()`, need to format here 119 127 $v = $v === 'false' ? 0 : (bool) $v; 120 128 } 121 129 122 if ( empty( $data2[ $k ] )) {123 $data2[ $k] = array();124 } 125 126 $data2[ $k ][ $child] = $v;130 if (empty($data2[$k])) { 131 $data2[$k] = array(); 132 } 133 134 $data2[$k][$child] = $v; 127 135 } 128 136 … … 147 155 * empty line for `vals` use literal `_null` 148 156 */ 149 if ( $data ) foreach ( $data as $k => $v) {150 if ( $child == self::CRWL_COOKIE_VALS) {151 $v = Utility::sanitize_lines( $v);152 } 153 154 if ( empty( $data2[ $k ] )) {155 $data2[ $k] = array();156 } 157 158 $data2[ $k ][ $child] = $v;157 if ($data) foreach ($data as $k => $v) { 158 if ($child == self::CRWL_COOKIE_VALS) { 159 $v = Utility::sanitize_lines($v); 160 } 161 162 if (empty($data2[$k])) { 163 $data2[$k] = array(); 164 } 165 166 $data2[$k][$child] = $v; 159 167 } 160 168 … … 162 170 break; 163 171 164 // Cache exclude cat172 // Cache exclude cat 165 173 case self::O_CACHE_EXC_CAT: 166 174 $data2 = array(); 167 $data = Utility::sanitize_lines( $data);168 foreach ( $data as $v) {169 $cat_id = get_cat_ID( $v);170 if ( ! $cat_id) {175 $data = Utility::sanitize_lines($data); 176 foreach ($data as $v) { 177 $cat_id = get_cat_ID($v); 178 if (!$cat_id) { 171 179 continue; 172 180 } … … 177 185 break; 178 186 179 // Cache exclude tag180 case self::O_CACHE_EXC_TAG :187 // Cache exclude tag 188 case self::O_CACHE_EXC_TAG: 181 189 $data2 = array(); 182 $data = Utility::sanitize_lines( $data);183 foreach ( $data as $v) {184 $term = get_term_by( 'name', $v, 'post_tag');185 if ( ! $term) {190 $data = Utility::sanitize_lines($data); 191 foreach ($data as $v) { 192 $term = get_term_by('name', $v, 'post_tag'); 193 if (!$term) { 186 194 // todo: can show the error in admin error msg 187 195 continue; … … 197 205 } 198 206 199 $the_matrix[ $id] = $data;207 $the_matrix[$id] = $data; 200 208 } 201 209 202 210 // Special handler for CDN/Crawler 2d list to drop empty rows 203 foreach ( $the_matrix as $id => $data) {211 foreach ($the_matrix as $id => $data) { 204 212 /** 205 213 * cdn-mapping[ 0 ][ url ] = 'xxx' … … 210 218 * crawler-cookie[ 2 ][ name ] = 'xxx2' 211 219 */ 212 if ( $id == self::O_CDN_MAPPING || $id == self::O_CRAWLER_COOKIES) {220 if ($id == self::O_CDN_MAPPING || $id == self::O_CRAWLER_COOKIES) { 213 221 // Drop this line if all children elements are empty 214 foreach ( $data as $k => $v) {215 foreach ( $v as $v2) {216 if ( $v2) {222 foreach ($data as $k => $v) { 223 foreach ($v as $v2) { 224 if ($v2) { 217 225 continue 2; 218 226 } 219 227 } 220 228 // If hit here, means all empty 221 unset( $the_matrix[ $id ][ $k ]);229 unset($the_matrix[$id][$k]); 222 230 } 223 231 } 224 232 225 233 // Don't allow repeated cookie name 226 if ( $id == self::O_CRAWLER_COOKIES) {234 if ($id == self::O_CRAWLER_COOKIES) { 227 235 $existed = array(); 228 foreach ( $the_matrix[ $id ] as $k => $v) {229 if ( ! $v[ self::CRWL_COOKIE_NAME ] || in_array( $v[ self::CRWL_COOKIE_NAME ], $existed )) { // Filter repeated or empty name230 unset( $the_matrix[ $id ][ $k ]);236 foreach ($the_matrix[$id] as $k => $v) { 237 if (!$v[self::CRWL_COOKIE_NAME] || in_array($v[self::CRWL_COOKIE_NAME], $existed)) { // Filter repeated or empty name 238 unset($the_matrix[$id][$k]); 231 239 continue; 232 240 } 233 241 234 $existed[] = $v[ self::CRWL_COOKIE_NAME];242 $existed[] = $v[self::CRWL_COOKIE_NAME]; 235 243 } 236 244 } … … 238 246 // CDN mapping allow URL values repeated 239 247 // if ( $id == self::O_CDN_MAPPING ) {} 248 249 // tmp fix the 3rd part woo update hook issue when enabling vary cookie 250 if ($id == 'wc_cart_vary') { 251 if ($data) 252 add_filter('litespeed_vary_cookies', function ($list) { 253 $list[] = 'woocommerce_cart_hash'; 254 return array_unique($list); 255 }); 256 else { 257 add_filter('litespeed_vary_cookies', function ($list) { 258 if (in_array('woocommerce_cart_hash', $list)) { 259 unset($list[array_search('woocommerce_cart_hash', $list)]); 260 } 261 return array_unique($list); 262 }); 263 } 264 } 240 265 } 241 266 242 267 // id validation will be inside 243 $this->cls( 'Conf' )->update_confs( $the_matrix);244 245 $msg = __( 'Options saved.', 'litespeed-cache');246 Admin_Display::succeed( $msg);268 $this->cls('Conf')->update_confs($the_matrix); 269 270 $msg = __('Options saved.', 'litespeed-cache'); 271 Admin_Display::succeed($msg); 247 272 } 248 273 … … 253 278 * @access public 254 279 */ 255 public function network_save( $raw_data ) { 256 Debug2::debug( '[Settings] network saving' ); 257 258 if ( empty( $raw_data[ self::ENROLL ] ) ) { 259 exit( 'No fields' ); 260 } 261 262 $raw_data = Admin::cleanup_text( $raw_data ); 263 264 foreach ( array_unique( $raw_data[ self::ENROLL ] ) as $id ) { 280 public function network_save($raw_data) 281 { 282 Debug2::debug('[Settings] network saving'); 283 284 if (empty($raw_data[self::ENROLL])) { 285 exit('No fields'); 286 } 287 288 $raw_data = Admin::cleanup_text($raw_data); 289 290 foreach (array_unique($raw_data[self::ENROLL]) as $id) { 265 291 // Append current field to setting save 266 if ( ! array_key_exists( $id, self::$_default_site_options )) {292 if (!array_key_exists($id, self::$_default_site_options)) { 267 293 continue; 268 294 } 269 295 270 $data = ! empty( $raw_data[ $id ] ) ? $raw_data[ $id] : false;296 $data = !empty($raw_data[$id]) ? $raw_data[$id] : false; 271 297 272 298 // id validation will be inside 273 $this->cls( 'Conf' )->network_update( $id, $data);299 $this->cls('Conf')->network_update($id, $data); 274 300 } 275 301 … … 277 303 Activation::cls()->update_files(); 278 304 279 $msg = __( 'Options saved.', 'litespeed-cache');280 Admin_Display::succeed( $msg);305 $msg = __('Options saved.', 'litespeed-cache'); 306 Admin_Display::succeed($msg); 281 307 } 282 308 … … 290 316 * @return string the updated location string. 291 317 */ 292 public static function widget_save_err( $location ) { 293 return str_replace( '?message=0', '?error=0', $location ) ; 318 public static function widget_save_err($location) 319 { 320 return str_replace('?message=0', '?error=0', $location); 294 321 } 295 322 … … 306 333 * @return mixed Updated settings on success, false on error. 307 334 */ 308 public static function validate_widget_save( $instance, $new_instance, $old_instance, $widget ) { 309 if ( empty( $new_instance ) ) { 335 public static function validate_widget_save($instance, $new_instance, $old_instance, $widget) 336 { 337 if (empty($new_instance)) { 310 338 return $instance; 311 339 } 312 340 313 if ( ! isset( $new_instance[ ESI::WIDGET_O_ESIENABLE ] ) || ! isset( $new_instance[ ESI::WIDGET_O_TTL ] )) {341 if (!isset($new_instance[ESI::WIDGET_O_ESIENABLE]) || !isset($new_instance[ESI::WIDGET_O_TTL])) { 314 342 return $instance; 315 343 } 316 344 317 $esi = intval( $new_instance[ ESI::WIDGET_O_ESIENABLE ] ) % 3; 318 $ttl = (int) $new_instance[ ESI::WIDGET_O_TTL ]; 319 320 if ( $ttl != 0 && $ttl < 30 ) { 321 add_filter( 'wp_redirect', __CLASS__ . '::widget_save_err' ) ; 322 return false ; // invalid ttl. 323 } 324 325 if ( empty( $instance[ Conf::OPTION_NAME ] ) ) {// todo: to be removed 326 $instance[ Conf::OPTION_NAME ] = array() ; 327 } 328 $instance[ Conf::OPTION_NAME ][ ESI::WIDGET_O_ESIENABLE ] = $esi ; 329 $instance[ Conf::OPTION_NAME ][ ESI::WIDGET_O_TTL ] = $ttl ; 330 331 $current = ! empty( $old_instance[ Conf::OPTION_NAME ] ) ? $old_instance[ Conf::OPTION_NAME ] : false ; 332 if ( ! strpos( $_SERVER[ 'HTTP_REFERER' ], '/wp-admin/customize.php') ) { 333 if ( ! $current || $esi != $current[ ESI::WIDGET_O_ESIENABLE ] ) { 334 Purge::purge_all( 'Wdiget ESI_enable changed' ) ; 335 } 336 elseif ( $ttl != 0 && $ttl != $current[ ESI::WIDGET_O_TTL ] ) { 337 Purge::add( Tag::TYPE_WIDGET . $widget->id ) ; 338 } 339 340 Purge::purge_all( 'Wdiget saved' ) ; 341 } 342 return $instance ; 345 $esi = intval($new_instance[ESI::WIDGET_O_ESIENABLE]) % 3; 346 $ttl = (int) $new_instance[ESI::WIDGET_O_TTL]; 347 348 if ($ttl != 0 && $ttl < 30) { 349 add_filter('wp_redirect', __CLASS__ . '::widget_save_err'); 350 return false; // invalid ttl. 351 } 352 353 if (empty($instance[Conf::OPTION_NAME])) { // todo: to be removed 354 $instance[Conf::OPTION_NAME] = array(); 355 } 356 $instance[Conf::OPTION_NAME][ESI::WIDGET_O_ESIENABLE] = $esi; 357 $instance[Conf::OPTION_NAME][ESI::WIDGET_O_TTL] = $ttl; 358 359 $current = !empty($old_instance[Conf::OPTION_NAME]) ? $old_instance[Conf::OPTION_NAME] : false; 360 if (!strpos($_SERVER['HTTP_REFERER'], '/wp-admin/customize.php')) { 361 if (!$current || $esi != $current[ESI::WIDGET_O_ESIENABLE]) { 362 Purge::purge_all('Wdiget ESI_enable changed'); 363 } elseif ($ttl != 0 && $ttl != $current[ESI::WIDGET_O_TTL]) { 364 Purge::add(Tag::TYPE_WIDGET . $widget->id); 365 } 366 367 Purge::purge_all('Wdiget saved'); 368 } 369 return $instance; 343 370 } 344 371 } -
litespeed-cache/trunk/src/base.cls.php
r2954001 r2977143 160 160 const O_OPTM_DNS_PREFETCH = 'optm-dns_prefetch'; 161 161 const O_OPTM_DNS_PREFETCH_CTRL = 'optm-dns_prefetch_ctrl'; 162 const O_OPTM_DNS_PRECONNECT = 'optm-dns_preconnect'; 162 163 const O_OPTM_EXC = 'optm-exc'; 163 164 const O_OPTM_GUEST_ONLY = 'optm-guest_only'; … … 447 448 self::O_OPTM_DNS_PREFETCH => array(), 448 449 self::O_OPTM_DNS_PREFETCH_CTRL => false, 450 self::O_OPTM_DNS_PRECONNECT => array(), 449 451 self::O_OPTM_EXC => array(), 450 452 self::O_OPTM_GUEST_ONLY => false, -
litespeed-cache/trunk/src/cdn.cls.php
r2524344 r2977143 248 248 foreach ( $matches[ $v[ 0 ] ? 3 : 2 ] as $k2 => $url ) { 249 249 // Debug2::debug2( '[CDN] check ' . $url ); 250 $postfix = '.' . pathinfo( parse_url( $url, PHP_URL_PATH ), PATHINFO_EXTENSION );250 $postfix = '.' . pathinfo( (string) parse_url( $url, PHP_URL_PATH ), PATHINFO_EXTENSION ); 251 251 if ( ! array_key_exists( $postfix, $this->_cfg_cdn_mapping ) ) { 252 252 // Debug2::debug2( '[CDN] non-existed postfix ' . $postfix ); -
litespeed-cache/trunk/src/cdn/quic.cls.php
r2771786 r2977143 1 1 <?php 2 2 3 /** 3 4 * The quic.cloud class. … … 8 9 * @author LiteSpeed Technologies <[email protected]> 9 10 */ 11 10 12 namespace LiteSpeed\CDN; 11 13 … … 13 15 use LiteSpeed\Base; 14 16 15 defined( 'WPINC') || exit;17 defined('WPINC') || exit; 16 18 17 class Quic extends Base { 19 class Quic extends Base 20 { 18 21 const LOG_TAG = '☁️'; 19 22 … … 21 24 22 25 protected $_summary; 23 public function __construct() { 26 public function __construct() 27 { 24 28 $this->_summary = self::get_summary(); 25 29 } … … 30 34 * @access public 31 35 */ 32 public static function try_sync_config() { 36 public static function try_sync_config() 37 { 33 38 self::cls()->try_sync_conf(); 34 39 } 35 40 36 public function try_sync_conf() { 41 public function try_sync_conf($force = false) 42 { 37 43 $options = $this->get_options(); 38 44 39 if ( ! $options[ self::O_CDN_QUIC ] ) { 45 if (!$options[self::O_CDN_QUIC]) { 46 if (!empty($this->_summary['conf_md5'])) self::save_summary(array('conf_md5' => '')); 40 47 return false; 41 48 } … … 46 53 self::O_OBJECT_PSWD, 47 54 ); 48 foreach ( $secure_fields as $v) {49 if ( ! empty( $options[ $v ] )) {50 $options[ $v ] = str_repeat( '*', strlen( $options[ $v ] ));55 foreach ($secure_fields as $v) { 56 if (!empty($options[$v])) { 57 $options[$v] = str_repeat('*', strlen($options[$v])); 51 58 } 52 59 } 53 unset( $options[ self::O_MEDIA_LQIP_EXC ] ); 60 unset($options[self::O_MEDIA_LQIP_EXC]); 61 62 // Remove overflow multi lines fields 63 foreach ($options as $k => $v) { 64 if (is_array($v) && count($v) > 30) { 65 $v = array_slice($v, 0, 30); 66 $options[$k] = $v; 67 } 68 } 54 69 55 70 // Rest url 56 $options[ '_rest' ] = function_exists( 'rest_get_url_prefix' ) ? rest_get_url_prefix() : apply_filters( 'rest_url_prefix', 'wp-json');57 $options[ '_home_url' ] = home_url( '/');71 $options['_rest'] = function_exists('rest_get_url_prefix') ? rest_get_url_prefix() : apply_filters('rest_url_prefix', 'wp-json'); 72 $options['_home_url'] = home_url('/'); 58 73 59 74 // Add server env vars 60 $options[ '_server'] = $this->server_vars();75 $options['_server'] = $this->server_vars(); 61 76 62 77 // Append hooks 63 $options[ '_tp_cookies' ] = apply_filters( 'litespeed_vary_cookies', array());78 $options['_tp_cookies'] = apply_filters('litespeed_vary_cookies', array()); 64 79 65 $conf_md5 = md5( json_encode( $options ) ); 66 if ( ! empty( $this->_summary[ 'conf_md5' ] ) && $conf_md5 == $this->_summary[ 'conf_md5' ] ) { 67 self::debug( 'Bypass sync conf to QC due to same md5', $conf_md5 ); 68 return; 80 $conf_md5 = md5(json_encode($options)); 81 if (!empty($this->_summary['conf_md5']) && $conf_md5 == $this->_summary['conf_md5']) { 82 if (!$force) { 83 self::debug('Bypass sync conf to QC due to same md5', $conf_md5); 84 return; 85 } 86 self::debug('!!!Force sync conf even same md5'); 69 87 } 70 88 71 self::save_summary( array( 'conf_md5' => $conf_md5 ));89 self::save_summary(array('conf_md5' => $conf_md5)); 72 90 self::debug('sync conf to QC', $options); 73 91 74 Cloud::post( Cloud::SVC_D_SYNC_CONF, $options);92 Cloud::post(Cloud::SVC_D_SYNC_CONF, $options); 75 93 } 76 77 94 } -
litespeed-cache/trunk/src/cloud.cls.php
r2940517 r2977143 576 576 $home_url = home_url(); 577 577 if (!wp_http_validate_url($home_url)) { 578 self::debug('wp_http_validate_url failed: ' . $home_url); 578 579 return false; 579 580 } … … 589 590 /** @since 5.0 If in valid err_domains, bypass request */ 590 591 if ($this->_is_err_domain($home_url)) { 592 self::debug('home url is in err_domains, bypass request: ' . $home_url); 591 593 return false; 592 594 } … … 1370 1372 $this->_summary['is_linked'] = 1; 1371 1373 self::save_summary(); 1374 1375 # Force resync qc conf 1376 $this->cls('CDN\Quic')->try_sync_conf(true); 1372 1377 } 1373 1378 -
litespeed-cache/trunk/src/control.cls.php
r2869601 r2977143 743 743 744 744 $method = isset( $_SERVER['REQUEST_METHOD'] ) ? $_SERVER['REQUEST_METHOD'] : 'unknown'; 745 if ( 'GET' !== $method ) {745 if ( 'GET' !== $method && 'HEAD' !== $method ) { 746 746 return $this->_no_cache_for('Not GET method: ' . $method); 747 747 } -
litespeed-cache/trunk/src/crawler.cls.php
r2928795 r2977143 961 961 962 962 // WebP on/off 963 if ( $this->conf(Base::O_GUEST) || $this->conf(Base::O_IMG_OPTM_WEBP)) {963 if (($this->conf(Base::O_GUEST) && $this->conf(Base::O_GUEST_OPTM)) || $this->conf(Base::O_IMG_OPTM_WEBP)) { 964 964 $crawler_factors['webp'] = array(1 => 'WebP', 0 => ''); 965 965 } -
litespeed-cache/trunk/src/doc.cls.php
r2928795 r2977143 27 27 { 28 28 if (apply_filters('litespeed_conf', $id)) return; 29 if (!apply_filters('litespeed_conf', Base::O_GUEST)) return; 29 30 if (!apply_filters('litespeed_conf', Base::O_GUEST_OPTM)) return; 30 31 echo '<font class="litespeed-warning">'; 31 echo '⚠️ ' . sprintf(__('This setting is passively %1$s due to %2$s!', 'litespeed-cache'), '<code>' . __('ON', 'litespeed-cache') . '</code>', Lang::title(Base::O_GUEST_OPTM)); 32 echo '⚠️ ' . sprintf(__('This setting is %1$s for certain qualifying requests due to %2$s!', 'litespeed-cache'), '<code>' . __('ON', 'litespeed-cache') . '</code>', Lang::title(Base::O_GUEST_OPTM)); 33 self::learn_more('https://docs.litespeedtech.com/lscache/lscwp/general/#guest-optimization'); 32 34 echo '</font>'; 33 35 } -
litespeed-cache/trunk/src/esi.cls.php
r2761310 r2977143 1 1 <?php 2 2 3 /** 3 4 * The ESI class. … … 10 11 * @author LiteSpeed Technologies <[email protected]> 11 12 */ 13 12 14 namespace LiteSpeed; 13 15 14 defined( 'WPINC' ) || exit; 15 16 class ESI extends Root { 16 defined('WPINC') || exit; 17 18 class ESI extends Root 19 { 20 const LOG_TAG = '⏺'; 21 17 22 private static $has_esi = false; 18 23 private static $_combine_ids = array(); 19 24 private $esi_args = null; 20 25 private $_esi_preserve_list = array(); 21 private $_nonce_actions = array( -1 => ''); // val is cache control26 private $_nonce_actions = array(-1 => ''); // val is cache control 22 27 23 28 const QS_ACTION = 'lsesi'; … … 39 44 * @since 4.0 Change to be after Vary init in hook 'after_setup_theme' 40 45 */ 41 public function init() { 46 public function init() 47 { 42 48 /** 43 49 * Bypass ESI related funcs if disabled ESI to fix potential DIVI compatibility issue 44 50 * @since 2.9.7.2 45 51 */ 46 if ( Router::is_ajax() || ! $this->cls( 'Router' )->esi_enabled()) {52 if (Router::is_ajax() || !$this->cls('Router')->esi_enabled()) { 47 53 return; 48 54 } 49 55 50 56 // Guest mode, don't need to use ESI 51 if ( defined( 'LITESPEED_GUEST' ) && LITESPEED_GUEST) {52 return; 53 } 54 55 if ( defined( 'LITESPEED_ESI_OFF' )) {57 if (defined('LITESPEED_GUEST') && LITESPEED_GUEST) { 58 return; 59 } 60 61 if (defined('LITESPEED_ESI_OFF')) { 56 62 return; 57 63 } … … 66 72 $this->_transform_nonce(); 67 73 68 ! defined( 'LITESPEED_ESI_INITED' ) && define( 'LITESPEED_ESI_INITED', true);74 !defined('LITESPEED_ESI_INITED') && define('LITESPEED_ESI_INITED', true); 69 75 } 70 76 … … 78 84 * @access private 79 85 */ 80 private function _hooks() { 81 add_filter( 'template_include', array( $this, 'esi_template' ), 99999 ); 82 83 add_action( 'load-widgets.php', __NAMESPACE__ . '\Purge::purge_widget' ); 84 add_action( 'wp_update_comment_count', __NAMESPACE__ . '\Purge::purge_comment_widget' ); 86 private function _hooks() 87 { 88 add_filter('template_include', array($this, 'esi_template'), 99999); 89 90 add_action('load-widgets.php', __NAMESPACE__ . '\Purge::purge_widget'); 91 add_action('wp_update_comment_count', __NAMESPACE__ . '\Purge::purge_comment_widget'); 85 92 86 93 /** … … 88 95 * @since 1.8.1 89 96 */ 90 if ( ! empty( $_GET[ self::QS_ACTION ] ) ) { 97 if (!empty($_GET[self::QS_ACTION])) { 98 self::debug('ESI req'); 91 99 $this->_register_esi_actions(); 92 100 } … … 106 114 * @since 2.8.1 Check is_admin for Elementor compatibility #726013 107 115 */ 108 if ( ! is_admin() ) { 109 add_shortcode( 'esi', array( $this, 'shortcode' ) ); 110 } 111 116 if (!is_admin()) { 117 add_shortcode('esi', array($this, 'shortcode')); 118 } 112 119 } 113 120 … … 117 124 * @since 2.9.5 118 125 */ 119 private function _transform_nonce() { 120 if ( is_admin() ) { 126 private function _transform_nonce() 127 { 128 if (is_admin()) { 121 129 return; 122 130 } 123 131 124 132 // Load ESI nonces in conf 125 $nonces = $this->conf( Base::O_ESI_NONCE);126 add_filter( 'litespeed_esi_nonces', array( $this->cls( 'Data' ), 'load_esi_nonces' ));127 if ( $nonces = apply_filters( 'litespeed_esi_nonces', $nonces )) {128 foreach ( $nonces as $action) {129 $this->nonce_action( $action);130 } 131 } 132 133 add_action( 'litespeed_nonce', array( $this, 'nonce_action' ));133 $nonces = $this->conf(Base::O_ESI_NONCE); 134 add_filter('litespeed_esi_nonces', array($this->cls('Data'), 'load_esi_nonces')); 135 if ($nonces = apply_filters('litespeed_esi_nonces', $nonces)) { 136 foreach ($nonces as $action) { 137 $this->nonce_action($action); 138 } 139 } 140 141 add_action('litespeed_nonce', array($this, 'nonce_action')); 134 142 } 135 143 … … 139 147 * @since 2.9.5 140 148 */ 141 public function nonce_action( $action ) { 149 public function nonce_action($action) 150 { 142 151 // Split the Cache Control 143 $action = explode( ' ', $action);144 $control = ! empty( $action[ 1 ] ) ? $action[ 1] : '';145 $action = $action[ 0];152 $action = explode(' ', $action); 153 $control = !empty($action[1]) ? $action[1] : ''; 154 $action = $action[0]; 146 155 147 156 // Wildcard supported 148 $action = Utility::wildcard2regex( $action);149 150 if ( array_key_exists( $action, $this->_nonce_actions )) {151 return; 152 } 153 154 $this->_nonce_actions[ $action] = $control;155 156 Debug2::debug( '[ESI] Appended nonce action to nonce list [action] ' . $action);157 $action = Utility::wildcard2regex($action); 158 159 if (array_key_exists($action, $this->_nonce_actions)) { 160 return; 161 } 162 163 $this->_nonce_actions[$action] = $control; 164 165 Debug2::debug('[ESI] Appended nonce action to nonce list [action] ' . $action); 157 166 } 158 167 … … 162 171 * @since 2.9.5 163 172 */ 164 public function is_nonce_action( $action ) { 173 public function is_nonce_action($action) 174 { 165 175 // If GM not run yet, then ESI not init yet, then ESI nonce will not be allowed even nonce func replaced. 166 if ( ! defined( 'LITESPEED_ESI_INITED' )) {176 if (!defined('LITESPEED_ESI_INITED')) { 167 177 return null; 168 178 } 169 179 170 if ( is_admin()) {180 if (is_admin()) { 171 181 return null; 172 182 } 173 183 174 if ( defined( 'LITESPEED_ESI_OFF' )) {184 if (defined('LITESPEED_ESI_OFF')) { 175 185 return null; 176 186 } 177 187 178 foreach ( $this->_nonce_actions as $k => $v) {179 if ( strpos( $k, '*' ) !== false) {180 if ( preg_match( '#' . $k . '#iU', $action )) {188 foreach ($this->_nonce_actions as $k => $v) { 189 if (strpos($k, '*') !== false) { 190 if (preg_match('#' . $k . '#iU', $action)) { 181 191 return $v; 182 192 } 183 } 184 else { 185 if ( $k == $action ) { 193 } else { 194 if ($k == $action) { 186 195 return $v; 187 196 } … … 198 207 * @access public 199 208 */ 200 public function shortcode( $atts ) { 201 if ( empty( $atts[ 0 ] ) ) { 202 Debug2::debug( '[ESI] ===shortcode wrong format', $atts ); 209 public function shortcode($atts) 210 { 211 if (empty($atts[0])) { 212 Debug2::debug('[ESI] ===shortcode wrong format', $atts); 203 213 return 'Wrong shortcode esi format'; 204 214 } 205 215 206 216 $cache = 'public,no-vary'; 207 if ( ! empty( $atts[ 'cache' ] )) {208 $cache = $atts[ 'cache'];209 unset( $atts[ 'cache' ]);217 if (!empty($atts['cache'])) { 218 $cache = $atts['cache']; 219 unset($atts['cache']); 210 220 } 211 221 212 222 $silence = false; 213 if ( ! empty( $atts[ '_ls_silence' ] )) {223 if (!empty($atts['_ls_silence'])) { 214 224 $silence = true; 215 225 } 216 226 217 do_action( 'litespeed_esi_shortcode-' . $atts[ 0 ]);227 do_action('litespeed_esi_shortcode-' . $atts[0]); 218 228 219 229 // Show ESI link 220 return $this->sub_esi_block( 'esi', 'esi-shortcode', $atts, $cache, $silence);230 return $this->sub_esi_block('esi', 'esi-shortcode', $atts, $cache, $silence); 221 231 } 222 232 … … 229 239 * @return string Esi On header if request has esi, empty string otherwise. 230 240 */ 231 public static function has_esi() { 241 public static function has_esi() 242 { 232 243 return self::$has_esi; 233 244 } … … 239 250 * @access public 240 251 */ 241 public static function set_has_esi() { 252 public static function set_has_esi() 253 { 242 254 self::$has_esi = true; 243 255 } … … 250 262 * @access private 251 263 */ 252 private function _register_esi_actions() { 253 ! defined( 'LSCACHE_IS_ESI' ) && define( 'LSCACHE_IS_ESI', $_GET[ self::QS_ACTION ] );// Reused this to ESI block ID 254 255 ! empty( $_SERVER[ 'ESI_REFERER' ] ) && defined( 'LSCWP_LOG' ) && Debug2::debug( '[ESI] ESI_REFERER: ' . $_SERVER[ 'ESI_REFERER' ] ); 264 private function _register_esi_actions() 265 { 266 /** 267 * This hook is in `init` 268 * For any plugin need to check if page is ESI, use `LSCACHE_IS_ESI` check after `init` hook 269 */ 270 !defined('LSCACHE_IS_ESI') && define('LSCACHE_IS_ESI', $_GET[self::QS_ACTION]); // Reused this to ESI block ID 271 272 !empty($_SERVER['ESI_REFERER']) && defined('LSCWP_LOG') && Debug2::debug('[ESI] ESI_REFERER: ' . $_SERVER['ESI_REFERER']); 256 273 257 274 /** … … 259 276 * @since 2.9.3 260 277 */ 261 if ( ! empty( $_SERVER[ 'ESI_REFERER' ] ) && ! $this->cls( 'REST' )->is_rest( $_SERVER[ 'ESI_REFERER' ] ) ) { 262 $_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'ESI_REFERER' ]; 263 } 264 265 if ( ! empty( $_SERVER[ 'ESI_CONTENT_TYPE' ] ) && strpos( $_SERVER[ 'ESI_CONTENT_TYPE' ], 'application/json' ) === 0 ) { 266 add_filter( 'litespeed_is_json', '__return_true' ); 278 if (!empty($_SERVER['ESI_REFERER']) && !$this->cls('REST')->is_rest($_SERVER['ESI_REFERER'])) { 279 self::debug('overwrite REQUEST_URI to ESI_REFERER [from] ' . $_SERVER['REQUEST_URI'] . ' [to] ' . $_SERVER['ESI_REFERER']); 280 $_SERVER['REQUEST_URI'] = trailingslashit($_SERVER['ESI_REFERER']); 281 # Prevent from 301 redirecting 282 if (!empty($_SERVER['SCRIPT_URI'])) { 283 $SCRIPT_URI = parse_url($_SERVER['SCRIPT_URI']); 284 $SCRIPT_URI['path'] = $_SERVER['REQUEST_URI']; 285 Utility::compatibility(); 286 $_SERVER['SCRIPT_URI'] = http_build_url($SCRIPT_URI); 287 } 288 } 289 290 if (!empty($_SERVER['ESI_CONTENT_TYPE']) && strpos($_SERVER['ESI_CONTENT_TYPE'], 'application/json') === 0) { 291 add_filter('litespeed_is_json', '__return_true'); 267 292 } 268 293 … … 272 297 * @since 2.9.4 273 298 */ 274 add_action( 'rest_api_init', array( $this, 'load_esi_block' ), 101);299 add_action('rest_api_init', array($this, 'load_esi_block'), 101); 275 300 276 301 // Register ESI blocks … … 279 304 add_action('litespeed_esi_load-comment-form', array($this, 'load_comment_form_block')); 280 305 281 add_action('litespeed_esi_load-nonce', array( $this, 'load_nonce_block' ));282 add_action('litespeed_esi_load-esi', array( $this, 'load_esi_shortcode' ));283 284 add_action('litespeed_esi_load-' . self::COMBO, array( $this, 'load_combo' ));306 add_action('litespeed_esi_load-nonce', array($this, 'load_nonce_block')); 307 add_action('litespeed_esi_load-esi', array($this, 'load_esi_shortcode')); 308 309 add_action('litespeed_esi_load-' . self::COMBO, array($this, 'load_combo')); 285 310 } 286 311 … … 294 319 * @return string The new template path. 295 320 */ 296 public function esi_template( $template ) { 321 public function esi_template($template) 322 { 297 323 // Check if is an ESI request 298 if ( defined( 'LSCACHE_IS_ESI' )) {299 Debug2::debug( '[ESI] calling template');324 if (defined('LSCACHE_IS_ESI')) { 325 self::debug('calling ESI template'); 300 326 301 327 return LSCWP_DIR . 'tpl/esi.tpl.php'; 302 328 } 329 self::debug('calling default template'); 303 330 $this->_register_not_esi_actions(); 304 331 return $template; … … 312 339 * @access private 313 340 */ 314 private function _register_not_esi_actions() { 315 do_action( 'litespeed_tpl_normal' ); 316 317 if ( ! Control::is_cacheable() ) { 318 return; 319 } 320 321 if ( Router::is_ajax() ) { 322 return; 323 } 324 325 add_filter('widget_display_callback', array( $this, 'sub_widget_block' ), 0, 3); 341 private function _register_not_esi_actions() 342 { 343 do_action('litespeed_tpl_normal'); 344 345 if (!Control::is_cacheable()) { 346 return; 347 } 348 349 if (Router::is_ajax()) { 350 return; 351 } 352 353 add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3); 326 354 327 355 // Add admin_bar esi 328 if ( Router::is_logged_in()) {356 if (Router::is_logged_in()) { 329 357 remove_action('wp_footer', 'wp_admin_bar_render', 1000); 330 358 add_action('wp_footer', array($this, 'sub_admin_bar_block'), 1000); … … 332 360 333 361 // Add comment forum esi for logged-in user or commenter 334 if ( ! Router::is_ajax() && Vary::has_vary() ) { 335 add_filter( 'comment_form_defaults', array( $this, 'register_comment_form_actions' ) ); 336 } 337 362 if (!Router::is_ajax() && Vary::has_vary()) { 363 add_filter('comment_form_defaults', array($this, 'register_comment_form_actions')); 364 } 338 365 } 339 366 … … 343 370 * @since 3.4.2 344 371 */ 345 public static function combine( $block_id ) { 346 if ( ! isset( $_SERVER[ 'X-LSCACHE' ] ) || strpos( $_SERVER[ 'X-LSCACHE' ], 'combine' ) === false ) { 347 return; 348 } 349 350 if ( in_array( $block_id, self::$_combine_ids ) ) { 372 public static function combine($block_id) 373 { 374 if (!isset($_SERVER['X-LSCACHE']) || strpos($_SERVER['X-LSCACHE'], 'combine') === false) { 375 return; 376 } 377 378 if (in_array($block_id, self::$_combine_ids)) { 351 379 return; 352 380 } … … 360 388 * @since 3.4.2 361 389 */ 362 public function load_combo() { 363 Control::set_nocache( 'ESI combine request' ); 364 365 if ( empty( $_POST[ 'esi_include' ] ) ) { 390 public function load_combo() 391 { 392 Control::set_nocache('ESI combine request'); 393 394 if (empty($_POST['esi_include'])) { 366 395 return; 367 396 } … … 369 398 self::set_has_esi(); 370 399 371 Debug2::debug( '[ESI] 🍔 Load combo', $_POST[ 'esi_include' ]);400 Debug2::debug('[ESI] 🍔 Load combo', $_POST['esi_include']); 372 401 373 402 $output = ''; 374 foreach ( $_POST[ 'esi_include' ] as $url) {375 $qs = parse_url( htmlspecialchars_decode( $url ), PHP_URL_QUERY);376 parse_str( $qs, $qs);377 if ( empty( $qs[ self::QS_ACTION ] )) {403 foreach ($_POST['esi_include'] as $url) { 404 $qs = parse_url(htmlspecialchars_decode($url), PHP_URL_QUERY); 405 parse_str($qs, $qs); 406 if (empty($qs[self::QS_ACTION])) { 378 407 continue; 379 408 } 380 $esi_id = $qs[ self::QS_ACTION];381 $esi_param = ! empty( $qs[ self::QS_PARAMS ] ) ? $this->_parse_esi_param( $qs[ self::QS_PARAMS ]) : false;382 $inline_param = apply_filters( 'litespeed_esi_inline-' . $esi_id, array(), $esi_param); // Returned array need to be [ val, control, tag ]383 if ( $inline_param) {384 $output .= self::_build_inline( $url, $inline_param);409 $esi_id = $qs[self::QS_ACTION]; 410 $esi_param = !empty($qs[self::QS_PARAMS]) ? $this->_parse_esi_param($qs[self::QS_PARAMS]) : false; 411 $inline_param = apply_filters('litespeed_esi_inline-' . $esi_id, array(), $esi_param); // Returned array need to be [ val, control, tag ] 412 if ($inline_param) { 413 $output .= self::_build_inline($url, $inline_param); 385 414 } 386 415 } … … 394 423 * @since 3.4.2 395 424 */ 396 private static function _build_inline( $url, $inline_param ) { 397 if ( ! $url || empty( $inline_param[ 'val' ] ) || empty( $inline_param[ 'control' ] ) || empty( $inline_param[ 'tag' ] ) ) { 425 private static function _build_inline($url, $inline_param) 426 { 427 if (!$url || empty($inline_param['val']) || empty($inline_param['control']) || empty($inline_param['tag'])) { 398 428 return ''; 399 429 } 400 430 401 return "<esi:inline name='$url' cache-control='" . $inline_param[ 'control' ] . "' cache-tag='" . $inline_param[ 'tag' ] . "'>" . $inline_param[ 'val' ] . "</esi:inline>"; 431 $url = esc_attr($url); 432 $control = esc_attr($inline_param['control']); 433 $tag = esc_attr($inline_param['tag']); 434 435 return "<esi:inline name='$url' cache-control='" . $control . "' cache-tag='" . $tag . "'>" . $inline_param['val'] . "</esi:inline>"; 402 436 } 403 437 … … 418 452 * @param array $inline_val If show the current value for current request( this can avoid multiple esi requests in first time cache generating process ) 419 453 */ 420 public function sub_esi_block( $block_id, $wrapper, $params = array(), $control = 'private,no-vary', $silence = false, $preserved = false, $svar = false, $inline_param = array() ) { 421 if ( empty($block_id) || ! is_array($params) || preg_match('/[^\w-]/', $block_id) ) { 454 public function sub_esi_block($block_id, $wrapper, $params = array(), $control = 'private,no-vary', $silence = false, $preserved = false, $svar = false, $inline_param = array()) 455 { 456 if (empty($block_id) || !is_array($params) || preg_match('/[^\w-]/', $block_id)) { 422 457 return false; 423 458 } 424 459 425 if ( defined( 'LITESPEED_ESI_OFF' )) {426 Debug2::debug( '[ESI] ESI OFF so force loading [block_id] ' . $block_id);427 do_action( 'litespeed_esi_load-' . $block_id, $params);428 return; 429 } 430 431 if ( $silence) {460 if (defined('LITESPEED_ESI_OFF')) { 461 Debug2::debug('[ESI] ESI OFF so force loading [block_id] ' . $block_id); 462 do_action('litespeed_esi_load-' . $block_id, $params); 463 return; 464 } 465 466 if ($silence) { 432 467 // Don't add comment to esi block ( original for nonce used in tag property data-nonce='esi_block' ) 433 $params[ '_ls_silence'] = true;434 } 435 436 if ( $this->cls( 'REST' )->is_rest() || $this->cls( 'REST' )->is_internal_rest()) {437 $params[ 'is_json'] = 1;438 } 439 440 $params = apply_filters( 'litespeed_esi_params', $params, $block_id);441 $control = apply_filters('litespeed_esi_control', $control, $block_id );442 443 if ( !is_array($params) || !is_string($control)) {444 defined( 'LSCWP_LOG' ) && Debug2::debug( "[ESI] 🛑 Sub hooks returned Params: \n" . var_export($params, true) . "\ncache control: \n" . var_export($control, true));468 $params['_ls_silence'] = true; 469 } 470 471 if ($this->cls('REST')->is_rest() || $this->cls('REST')->is_internal_rest()) { 472 $params['is_json'] = 1; 473 } 474 475 $params = apply_filters('litespeed_esi_params', $params, $block_id); 476 $control = apply_filters('litespeed_esi_control', $control, $block_id); 477 478 if (!is_array($params) || !is_string($control)) { 479 defined('LSCWP_LOG') && Debug2::debug("[ESI] 🛑 Sub hooks returned Params: \n" . var_export($params, true) . "\ncache control: \n" . var_export($control, true)); 445 480 446 481 return false; … … 451 486 self::QS_ACTION => $block_id, 452 487 ); 453 if ( ! empty( $control )) {454 $appended_params[ '_control'] = $control;455 } 456 if ( $params) {457 $appended_params[ self::QS_PARAMS ] = base64_encode( json_encode( $params ));458 Debug2::debug2( '[ESI] param ', $params);488 if (!empty($control)) { 489 $appended_params['_control'] = $control; 490 } 491 if ($params) { 492 $appended_params[self::QS_PARAMS] = base64_encode(json_encode($params)); 493 Debug2::debug2('[ESI] param ', $params); 459 494 } 460 495 461 496 // Append hash 462 $appended_params[ '_hash' ] = $this->_gen_esi_md5( $appended_params);497 $appended_params['_hash'] = $this->_gen_esi_md5($appended_params); 463 498 464 499 /** … … 466 501 * @since 2.9.4 467 502 */ 468 $appended_params = array_map( 'urlencode', $appended_params);503 $appended_params = array_map('urlencode', $appended_params); 469 504 470 505 // Generate ESI URL 471 $url = add_query_arg( $appended_params, trailingslashit( wp_make_link_relative( home_url() ) ));506 $url = add_query_arg($appended_params, trailingslashit(wp_make_link_relative(home_url()))); 472 507 473 508 $output = ''; 474 if ( $inline_param) {475 $output .= self::_build_inline( $url, $inline_param);509 if ($inline_param) { 510 $output .= self::_build_inline($url, $inline_param); 476 511 } 477 512 478 513 $output .= "<esi:include src='$url'"; 479 if ( ! empty( $control ) ) { 514 if (!empty($control)) { 515 $control = esc_attr($control); 480 516 $output .= " cache-control='$control'"; 481 517 } 482 if ( $svar) {518 if ($svar) { 483 519 $output .= " as-var='1'"; 484 520 } 485 if ( in_array( $block_id, self::$_combine_ids )) {521 if (in_array($block_id, self::$_combine_ids)) { 486 522 $output .= " combine='sub'"; 487 523 } 488 if ( $block_id == self::COMBO && isset( $_SERVER[ 'X-LSCACHE' ] ) && strpos( $_SERVER[ 'X-LSCACHE' ], 'combine' ) !== false) {524 if ($block_id == self::COMBO && isset($_SERVER['X-LSCACHE']) && strpos($_SERVER['X-LSCACHE'], 'combine') !== false) { 489 525 $output .= " combine='main'"; 490 526 } 491 527 $output .= " />"; 492 528 493 if ( ! $silence) {529 if (!$silence) { 494 530 $output = "<!-- lscwp $wrapper -->$output<!-- lscwp $wrapper esi end -->"; 495 531 } 496 532 497 Debug2::debug( "[ESI] 💕 [BLock_ID] $block_id \t[wrapper] $wrapper \t\t[Control] $control");498 Debug2::debug2( $output);533 self::debug("💕 [BLock_ID] $block_id \t[wrapper] $wrapper \t\t[Control] $control"); 534 self::debug2($output); 499 535 500 536 self::set_has_esi(); … … 502 538 // Convert to string to avoid html chars filter when using 503 539 // Will reverse the buffer when output in self::finalize() 504 if ( $preserved) {505 $hash = md5( $output);506 $this->_esi_preserve_list[ $hash] = $output;507 Debug2::debug( "[ESI] Preserved to $hash");540 if ($preserved) { 541 $hash = md5($output); 542 $this->_esi_preserve_list[$hash] = $output; 543 self::debug("Preserved to $hash"); 508 544 509 545 return $hash; … … 519 555 * @access private 520 556 */ 521 private function _gen_esi_md5( $params ) { 557 private function _gen_esi_md5($params) 558 { 522 559 $keys = array( 523 560 self::QS_ACTION, … … 527 564 528 565 $str = ''; 529 foreach ( $keys as $v) {530 if ( isset( $params[ $v ] ) && is_string( $params[ $v ] )) {531 $str .= $params[ $v];532 } 533 } 534 Debug2::debug2( '[ESI] md5_string=' . $str);535 536 return md5( $this->conf( Base::HASH ) . $str);566 foreach ($keys as $v) { 567 if (isset($params[$v]) && is_string($params[$v])) { 568 $str .= $params[$v]; 569 } 570 } 571 Debug2::debug2('[ESI] md5_string=' . $str); 572 573 return md5($this->conf(Base::HASH) . $str); 537 574 } 538 575 … … 543 580 * @access private 544 581 */ 545 private function _parse_esi_param( $qs_params = false ) { 582 private function _parse_esi_param($qs_params = false) 583 { 546 584 $req_params = false; 547 if ( $qs_params) {585 if ($qs_params) { 548 586 $req_params = $qs_params; 549 } 550 elseif ( isset( $_REQUEST[ self::QS_PARAMS ] ) ) { 551 $req_params = $_REQUEST[ self::QS_PARAMS ]; 552 } 553 554 if ( ! $req_params ) { 587 } elseif (isset($_REQUEST[self::QS_PARAMS])) { 588 $req_params = $_REQUEST[self::QS_PARAMS]; 589 } 590 591 if (!$req_params) { 555 592 return false; 556 593 } 557 594 558 $unencrypted = base64_decode( $req_params);559 if ( $unencrypted === false) {595 $unencrypted = base64_decode($req_params); 596 if ($unencrypted === false) { 560 597 return false; 561 598 } 562 599 563 Debug2::debug2( '[ESI] parms', $unencrypted);600 Debug2::debug2('[ESI] parms', $unencrypted); 564 601 // $unencoded = urldecode($unencrypted); no need to do this as $_GET is already parsed 565 $params = json_decode( $unencrypted, true);602 $params = json_decode($unencrypted, true); 566 603 567 604 return $params; … … 574 611 * @access public 575 612 */ 576 public function load_esi_block() { 613 public function load_esi_block() 614 { 577 615 /** 578 616 * Validate if is a legal ESI req 579 617 * @since 2.9.6 580 618 */ 581 if ( empty( $_GET[ '_hash' ] ) || $this->_gen_esi_md5( $_GET ) != $_GET[ '_hash' ]) {582 Debug2::debug( '[ESI] ❌ Failed to validate _hash');619 if (empty($_GET['_hash']) || $this->_gen_esi_md5($_GET) != $_GET['_hash']) { 620 Debug2::debug('[ESI] ❌ Failed to validate _hash'); 583 621 return; 584 622 } … … 586 624 $params = $this->_parse_esi_param(); 587 625 588 if ( defined( 'LSCWP_LOG' )) {626 if (defined('LSCWP_LOG')) { 589 627 $logInfo = '[ESI] ⭕ '; 590 if ( ! empty( $params[ self::PARAM_NAME ] )) {591 $logInfo .= ' Name: ' . $params[ self::PARAM_NAME] . ' ----- ';628 if (!empty($params[self::PARAM_NAME])) { 629 $logInfo .= ' Name: ' . $params[self::PARAM_NAME] . ' ----- '; 592 630 } 593 631 $logInfo .= ' [ID] ' . LSCACHE_IS_ESI; 594 Debug2::debug( $logInfo);595 } 596 597 if ( ! empty( $params[ '_ls_silence' ] )) {598 ! defined( 'LSCACHE_ESI_SILENCE' ) && define( 'LSCACHE_ESI_SILENCE', true);632 Debug2::debug($logInfo); 633 } 634 635 if (!empty($params['_ls_silence'])) { 636 !defined('LSCACHE_ESI_SILENCE') && define('LSCACHE_ESI_SILENCE', true); 599 637 } 600 638 … … 603 641 * @since 2.9.4 604 642 */ 605 if ( ! empty( $params[ 'is_json' ] )) {606 add_filter( 'litespeed_is_json', '__return_true');607 } 608 609 Tag::add( rtrim( Tag::TYPE_ESI, '.' ));610 Tag::add( Tag::TYPE_ESI . LSCACHE_IS_ESI);643 if (!empty($params['is_json'])) { 644 add_filter('litespeed_is_json', '__return_true'); 645 } 646 647 Tag::add(rtrim(Tag::TYPE_ESI, '.')); 648 Tag::add(Tag::TYPE_ESI . LSCACHE_IS_ESI); 611 649 612 650 // Debug2::debug(var_export($params, true )); … … 617 655 * @since 2.2.3 618 656 */ 619 if ( ! empty( $_GET[ '_control' ] )) {620 $control = explode( ',', $_GET[ '_control' ]);621 if ( in_array( 'private', $control )) {657 if (!empty($_GET['_control'])) { 658 $control = explode(',', $_GET['_control']); 659 if (in_array('private', $control)) { 622 660 Control::set_private(); 623 661 } 624 662 625 if ( in_array( 'no-vary', $control )) {663 if (in_array('no-vary', $control)) { 626 664 Control::set_no_vary(); 627 665 } … … 631 669 } 632 670 633 // The *_sub_* functions are helpers for the sub_* functions.634 // The *_load_* functions are helpers for the load_* functions.671 // The *_sub_* functions are helpers for the sub_* functions. 672 // The *_load_* functions are helpers for the load_* functions. 635 673 636 674 /** … … 640 678 * @access public 641 679 */ 642 public static function widget_default_options($options, $widget) { 643 if ( ! is_array($options) ) { 680 public static function widget_default_options($options, $widget) 681 { 682 if (!is_array($options)) { 644 683 return $options; 645 684 } … … 647 686 $widget_name = get_class($widget); 648 687 switch ($widget_name) { 649 case 'WP_Widget_Recent_Posts' :650 case 'WP_Widget_Recent_Comments' :688 case 'WP_Widget_Recent_Posts': 689 case 'WP_Widget_Recent_Comments': 651 690 $options[self::WIDGET_O_ESIENABLE] = Base::VAL_OFF; 652 691 $options[self::WIDGET_O_TTL] = 86400; 653 692 break; 654 default :693 default: 655 694 break; 656 695 } … … 670 709 * @return mixed Return false if display through esi, instance otherwise. 671 710 */ 672 public function sub_widget_block( $instance, $widget, $args ) { 711 public function sub_widget_block($instance, $widget, $args) 712 { 673 713 // #210407 674 if ( ! is_array( $instance )) {714 if (!is_array($instance)) { 675 715 return $instance; 676 716 } 677 717 678 $name = get_class( $widget);679 if ( ! isset( $instance[ Base::OPTION_NAME ] )) {718 $name = get_class($widget); 719 if (!isset($instance[Base::OPTION_NAME])) { 680 720 return $instance; 681 721 } 682 $options = $instance[ Base::OPTION_NAME];683 if ( ! isset( $options ) || ! $options[ self::WIDGET_O_ESIENABLE ]) {684 defined( 'LSCWP_LOG' ) && Debug2::debug( 'ESI 0 ' . $name . ': '. ( ! isset( $options ) ? 'not set' : 'set off' ));722 $options = $instance[Base::OPTION_NAME]; 723 if (!isset($options) || !$options[self::WIDGET_O_ESIENABLE]) { 724 defined('LSCWP_LOG') && Debug2::debug('ESI 0 ' . $name . ': ' . (!isset($options) ? 'not set' : 'set off')); 685 725 686 726 return $instance; 687 727 } 688 728 689 $esi_private = $options[ self::WIDGET_O_ESIENABLE] == Base::VAL_ON2 ? 'private,' : '';729 $esi_private = $options[self::WIDGET_O_ESIENABLE] == Base::VAL_ON2 ? 'private,' : ''; 690 730 691 731 $params = array( … … 696 736 ); 697 737 698 echo $this->sub_esi_block( 'widget', 'widget ' . $name, $params, $esi_private . 'no-vary');738 echo $this->sub_esi_block('widget', 'widget ' . $name, $params, $esi_private . 'no-vary'); 699 739 700 740 return false; … … 709 749 * @global type $wp_admin_bar 710 750 */ 711 public function sub_admin_bar_block() { 751 public function sub_admin_bar_block() 752 { 712 753 global $wp_admin_bar; 713 754 714 if ( ! is_admin_bar_showing() || ! is_object($wp_admin_bar)) {755 if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) { 715 756 return; 716 757 } … … 718 759 // To make each admin bar ESI request different for `Edit` button different link 719 760 $params = array( 720 'ref' => $_SERVER[ 'REQUEST_URI'],761 'ref' => $_SERVER['REQUEST_URI'], 721 762 ); 722 763 723 echo $this->sub_esi_block( 'admin-bar', 'adminbar', $params);764 echo $this->sub_esi_block('admin-bar', 'adminbar', $params); 724 765 } 725 766 … … 732 773 * @param array $params Input parameters needed to correctly display widget 733 774 */ 734 public function load_widget_block( $params ) { 775 public function load_widget_block($params) 776 { 735 777 // global $wp_widget_factory; 736 778 // $widget = $wp_widget_factory->widgets[ $params[ self::PARAM_NAME ] ]; 737 $option = $params[ self::PARAM_INSTANCE];738 $option = $option[ Base::OPTION_NAME];779 $option = $params[self::PARAM_INSTANCE]; 780 $option = $option[Base::OPTION_NAME]; 739 781 740 782 // Since we only reach here via esi, safe to assume setting exists. 741 $ttl = $option[ self::WIDGET_O_TTL ]; 742 defined( 'LSCWP_LOG' ) && Debug2::debug( 'ESI widget render: name ' . $params[ self::PARAM_NAME ] . ', id ' . $params[ self::PARAM_ID ] . ', ttl ' . $ttl ); 743 if ( $ttl == 0 ) { 744 Control::set_nocache( 'ESI Widget time to live set to 0' ); 745 } 746 else { 747 Control::set_custom_ttl( $ttl ); 748 749 if ( $option[ self::WIDGET_O_ESIENABLE ] == Base::VAL_ON2 ) { 783 $ttl = $option[self::WIDGET_O_TTL]; 784 defined('LSCWP_LOG') && Debug2::debug('ESI widget render: name ' . $params[self::PARAM_NAME] . ', id ' . $params[self::PARAM_ID] . ', ttl ' . $ttl); 785 if ($ttl == 0) { 786 Control::set_nocache('ESI Widget time to live set to 0'); 787 } else { 788 Control::set_custom_ttl($ttl); 789 790 if ($option[self::WIDGET_O_ESIENABLE] == Base::VAL_ON2) { 750 791 Control::set_private(); 751 792 } 752 793 Control::set_no_vary(); 753 Tag::add( Tag::TYPE_WIDGET . $params[ self::PARAM_ID ]);754 } 755 the_widget( $params[ self::PARAM_NAME ], $params[ self::PARAM_INSTANCE ], $params[ self::PARAM_ARGS ]);794 Tag::add(Tag::TYPE_WIDGET . $params[self::PARAM_ID]); 795 } 796 the_widget($params[self::PARAM_NAME], $params[self::PARAM_INSTANCE], $params[self::PARAM_ARGS]); 756 797 } 757 798 … … 762 803 * @since 1.1.3 763 804 */ 764 public function load_admin_bar_block( $params ) { 765 766 if ( ! empty( $params[ 'ref' ] ) ) { 767 $ref_qs = parse_url( $params[ 'ref' ], PHP_URL_QUERY ); 768 if ( ! empty( $ref_qs ) ) { 769 parse_str( $ref_qs, $ref_qs_arr ); 770 771 if ( ! empty( $ref_qs_arr ) ) { 772 foreach ( $ref_qs_arr as $k => $v ) { 773 $_GET[ $k ] = $v; 805 public function load_admin_bar_block($params) 806 { 807 808 if (!empty($params['ref'])) { 809 $ref_qs = parse_url($params['ref'], PHP_URL_QUERY); 810 if (!empty($ref_qs)) { 811 parse_str($ref_qs, $ref_qs_arr); 812 813 if (!empty($ref_qs_arr)) { 814 foreach ($ref_qs_arr as $k => $v) { 815 $_GET[$k] = $v; 774 816 } 775 817 } … … 778 820 779 821 wp_admin_bar_render(); 780 if ( ! $this->conf( Base::O_ESI_CACHE_ADMBAR ) ) { 781 Control::set_nocache( 'build-in set to not cacheable' ); 782 } 783 else { 822 if (!$this->conf(Base::O_ESI_CACHE_ADMBAR)) { 823 Control::set_nocache('build-in set to not cacheable'); 824 } else { 784 825 Control::set_private(); 785 826 Control::set_no_vary(); 786 827 } 787 828 788 defined( 'LSCWP_LOG' ) && Debug2::debug( 'ESI: adminbar ref: ' . $_SERVER[ 'REQUEST_URI' ]);829 defined('LSCWP_LOG') && Debug2::debug('ESI: adminbar ref: ' . $_SERVER['REQUEST_URI']); 789 830 } 790 831 … … 797 838 * @param array $params Input parameters needed to correctly display comment form 798 839 */ 799 public function load_comment_form_block( $params ) {800 comment_form( $params[ self::PARAM_ARGS ], $params[ self::PARAM_ID ] );801 802 if ( ! $this->conf( Base::O_ESI_CACHE_COMMFORM ) ) { 803 Control::set_nocache( 'build-in set to not cacheable' );804 }805 else {840 public function load_comment_form_block($params) 841 { 842 comment_form($params[self::PARAM_ARGS], $params[self::PARAM_ID]); 843 844 if (!$this->conf(Base::O_ESI_CACHE_COMMFORM)) { 845 Control::set_nocache('build-in set to not cacheable'); 846 } else { 806 847 // by default comment form is public 807 if ( Vary::has_vary()) {848 if (Vary::has_vary()) { 808 849 Control::set_private(); 809 850 Control::set_no_vary(); … … 818 859 * @since 2.6 819 860 */ 820 public function load_nonce_block( $params ) { 821 $action = $params[ 'action' ]; 822 823 Debug2::debug( '[ESI] load_nonce_block [action] ' . $action ); 861 public function load_nonce_block($params) 862 { 863 $action = $params['action']; 864 865 Debug2::debug('[ESI] load_nonce_block [action] ' . $action); 824 866 825 867 // set nonce TTL to half day 826 Control::set_custom_ttl( 43200);827 828 if ( Router::is_logged_in()) {868 Control::set_custom_ttl(43200); 869 870 if (Router::is_logged_in()) { 829 871 Control::set_private(); 830 872 } 831 873 832 if ( function_exists( 'wp_create_nonce_litespeed_esi' ) ) { 833 echo wp_create_nonce_litespeed_esi( $action ); 834 } 835 else { 836 echo wp_create_nonce( $action ); 874 if (function_exists('wp_create_nonce_litespeed_esi')) { 875 echo wp_create_nonce_litespeed_esi($action); 876 } else { 877 echo wp_create_nonce($action); 837 878 } 838 879 } … … 844 885 * @since 2.8 845 886 */ 846 public function load_esi_shortcode( $params ) {847 if ( isset( $params[ 'ttl' ] ) ){848 if ( ! $params[ 'ttl' ]) {849 Control::set_nocache( 'ESI shortcode att ttl=0' );850 }851 else {852 Control::set_custom_ttl( $params[ 'ttl' ]);853 } 854 unset( $params[ 'ttl' ]);887 public function load_esi_shortcode($params) 888 { 889 if (isset($params['ttl'])) { 890 if (!$params['ttl']) { 891 Control::set_nocache('ESI shortcode att ttl=0'); 892 } else { 893 Control::set_custom_ttl($params['ttl']); 894 } 895 unset($params['ttl']); 855 896 } 856 897 857 898 // Replace to original shortcode 858 $shortcode = $params[ 0];899 $shortcode = $params[0]; 859 900 $atts_ori = array(); 860 foreach ( $params as $k => $v) {861 if ( $k === 0) {901 foreach ($params as $k => $v) { 902 if ($k === 0) { 862 903 continue; 863 904 } 864 905 865 $atts_ori[] = is_string( $k ) ? "$k='" . addslashes( $v) . "'" : $v;866 } 867 868 Tag::add( Tag::TYPE_ESI . "esi.$shortcode");906 $atts_ori[] = is_string($k) ? "$k='" . addslashes($v) . "'" : $v; 907 } 908 909 Tag::add(Tag::TYPE_ESI . "esi.$shortcode"); 869 910 870 911 // Output original shortcode final content 871 echo do_shortcode( "[$shortcode " . implode( ' ', $atts_ori ) . " ]");912 echo do_shortcode("[$shortcode " . implode(' ', $atts_ori) . " ]"); 872 913 } 873 914 … … 881 922 * @access public 882 923 */ 883 public function register_comment_form_actions( $defaults ) { 924 public function register_comment_form_actions($defaults) 925 { 884 926 $this->esi_args = $defaults; 885 927 echo GUI::clean_wrapper_begin(); 886 add_filter( 'comment_form_submit_button', array( $this, 'sub_comment_form_btn' ), 1000, 2); // To save the params passed in887 add_action( 'comment_form', array( $this, 'sub_comment_form_block' ), 1000);928 add_filter('comment_form_submit_button', array($this, 'sub_comment_form_btn'), 1000, 2); // To save the params passed in 929 add_action('comment_form', array($this, 'sub_comment_form_block'), 1000); 888 930 return $defaults; 889 931 } … … 895 937 * @access public 896 938 */ 897 public function sub_comment_form_btn( $unused, $args ) { 898 if ( empty( $args ) || empty( $this->esi_args ) ) { 899 Debug2::debug( 'comment form args empty?' ); 939 public function sub_comment_form_btn($unused, $args) 940 { 941 if (empty($args) || empty($this->esi_args)) { 942 Debug2::debug('comment form args empty?'); 900 943 return $unused; 901 944 } … … 903 946 904 947 // compare current args with default ones 905 foreach ( $args as $k => $v ) { 906 if ( ! isset( $this->esi_args[ $k ] ) ) { 907 $esi_args[ $k ] = $v; 908 } 909 elseif ( is_array( $v ) ) { 910 $diff = array_diff_assoc( $v, $this->esi_args[ $k ] ); 911 if ( ! empty( $diff ) ) { 912 $esi_args[ $k ] = $diff; 948 foreach ($args as $k => $v) { 949 if (!isset($this->esi_args[$k])) { 950 $esi_args[$k] = $v; 951 } elseif (is_array($v)) { 952 $diff = array_diff_assoc($v, $this->esi_args[$k]); 953 if (!empty($diff)) { 954 $esi_args[$k] = $diff; 913 955 } 914 } 915 elseif ( $v !== $this->esi_args[ $k ] ) { 916 $esi_args[ $k ] = $v; 956 } elseif ($v !== $this->esi_args[$k]) { 957 $esi_args[$k] = $v; 917 958 } 918 959 } … … 931 972 * @since 1.1.3 932 973 */ 933 public function sub_comment_form_block( $post_id ) { 974 public function sub_comment_form_block($post_id) 975 { 934 976 echo GUI::clean_wrapper_end(); 935 977 $params = array( … … 938 980 ); 939 981 940 echo $this->sub_esi_block( 'comment-form', 'comment form', $params);982 echo $this->sub_esi_block('comment-form', 'comment form', $params); 941 983 echo GUI::clean_wrapper_begin(); 942 add_action( 'comment_form_after', array( $this, 'comment_form_sub_clean' ));984 add_action('comment_form_after', array($this, 'comment_form_sub_clean')); 943 985 } 944 986 … … 950 992 * @access public 951 993 */ 952 public function comment_form_sub_clean() { 994 public function comment_form_sub_clean() 995 { 953 996 echo GUI::clean_wrapper_end(); 954 997 } … … 960 1003 * @access public 961 1004 */ 962 public function finalize( $buffer ) { 1005 public function finalize($buffer) 1006 { 963 1007 // Prepend combo esi block 964 if ( self::$_combine_ids) {965 Debug2::debug( '[ESI] 🍔 Enabled combo');966 $esi_block = $this->sub_esi_block( self::COMBO, '__COMBINE_MAIN__', array(), 'no-cache', true);1008 if (self::$_combine_ids) { 1009 Debug2::debug('[ESI] 🍔 Enabled combo'); 1010 $esi_block = $this->sub_esi_block(self::COMBO, '__COMBINE_MAIN__', array(), 'no-cache', true); 967 1011 $buffer = $esi_block . $buffer; 968 1012 } 969 1013 970 1014 // Bypass if no preserved list to be replaced 971 if ( ! $this->_esi_preserve_list) {1015 if (!$this->_esi_preserve_list) { 972 1016 return $buffer; 973 1017 } 974 1018 975 $keys = array_keys( $this->_esi_preserve_list);976 977 Debug2::debug( '[ESI] replacing preserved blocks', $keys);978 979 $buffer = str_replace( $keys, $this->_esi_preserve_list, $buffer);1019 $keys = array_keys($this->_esi_preserve_list); 1020 1021 Debug2::debug('[ESI] replacing preserved blocks', $keys); 1022 1023 $buffer = str_replace($keys, $this->_esi_preserve_list, $buffer); 980 1024 981 1025 return $buffer; … … 987 1031 * @since 3.3 988 1032 */ 989 public function contain_preserve_esi( $content ) { 1033 public function contain_preserve_esi($content) 1034 { 990 1035 $hit_list = array(); 991 foreach ( $this->_esi_preserve_list as $k => $v) {992 if ( strpos( $content, '"' . $k . '"' ) !== false) {1036 foreach ($this->_esi_preserve_list as $k => $v) { 1037 if (strpos($content, '"' . $k . '"') !== false) { 993 1038 $hit_list[] = '"' . $k . '"'; 994 1039 } 995 if ( strpos( $content, "'" . $k . "'" ) !== false) {1040 if (strpos($content, "'" . $k . "'") !== false) { 996 1041 $hit_list[] = "'" . $k . "'"; 997 1042 } … … 999 1044 return $hit_list; 1000 1045 } 1001 1002 1046 } -
litespeed-cache/trunk/src/htaccess.cls.php
r2928795 r2977143 559 559 $vary_cookies[] = ',wp-postpass_' . COOKIEHASH; 560 560 } 561 $vary_cookies = apply_filters('litespeed_vary_cookies', $vary_cookies); // todo: test if response vary header can work in latest OLS, drop the above two lines562 }561 } 562 $vary_cookies = apply_filters('litespeed_vary_cookies', $vary_cookies); // todo: test if response vary header can work in latest OLS, drop the above two lines 563 563 // frontend and backend 564 564 if ($vary_cookies) { 565 565 $env = 'Cache-Vary:' . implode(',', $vary_cookies); 566 if (LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS') {567 $env = '"' . $env . '"';568 }566 // if (LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS') { 567 // } 568 $env = '"' . $env . '"'; 569 569 $new_rules[] = $new_rules_backend[] = self::MARKER_LOGIN_COOKIE . self::MARKER_START; 570 570 $new_rules[] = $new_rules_backend[] = 'RewriteRule .? - [E=' . $env . ']'; … … 594 594 // webp support 595 595 $id = Base::O_IMG_OPTM_WEBP; 596 if (!empty($cfg[$id]) || !empty($cfg[Base::O_GUEST])) {596 if (!empty($cfg[$id]) || (!empty($cfg[Base::O_GUEST]) && !empty($cfg[Base::O_GUEST_OPTM]))) { 597 597 $new_rules[] = self::MARKER_WEBP . self::MARKER_START; 598 598 $new_rules[] = 'RewriteCond %{HTTP_ACCEPT} "image/webp"'; -
litespeed-cache/trunk/src/img-optm.cls.php
r2940517 r2977143 1191 1191 $to_be_continued = $wpdb->get_row($wpdb->prepare($img_q, array($offset * $limit, 1))); 1192 1192 if ($to_be_continued) { 1193 return Router::self_redirect(Router::ACTION_IMG_OPTM, self::TYPE_DESTROY); 1193 # Check if post_id is beyond next_post_id 1194 self::debug('[next_post_id] ' . $this->_summary['next_post_id'] . ' [cursor post id] ' . $to_be_continued->post_id); 1195 if ($to_be_continued->post_id <= $this->_summary['next_post_id']) { 1196 self::debug('redirecting to next'); 1197 return Router::self_redirect(Router::ACTION_IMG_OPTM, self::TYPE_DESTROY); 1198 } 1199 self::debug('🎊 Finished destroying'); 1194 1200 } 1195 1201 … … 1220 1226 $short_file_path = $this->tmp_path . $short_file_path; 1221 1227 } 1228 self::debug('deleting ' . $short_file_path); 1222 1229 1223 1230 // del webp … … 1232 1239 // del optimized ori 1233 1240 if ($this->__media->info($bk_file, $this->tmp_pid)) { 1241 self::debug('deleting optim ori'); 1234 1242 $this->__media->del($short_file_path, $this->tmp_pid); 1235 1243 $this->__media->rename($bk_file, $short_file_path, $this->tmp_pid); -
litespeed-cache/trunk/src/lang.cls.php
r2954001 r2977143 156 156 self::O_OPTM_DNS_PREFETCH => __('DNS Prefetch', 'litespeed-cache'), 157 157 self::O_OPTM_DNS_PREFETCH_CTRL => __('DNS Prefetch Control', 'litespeed-cache'), 158 self::O_OPTM_DNS_PRECONNECT => __('DNS Preconnect', 'litespeed-cache'), 158 159 self::O_OPTM_CSS_EXC => __('CSS Excludes', 'litespeed-cache'), 159 160 self::O_OPTM_JS_DELAY_INC => __('JS Delayed Includes', 'litespeed-cache'), -
litespeed-cache/trunk/src/media.cls.php
r2928795 r2977143 645 645 // Add missing dimensions 646 646 if (defined('LITESPEED_GUEST_OPTM') || $this->conf(Base::O_MEDIA_ADD_MISSING_SIZES)) { 647 if (empty($attrs['width']) || $attrs['width'] == 'auto' || empty($attrs['height']) || $attrs['height'] == 'auto') { 647 if (!apply_filters('litespeed_media_add_missing_sizes', true)) { 648 Debug2::debug2('[Media] add_missing_sizes bypassed via litespeed_media_add_missing_sizes filter'); 649 } elseif (empty($attrs['width']) || $attrs['width'] == 'auto' || empty($attrs['height']) || $attrs['height'] == 'auto') { 648 650 self::debug('⚠️ Missing sizes for image [src] ' . $attrs['src']); 649 651 $dimensions = $this->_detect_dimensions($attrs['src']); -
litespeed-cache/trunk/src/optimize.cls.php
r2954001 r2977143 35 35 36 36 private $dns_prefetch; 37 private $dns_preconnect; 37 38 private $_ggfonts_urls = array(); 38 39 private $_ccss; … … 128 129 */ 129 130 $this->_dns_prefetch_init(); 131 132 /** 133 * Preconnect 134 * @since 5.6.1 135 */ 136 $this->_dns_preconnect_init(); 130 137 131 138 add_filter('litespeed_buffer_finalize', array($this, 'finalize'), 20); … … 659 666 660 667 /** 668 * Preconnect init 669 * 670 * @since 5.6.1 671 */ 672 private function _dns_preconnect_init() 673 { 674 675 $this->dns_preconnect = $this->conf(self::O_OPTM_DNS_PRECONNECT); 676 if ($this->dns_preconnect) { 677 add_action('litespeed_optm', array($this, 'dns_preconnect_output')); 678 } 679 } 680 681 /** 661 682 * Prefetch DNS hook for WP 662 683 * … … 690 711 if ($v) { 691 712 $this->html_head .= '<link rel="dns-prefetch" href="' . $v . '" />'; 713 } 714 } 715 } 716 717 /** 718 * Preconnect 719 * 720 * @since 5.6.1 721 * @access public 722 */ 723 public function dns_preconnect_output() 724 { 725 foreach ($this->dns_preconnect as $v) { 726 if ($v) { 727 $this->html_head .= '<link rel="preconnect" href="' . $v . '" />'; 692 728 } 693 729 } … … 823 859 824 860 $combine_ext_inl = $this->conf(self::O_OPTM_JS_COMB_EXT_INL); 861 if (!apply_filters('litespeed_optm_js_comb_ext_inl', true)) { 862 Debug2::debug2('[Optm] js_comb_ext_inl bypassed via litespeed_optm_js_comb_ext_inl filter'); 863 $combine_ext_inl = false; 864 } 825 865 826 866 $src_list = array(); … … 996 1036 997 1037 $combine_ext_inl = $this->conf(self::O_OPTM_CSS_COMB_EXT_INL); 1038 if (!apply_filters('litespeed_optm_css_comb_ext_inl', true)) { 1039 Debug2::debug2('[Optm] css_comb_ext_inl bypassed via litespeed_optm_css_comb_ext_inl filter'); 1040 $combine_ext_inl = false; 1041 } 998 1042 999 1043 $css_to_be_removed = apply_filters('litespeed_optm_css_to_be_removed', array()); -
litespeed-cache/trunk/thirdparty/litespeed-check.cls.php
r2771786 r2977143 1 1 <?php 2 2 3 /** 3 4 * Check if any plugins that could conflict with LiteSpeed Cache are active. … … 7 8 namespace LiteSpeed\Thirdparty; 8 9 9 defined( 'WPINC') || exit;10 defined('WPINC') || exit; 10 11 11 class LiteSpeed_Check { 12 class LiteSpeed_Check 13 { 12 14 13 15 public static $_incompatible_plugins = 14 array( 15 // 'autoptimize/autoptimize.php', 16 'breeze/breeze.php', 17 'cache-enabler/cache-enabler.php', 18 'cachify/cachify.php', 19 'cloudflare/cloudflare.php', 20 'comet-cache/comet-cache.php', 21 'docket-cache/docket-cache.php', 22 'fast-velocity-minify/fvm.php', 23 'hummingbird-performance/wp-hummingbird.php', 24 'nginx-cache/nginx-cache.php', 25 'nitropack/main.php', 26 'pantheon-advanced-page-cache/pantheon-advanced-page-cache.php', 27 'powered-cache/powered-cache.php', 28 'sg-cachepress/sg-cachepress.php', 29 'simple-cache/simple-cache.php', 30 // 'redis-cache/redis-cache.php', 31 'w3-total-cache/w3-total-cache.php', 32 'wp-cloudflare-page-cache/wp-cloudflare-page-cache.php', 33 'wp-fastest-cache/wpFastestCache.php', 34 'wp-meteor/wp-meteor.php', 35 'wp-optimize/wp-optimize.php', 36 'wp-performance-score-booster/wp-performance-score-booster.php', 37 'wp-rocket/wp-rocket.php', 38 'wp-super-cache/wp-cache.php', 39 ); 16 array( 17 // 'autoptimize/autoptimize.php', 18 'breeze/breeze.php', 19 'cache-enabler/cache-enabler.php', 20 'cachify/cachify.php', 21 'cloudflare/cloudflare.php', 22 'comet-cache/comet-cache.php', 23 'docket-cache/docket-cache.php', 24 'fast-velocity-minify/fvm.php', 25 'hummingbird-performance/wp-hummingbird.php', 26 'nginx-cache/nginx-cache.php', 27 'nitropack/main.php', 28 'pantheon-advanced-page-cache/pantheon-advanced-page-cache.php', 29 'powered-cache/powered-cache.php', 30 'psn-pagespeed-ninja/pagespeedninja.php', 31 'sg-cachepress/sg-cachepress.php', 32 'simple-cache/simple-cache.php', 33 // 'redis-cache/redis-cache.php', 34 'w3-total-cache/w3-total-cache.php', 35 'wp-cloudflare-page-cache/wp-cloudflare-page-cache.php', 36 'wp-fastest-cache/wpFastestCache.php', 37 'wp-meteor/wp-meteor.php', 38 'wp-optimize/wp-optimize.php', 39 'wp-performance-score-booster/wp-performance-score-booster.php', 40 'wp-rocket/wp-rocket.php', 41 'wp-super-cache/wp-cache.php', 42 ); 40 43 41 44 private static $_option = 'thirdparty_litespeed_check'; 42 45 private static $_msg_id = 'id="lscwp-incompatible-plugin-notice"'; 43 46 44 public static function detect() { 45 if ( ! is_admin() ) { 47 public static function detect() 48 { 49 if (!is_admin()) { 46 50 return; 47 51 } … … 50 54 * Check for incompatible plugins when `litespeed-cache` is first activated. 51 55 */ 52 $plugin = basename( LSCWP_DIR) . '/litespeed-cache.php';53 register_deactivation_hook( $plugin, function( $_network_wide) {54 \LiteSpeed\Admin_Display::delete_option( self::$_option);55 } );56 if ( ! \LiteSpeed\Admin_Display::get_option( self::$_option )) {57 self::activated_plugin( $plugin, null);58 \LiteSpeed\Admin_Display::add_option( self::$_option, true);56 $plugin = basename(LSCWP_DIR) . '/litespeed-cache.php'; 57 register_deactivation_hook($plugin, function ($_network_wide) { 58 \LiteSpeed\Admin_Display::delete_option(self::$_option); 59 }); 60 if (!\LiteSpeed\Admin_Display::get_option(self::$_option)) { 61 self::activated_plugin($plugin, null); 62 \LiteSpeed\Admin_Display::add_option(self::$_option, true); 59 63 } 60 64 … … 62 66 * Check for incompatible plugins when any plugin is (de)activated. 63 67 */ 64 add_action( 'activated_plugin', __CLASS__ . '::activated_plugin', 10, 2 ); 65 add_action( 'deactivated_plugin', __CLASS__ . '::deactivated_plugin', 10, 2 ); 68 add_action('activated_plugin', __CLASS__ . '::activated_plugin', 10, 2); 69 add_action('deactivated_plugin', __CLASS__ . '::deactivated_plugin', 10, 2); 70 71 if (class_exists('PagespeedNinja')) { 72 \LiteSpeed\Admin_Display::error( 73 '<div ' . self::$_msg_id . '>' 74 . esc_html__( 75 'Please consider disabling the following detected plugins, as they may conflict with LiteSpeed Cache:', 76 'litespeed-cache' 77 ) 78 . '<p style="color: red; font-weight: 700;">' 79 . 'PageSpeed Ninja' 80 . '</p>' 81 . '</div>', 82 false, 83 true 84 ); 85 } 66 86 } 67 87 68 public static function activated_plugin( $plugin, $network_wide ) { 69 self::incompatible_plugin_notice( $plugin, $network_wide, 'activated' ); 88 public static function activated_plugin($plugin, $network_wide) 89 { 90 self::incompatible_plugin_notice($plugin, $network_wide, 'activated'); 70 91 } 71 92 72 public static function deactivated_plugin( $plugin, $network_wide ) { 73 self::incompatible_plugin_notice( $plugin, $network_wide, 'deactivated' ); 93 public static function deactivated_plugin($plugin, $network_wide) 94 { 95 self::incompatible_plugin_notice($plugin, $network_wide, 'deactivated'); 74 96 } 75 97 … … 78 100 * Show a notification if there are any. 79 101 */ 80 public static function incompatible_plugin_notice( $plugin, $_network_wide, $action ) { 102 public static function incompatible_plugin_notice($plugin, $_network_wide, $action) 103 { 81 104 self::update_messages(); 82 105 … … 86 109 * remove `$plugin` from the list. 87 110 */ 88 $deactivated = 'deactivated' === $action ? array( $plugin) : array();111 $deactivated = 'deactivated' === $action ? array($plugin) : array(); 89 112 90 113 $incompatible_plugins = 91 114 array_map( 92 function( $plugin ) { return WP_PLUGIN_DIR . '/' . $plugin; }, 93 array_diff( self::$_incompatible_plugins, $deactivated ) 115 function ($plugin) { 116 return WP_PLUGIN_DIR . '/' . $plugin; 117 }, 118 array_diff(self::$_incompatible_plugins, $deactivated) 94 119 ); 95 120 96 121 $active_incompatible_plugins = 97 122 array_map( 98 function ( $plugin) {99 $plugin = get_plugin_data( $plugin, false, true);123 function ($plugin) { 124 $plugin = get_plugin_data($plugin, false, true); 100 125 return $plugin['Name']; 101 126 }, 102 array_intersect( $incompatible_plugins, wp_get_active_and_valid_plugins())127 array_intersect($incompatible_plugins, wp_get_active_and_valid_plugins()) 103 128 ); 104 129 105 if ( empty( $active_incompatible_plugins )) {130 if (empty($active_incompatible_plugins)) { 106 131 return; 107 132 } … … 109 134 \LiteSpeed\Admin_Display::error( 110 135 '<div ' . self::$_msg_id . '>' 111 . esc_html__(112 'Please consider disabling the following detected plugins, as they may conflict with LiteSpeed Cache:',113 'litespeed-cache'114 )115 . '<p style="color: red; font-weight: 700;">'116 . implode( ', ', $active_incompatible_plugins)117 . '</p>'118 . '</div>',136 . esc_html__( 137 'Please consider disabling the following detected plugins, as they may conflict with LiteSpeed Cache:', 138 'litespeed-cache' 139 ) 140 . '<p style="color: red; font-weight: 700;">' 141 . implode(', ', $active_incompatible_plugins) 142 . '</p>' 143 . '</div>', 119 144 false, 120 145 true … … 127 152 * notice(s). 128 153 */ 129 private static function update_messages() { 154 private static function update_messages() 155 { 130 156 $messages = 131 157 \LiteSpeed\Admin_Display::get_option( … … 133 159 array() 134 160 ); 135 if ( is_array( $messages )) {136 foreach ( $messages as $index => $message) {137 if ( strpos( $message, self::$_msg_id ) !== false) {138 unset( $messages[ $index ]);139 if ( ! $messages) {161 if (is_array($messages)) { 162 foreach ($messages as $index => $message) { 163 if (strpos($message, self::$_msg_id) !== false) { 164 unset($messages[$index]); 165 if (!$messages) { 140 166 $messages = -1; 141 167 } -
litespeed-cache/trunk/thirdparty/woocommerce.cls.php
r2832517 r2977143 1 1 <?php 2 2 3 /** 3 4 * The Third Party integration with the WooCommerce plugin. … … 9 10 * @author LiteSpeed Technologies <[email protected]> 10 11 */ 12 11 13 namespace LiteSpeed\Thirdparty; 12 14 13 defined( 'WPINC') || exit;15 defined('WPINC') || exit; 14 16 15 17 use \LiteSpeed\API; 16 18 use \LiteSpeed\Base; 17 19 18 class WooCommerce extends Base { 20 class WooCommerce extends Base 21 { 19 22 const O_CACHE_TTL_FRONTPAGE = Base::O_CACHE_TTL_FRONTPAGE; 20 23 21 const CACHETAG_SHOP = 'WC_S' ; 22 const CACHETAG_TERM = 'WC_T.' ; 23 const O_UPDATE_INTERVAL = 'wc_update_interval' ; 24 const O_PQS_CS = 0 ; // flush product on quantity + stock change, categories on stock change 25 const O_PS_CS = 1 ; // flush product and categories on stock change 26 const O_PS_CN = 2 ; // flush product on stock change, categories no flush 27 const O_PQS_CQS = 3 ; // flush product and categories on quantity + stock change 28 29 const ESI_PARAM_ARGS = 'wc_args' ; 30 const ESI_PARAM_POSTID = 'wc_post_id' ; 31 const ESI_PARAM_NAME = 'wc_name' ; 32 const ESI_PARAM_PATH = 'wc_path' ; 33 const ESI_PARAM_LOCATED = 'wc_located' ; 34 35 private $esi_enabled ; 24 const CACHETAG_SHOP = 'WC_S'; 25 const CACHETAG_TERM = 'WC_T.'; 26 const O_UPDATE_INTERVAL = 'wc_update_interval'; 27 const O_CART_VARY = 'wc_cart_vary'; 28 const O_PQS_CS = 0; // flush product on quantity + stock change, categories on stock change 29 const O_PS_CS = 1; // flush product and categories on stock change 30 const O_PS_CN = 2; // flush product on stock change, categories no flush 31 const O_PQS_CQS = 3; // flush product and categories on quantity + stock change 32 33 const ESI_PARAM_ARGS = 'wc_args'; 34 const ESI_PARAM_POSTID = 'wc_post_id'; 35 const ESI_PARAM_NAME = 'wc_name'; 36 const ESI_PARAM_PATH = 'wc_path'; 37 const ESI_PARAM_LOCATED = 'wc_located'; 38 39 private $esi_enabled; 36 40 37 41 /** … … 43 47 public static function detect() 44 48 { 45 if ( ! defined( 'WOOCOMMERCE_VERSION' ) ) { 46 return ; 47 } 48 49 self::cls()->add_hooks() ; 50 49 if (!defined('WOOCOMMERCE_VERSION')) { 50 return; 51 } 52 53 self::cls()->add_hooks(); 51 54 } 52 55 … … 59 62 public function add_hooks() 60 63 { 61 $this->_option_append() ;62 63 $this->esi_enabled = apply_filters( 'litespeed_esi_status', false);64 65 add_action( 'litespeed_control_finalize', array( $this, 'set_control' ));66 add_action( 'litespeed_tag_finalize', array( $this, 'set_tag' ));64 $this->_option_append(); 65 66 $this->esi_enabled = apply_filters('litespeed_esi_status', false); 67 68 add_action('litespeed_control_finalize', array($this, 'set_control')); 69 add_action('litespeed_tag_finalize', array($this, 'set_tag')); 67 70 68 71 // Purging a product on stock change should only occur during product purchase. This function will add the purging callback when an order is complete. 69 add_action( 'woocommerce_product_set_stock', array( $this, 'purge_product' ) );70 add_action( 'woocommerce_variation_set_stock', array( $this, 'purge_product' ) ); // #984479 Update variations stock71 72 add_action( 'comment_post', array( $this, 'add_review' ), 10, 3 );73 74 if ( $this->esi_enabled) {75 if ( function_exists( 'is_shop' ) && ! is_shop()) {76 add_action( 'litespeed_tpl_normal', array( $this, 'set_block_template' ));72 add_action('woocommerce_product_set_stock', array($this, 'purge_product')); 73 add_action('woocommerce_variation_set_stock', array($this, 'purge_product')); // #984479 Update variations stock 74 75 add_action('comment_post', array($this, 'add_review'), 10, 3); 76 77 if ($this->esi_enabled) { 78 if (function_exists('is_shop') && !is_shop()) { 79 add_action('litespeed_tpl_normal', array($this, 'set_block_template')); 77 80 // No need for add-to-cart button 78 81 // add_action( 'litespeed_esi_load-wc-add-to-cart-form', array( $this, 'load_add_to_cart_form_block' ) ) ; 79 82 80 add_action( 'litespeed_esi_load-storefront-cart-header', array( $this, 'load_cart_header' ) ); 81 add_action( 'litespeed_esi_load-widget', array( $this, 'register_post_view' ) ); 82 } 83 84 if ( function_exists( 'is_product' ) && is_product() ) { 85 add_filter( 'litespeed_esi_params', array( $this, 'add_post_id' ), 10, 2 ); 86 } 87 88 } 89 90 if ( is_admin() ) { 91 add_action('litespeed_api_purge_post', array( $this, 'backend_purge' ) ) ;//todo 92 add_action( 'delete_term_relationships', array( $this, 'delete_rel' ), 10, 2 ) ; 93 add_action( 'litespeed_settings_tab', array( $this, 'settings_add_tab' ) ); 94 add_action( 'litespeed_settings_content', array( $this, 'settings_add_content' ) ); 95 add_filter( 'litespeed_widget_default_options', array( $this, 'wc_widget_default' ), 10, 2 ); 96 } 97 83 add_action('litespeed_esi_load-storefront-cart-header', array($this, 'load_cart_header')); 84 add_action('litespeed_esi_load-widget', array($this, 'register_post_view')); 85 } 86 87 if (function_exists('is_product') && is_product()) { 88 add_filter('litespeed_esi_params', array($this, 'add_post_id'), 10, 2); 89 } 90 } 91 92 if (is_admin()) { 93 add_action('litespeed_api_purge_post', array($this, 'backend_purge')); //todo 94 add_action('delete_term_relationships', array($this, 'delete_rel'), 10, 2); 95 add_action('litespeed_settings_tab', array($this, 'settings_add_tab')); 96 add_action('litespeed_settings_content', array($this, 'settings_add_content')); 97 add_filter('litespeed_widget_default_options', array($this, 'wc_widget_default'), 10, 2); 98 } 99 100 if (apply_filters('litespeed_conf', self::O_CART_VARY)) { 101 add_filter('litespeed_vary_cookies', function ($list) { 102 $list[] = 'woocommerce_cart_hash'; 103 return array_unique($list); 104 }); 105 } 98 106 } 99 107 … … 106 114 public function purge_esi() 107 115 { 108 do_action( 'litespeed_debug', '3rd woo purge ESI in action: ' . current_filter() ) ; 109 do_action( 'litespeed_purge_private_esi', 'storefront-cart-header' ); 110 116 do_action('litespeed_debug', '3rd woo purge ESI in action: ' . current_filter()); 117 do_action('litespeed_purge_private_esi', 'storefront-cart-header'); 111 118 } 112 119 … … 119 126 public function purge_private_all() 120 127 { 121 do_action( 'litespeed_purge_private_all');128 do_action('litespeed_purge_private_all'); 122 129 } 123 130 … … 128 135 * @access public 129 136 */ 130 public function check_if_need_esi( $template)131 { 132 if ( $this->vary_needed()) {133 do_action( 'litespeed_debug', 'API: 3rd woo added ESI');134 add_action( 'litespeed_tpl_normal', array( $this, 'set_swap_header_cart' ));137 public function check_if_need_esi($template) 138 { 139 if ($this->vary_needed()) { 140 do_action('litespeed_debug', 'API: 3rd woo added ESI'); 141 add_action('litespeed_tpl_normal', array($this, 'set_swap_header_cart')); 135 142 } 136 143 137 144 return $template; 138 139 145 } 140 146 … … 145 151 * @access public 146 152 */ 147 public function vary_maintain( $vary ) { 148 if ( $this->vary_needed() ) { 149 do_action( 'litespeed_debug', 'API: 3rd woo added vary due to cart not empty' ); 150 $vary[ 'woo_cart' ] = 1; 153 public function vary_maintain($vary) 154 { 155 if ($this->vary_needed()) { 156 do_action('litespeed_debug', 'API: 3rd woo added vary due to cart not empty'); 157 $vary['woo_cart'] = 1; 151 158 } 152 159 … … 162 169 private function vary_needed() 163 170 { 164 if ( ! function_exists( 'WC' )) {165 return false ;166 } 167 168 $woocom = WC() ;169 if ( ! $woocom) {170 return false ;171 } 172 173 if ( is_null( $woocom->cart )) {174 return false ;175 } 176 return $woocom->cart->get_cart_contents_count() > 0 ;171 if (!function_exists('WC')) { 172 return false; 173 } 174 175 $woocom = WC(); 176 if (!$woocom) { 177 return false; 178 } 179 180 if (is_null($woocom->cart)) { 181 return false; 182 } 183 return $woocom->cart->get_cart_contents_count() > 0; 177 184 } 178 185 … … 186 193 public function set_block_template() 187 194 { 188 add_action('woocommerce_before_template_part', array( $this, 'block_template' ), 999, 4);195 add_action('woocommerce_before_template_part', array($this, 'block_template'), 999, 4); 189 196 } 190 197 … … 202 209 public function set_swap_header_cart() 203 210 { 204 $priority = has_action('storefront_header', 'storefront_header_cart') ;205 if ( $priority !== false) {206 remove_action('storefront_header', 'storefront_header_cart', $priority) ;207 add_action('storefront_header', array( $this, 'esi_cart_header' ), $priority);211 $priority = has_action('storefront_header', 'storefront_header_cart'); 212 if ($priority !== false) { 213 remove_action('storefront_header', 'storefront_header_cart', $priority); 214 add_action('storefront_header', array($this, 'esi_cart_header'), $priority); 208 215 } 209 216 } … … 220 227 public function block_template($template_name, $template_path, $located, $args) 221 228 { 222 if ( strpos($template_name, 'add-to-cart') === false) {223 if ( strpos($template_name, 'related.php') !== false) {224 remove_action('woocommerce_before_template_part', array( $this, 'block_template' ), 999);225 add_filter('woocommerce_related_products_args', array( $this, 'add_related_tags' ) );226 add_action('woocommerce_after_template_part', array( $this, 'end_template' ), 999);227 } 228 return ;229 } 230 return ;231 232 233 234 235 // todo: wny not use?236 237 global $post ;229 if (strpos($template_name, 'add-to-cart') === false) { 230 if (strpos($template_name, 'related.php') !== false) { 231 remove_action('woocommerce_before_template_part', array($this, 'block_template'), 999); 232 add_filter('woocommerce_related_products_args', array($this, 'add_related_tags')); 233 add_action('woocommerce_after_template_part', array($this, 'end_template'), 999); 234 } 235 return; 236 } 237 return; 238 239 240 241 242 // todo: wny not use? 243 244 global $post; 238 245 $params = array( 239 246 self::ESI_PARAM_ARGS => $args, … … 242 249 self::ESI_PARAM_PATH => $template_path, 243 250 self::ESI_PARAM_LOCATED => $located 244 ) ;245 add_action('woocommerce_after_add_to_cart_form', array( $this, 'end_form' ) );246 add_action('woocommerce_after_template_part', array( $this, 'end_form' ), 999);247 echo apply_filters( 'litespeed_esi_url', 'wc-add-to-cart-form', 'WC_CART_FORM', $params);248 echo apply_filters( 'litespeed_clean_wrapper_begin', '');251 ); 252 add_action('woocommerce_after_add_to_cart_form', array($this, 'end_form')); 253 add_action('woocommerce_after_template_part', array($this, 'end_form'), 999); 254 echo apply_filters('litespeed_esi_url', 'wc-add-to-cart-form', 'WC_CART_FORM', $params); 255 echo apply_filters('litespeed_clean_wrapper_begin', ''); 249 256 } 250 257 … … 260 267 public function end_form($template_name = '') 261 268 { 262 if ( ! empty($template_name) && strpos($template_name, 'add-to-cart') === false) {263 return ;264 } 265 echo apply_filters( 'litespeed_clean_wrapper_end', '');266 remove_action('woocommerce_after_add_to_cart_form', array( $this, 'end_form' ) );267 remove_action('woocommerce_after_template_part', array( $this, 'end_form' ), 999);269 if (!empty($template_name) && strpos($template_name, 'add-to-cart') === false) { 270 return; 271 } 272 echo apply_filters('litespeed_clean_wrapper_end', ''); 273 remove_action('woocommerce_after_add_to_cart_form', array($this, 'end_form')); 274 remove_action('woocommerce_after_template_part', array($this, 'end_form'), 999); 268 275 } 269 276 … … 281 288 public function add_related_tags($args) 282 289 { 283 if ( empty($args) || ! isset($args['post__in'])) {284 return $args ;285 } 286 $related_posts = $args['post__in'] ;287 foreach ( $related_posts as $related) {288 do_action( 'litespeed_tag_add_post', $related);289 } 290 return $args ;290 if (empty($args) || !isset($args['post__in'])) { 291 return $args; 292 } 293 $related_posts = $args['post__in']; 294 foreach ($related_posts as $related) { 295 do_action('litespeed_tag_add_post', $related); 296 } 297 return $args; 291 298 } 292 299 … … 302 309 public function end_template($template_name) 303 310 { 304 if ( strpos($template_name, 'related.php') !== false) {305 remove_action('woocommerce_after_template_part', array( $this, 'end_template' ), 999);306 $this->set_block_template() ;311 if (strpos($template_name, 'related.php') !== false) { 312 remove_action('woocommerce_after_template_part', array($this, 'end_template'), 999); 313 $this->set_block_template(); 307 314 } 308 315 } … … 318 325 public function esi_cart_header() 319 326 { 320 echo apply_filters( 'litespeed_esi_url', 'storefront-cart-header', 'STOREFRONT_CART_HEADER');327 echo apply_filters('litespeed_esi_url', 'storefront-cart-header', 'STOREFRONT_CART_HEADER'); 321 328 } 322 329 … … 348 355 public function load_add_to_cart_form_block($params) 349 356 { 350 global $post, $wp_query ;351 $post = get_post($params[self::ESI_PARAM_POSTID]) ;352 $wp_query->setup_postdata($post) ;353 function_exists( 'wc_get_template' ) && wc_get_template($params[self::ESI_PARAM_NAME], $params[self::ESI_PARAM_ARGS], $params[self::ESI_PARAM_PATH]);357 global $post, $wp_query; 358 $post = get_post($params[self::ESI_PARAM_POSTID]); 359 $wp_query->setup_postdata($post); 360 function_exists('wc_get_template') && wc_get_template($params[self::ESI_PARAM_NAME], $params[self::ESI_PARAM_ARGS], $params[self::ESI_PARAM_PATH]); 354 361 } 355 362 … … 367 374 public function register_post_view($params) 368 375 { 369 if ( $params[API::PARAM_NAME] !== 'WC_Widget_Recently_Viewed') {370 return ;371 } 372 if ( ! isset($params[self::ESI_PARAM_POSTID])) {373 return ;374 } 375 $id = $params[self::ESI_PARAM_POSTID] ;376 $esi_post = get_post($id) ;377 $product = function_exists( 'wc_get_product' ) ? wc_get_product($esi_post) : false;378 379 if ( empty($product)) {380 return ;381 } 382 383 global $post ;384 $post = $esi_post ;385 function_exists( 'wc_track_product_view' ) && wc_track_product_view();376 if ($params[API::PARAM_NAME] !== 'WC_Widget_Recently_Viewed') { 377 return; 378 } 379 if (!isset($params[self::ESI_PARAM_POSTID])) { 380 return; 381 } 382 $id = $params[self::ESI_PARAM_POSTID]; 383 $esi_post = get_post($id); 384 $product = function_exists('wc_get_product') ? wc_get_product($esi_post) : false; 385 386 if (empty($product)) { 387 return; 388 } 389 390 global $post; 391 $post = $esi_post; 392 function_exists('wc_track_product_view') && wc_track_product_view(); 386 393 } 387 394 … … 394 401 * @access public 395 402 */ 396 public function add_post_id( $params, $block_id)397 { 398 if ( $block_id == 'widget') {399 if ( $params[ API::PARAM_NAME ] == 'WC_Widget_Recently_Viewed') {400 $params[ self::ESI_PARAM_POSTID] = get_the_ID();403 public function add_post_id($params, $block_id) 404 { 405 if ($block_id == 'widget') { 406 if ($params[API::PARAM_NAME] == 'WC_Widget_Recently_Viewed') { 407 $params[self::ESI_PARAM_POSTID] = get_the_ID(); 401 408 } 402 409 } … … 414 421 * @access public 415 422 */ 416 public function wc_widget_default( $options, $widget)417 { 418 if ( ! is_array( $options )) {423 public function wc_widget_default($options, $widget) 424 { 425 if (!is_array($options)) { 419 426 return $options; 420 427 } 421 $widget_name = get_class( $widget ) ; 422 if ( $widget_name === 'WC_Widget_Recently_Viewed' ) { 423 $options[ API::WIDGET_O_ESIENABLE ] = API::VAL_ON2; 424 $options[ API::WIDGET_O_TTL ] = 0; 425 } 426 elseif ( $widget_name === 'WC_Widget_Recent_Reviews' ) { 427 $options[ API::WIDGET_O_ESIENABLE ] = API::VAL_ON; 428 $options[ API::WIDGET_O_TTL ] = 86400; 428 $widget_name = get_class($widget); 429 if ($widget_name === 'WC_Widget_Recently_Viewed') { 430 $options[API::WIDGET_O_ESIENABLE] = API::VAL_ON2; 431 $options[API::WIDGET_O_TTL] = 0; 432 } elseif ($widget_name === 'WC_Widget_Recent_Reviews') { 433 $options[API::WIDGET_O_ESIENABLE] = API::VAL_ON; 434 $options[API::WIDGET_O_TTL] = 86400; 429 435 } 430 436 return $options; … … 440 446 public function set_tag() 441 447 { 442 $id = get_the_ID() ;443 if ( $id === false) {444 return ;448 $id = get_the_ID(); 449 if ($id === false) { 450 return; 445 451 } 446 452 447 453 // Check if product has a cache ttl limit or not 448 $sale_from = (int) get_post_meta( $id, '_sale_price_dates_from', true ) ; 449 $sale_to = (int) get_post_meta( $id, '_sale_price_dates_to', true ) ; 450 $now = current_time( 'timestamp' ) ; 451 $ttl = false ; 452 if ( $sale_from && $now < $sale_from ) { 453 $ttl = $sale_from - $now ; 454 } 455 elseif ( $sale_to && $now < $sale_to ) { 456 $ttl = $sale_to - $now ; 457 } 458 if ( $ttl && $ttl < apply_filters( 'litespeed_control_ttl', 0 ) ) { 459 do_action( 'litespeed_control_set_ttl', $ttl, "WooCommerce set scheduled TTL to $ttl" ) ; 460 } 461 462 if ( function_exists( 'is_shop' ) && is_shop() ) { 463 do_action( 'litespeed_tag_add', self::CACHETAG_SHOP ); 464 } 465 if ( function_exists( 'is_product_taxonomy' ) && ! is_product_taxonomy() ) { 466 return ; 467 } 468 if ( isset($GLOBALS['product_cat']) && is_string( $GLOBALS['product_cat'] ) ) { // todo: need to check previous woo version to find if its from old woo versions or not! 469 $term = get_term_by('slug', $GLOBALS['product_cat'], 'product_cat') ; 470 } 471 elseif ( isset($GLOBALS['product_tag']) && is_string( $GLOBALS['product_tag'] ) ) { 472 $term = get_term_by('slug', $GLOBALS['product_tag'], 'product_tag') ; 473 } 474 else { 475 $term = false ; 476 } 477 478 if ( $term === false ) { 479 return ; 480 } 481 while ( isset($term) ) { 482 do_action( 'litespeed_tag_add', self::CACHETAG_TERM . $term->term_id ); 483 if ( $term->parent == 0 ) { 484 break ; 485 } 486 $term = get_term($term->parent) ; 454 $sale_from = (int) get_post_meta($id, '_sale_price_dates_from', true); 455 $sale_to = (int) get_post_meta($id, '_sale_price_dates_to', true); 456 $now = current_time('timestamp'); 457 $ttl = false; 458 if ($sale_from && $now < $sale_from) { 459 $ttl = $sale_from - $now; 460 } elseif ($sale_to && $now < $sale_to) { 461 $ttl = $sale_to - $now; 462 } 463 if ($ttl && $ttl < apply_filters('litespeed_control_ttl', 0)) { 464 do_action('litespeed_control_set_ttl', $ttl, "WooCommerce set scheduled TTL to $ttl"); 465 } 466 467 if (function_exists('is_shop') && is_shop()) { 468 do_action('litespeed_tag_add', self::CACHETAG_SHOP); 469 } 470 if (function_exists('is_product_taxonomy') && !is_product_taxonomy()) { 471 return; 472 } 473 if (isset($GLOBALS['product_cat']) && is_string($GLOBALS['product_cat'])) { // todo: need to check previous woo version to find if its from old woo versions or not! 474 $term = get_term_by('slug', $GLOBALS['product_cat'], 'product_cat'); 475 } elseif (isset($GLOBALS['product_tag']) && is_string($GLOBALS['product_tag'])) { 476 $term = get_term_by('slug', $GLOBALS['product_tag'], 'product_tag'); 477 } else { 478 $term = false; 479 } 480 481 if ($term === false) { 482 return; 483 } 484 while (isset($term)) { 485 do_action('litespeed_tag_add', self::CACHETAG_TERM . $term->term_id); 486 if ($term->parent == 0) { 487 break; 488 } 489 $term = get_term($term->parent); 487 490 } 488 491 } … … 494 497 * @since 1.6.3 Removed static 495 498 * @access public 496 * @param string $esi_id The ESI block id if a request is an ESI request.499 * @param string $esi_id The ESI block id if a request is an ESI request. 497 500 * @return boolean True if cacheable, false if not. 498 501 */ 499 502 public function set_control($esi_id) 500 503 { 501 if ( ! apply_filters( 'litespeed_control_cacheable', false )) {504 if (!apply_filters('litespeed_control_cacheable', false)) { 502 505 return; 503 506 } … … 507 510 * @since 1.6.2.1 508 511 */ 509 if ( ! function_exists( 'WC' )) {510 return ;511 } 512 513 $woocom = WC() ;514 if ( ! $woocom || empty( $woocom->session )) {515 return ;512 if (!function_exists('WC')) { 513 return; 514 } 515 516 $woocom = WC(); 517 if (!$woocom || empty($woocom->session)) { 518 return; 516 519 } 517 520 518 521 // For later versions, DONOTCACHEPAGE should be set. 519 522 // No need to check uri/qs. 520 if ( version_compare($woocom->version, '1.4.2', '>=') ) { 521 if ( version_compare( $woocom->version, '3.2.0', '<' ) && defined('DONOTCACHEPAGE') && DONOTCACHEPAGE ) { 522 do_action( 'litespeed_control_set_nocache', '3rd party woocommerce not cache by constant' ); 523 return ; 524 } 525 elseif ( version_compare($woocom->version, '2.1.0', '>=') ) { 526 $err = false ; 527 528 if ( ! function_exists( 'wc_get_page_id' ) ) { 529 return ; 523 if (version_compare($woocom->version, '1.4.2', '>=')) { 524 if (version_compare($woocom->version, '3.2.0', '<') && defined('DONOTCACHEPAGE') && DONOTCACHEPAGE) { 525 do_action('litespeed_control_set_nocache', '3rd party woocommerce not cache by constant'); 526 return; 527 } elseif (version_compare($woocom->version, '2.1.0', '>=')) { 528 $err = false; 529 530 if (!function_exists('wc_get_page_id')) { 531 return; 530 532 } 531 533 /** … … 533 535 * @since 1.4 534 536 */ 535 $page_ids = array_filter( array( wc_get_page_id( 'cart' ), wc_get_page_id( 'checkout' ), wc_get_page_id( 'myaccount' ) ) ); 536 if ( isset( $_GET['download_file'] ) || isset( $_GET['add-to-cart'] ) || is_page( $page_ids ) ) { 537 $err = 'woo non cacheable pages' ; 537 $page_ids = array_filter(array(wc_get_page_id('cart'), wc_get_page_id('checkout'), wc_get_page_id('myaccount'))); 538 if (isset($_GET['download_file']) || isset($_GET['add-to-cart']) || is_page($page_ids)) { 539 $err = 'woo non cacheable pages'; 540 } elseif (function_exists('wc_notice_count') && wc_notice_count() > 0) { 541 $err = 'has wc notice'; 538 542 } 539 elseif ( function_exists( 'wc_notice_count' ) && wc_notice_count() > 0 ) { 540 $err = 'has wc notice' ; 543 544 if ($err) { 545 do_action('litespeed_control_set_nocache', '3rd party woocommerce not cache due to ' . $err); 546 return; 541 547 } 542 543 if ( $err ) { 544 do_action( 'litespeed_control_set_nocache', '3rd party woocommerce not cache due to ' . $err ); 545 return ; 546 } 547 } 548 return ; 549 } 550 551 $uri = esc_url($_SERVER["REQUEST_URI"]) ; 552 $uri_len = strlen($uri) ; 553 if ( $uri_len < 5 ) { 554 return ; 555 } 556 557 if ( in_array($uri, array('cart/', 'checkout/', 'my-account/', 'addons/', 'logout/', 'lost-password/', 'product/')) ) { // why contains `product`? 558 do_action( 'litespeed_control_set_nocache', 'uri in cart/account/user pages' ); 559 return ; 560 } 561 562 $qs = sanitize_text_field($_SERVER["QUERY_STRING"]) ; 563 $qs_len = strlen($qs) ; 564 if ( ! empty($qs) && $qs_len >= 12 && strpos( $qs, 'add-to-cart=' ) === 0 ) { 565 do_action( 'litespeed_control_set_nocache', 'qs contains add-to-cart' ); 566 return ; 548 } 549 return; 550 } 551 552 $uri = esc_url($_SERVER["REQUEST_URI"]); 553 $uri_len = strlen($uri); 554 if ($uri_len < 5) { 555 return; 556 } 557 558 if (in_array($uri, array('cart/', 'checkout/', 'my-account/', 'addons/', 'logout/', 'lost-password/', 'product/'))) { // why contains `product`? 559 do_action('litespeed_control_set_nocache', 'uri in cart/account/user pages'); 560 return; 561 } 562 563 $qs = sanitize_text_field($_SERVER["QUERY_STRING"]); 564 $qs_len = strlen($qs); 565 if (!empty($qs) && $qs_len >= 12 && strpos($qs, 'add-to-cart=') === 0) { 566 do_action('litespeed_control_set_nocache', 'qs contains add-to-cart'); 567 return; 567 568 } 568 569 } … … 576 577 * @param WC_Product $product 577 578 */ 578 public function purge_product($product) { 579 do_action( 'litespeed_debug', '[3rd] Woo Purge [pid]' . $product->get_id() ); 580 581 $config = apply_filters( 'litespeed_conf', self::O_UPDATE_INTERVAL ) ; 582 if ( is_null($config) ) { 583 $config = self::O_PQS_CS ; 584 } 585 586 if ( $config === self::O_PQS_CQS ) { 587 $this->backend_purge($product->get_id()) ; 588 } 589 elseif ( $config !== self::O_PQS_CS && $product->is_in_stock() ) { 590 do_action( 'litespeed_debug', '[3rd] Woo No purge needed [option] ' . $config ); 591 return ; 592 } 593 elseif ( $config !== self::O_PS_CN && ! $product->is_in_stock() ) { 594 $this->backend_purge($product->get_id()) ; 595 } 596 597 do_action( 'litespeed_purge_post', $product->get_id() ); 579 public function purge_product($product) 580 { 581 do_action('litespeed_debug', '[3rd] Woo Purge [pid]' . $product->get_id()); 582 583 $config = apply_filters('litespeed_conf', self::O_UPDATE_INTERVAL); 584 if (is_null($config)) { 585 $config = self::O_PQS_CS; 586 } 587 588 if ($config === self::O_PQS_CQS) { 589 $this->backend_purge($product->get_id()); 590 } elseif ($config !== self::O_PQS_CS && $product->is_in_stock()) { 591 do_action('litespeed_debug', '[3rd] Woo No purge needed [option] ' . $config); 592 return; 593 } elseif ($config !== self::O_PS_CN && !$product->is_in_stock()) { 594 $this->backend_purge($product->get_id()); 595 } 596 597 do_action('litespeed_purge_post', $product->get_id()); 598 598 599 599 // Check if is variation, purge stock too #984479 600 if ( $product->is_type( 'variation' ) ) { 601 do_action( 'litespeed_purge_post', $product->get_parent_id() ); 600 if ($product->is_type('variation')) { 601 do_action('litespeed_purge_post', $product->get_parent_id()); 602 } 603 604 // Check if WPML is enabled ##972971 605 if ( defined( 'WPML_PLUGIN_BASENAME' ) ) { 606 // Check if it is a variable product and get post/parent ID 607 $wpml_purge_id = $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id(); 608 $type = apply_filters( 'wpml_element_type', get_post_type( $wpml_purge_id ) ); 609 $trid = apply_filters( 'wpml_element_trid', false, $wpml_purge_id, $type ); 610 $translations = apply_filters( 'wpml_get_element_translations', array(), $trid, $type ); 611 foreach ( $translations as $lang => $translation ) { 612 do_action( 'litespeed_debug', '[3rd] Woo WPML purge language: ' . $translation->language_code . ' , post ID: ' . $translation->element_id); 613 do_action( 'litespeed_purge_post', $translation->element_id ); 614 // use the $translation->element_id as it is post ID of other languages 615 } 602 616 } 603 617 } … … 616 630 public function delete_rel($post_id, $term_ids) 617 631 { 618 if ( ! function_exists( 'wc_get_product' )) {619 return ;620 } 621 622 if ( empty($term_ids) || wc_get_product($post_id) === false) {623 return ;624 } 625 foreach ( $term_ids as $term_id) {626 do_action( 'litespeed_purge', self::CACHETAG_TERM . $term_id);632 if (!function_exists('wc_get_product')) { 633 return; 634 } 635 636 if (empty($term_ids) || wc_get_product($post_id) === false) { 637 return; 638 } 639 foreach ($term_ids as $term_id) { 640 do_action('litespeed_purge', self::CACHETAG_TERM . $term_id); 627 641 } 628 642 } … … 638 652 public function backend_purge($post_id) 639 653 { 640 if ( ! function_exists( 'wc_get_product' )) {641 return ;642 } 643 644 if ( ! isset($post_id) || wc_get_product($post_id) === false) {645 return ;646 } 647 648 $cats = $this->get_cats($post_id) ;649 if ( ! empty($cats)) {650 foreach ( $cats as $cat) {651 do_action( 'litespeed_purge', self::CACHETAG_TERM . $cat);652 } 653 } 654 655 if ( ! function_exists( 'wc_get_product_terms' )) {656 return ;657 } 658 659 $tags = wc_get_product_terms($post_id, 'product_tag', array('fields' => 'ids')) ;660 if ( ! empty($tags)) {661 foreach ( $tags as $tag) {662 do_action( 'litespeed_purge', self::CACHETAG_TERM . $tag);654 if (!function_exists('wc_get_product')) { 655 return; 656 } 657 658 if (!isset($post_id) || wc_get_product($post_id) === false) { 659 return; 660 } 661 662 $cats = $this->get_cats($post_id); 663 if (!empty($cats)) { 664 foreach ($cats as $cat) { 665 do_action('litespeed_purge', self::CACHETAG_TERM . $cat); 666 } 667 } 668 669 if (!function_exists('wc_get_product_terms')) { 670 return; 671 } 672 673 $tags = wc_get_product_terms($post_id, 'product_tag', array('fields' => 'ids')); 674 if (!empty($tags)) { 675 foreach ($tags as $tag) { 676 do_action('litespeed_purge', self::CACHETAG_TERM . $tag); 663 677 } 664 678 } … … 677 691 public function add_review($unused, $comment_approved, $commentdata) 678 692 { 679 if ( ! function_exists( 'wc_get_product' )) {680 return ;681 } 682 683 $post_id = $commentdata['comment_post_ID'] ;684 if ( $comment_approved !== 1 || ! isset($post_id) || wc_get_product($post_id) === false) {685 return ;686 } 687 global $wp_widget_factory ;688 $recent_reviews = $wp_widget_factory->widgets[ 'WC_Widget_Recent_Reviews' ];689 if ( ! is_null( $recent_reviews )) {690 do_action( 'litespeed_tag_add_widget', $recent_reviews->id);693 if (!function_exists('wc_get_product')) { 694 return; 695 } 696 697 $post_id = $commentdata['comment_post_ID']; 698 if ($comment_approved !== 1 || !isset($post_id) || wc_get_product($post_id) === false) { 699 return; 700 } 701 global $wp_widget_factory; 702 $recent_reviews = $wp_widget_factory->widgets['WC_Widget_Recent_Reviews']; 703 if (!is_null($recent_reviews)) { 704 do_action('litespeed_tag_add_widget', $recent_reviews->id); 691 705 } 692 706 } … … 698 712 * @since 3.0 new API 699 713 */ 700 private function _option_append() { 714 private function _option_append() 715 { 701 716 // Append option save value filter 702 do_action( 'litespeed_conf_multi_switch', self::O_UPDATE_INTERVAL, 3 ); // This need to be before conf_append 703 704 do_action( 'litespeed_conf_append', self::O_UPDATE_INTERVAL, false ); 717 do_action('litespeed_conf_multi_switch', self::O_UPDATE_INTERVAL, 3); // This need to be before conf_append 718 719 do_action('litespeed_conf_append', self::O_UPDATE_INTERVAL, false); 720 do_action('litespeed_conf_append', self::O_CART_VARY, false); 705 721 } 706 722 … … 711 727 * @since 1.6.3 Removed static 712 728 */ 713 public function settings_add_tab( $setting_page)714 { 715 if ( $setting_page != 'cache') {716 return ;717 } 718 719 require 'woocommerce.tab.tpl.php' ;729 public function settings_add_tab($setting_page) 730 { 731 if ($setting_page != 'cache') { 732 return; 733 } 734 735 require 'woocommerce.tab.tpl.php'; 720 736 } 721 737 … … 725 741 * @since 3.0 726 742 */ 727 public function settings_add_content( $setting_page)728 { 729 if ( $setting_page != 'cache') {730 return ;731 } 732 733 require 'woocommerce.content.tpl.php' ;743 public function settings_add_content($setting_page) 744 { 745 if ($setting_page != 'cache') { 746 return; 747 } 748 749 require 'woocommerce.content.tpl.php'; 734 750 } 735 751 … … 746 762 private function get_cats($product_id) 747 763 { 748 if ( ! function_exists( 'WC' )) {749 return ;750 } 751 752 $woocom = WC() ;753 if ( isset($woocom) && version_compare($woocom->version, '2.5.0', '>=') && function_exists( 'wc_get_product_cat_ids' )) {754 return wc_get_product_cat_ids($product_id) ;755 } 756 $product_cats = wp_get_post_terms($product_id, 'product_cat', array("fields" => "ids")) ;757 foreach ( $product_cats as $product_cat) {758 $product_cats = array_merge($product_cats, get_ancestors($product_cat, 'product_cat')) ;759 } 760 761 return $product_cats ;764 if (!function_exists('WC')) { 765 return; 766 } 767 768 $woocom = WC(); 769 if (isset($woocom) && version_compare($woocom->version, '2.5.0', '>=') && function_exists('wc_get_product_cat_ids')) { 770 return wc_get_product_cat_ids($product_id); 771 } 772 $product_cats = wp_get_post_terms($product_id, 'product_cat', array("fields" => "ids")); 773 foreach ($product_cats as $product_cat) { 774 $product_cats = array_merge($product_cats, get_ancestors($product_cat, 'product_cat')); 775 } 776 777 return $product_cats; 762 778 } 763 779 … … 773 789 * Bulk edit hook need to add to preload as it will die before detect. 774 790 */ 775 add_action( 'wp_ajax_wpmelon_adv_bulk_edit', __CLASS__ . '::bulk_edit_purge', 1 );791 add_action('wp_ajax_wpmelon_adv_bulk_edit', __CLASS__ . '::bulk_edit_purge', 1); 776 792 } 777 793 … … 783 799 public static function bulk_edit_purge() 784 800 { 785 if ( empty( $_POST[ 'type' ] ) || $_POST[ 'type' ] != 'saveproducts' || empty( $_POST[ 'data' ] ) ) return;801 if (empty($_POST['type']) || $_POST['type'] != 'saveproducts' || empty($_POST['data'])) return; 786 802 787 803 /* … … 795 811 * ) 796 812 */ 797 $stock_string_arr = array() ;798 foreach ( $_POST[ 'data' ] as $stock_value) {799 $stock_string_arr = array_merge( $stock_string_arr, explode( '#^#', $stock_value ) );800 } 801 802 $lscwp_3rd_woocommerce = new self() ;803 804 if ( count( $stock_string_arr ) < 1) {805 return ;806 } 807 808 foreach ( $stock_string_arr as $edited_stock) {809 $product_id = strtok( $edited_stock, '$');810 $product = wc_get_product( $product_id );811 812 if ( empty( $product )) {813 do_action( 'litespeed_debug', '3rd woo purge: ' . $product_id . ' not found.' );814 continue ;815 } 816 817 $lscwp_3rd_woocommerce->purge_product( $product);813 $stock_string_arr = array(); 814 foreach ($_POST['data'] as $stock_value) { 815 $stock_string_arr = array_merge($stock_string_arr, explode('#^#', $stock_value)); 816 } 817 818 $lscwp_3rd_woocommerce = new self(); 819 820 if (count($stock_string_arr) < 1) { 821 return; 822 } 823 824 foreach ($stock_string_arr as $edited_stock) { 825 $product_id = strtok($edited_stock, '$'); 826 $product = wc_get_product($product_id); 827 828 if (empty($product)) { 829 do_action('litespeed_debug', '3rd woo purge: ' . $product_id . ' not found.'); 830 continue; 831 } 832 833 $lscwp_3rd_woocommerce->purge_product($product); 818 834 } 819 835 } 820 836 } 821 -
litespeed-cache/trunk/thirdparty/woocommerce.content.tpl.php
r2808204 r2977143 1 1 <?php 2 2 3 namespace LiteSpeed\Thirdparty; 3 4 4 defined( 'WPINC') || exit;5 defined('WPINC') || exit; 5 6 6 7 use \LiteSpeed\API; … … 13 14 <div data-litespeed-layout='woocommerce'> 14 15 15 <h3 class="litespeed-title-short">16 <?php echo __( 'WooCommerce Settings', 'litespeed-cache'); ?>17 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#woocommerce-tab'); ?>18 </h3>16 <h3 class="litespeed-title-short"> 17 <?php echo __('WooCommerce Settings', 'litespeed-cache'); ?> 18 <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/cache/#woocommerce-tab'); ?> 19 </h3> 19 20 20 <div class="litespeed-callout notice notice-warning inline"> 21 <h4><?php echo __( 'NOTICE:', 'litespeed-cache' ); ?></h4> 22 <p><?php echo __( 'After verifying that the cache works in general, please test the cart.', 'litespeed-cache' ); ?></p> 23 <p><?php echo sprintf( __( 'To test the cart, visit the <a %s>FAQ</a>.', 'litespeed-cache' ), 'href="https://docs.litespeedtech.com/lscache/lscwp/installation/#non-cacheable-pages" target="_blank"' ); ?></p> 24 <p><?php echo __( 'By default, the My Account, Checkout, and Cart pages are automatically excluded from caching. Misconfiguration of page associations in WooCommerce settings may cause some pages to be erroneously excluded.', 'litespeed-cache' ); ?></p> 21 <div class="litespeed-callout notice notice-warning inline"> 22 <h4><?php echo __('NOTICE:', 'litespeed-cache'); ?></h4> 23 <p><?php echo __('After verifying that the cache works in general, please test the cart.', 'litespeed-cache'); ?></p> 24 <p><?php echo sprintf(__('To test the cart, visit the <a %s>FAQ</a>.', 'litespeed-cache'), 'href="https://docs.litespeedtech.com/lscache/lscwp/installation/#non-cacheable-pages" target="_blank"'); ?></p> 25 <p><?php echo __('By default, the My Account, Checkout, and Cart pages are automatically excluded from caching. Misconfiguration of page associations in WooCommerce settings may cause some pages to be erroneously excluded.', 'litespeed-cache'); ?></p> 26 </div> 27 28 <table class="wp-list-table striped litespeed-table"> 29 <tbody> 30 <tr> 31 <th> 32 <?php $id = self::O_UPDATE_INTERVAL; ?> 33 <?php echo __('Product Update Interval', 'litespeed-cache'); ?> 34 </th> 35 <td> 36 <?php 37 $options = array( 38 self::O_PQS_CS => __('Purge product on changes to the quantity or stock status.', 'litespeed-cache') . ' ' . __('Purge categories only when stock status changes.', 'litespeed-cache'), 39 self::O_PS_CS => __('Purge product and categories only when the stock status changes.', 'litespeed-cache'), 40 self::O_PS_CN => __('Purge product only when the stock status changes.', 'litespeed-cache') . ' ' . __('Do not purge categories on changes to the quantity or stock status.', 'litespeed-cache'), 41 self::O_PQS_CQS => __('Always purge both product and categories on changes to the quantity or stock status.', 'litespeed-cache'), 42 ); 43 $conf = (int) apply_filters('litespeed_conf', $id); 44 foreach ($options as $k => $v) : 45 $checked = (int) $k === $conf ? ' checked ' : ''; 46 ?> 47 <?php do_action('litespeed_setting_enroll', $id); ?> 48 <div class='litespeed-radio-row'> 49 <input type='radio' autocomplete='off' name='<?php echo $id; ?>' id='conf_<?php echo $id; ?>_<?php echo $k; ?>' value='<?php echo $k; ?>' <?php echo $checked; ?> /> 50 <label for='conf_<?php echo $id; ?>_<?php echo $k; ?>'><?php echo $v; ?></label> 51 </div> 52 <?php endforeach; ?> 53 <div class="litespeed-desc"> 54 <?php echo __('Determines how changes in product quantity and product stock status affect product pages and their associated category pages.', 'litespeed-cache'); ?> 55 </div> 56 </td> 57 </tr> 58 59 <tr> 60 <th> 61 <?php $id = self::O_CART_VARY; ?> 62 <?php echo __('Vary for Mini Cart', 'litespeed-cache'); ?> 63 </th> 64 <td> 65 <?php 66 $conf = (int) apply_filters('litespeed_conf', $id); 67 $this->cls('Admin_Display')->build_switch($id); ?> 68 <div class="litespeed-desc"> 69 <?php echo __('Generate a separate vary cache copy for the mini cart when the cart is not empty.', 'litespeed-cache'); ?> 70 <?php echo __('If your theme does not use JS to update the mini cart, you must enable this option to display the correct cart contents.', 'litespeed-cache'); ?> 71 <br /><?php Doc::notice_htaccess(); ?> 72 </div> 73 </td> 74 </tr> 75 76 </tbody> 77 </table> 25 78 </div> 26 27 <table class="wp-list-table striped litespeed-table"><tbody>28 <tr>29 <th>30 <?php $id = self::O_UPDATE_INTERVAL; ?>31 <?php echo __( 'Product Update Interval', 'litespeed-cache' ); ?>32 </th>33 <td>34 <?php35 $options = array(36 self::O_PQS_CS => __( 'Purge product on changes to the quantity or stock status.', 'litespeed-cache' ) . ' ' . __( 'Purge categories only when stock status changes.', 'litespeed-cache' ),37 self::O_PS_CS => __( 'Purge product and categories only when the stock status changes.', 'litespeed-cache' ),38 self::O_PS_CN => __( 'Purge product only when the stock status changes.', 'litespeed-cache' ) . ' ' . __( 'Do not purge categories on changes to the quantity or stock status.', 'litespeed-cache' ),39 self::O_PQS_CQS => __( 'Always purge both product and categories on changes to the quantity or stock status.', 'litespeed-cache' ),40 );41 $conf = (int) apply_filters( 'litespeed_conf', $id );42 foreach ( $options as $k => $v ) :43 $checked = (int) $k === $conf ? ' checked ' : '';44 ?>45 <?php do_action( 'litespeed_setting_enroll', $id ); ?>46 <div class='litespeed-radio-row'>47 <input type='radio' autocomplete='off' name='<?php echo $id; ?>' id='conf_<?php echo $id; ?>_<?php echo $k; ?>' value='<?php echo $k; ?>' <?php echo $checked; ?> />48 <label for='conf_<?php echo $id; ?>_<?php echo $k; ?>'><?php echo $v; ?></label>49 </div>50 <?php endforeach; ?>51 <div class="litespeed-desc">52 <?php echo __( 'Determines how changes in product quantity and product stock status affect product pages and their associated category pages.', 'litespeed-cache' ); ?>53 </div>54 </td>55 </tr>56 57 </tbody></table>58 59 </div> -
litespeed-cache/trunk/tpl/dash/dashboard.tpl.php
r2928795 r2977143 607 607 </div> 608 608 609 <div class="postbox litespeed-postbox litespeed-postbox-quiccloud litespeed-bg-quic-cloud"> 610 <div class="inside litespeed-text-center"> 611 <h3 class="litespeed-title"> 612 QUIC.cloud 613 <a href="https://www.quic.cloud/quic-cloud-services-and-features/litespeed-cache-service/" class="litespeed-title-right-icon">Learn More</a> 614 </h3> 615 <p class="litespeed-top20 litespeed-text-bold litespeed-margin-bottom20"> 616 <a href="https://www.quic.cloud/docs/onboarding/" class="">Try QUIC.cloud CDN!</a> 617 </p> 618 <p class="litespeed-margin-y5"> 619 Best available WordPress performance 620 </p> 621 <p class="litespeed-margin-y5"> 622 Globally fast TTFB, easy setup, and <a href="https://www.quic.cloud/quic-cloud-services-and-features/litespeed-cache-service/">more</a>! 623 </p> 624 <div class="litespeed-top10"> 625 <img src="<?php echo LSWCP_PLUGIN_URL; ?>assets/img/quic-cloud-logo.svg" alt="QUIC.cloud" width="45%" height="auto"> 626 </div> 627 </div> 628 </div> 629 609 630 </div> 610 631 611 632 </div> 612 633 613 614 634 </div> -
litespeed-cache/trunk/tpl/page_optm/settings_html.tpl.php
r2554181 r2977143 1 1 <?php 2 2 3 namespace LiteSpeed; 3 defined( 'WPINC' ) || exit; 4 5 defined('WPINC') || exit; 4 6 ?> 5 7 6 8 <h3 class="litespeed-title-short"> 7 <?php echo __( 'HTML Settings', 'litespeed-cache'); ?>8 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#html-settings-tab'); ?>9 <?php echo __('HTML Settings', 'litespeed-cache'); ?> 10 <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/pageopt/#html-settings-tab'); ?> 9 11 </h3> 10 12 11 <table class="wp-list-table striped litespeed-table"><tbody> 12 <tr> 13 <th> 14 <?php $id = Base::O_OPTM_HTML_MIN; ?> 15 <?php $this->title( $id ); ?> 16 </th> 17 <td> 18 <?php $this->build_switch( $id ); ?> 19 <div class="litespeed-desc"> 20 <?php echo __( 'Minify HTML content.', 'litespeed-cache' ); ?> 21 </div> 22 </td> 23 </tr> 13 <table class="wp-list-table striped litespeed-table"> 14 <tbody> 15 <tr> 16 <th> 17 <?php $id = Base::O_OPTM_HTML_MIN; ?> 18 <?php $this->title($id); ?> 19 </th> 20 <td> 21 <?php $this->build_switch($id); ?> 22 <div class="litespeed-desc"> 23 <?php echo __('Minify HTML content.', 'litespeed-cache'); ?> 24 </div> 25 </td> 26 </tr> 24 27 25 <tr>26 <th>27 <?php $id = Base::O_OPTM_DNS_PREFETCH; ?>28 <?php $this->title( $id); ?>29 </th>30 <td>31 <?php $this->build_textarea( $id); ?>32 <div class="litespeed-desc">33 <?php echo __( 'Prefetching DNS can reduce latency for visitors.', 'litespeed-cache'); ?>34 <?php echo __( 'For example', 'litespeed-cache'); ?>: <code>//www.example.com</code>35 <?php Doc::one_per_line(); ?>36 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#dns-prefetch'); ?>37 </div>38 </td>39 </tr>28 <tr> 29 <th> 30 <?php $id = Base::O_OPTM_DNS_PREFETCH; ?> 31 <?php $this->title($id); ?> 32 </th> 33 <td> 34 <?php $this->build_textarea($id); ?> 35 <div class="litespeed-desc"> 36 <?php echo __('Prefetching DNS can reduce latency for visitors.', 'litespeed-cache'); ?> 37 <?php echo __('For example', 'litespeed-cache'); ?>: <code>//www.example.com</code> 38 <?php Doc::one_per_line(); ?> 39 <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/pageopt/#dns-prefetch'); ?> 40 </div> 41 </td> 42 </tr> 40 43 41 <tr>42 <th>43 <?php $id = Base::O_OPTM_DNS_PREFETCH_CTRL; ?>44 <?php $this->title( $id); ?>45 </th>46 <td>47 <?php $this->build_switch( $id); ?>48 <div class="litespeed-desc">49 <?php echo __( 'Automatically enable DNS prefetching for all URLs in the document, including images, CSS, JavaScript, and so forth.', 'litespeed-cache'); ?>50 <?php echo __( 'This can improve the page loading speed.', 'litespeed-cache'); ?>51 <?php Doc::learn_more( 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control'); ?>52 </div>53 </td>54 </tr>44 <tr> 45 <th> 46 <?php $id = Base::O_OPTM_DNS_PREFETCH_CTRL; ?> 47 <?php $this->title($id); ?> 48 </th> 49 <td> 50 <?php $this->build_switch($id); ?> 51 <div class="litespeed-desc"> 52 <?php echo __('Automatically enable DNS prefetching for all URLs in the document, including images, CSS, JavaScript, and so forth.', 'litespeed-cache'); ?> 53 <?php echo __('This can improve the page loading speed.', 'litespeed-cache'); ?> 54 <?php Doc::learn_more('https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control'); ?> 55 </div> 56 </td> 57 </tr> 55 58 56 <tr> 57 <th> 58 <?php $id = Base::O_OPTM_HTML_LAZY; ?> 59 <?php $this->title( $id ); ?> 60 </th> 61 <td> 62 <?php $this->build_textarea( $id ); ?> 63 <div class="litespeed-desc"> 64 <?php echo __( 'Delay rendering off-screen HTML elements by its selector.', 'litespeed-cache' ); ?> 65 <?php Doc::one_per_line(); ?> 66 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#html-lazyload-selectors' ); ?> 67 </div> 68 </td> 69 </tr> 59 <tr> 60 <th> 61 <?php $id = Base::O_OPTM_DNS_PRECONNECT; ?> 62 <?php $this->title($id); ?> 63 </th> 64 <td> 65 <?php $this->build_textarea($id); ?> 66 <div class="litespeed-desc"> 67 <?php echo __('Preconnecting speeds up future loads from a given origin.', 'litespeed-cache'); ?> 68 <?php echo __('For example', 'litespeed-cache'); ?>: <code>https://example.com</code> 69 <?php Doc::one_per_line(); ?> 70 <?php Doc::learn_more('https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect'); ?> 71 </div> 72 </td> 73 </tr> 70 74 71 <tr> 72 <th> 73 <?php $id = Base::O_OPTM_QS_RM; ?> 74 <?php $this->title( $id ); ?> 75 </th> 76 <td> 77 <?php $this->build_switch( $id ); ?> 78 <div class="litespeed-desc"> 79 <?php echo __( 'Remove query strings from internal static resources.', 'litespeed-cache' ); ?> 80 <br /><font class="litespeed-warning"> 81 ⚠️ 82 <?php echo __( 'Google reCAPTCHA will be bypassed automatically.', 'litespeed-cache' ); ?> 83 </font> 84 <br /><font class="litespeed-success"> 85 <?php echo __( 'API', 'litespeed-cache' ); ?>: 86 <?php echo sprintf( __( 'Append query string %s to the resources to bypass this action.', 'litespeed-cache' ), '<code>&_litespeed_rm_qs=0</code>' ); ?> 87 </font> 88 </div> 89 </td> 90 </tr> 75 <tr> 76 <th> 77 <?php $id = Base::O_OPTM_HTML_LAZY; ?> 78 <?php $this->title($id); ?> 79 </th> 80 <td> 81 <?php $this->build_textarea($id); ?> 82 <div class="litespeed-desc"> 83 <?php echo __('Delay rendering off-screen HTML elements by its selector.', 'litespeed-cache'); ?> 84 <?php Doc::one_per_line(); ?> 85 <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/pageopt/#html-lazyload-selectors'); ?> 86 </div> 87 </td> 88 </tr> 91 89 92 <tr> 93 <th> 94 <?php $id = Base::O_OPTM_GGFONTS_ASYNC; ?> 95 <?php $this->title( $id ); ?> 96 </th> 97 <td> 98 <?php $this->build_switch( $id ); ?> 99 <div class="litespeed-desc"> 100 <?php echo __( 'Use Web Font Loader library to load Google Fonts asynchronously while leaving other CSS intact.', 'litespeed-cache' ); ?> 101 <?php echo __( 'This will also add a preconnect to Google Fonts to establish a connection earlier.', 'litespeed-cache' ); ?> 102 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#load-google-fonts-asynchronously' ); ?> 103 </div> 104 </td> 105 </tr> 90 <tr> 91 <th> 92 <?php $id = Base::O_OPTM_QS_RM; ?> 93 <?php $this->title($id); ?> 94 </th> 95 <td> 96 <?php $this->build_switch($id); ?> 97 <div class="litespeed-desc"> 98 <?php echo __('Remove query strings from internal static resources.', 'litespeed-cache'); ?> 99 <br /> 100 <font class="litespeed-warning"> 101 ⚠️ 102 <?php echo __('Google reCAPTCHA will be bypassed automatically.', 'litespeed-cache'); ?> 103 </font> 104 <br /> 105 <font class="litespeed-success"> 106 <?php echo __('API', 'litespeed-cache'); ?>: 107 <?php echo sprintf(__('Append query string %s to the resources to bypass this action.', 'litespeed-cache'), '<code>&_litespeed_rm_qs=0</code>'); ?> 108 </font> 109 </div> 110 </td> 111 </tr> 106 112 107 <tr> 108 <th> 109 <?php $id = Base::O_OPTM_GGFONTS_RM; ?> 110 <?php $this->title( $id ); ?> 111 </th> 112 <td> 113 <?php $this->build_switch( $id ); ?> 114 <div class="litespeed-desc"> 115 <?php echo __( 'Prevent Google Fonts from loading on all pages.', 'litespeed-cache' ); ?> 116 </div> 117 </td> 118 </tr> 113 <tr> 114 <th> 115 <?php $id = Base::O_OPTM_GGFONTS_ASYNC; ?> 116 <?php $this->title($id); ?> 117 </th> 118 <td> 119 <?php $this->build_switch($id); ?> 120 <div class="litespeed-desc"> 121 <?php echo __('Use Web Font Loader library to load Google Fonts asynchronously while leaving other CSS intact.', 'litespeed-cache'); ?> 122 <?php echo __('This will also add a preconnect to Google Fonts to establish a connection earlier.', 'litespeed-cache'); ?> 123 <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/pageopt/#load-google-fonts-asynchronously'); ?> 124 </div> 125 </td> 126 </tr> 119 127 120 <tr> 121 <th> 122 <?php $id = Base::O_OPTM_EMOJI_RM; ?> 123 <?php $this->title( $id ); ?> 124 </th> 125 <td> 126 <?php $this->build_switch( $id ); ?> 127 <div class="litespeed-desc"> 128 <?php echo __( 'Stop loading WordPress.org emoji. Browser default emoji will be displayed instead.', 'litespeed-cache' ); ?> 129 <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ); ?> 130 </div> 131 </td> 132 </tr> 128 <tr> 129 <th> 130 <?php $id = Base::O_OPTM_GGFONTS_RM; ?> 131 <?php $this->title($id); ?> 132 </th> 133 <td> 134 <?php $this->build_switch($id); ?> 135 <div class="litespeed-desc"> 136 <?php echo __('Prevent Google Fonts from loading on all pages.', 'litespeed-cache'); ?> 137 </div> 138 </td> 139 </tr> 133 140 134 <tr>135 <th>136 <?php $id = Base::O_OPTM_NOSCRIPT_RM; ?>137 <?php $this->title( $id); ?>138 </th>139 <td>140 <?php $this->build_switch( $id); ?>141 <div class="litespeed-desc">142 <?php echo sprintf( __( 'This option will remove all %s tags from HTML.', 'litespeed-cache' ), '<code><noscript></code>'); ?>143 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#remove-noscript-tags'); ?>144 </div>145 </td>146 </tr>141 <tr> 142 <th> 143 <?php $id = Base::O_OPTM_EMOJI_RM; ?> 144 <?php $this->title($id); ?> 145 </th> 146 <td> 147 <?php $this->build_switch($id); ?> 148 <div class="litespeed-desc"> 149 <?php echo __('Stop loading WordPress.org emoji. Browser default emoji will be displayed instead.', 'litespeed-cache'); ?> 150 <?php echo __('This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache'); ?> 151 </div> 152 </td> 153 </tr> 147 154 148 </tbody></table> 155 <tr> 156 <th> 157 <?php $id = Base::O_OPTM_NOSCRIPT_RM; ?> 158 <?php $this->title($id); ?> 159 </th> 160 <td> 161 <?php $this->build_switch($id); ?> 162 <div class="litespeed-desc"> 163 <?php echo sprintf(__('This option will remove all %s tags from HTML.', 'litespeed-cache'), '<code><noscript></code>'); ?> 164 <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/pageopt/#remove-noscript-tags'); ?> 165 </div> 166 </td> 167 </tr> 168 169 </tbody> 170 </table>
Note: See TracChangeset
for help on using the changeset viewer.