$block_id, 'zone' => $zone, 'timestamp' => microtime(true), ], $meta); } public static function is_content_processed($hash) { return isset(self::$processed_content[$hash]); } public static function get_processed_content($hash) { return self::$processed_content[$hash] ?? null; } public static function mark_content_processed($hash, $content) { self::$processed_content[$hash] = $content; } public static function get_inserted_blocks() { return self::$inserted_blocks; } public static function get_zone_count($zone) { $count = 0; foreach (self::$inserted_blocks as $data) { if (($data['zone'] ?? null) === $zone) { $count++; } } return $count; } public static function export_audit() { $blocks = []; foreach (self::$inserted_blocks as $key => $data) { $blocks[] = array_merge(['key' => $key], $data); } return [ 'request_id' => self::$request_id, 'total' => count($blocks), 'by_zone' => [ 'content' => self::get_zone_count('content'), 'header' => self::get_zone_count('header'), 'footer' => self::get_zone_count('footer'), 'sidebar' => self::get_zone_count('sidebar'), ], 'blocks' => $blocks, ]; } public static function reset() { self::$inserted_blocks = []; self::$processed_content = []; self::$request_id = null; } }