sanitize($source['content_html']); $doc = new DOMDocument; $old = libxml_use_internal_errors(true); $doc->loadHTML(''.$source['content_html'].'', LIBXML_NONET); libxml_clear_errors(); libxml_use_internal_errors($old); $headings = []; foreach ($doc->getElementsByTagName('h1') as $heading) { $headings[] = str_contains(html_entity_decode(strip_tags($projected), ENT_QUOTES | ENT_HTML5, 'UTF-8'), $heading->textContent); } $checks[] = ['legacy_id' => $article['id'], 'original_sha256_preserved' => true, 'source_h1_count' => count($headings), 'heading_text_preserved' => ! in_array(false, $headings, true), 'projected_h1_count' => preg_match_all('/ hash('sha256', $projected)]; } $malicious = $adapter->sanitize('

TítuloFonte

'); $security = ! preg_match('/ $passed ? 'passed' : 'failed', 'phase' => $phase, 'checks' => $checks, 'active_markup_removed' => $security, 'database_access' => false, 'interface_accepted' => false]; file_put_contents($root.'/content-check-'.$phase.'.json', json_encode($proof, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); echo json_encode(['result' => $proof['result'], 'phase' => $phase, 'articles' => count($checks), 'missing_heading_articles' => array_values(array_column(array_filter($checks, fn ($c) => ! $c['heading_text_preserved']), 'legacy_id')), 'active_markup_removed' => $security, 'database_access' => false, 'interface_accepted' => false], JSON_THROW_ON_ERROR).PHP_EOL; exit($passed ? 0 : 1);