/** * Plugin Name: Source Code Privacy Replacement * Description: Reemplaza metadatos sensibles en el código fuente * Version: 1.1 * Author: Tu Nombre */ // Prevenir acceso directo if (!defined('ABSPATH')) { exit; } /** * Modificar directamente el contenido de la página */ function scpr_modify_page_content($content) { // Reemplazar específicamente el autor "team" en ImageObject $content = preg_replace( '/"@type":"ImageObject","author":"team"/i', '"@type":"ImageObject","author":"private"', $content ); // Reemplazar fechas con "private" $content = preg_replace( '/"datePublished":"[^"]*"/i', '"datePublished":"private"', $content ); return $content; } /** * Función para capturar y modificar la salida final */ function scpr_output_modifier($buffer) { return scpr_modify_page_content($buffer); } /** * Iniciar captura de buffer */ function scpr_start_buffer() { // Limpiar cualquier buffer existente while (ob_get_level()) { ob_end_clean(); } // Iniciar nuevo buffer ob_start('scpr_output_modifier'); } /** * Hooks para diferentes momentos de renderizado */ add_action('init', 'scpr_start_buffer', 1); add_action('shutdown', function() { if (ob_get_level()) { ob_end_flush(); } }, 999); /** * Modificación de JSON-LD para plugins de SEO */ function scpr_modify_jsonld($data) { // Convertir a JSON para manipulación de texto $json_string = json_encode($data); // Reemplazar autor y fecha $modified_json = preg_replace( [ '/"author":"team"/i', '/"datePublished":"[^"]*"/i' ], [ '"author":"private"', '"datePublished":"private"' ], $json_string ); // Decodificar de vuelta return json_decode($modified_json, true); } // Hooks para diferentes plugins de SEO add_filter('rank_math/json_ld', 'scpr_modify_jsonld', 9999); add_filter('wpseo_json_ld', 'scpr_modify_jsonld', 9999); add_filter('all_in_one_seo_json_data', 'scpr_modify_jsonld', 9999); MUSEUM Archives - ProdAfrica Business Directory

All MUSEUM in Riyadh