PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.3
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.3
1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 All 29 releases
← All changes | includes/class-preloader.php +24 -4 1.2.41.3.3 View file →
@@ -376,9 +376,12 @@
376 376 if ( empty( $opts['add_missing_dimensions'] ) ) {
377 377 return;
378 378 }
379 379
380 - if ( ! preg_match_all( '#<img\b[^>]*\bsrc\s*=\s*["\']([^"\']+)["\'][^>]*>#i', $html, $m, PREG_SET_ORDER ) ) {
380 + // Match any <img>, not only one carrying `src`. The URL worth warming
381 + // may live in a lazy attribute instead — which is the whole point of
382 + // #328 — and resolvable_image_url() below is what knows where to look.
383 + if ( ! preg_match_all( '#<img\b[^>]*>#i', $html, $m, PREG_SET_ORDER ) ) {
381 384 return;
382 385 }
383 386
384 387 $home = wp_parse_url( home_url(), PHP_URL_HOST );
@@ -385,13 +388,30 @@
385 388 $targets = array();
386 389 foreach ( $m as $tag ) {
387 390 // Only tags MISSING a dimension are worth resolving — one that
388 391 // already declares both needs nothing.
389 - if ( preg_match( '#\bwidth\s*=#i', $tag[0] ) && preg_match( '#\bheight\s*=#i', $tag[0] ) ) {
392 + // Same lookbehind as Lazy_Loader::ensure_dimensions(): a bare
393 + // `\bwidth=` also matches `data-width=`, so a slider carrying its
394 + // own metadata looked already-sized and was skipped from warming.
395 + // The two must agree, or the collector skips exactly the tags the
396 + // renderer still needs measured. (#333 review round 3, issue 2)
397 + if ( preg_match( '#(?<![-\w])width\s*=#i', $tag[0] ) && preg_match( '#(?<![-\w])height\s*=#i', $tag[0] ) ) {
390 398 continue;
391 399 }
392 - $src = $tag[1];
393 - if ( ! preg_match( '#^https?://#i', $src ) ) {
400 + // Ask the same resolver the render path uses, rather than reading
401 + // `src` directly. A slider parks a spacer in `src` and the real
402 + // URL in `data-lazy`/`data-src`/`data-original`, so a collector
403 + // looking only at `src` warmed the SPACER and never the image —
404 + // leaving remotely-hosted slider images unresolvable at render
405 + // time, the exact markup #328 is about. (#333 review round 2,
406 + // issue 3)
407 + // `false`: do not let the resolver settle a name-refused URL by
408 + // MEASURING it. That is circular here — remote measurement is
409 + // gated until warm_dimensions() sets $warming, and this collector
410 + // is what feeds warm_dimensions(). Take the URL the tag offers and
411 + // let the warm pass decide. (#333 review round 3, issue 3)
412 + $src = Lazy_Loader::resolvable_image_url( $tag[0], false );
413 + if ( '' === $src || ! preg_match( '#^https?://#i', $src ) ) {
394 414 continue;
395 415 }
396 416 $host = wp_parse_url( $src, PHP_URL_HOST );
397 417 if ( ! $host || $host === $home ) {