<?php
if( ! defined( 'ABSPATH' ) ){
    exit;
}

class SS_Breadcrumb_Detector {

    public static function init() {
        // hook if needed later
    }

    public static function scan($html) {
        global $searchshifter_breadcrumb_detected;

        $plain = strtolower($html);

        $patterns = [
            '/home\s*>\s*/',
            '/home\s*&gt;\s*/',
            '/<nav[^>]*breadcrumb/i',
            '/breadcrumb/i',
            '/you are here/i',
        ];

        foreach ($patterns as $pattern) {
            if (preg_match($pattern, $plain)) {
                $searchshifter_breadcrumb_detected = true;
                break;
            }
        }

        return $html;
    }
}