From f524c28d079eb25cf0f0bbd9cf847237bda2eb59 Mon Sep 17 00:00:00 2001 From: Varun Kumar Dubey Date: Fri, 28 Aug 2026 13:46:42 +0530 Subject: [PATCH] Remove dead code: unused debug_log() helper in public class Proof: `grep -rn "debug_log" --include="*.php"` returns only the definition at public/class-infinite-loader-for-woocommerce-public.php:620 - zero callers. It is a `private` method, so no dynamic/external dispatch is possible; nothing in the class (or repo) invokes it. Removing it changes no behavior. PHP-only cut - no JS/CSS source touched, so the grunt min bundles are unaffected. build-release.sh passes: PHP lint clean, verify-build-freshness OK, zip built. Kept (reported as owner decisions, not cut): - Rate limiter (check_rate_limit/get_client_ip) - guards the live read-GET next-page fetch, which sends infinite_loader_ajax=1 (infinite_loader_products.js:265). DoS/scraping protection on a real endpoint; owner decision. - add_security_headers() - live X-Frame/X-Content-Type/Referrer-Policy headers on frontend WooCommerce pages; owner decision. - Hand-rolled sanitize_hex_color() (public + admin) - many live callers, and the signature differs from core (takes a $default fallback, runs on the frontend where the customizer's sanitize_hex_color() is not guaranteed loaded); NOT an exact core replacement. - sanitize_css_js_option / sanitize_javascript - input sanitization, never removed. --- .../class-infinite-loader-for-woocommerce-public.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/public/class-infinite-loader-for-woocommerce-public.php b/public/class-infinite-loader-for-woocommerce-public.php index 9c14e11..9124e4f 100644 --- a/public/class-infinite-loader-for-woocommerce-public.php +++ b/public/class-infinite-loader-for-woocommerce-public.php @@ -611,15 +611,4 @@ private function sanitize_hex_color( $color, $default = '' ) { return $default; } - - /** - * Debug log helper - * - * @param mixed $message Message to log. - */ - private function debug_log( $message ) { - if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { - error_log( 'Infinite Loader: ' . print_r( $message, true ) ); - } - } } \ No newline at end of file