| @@ -744,10 +744,14 @@ | ||
| 744 | 744 | if ( ! class_exists( __NAMESPACE__ . '\\Object_Cache' ) ) { |
| 745 | 745 | return $result; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - $opts = (array) Settings_Manager::get( 'object-cache' ); | |
| 749 | - $state = Object_Cache::enable( $opts ); | |
| 748 | + $opts = (array) Settings_Manager::get( 'object-cache' ); | |
| 749 | + // An import IS the user switching away from the source plugin, so it | |
| 750 | + // takes the same switch path: the source's own object cache is turned | |
| 751 | + // off through its settings (or the plugin deactivated) before ours goes | |
| 752 | + // in, instead of being overwritten while it stays on. (#686) | |
| 753 | + $state = Object_Cache::enable( $opts, array( 'takeover' => true ) ); | |
| 750 | 754 | |
| 751 | 755 | $result['ok'] = ! empty( $state['ok'] ); |
| 752 | 756 | $result['object_cache_ready'] = ! empty( $state['ok'] ); |
| 753 | 757 | if ( empty( $state['ok'] ) ) { |
| @@ -815,8 +819,11 @@ | ||
| 815 | 819 | 'lazy_images' => ! empty( $r['lazyload'] ), |
| 816 | 820 | 'lazy_iframes' => ! empty( $r['lazyload_iframes'] ), |
| 817 | 821 | 'lazy_videos' => ! empty( $r['lazyload_youtube'] ), |
| 818 | 822 | ); |
| 823 | + if ( ! empty( $r['lazyload_css_bg_img'] ) ) { | |
| 824 | + $patch['lazy']['lazy_background_images'] = true; | |
| 825 | + } | |
| 819 | 826 | |
| 820 | 827 | // Separate Mobile Cache — do NOT import this as ON. WP Rocket's |
| 821 | 828 | // "separate cache files for mobile" is frequently left on by habit even |
| 822 | 829 | // when the site serves identical HTML to every device, and xSpeed's |
| @@ -837,8 +844,19 @@ | ||
| 837 | 844 | $patch['preloader']['sitemap_urls'] = array_values( array_filter( array_map( 'strval', $r['sitemap_preload_url'] ) ) ); |
| 838 | 845 | } |
| 839 | 846 | } |
| 840 | 847 | |
| 848 | + // Bloat — WP Rocket's "Disable Emoji" and "Disable WordPress embeds". | |
| 849 | + $bloat = array_filter( | |
| 850 | + array( | |
| 851 | + 'disable_emojis' => ! empty( $r['emoji'] ), | |
| 852 | + 'disable_oembed' => ! empty( $r['embeds'] ), | |
| 853 | + ) | |
| 854 | + ); | |
| 855 | + if ( $bloat ) { | |
| 856 | + $patch['bloat'] = $bloat; | |
| 857 | + } | |
| 858 | + | |
| 841 | 859 | // CDN — WP Rocket stores CDN hosts in cdn_cnames (array). |
| 842 | 860 | if ( ! empty( $r['cdn'] ) && ! empty( $r['cdn_cnames'] ) && is_array( $r['cdn_cnames'] ) ) { |
| 843 | 861 | $first = (string) ( $r['cdn_cnames'][0] ?? '' ); |
| 844 | 862 | if ( '' !== $first ) { |
| @@ -1472,15 +1490,14 @@ | ||
| 1472 | 1490 | $patch['fonts'] = array( 'font_display_swap' => true ); |
| 1473 | 1491 | } |
| 1474 | 1492 | |
| 1475 | 1493 | // ── Disable bloat ───────────────────────────────────────────── |
| 1476 | - // Only map the one LiteSpeed "remove" toggle with a clean xSpeed | |
| 1477 | - // equivalent: removing the emoji + oEmbed scripts ≈ disable_oembed. | |
| 1478 | - // (LiteSpeed's optm-emoji_rm strips the wp-emoji + wp-embed pair.) | |
| 1479 | - // jQuery-migrate / dashicons / XML-RPC / RSS / REST aren't | |
| 1480 | - // LiteSpeed-managed, so we don't guess at them. | |
| 1494 | + // optm-emoji_rm is LiteSpeed's only bloat toggle. It used to map to | |
| 1495 | + // disable_oembed, which turned oEmbed off unasked and left emojis on | |
| 1496 | + // (#217, #532). jQuery-migrate / dashicons / XML-RPC / RSS / REST | |
| 1497 | + // aren't LiteSpeed-managed, so we don't guess at them. | |
| 1481 | 1498 | if ( $on( 'optm-emoji_rm' ) ) { |
| 1482 | - $patch['bloat'] = array( 'disable_oembed' => true ); | |
| 1499 | + $patch['bloat'] = array( 'disable_emojis' => true ); | |
| 1483 | 1500 | } |
| 1484 | 1501 | |
| 1485 | 1502 | // ── Browser cache (LiteSpeed: cache-browser) ────────────────── |
| 1486 | 1503 | if ( $on( 'cache-browser' ) ) { |