| @@ -75,15 +75,8 @@ | ||
| 75 | 75 | add_filter( 'style_loader_src', array( __CLASS__, 'rewrite_style' ), 10, 2 ); |
| 76 | 76 | } |
| 77 | 77 | if ( ! empty( $opts['minify_js'] ) ) { |
| 78 | 78 | add_filter( 'script_loader_src', array( __CLASS__, 'rewrite_script' ), 10, 2 ); |
| 79 | - // The src rewrite above runs before any plugin's own | |
| 80 | - // `script_loader_tag` filter can stamp data-no-minify / | |
| 81 | - // data-no-optimize onto the tag, so the marker arrives too late | |
| 82 | - // to prevent it. Priority 15: after third-party tag filters at | |
| 83 | - // the default 10 have printed their markers, before our defer | |
| 84 | - // (20) and delay (30) look at the tag. (#456) | |
| 85 | - add_filter( 'script_loader_tag', array( Minify_Filters::class, 'restore_marked_script_src' ), 15, 3 ); | |
| 86 | 79 | } |
| 87 | 80 | |
| 88 | 81 | // Phase 4.1a — filter-only "smarter minifier" features. Each is |
| 89 | 82 | // gated on its own toggle so users can enable any subset. |
| @@ -112,27 +105,8 @@ | ||
| 112 | 105 | // so the src sweep above never sees them; this one parks an |
| 113 | 106 | // inline body that names a known third-party host. |
| 114 | 107 | add_filter( 'xspeed_cache_final_html', array( Minify_Filters::class, 'delay_inline_snippets' ), 21 ); |
| 115 | 108 | } |
| 116 | - | |
| 117 | - // Everything above honors data-no-optimize / data-no-minify, but | |
| 118 | - // only sees markers stamped before priority 30. Borlabs Cookie | |
| 119 | - // stamps at 100, so its consent config was minified AND delayed | |
| 120 | - // despite carrying both markers. Snapshot the tag before our | |
| 121 | - // transforms (9) and hand the original back if a marker turns up | |
| 122 | - // after them (1000, past Borlabs' own 100 and 999). Registered | |
| 123 | - // whenever any of the three is on, | |
| 124 | - // since each one is individually enough to damage a marked | |
| 125 | - // script. (#469) | |
| 126 | - if ( ! empty( $opts['minify_js'] ) || ! empty( $opts['defer_js'] ) || ! empty( $opts['delay_js'] ) ) { | |
| 127 | - add_filter( 'script_loader_tag', array( Minify_Filters::class, 'snapshot_tag' ), 9, 3 ); | |
| 128 | - add_filter( | |
| 129 | - 'script_loader_tag', | |
| 130 | - array( Minify_Filters::class, 'revert_late_marked_tag' ), | |
| 131 | - Minify_Filters::late_opt_out_priority(), | |
| 132 | - 3 | |
| 133 | - ); | |
| 134 | - } | |
| 135 | 109 | if ( ! empty( $opts['async_css'] ) ) { |
| 136 | 110 | add_filter( 'style_loader_tag', array( Minify_Filters::class, 'async_style_tag' ), 20, 2 ); |
| 137 | 111 | // style_loader_tag only fires for wp_enqueue_style()'d sheets. |
| 138 | 112 | // Themes print Google/Bunny/Typekit font CSS as literal <link> |
| @@ -458,14 +432,8 @@ | ||
| 458 | 432 | } |
| 459 | 433 | list( , $open, $body, $close ) = $parts; |
| 460 | 434 | |
| 461 | 435 | if ( '' === trim( $body ) ) { |
| 462 | - return $block; | |
| 463 | - } | |
| 464 | - | |
| 465 | - // The tag asked to be left alone (data-no-optimize / data-no-minify — | |
| 466 | - // the convention consent managers print on their config scripts). (#456) | |
| 467 | - if ( Minify_Filters::tag_opts_out( $open ) ) { | |
| 468 | 436 | return $block; |
| 469 | 437 | } |
| 470 | 438 | |
| 471 | 439 | // Refuse a body that is already structurally broken. balanced() only |