]*?)\bhref=(["\'])(https:\/\/bpadvogados\.com\.br[^"\']*)\2([^>]*)>/i', function ($matches) { return ''; }, (string) $html); $homeUrl = siteSemanticUrl('/'); if ($homeUrl !== '') { $html = preg_replace( '//i', '', $html ); $html = preg_replace( '//i', '', $html ); } $html = str_replace( ['https://bpadvogados.com.br/lgpd/', 'https://bpadvogados.com.br/lgpd'], siteSemanticUrl('/lgpd/'), $html ); $assetReplacements = [ siteLegacyOrigin() . '/htmlf/bp/wp-content/' => siteMirrorUrl('/htmlf/bp/wp-content/'), siteLegacyOrigin() . '/wp-content/' => siteMirrorUrl('/wp-content/'), siteLegacyOrigin() . '/htmlf/bp/wp-includes/' => siteMirrorUrl('/htmlf/bp/wp-includes/'), siteJsEscapedUrl(siteLegacyOrigin() . '/htmlf/bp/wp-content/') => siteJsEscapedUrl(siteMirrorUrl('/htmlf/bp/wp-content/')), siteJsEscapedUrl(siteLegacyOrigin() . '/htmlf/bp/wp-includes/') => siteJsEscapedUrl(siteMirrorUrl('/htmlf/bp/wp-includes/')), '/htmlf/bp/wp-content/' => siteMirrorUrl('/htmlf/bp/wp-content/'), '/htmlf/bp/wp-includes/' => siteMirrorUrl('/htmlf/bp/wp-includes/'), '/htmlf/bp/media/' => siteMirrorUrl('/media/'), siteLegacyOrigin() . '/htmlf/bp/wp-admin/admin-ajax.php' => siteMirrorUrl('/htmlf/bp/wp-admin/admin-ajax.php'), siteJsEscapedUrl(siteLegacyOrigin() . '/htmlf/bp/wp-admin/admin-ajax.php') => siteJsEscapedUrl(siteMirrorUrl('/htmlf/bp/wp-admin/admin-ajax.php')), siteJsEscapedUrl(siteLegacyOrigin() . '/htmlf/bp/wp-json/') => siteJsEscapedUrl(siteMirrorUrl('/htmlf/bp/wp-json/')), siteLegacyOrigin() . '/#organization' => $homeUrl . '#organization', siteLegacyOrigin() . '/#website' => $homeUrl . '#website', siteLegacyOrigin() . '/#webpage' => $homeUrl . '#webpage', siteLegacyOrigin() . '/#richSnippet' => $homeUrl . '#richSnippet', siteLegacyOrigin() . '/author/admin/' => siteSemanticUrl('/author/admin/'), '["bpadvogados.com.br"]' => '["' . siteContentEscape((string) parse_url(siteAppRoot(), PHP_URL_HOST)) . '"]', '"url":"https://bpadvogados.com.br/"' => '"url":"' . $homeUrl . '"', '"url":"https://bpadvogados.com.br"' => '"url":"' . siteAppRoot() . '"', '"sameAs":["https://bpadvogados.com.br"]' => '"sameAs":["' . siteAppRoot() . '"]', '"target":"https://bpadvogados.com.br/?s={search_term_string}"' => '"target":"' . $homeUrl . '?s={search_term_string}"', ]; $html = strtr($html, $assetReplacements); $html = preg_replace('/]+>/i', '', $html); $html = preg_replace('/]+>/i', '', $html); $html = preg_replace('/]*>\s*(]*>)?\s*(]*>)?/i', '', $html); return $html; } function siteContentLocalPath($fileName) { return __DIR__ . '/.' . $fileName . '.json'; } function siteRecentPublicationItems($limit = 3) { $file = __DIR__ . '/.site-publications.json'; $items = is_file($file) ? json_decode((string) file_get_contents($file), true) : []; if (!is_array($items)) { return []; } $items = array_values(array_filter($items, function ($item) { return is_array($item) && !empty($item['slug']) && !empty($item['title']) && in_array((string) ($item['section'] ?? ''), ['artigos', 'agenda', 'noticias'], true); })); return array_slice($items, 0, max(1, (int) $limit)); } function siteRecentPublicationCategoryUrl($item) { $section = (string) ($item['section'] ?? 'artigos'); if (function_exists('sitePublicationArchiveUrl')) { return sitePublicationArchiveUrl($section); } $labels = ['agenda' => 'Agenda', 'noticias' => 'Notícias', 'artigos' => 'Artigos']; return '/p/bp/' . rawurlencode($section) . '/' . rawurlencode($section) . '/' . rawurlencode($labels[$section] ?? ucfirst($section)) . '/BP/pt'; } function siteRecentPublicationTagUrl($tag) { if (function_exists('sitePublicationTagUrl')) { return sitePublicationTagUrl($tag); } $token = siteSemanticToken($tag); return '/p/bp/tag' . rawurlencode($token) . '/tags/' . rawurlencode($token) . '/BP/pt'; } function siteRenderRecentPublications($limit = 3) { foreach (siteRecentPublicationItems($limit) as $item) { /* A home usa a rota pública completa, igual à utilizada no restante do site para cada publicação. */ $url = function_exists('sitePublicationUrl') ? sitePublicationUrl((string) $item['slug'], (string) $item['title']) : '/p/bp/' . rawurlencode((string) $item['slug']) . '/publicacoes/' . rawurlencode((string) $item['slug']) . '/BP/pt'; $title = siteContentEscape($item['title']); $image = siteContentEscape($item['home_image'] ?? $item['image'] ?? ''); $category = trim((string) ($item['category'] ?? '')); if ($category === '') { $labels = ['agenda' => 'Agenda', 'noticias' => 'Notícias', 'artigos' => 'Artigos']; $category = $labels[$item['section']] ?? 'Artigos'; } $categoryUrl = siteRecentPublicationCategoryUrl($item); $tags = isset($item['home_tags']) && is_array($item['home_tags']) ? $item['home_tags'] : (isset($item['tags']) && is_array($item['tags']) ? $item['tags'] : []); ?>
<?php echo $title; ?>

'/^#[0-9a-f]{3,8}$|^rgb(a)?\([0-9,\s.%]+\)$|^[a-z]+$/i', 'font-size' => '/^[0-9.]+(px|em|rem|%)$/i', 'text-align' => '/^(left|center|right|justify)$/i', 'line-height' => '/^[0-9.]+(px|em|rem|%)?$/i', 'width' => '/^[0-9.]+(px|%)$/i', 'max-width' => '/^[0-9.]+(px|%)$/i', 'height' => '/^[0-9.]+(px|%)$|^auto$/i', ]; $safe = []; foreach (explode(';', (string) $style) as $chunk) { $parts = explode(':', $chunk, 2); if (count($parts) !== 2) { continue; } $prop = strtolower(trim($parts[0])); $value = trim($parts[1]); if ($value === '' || !isset($allowed[$prop])) { continue; } if (preg_match($allowed[$prop], $value)) { $safe[] = $prop . ':' . $value; } } return implode(';', $safe); } function siteContentSanitizeHref($href) { $href = trim((string) $href); if ($href === '') { return ''; } if (preg_match('#^(https?:|mailto:|tel:|/|#)#i', $href)) { return $href; } return ''; } function siteContentSanitizeSrc($src) { $src = trim((string) $src); if ($src === '') { return ''; } if (preg_match('#^(https?:|/)#i', $src)) { return $src; } return ''; } function siteContentSanitizeClasses($html) { return preg_replace_callback('/class=(["\'])(.*?)\\1/i', function ($matches) { $classes = preg_split('/\s+/', trim($matches[2])); $classes = array_values(array_filter($classes, 'siteContentAllowedClass')); if (!$classes) { return ''; } return 'class="' . implode(' ', $classes) . '"'; }, $html); } function siteContentSanitizeStyles($html) { return preg_replace_callback('/style=(["\'])(.*?)\\1/i', function ($matches) { $style = siteContentSanitizeStyle($matches[2]); if ($style === '') { return ''; } return 'style="' . siteContentEscape($style) . '"'; }, $html); } function siteContentSanitizeLinks($html) { $html = preg_replace_callback('/href=(["\'])(.*?)\\1/i', function ($matches) { $href = siteContentSanitizeHref(html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8')); if ($href === '') { return ''; } return 'href="' . siteContentEscape($href) . '"'; }, $html); $html = preg_replace_callback('/target=(["\'])(.*?)\\1/i', function ($matches) { $target = strtolower(trim($matches[2])); if ($target !== '_blank' && $target !== '_self') { return ''; } return 'target="' . $target . '"'; }, $html); if (stripos($html, 'target="_blank"') !== false && stripos($html, 'rel=') === false) { $html = str_replace('target="_blank"', 'target="_blank" rel="noopener noreferrer"', $html); } return $html; } function siteContentSanitizeMedia($html) { $html = preg_replace_callback('/]*)>/i', function ($matches) { $attrs = $matches[1]; preg_match('/\bsrc=(["\'])(.*?)\1/i', $attrs, $srcMatch); $src = isset($srcMatch[2]) ? siteContentSanitizeSrc(html_entity_decode($srcMatch[2], ENT_QUOTES, 'UTF-8')) : ''; if ($src === '') { return ''; } preg_match('/\balt=(["\'])(.*?)\1/i', $attrs, $altMatch); preg_match('/\bstyle=(["\'])(.*?)\1/i', $attrs, $styleMatch); preg_match('/\bclass=(["\'])(.*?)\1/i', $attrs, $classMatch); $alt = isset($altMatch[2]) ? strip_tags($altMatch[2]) : ''; $style = isset($styleMatch[2]) ? siteContentSanitizeStyle($styleMatch[2]) : ''; $classes = isset($classMatch[2]) ? preg_split('/\s+/', trim($classMatch[2])) : []; $classes = array_values(array_filter($classes, 'siteContentAllowedClass')); $result = '' . siteContentEscape($alt) . ']*)>/i', function ($matches) { $attrs = $matches[1]; preg_match('/\bsrc=(["\'])(.*?)\1/i', $attrs, $srcMatch); $src = isset($srcMatch[2]) ? siteContentSanitizeSrc(html_entity_decode($srcMatch[2], ENT_QUOTES, 'UTF-8')) : ''; if ($src === '') { return ''; } preg_match('/\btype=(["\'])(.*?)\1/i', $attrs, $typeMatch); $type = isset($typeMatch[2]) ? preg_replace('/[^a-z0-9\-\/+\.]/i', '', $typeMatch[2]) : ''; $result = ']*)>/i', function ($matches) { $attrs = strtolower($matches[1]); $allowedFlags = []; foreach (['controls', 'playsinline', 'muted', 'loop'] as $flag) { if (strpos($attrs, $flag) !== false) { $allowedFlags[] = $flag; } } preg_match('/\bposter=(["\'])(.*?)\1/i', $matches[1], $posterMatch); preg_match('/\bpreload=(["\'])(.*?)\1/i', $matches[1], $preloadMatch); preg_match('/\bstyle=(["\'])(.*?)\1/i', $matches[1], $styleMatch); preg_match('/\bclass=(["\'])(.*?)\1/i', $matches[1], $classMatch); $poster = isset($posterMatch[2]) ? siteContentSanitizeSrc(html_entity_decode($posterMatch[2], ENT_QUOTES, 'UTF-8')) : ''; $preload = isset($preloadMatch[2]) ? strtolower(trim($preloadMatch[2])) : ''; $style = isset($styleMatch[2]) ? siteContentSanitizeStyle($styleMatch[2]) : ''; $classes = isset($classMatch[2]) ? preg_split('/\s+/', trim($classMatch[2])) : []; $classes = array_values(array_filter($classes, 'siteContentAllowedClass')); $result = ']*>#i', '', $html); $html = preg_replace('#<\s*li[^>]*>#i', '', $html); $html = preg_replace('#<\s*/li\s*>#i', '
', $html); $html = preg_replace('#<\s*(p|div)[^>]*>#i', '', $html); $html = preg_replace('#<\s*/(p|div)\s*>#i', '
', $html); $html = preg_replace('#(\s*){2,}#i', '
', $html); $html = preg_replace('#^(\s*)+|(\s*)+$#i', '', $html); return trim($html); } function siteContentNormalizeHtml($html, $mode) { $html = trim(str_replace(["\r\n", "\r"], "\n", (string) $html)); if ($html === '') { return ''; } $allowed = $mode === 'inline' ? '
' : '

    1. E o melhor: nada de SPAM e de acordo com a LGPD.

      ", "social_title": "Nossas redes sociais", "links_title": "Links importantes", "units_title": "Nossas unidades", "unit_1_text": "

      Unidade 1 – São Paulo

      Rua Funchal, 573 – sala 51/52 – Vila Olímpia
      São Paulo / SP – CEP 04551-060.

       

      Atendimento de segunda à sexta–feira de 9h às 19h.

      ", "unit_2_text": "

      Unidade 2 – São Paulo

      Rua Funchal, 573 – sala 53 – Vila Olímpia
      São Paulo / SP – CEP 04551-060.

       

      Atendimento de segunda à sexta–feira de 9h às 19h.

      ", "unit_3_text": "

      Unidade 3 – Sorocaba e Votorantim

      \n

      Av. Gisele Constantino, 1.850 – CJ 1216, Pq. Bela Vista Iguatemi Business 
      Votorantim / SP – CEP 18110-650.

      \n

      Atendimento de segunda à sexta–feira de 9h às 19h.

      ", "footer_message": "

      Celebrando o passado, construindo o futuro.
      Obrigado por fazer parte da nossa história!

      Saiba mais
      ", "footer_contact": "

      (11) 99504-9829 – (11) 3845-9369 relacionamento@bpadvogados.com.br – CNPJ 03.372.958/0001-00

      " } JSON , true); $SITE_CONTENT_MODES = json_decode(<<<'JSON' { "areas_title": "inline", "areas_subtitle": "inline", "areas_intro": "block", "numbers_title": "inline", "team_title": "inline", "team_subtitle": "inline", "team_intro": "block", "leader_1_image": "block", "leader_1_name": "inline", "leader_1_role": "inline", "leader_2_image": "block", "leader_2_name": "inline", "leader_2_role": "inline", "leader_3_image": "block", "leader_3_name": "inline", "leader_3_role": "inline", "awards_title": "inline", "awards_subtitle": "inline", "awards_intro": "block", "award_1_image": "block", "award_1_text": "block", "award_2_image": "block", "award_2_text": "block", "testimonials_intro": "block", "testimonial_1_image": "block", "testimonial_1_name": "inline", "testimonial_1_role": "inline", "testimonial_1_text": "block", "testimonial_2_image": "block", "testimonial_2_name": "inline", "testimonial_2_role": "inline", "testimonial_2_text": "block", "testimonial_3_image": "block", "testimonial_3_name": "inline", "testimonial_3_role": "inline", "testimonial_3_text": "block", "articles_title": "inline", "newsletter_title": "inline", "newsletter_text": "block", "social_title": "inline", "links_title": "inline", "units_title": "inline", "unit_1_text": "block", "unit_2_text": "block", "unit_3_text": "block", "footer_message": "block", "footer_contact": "inline" } JSON , true); $SITE_CONTENT_DEFAULTS['team_items'] = [ [ 'image' => $SITE_CONTENT_DEFAULTS['leader_1_image'], 'name' => $SITE_CONTENT_DEFAULTS['leader_1_name'], 'role' => $SITE_CONTENT_DEFAULTS['leader_1_role'], 'link' => '/p/bp/membroremohigashibattaglia/equipe/RemoHigashiBattaglia/BP/pt', ], [ 'image' => $SITE_CONTENT_DEFAULTS['leader_2_image'], 'name' => $SITE_CONTENT_DEFAULTS['leader_2_name'], 'role' => $SITE_CONTENT_DEFAULTS['leader_2_role'], 'link' => '/p/bp/membropauloandrempedrosa/equipe/PauloAndreMPedrosa/BP/pt', ], [ 'image' => $SITE_CONTENT_DEFAULTS['leader_3_image'], 'name' => $SITE_CONTENT_DEFAULTS['leader_3_name'], 'role' => $SITE_CONTENT_DEFAULTS['leader_3_role'], 'link' => '/p/bp/membromarceladebrito/equipe/MarceladeBrito/BP/pt', ], ]; $SITE_CONTENT_DEFAULTS['award_items'] = [ [ 'image' => $SITE_CONTENT_DEFAULTS['award_1_image'], 'text' => $SITE_CONTENT_DEFAULTS['award_1_text'], ], [ 'image' => $SITE_CONTENT_DEFAULTS['award_2_image'], 'text' => $SITE_CONTENT_DEFAULTS['award_2_text'], ], [ 'image' => '', 'text' => '

      Battaglia & Pedrosa Advogados é reconhecida pela Associação Brasileira da The Rotary Foundation – ABTRF que atesta a responsabilidade social

      ', ], ]; $SITE_CONTENT_DEFAULTS['testimonial_items'] = [ [ 'image' => $SITE_CONTENT_DEFAULTS['testimonial_1_image'], 'name' => $SITE_CONTENT_DEFAULTS['testimonial_1_name'], 'role' => $SITE_CONTENT_DEFAULTS['testimonial_1_role'], 'text' => $SITE_CONTENT_DEFAULTS['testimonial_1_text'], ], [ 'image' => $SITE_CONTENT_DEFAULTS['testimonial_2_image'], 'name' => $SITE_CONTENT_DEFAULTS['testimonial_2_name'], 'role' => $SITE_CONTENT_DEFAULTS['testimonial_2_role'], 'text' => $SITE_CONTENT_DEFAULTS['testimonial_2_text'], ], [ 'image' => $SITE_CONTENT_DEFAULTS['testimonial_3_image'], 'name' => $SITE_CONTENT_DEFAULTS['testimonial_3_name'], 'role' => $SITE_CONTENT_DEFAULTS['testimonial_3_role'], 'text' => $SITE_CONTENT_DEFAULTS['testimonial_3_text'], ], ]; /* O carrossel é aplicado pelo script ao final da página, tanto na versão desktop quanto na móvel. Mantê-lo como dados evita que um slide atualizado conserve o link de uma notícia anterior. */ $SITE_CONTENT_DEFAULTS['carousel_items'] = [ ['title' => 'Escritório de Advocacia em São Paulo com atuação nacional e internacional', 'description' => 'Sede na Vila Olímpia, em São Paulo, e unidade em Sorocaba, unindo mais de 25 anos de experiência, inovação e atendimento estratégico para empresas e pessoas em todo o Brasil', 'link' => '/p/bp/institucional/institucional/Institucional/BP/pt', 'image' => '/htmlf/bp/wp-content/uploads/elementor/thumbs/banca-de-2026-battaglia-e-pedros-advogados-scaled-rp3seoz4900v5s3lmlayq6lg2qvdz9p1j9mlxomekg.jpg', 'button' => 'Saiba mais'], ['title' => 'Reconhecido pelo segundo ano consecutivo no Prêmio Análise DNA+Fenalaw 2025', 'description' => 'O escritório recebeu o premio na categoria Prata com o case em Marketing', 'link' => '/p/bp/battagliapedrosaadvogadosereconhecidopelosegundoanoconsecutivonopremioanalisednafenalaw/publicacoes/BattagliaPedrosaAdvo/BP/pt', 'image' => '/htmlf/bp/wp-content/uploads/elementor/thumbs/premio-analise-dna-fenalaw-case-marketing-diego-parra-1-rgjca3kej4c0yr8jnk8ydujviyt9ychfjfbov5uji8.webp', 'button' => 'Leia mais'], ['title' => 'Paulo André M. Pedrosa participa do XI Congresso Internacional da AMA', 'description' => 'Ministrou a palestra intitulada "Dilemas éticos e desafios jurídicos da medicina contemporânea"', 'link' => '/p/bp/paulopedrosacongressoamadireitomedico/publicacoes/PauloAndrePedrosadeb/BP/pt', 'image' => '/htmlf/bp/wp-content/uploads/elementor/thumbs/simposio-internacional-paulo-pedrosa-rgjccmqqy1su8xk3v5nrlpjl5cbvozje7ylsf03cqo.webp', 'button' => 'Leia mais'], ['title' => 'Road Show 2024 em Milão: Direito Imobiliário e Expansão de Empresas Italianas para o Brasil', 'description' => 'Remo Battaglia realiza apresentação na Câmara Italiana de Milão.', 'link' => '/p/bp/nossaatuacaoitaliandeskassessoriajuridicaparanegociosbrasilitalia/atuacao/ItalianDeskAssessori/BP/pt', 'image' => '/htmlf/bp/wp-content/uploads/elementor/thumbs/camera-de-comercio-italiano1-r0mw688r96akdikl3px3uoekndeqof6ovlm5lcbhvk.jpg', 'button' => 'Leia mais'], ]; $SITE_REPEATABLE_SECTIONS = [ 'team_items' => [ 'allow_empty' => false, 'fields' => [ 'image' => ['mode' => 'block', 'default' => ''], 'name' => ['mode' => 'inline', 'default' => 'Nova liderança'], 'role' => ['mode' => 'inline', 'default' => 'Cargo da liderança'], 'link' => ['mode' => 'inline', 'default' => '#'], ], ], 'award_items' => [ 'allow_empty' => false, 'fields' => [ 'image' => ['mode' => 'block', 'default' => ''], 'text' => ['mode' => 'block', 'default' => '

      Descreva aqui o novo reconhecimento.

      '], ], ], 'testimonial_items' => [ 'allow_empty' => false, 'fields' => [ 'image' => ['mode' => 'block', 'default' => ''], 'name' => ['mode' => 'inline', 'default' => 'Novo depoimento'], 'role' => ['mode' => 'inline', 'default' => 'Cargo ou empresa'], 'text' => ['mode' => 'block', 'default' => '

      Escreva aqui o novo depoimento.

      '], ], ], ]; $requestMethod = isset($_SERVER['REQUEST_METHOD']) ? strtoupper((string) $_SERVER['REQUEST_METHOD']) : 'GET'; if ($requestMethod === 'POST' && in_array((isset($_POST['sitecontent_action']) ? $_POST['sitecontent_action'] : ''), ['carousel_save', 'carousel_add', 'carousel_remove'], true)) { header('Content-Type: application/json; charset=UTF-8'); if (!siteIsLoggedIn()) { http_response_code(403); echo json_encode(['ok' => false, 'error' => 'login_required']); exit; } $action = (string) $_POST['sitecontent_action']; $index = isset($_POST['index']) ? (int) $_POST['index'] : 0; $content = siteContentLoad($SITE_CONTENT_FILE, $SITE_CONTENT_DEFAULTS); $items = isset($content['carousel_items']) && is_array($content['carousel_items']) ? array_values($content['carousel_items']) : $SITE_CONTENT_DEFAULTS['carousel_items']; $cleanText = function ($value, $length) { $value = trim(preg_replace('/\s+/', ' ', strip_tags((string) $value))); return function_exists('mb_substr') ? mb_substr($value, 0, $length, 'UTF-8') : substr($value, 0, $length); }; if ($action === 'carousel_add') { if (count($items) >= 10) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'slide_limit']); exit; } $link = trim((string) ($_POST['link'] ?? '')); $image = trim((string) ($_POST['image'] ?? '')); if (!preg_match('#^(?:https?://|/)#i', $link) || !preg_match('#^(?:https?://|/)#i', $image)) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_url']); exit; } $base = ['title' => $cleanText($_POST['title'] ?? '', 180), 'description' => $cleanText($_POST['description'] ?? '', 500), 'link' => $link, 'image' => $image, 'button' => $cleanText($_POST['button'] ?? '', 60)]; if ($base['title'] === '' || $base['button'] === '') { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'required_fields']); exit; } $position = $index > 0 ? min($index, count($items)) : count($items); array_splice($items, $position, 0, [$base]); $content['carousel_items'] = $items; if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'save_failed']); exit; } echo json_encode(['ok' => true, 'items' => $items], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } if ($index < 1 || $index > count($items)) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_slide']); exit; } if ($action === 'carousel_remove') { if (count($items) <= 1) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'cannot_remove_last_slide']); exit; } array_splice($items, $index - 1, 1); $content['carousel_items'] = array_values($items); if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'save_failed']); exit; } echo json_encode(['ok' => true, 'items' => $content['carousel_items']], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } $link = trim((string) ($_POST['link'] ?? '')); $image = trim((string) ($_POST['image'] ?? '')); if (!preg_match('#^(?:https?://|/)#i', $link) || !preg_match('#^(?:https?://|/)#i', $image)) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_url']); exit; } $items[$index - 1] = ['title' => $cleanText($_POST['title'] ?? '', 180), 'description' => $cleanText($_POST['description'] ?? '', 500), 'link' => $link, 'image' => $image, 'button' => $cleanText($_POST['button'] ?? '', 60)]; if ($items[$index - 1]['title'] === '' || $items[$index - 1]['button'] === '') { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'required_fields']); exit; } $content['carousel_items'] = array_values($items); if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'save_failed']); exit; } echo json_encode(['ok' => true, 'item' => $items[$index - 1]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } if ($requestMethod === 'POST' && in_array((isset($_POST['sitecontent_action']) ? $_POST['sitecontent_action'] : ''), ['repeatable_add', 'repeatable_save', 'repeatable_delete', 'repeatable_remove'], true)) { header('Content-Type: application/json; charset=UTF-8'); if (!siteIsLoggedIn()) { http_response_code(403); echo json_encode(['ok' => false, 'error' => 'login_required']); exit; } $action = (string) $_POST['sitecontent_action']; $section = isset($_POST['section']) ? trim((string) $_POST['section']) : ''; if ($section === '' || !isset($SITE_REPEATABLE_SECTIONS[$section])) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_section']); exit; } $content = siteContentLoad($SITE_CONTENT_FILE, $SITE_CONTENT_DEFAULTS); $items = siteContentResolveRepeatableItems($content, $SITE_CONTENT_DEFAULTS, $section); $fieldConfig = $SITE_REPEATABLE_SECTIONS[$section]['fields']; $allowEmpty = !empty($SITE_REPEATABLE_SECTIONS[$section]['allow_empty']); $index = isset($_POST['index']) ? (int) $_POST['index'] : -1; if ($action === 'repeatable_add') { $baseItem = siteContentRepeatableDefaultItem($section); $insertAt = $index >= 0 ? min($index + 1, count($items)) : count($items); array_splice($items, $insertAt, 0, [siteContentNormalizeRepeatableItem($section, $baseItem)]); $content[$section] = array_values($items); if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'save_failed']); exit; } echo json_encode(['ok' => true, 'section' => $section, 'items' => $content[$section]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } if (!isset($items[$index])) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_index']); exit; } if ($action === 'repeatable_remove') { if (!$allowEmpty && count($items) <= 1) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'cannot_remove_last_item']); exit; } array_splice($items, $index, 1); $content[$section] = array_values($items); if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'delete_failed']); exit; } echo json_encode(['ok' => true, 'section' => $section, 'items' => $content[$section]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } $field = isset($_POST['field']) ? trim((string) $_POST['field']) : ''; if ($field === '' || !isset($fieldConfig[$field])) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_field']); exit; } if ($action === 'repeatable_delete') { $items[$index][$field] = ''; } else { $mode = isset($fieldConfig[$field]['mode']) ? (string) $fieldConfig[$field]['mode'] : 'block'; $items[$index][$field] = siteContentNormalizeHtml(isset($_POST['html']) ? (string) $_POST['html'] : '', $mode); } $content[$section] = array_values($items); if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'save_failed']); exit; } echo json_encode([ 'ok' => true, 'section' => $section, 'index' => $index, 'field' => $field, 'html' => $content[$section][$index][$field], ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } if ($requestMethod === 'POST' && (isset($_POST['sitecontent_action']) ? $_POST['sitecontent_action'] : '') === 'save') { header('Content-Type: application/json; charset=UTF-8'); if (!siteIsLoggedIn()) { http_response_code(403); echo json_encode(['ok' => false, 'error' => 'login_required']); exit; } $key = isset($_POST['key']) ? trim((string) $_POST['key']) : ''; if ($key === '' || !array_key_exists($key, $SITE_CONTENT_DEFAULTS)) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_key']); exit; } $mode = isset($SITE_CONTENT_MODES[$key]) ? $SITE_CONTENT_MODES[$key] : 'block'; $htmlValue = siteContentNormalizeHtml(isset($_POST['html']) ? (string) $_POST['html'] : '', $mode); if ($htmlValue === '') { $htmlValue = (string) $SITE_CONTENT_DEFAULTS[$key]; } $content = siteContentLoad($SITE_CONTENT_FILE, $SITE_CONTENT_DEFAULTS); $content[$key] = $htmlValue; if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'save_failed']); exit; } echo json_encode(['ok' => true, 'key' => $key, 'html' => $htmlValue], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } if ($requestMethod === 'POST' && (isset($_POST['sitecontent_action']) ? $_POST['sitecontent_action'] : '') === 'delete') { header('Content-Type: application/json; charset=UTF-8'); if (!siteIsLoggedIn()) { http_response_code(403); echo json_encode(['ok' => false, 'error' => 'login_required']); exit; } $key = isset($_POST['key']) ? trim((string) $_POST['key']) : ''; if ($key === '' || !array_key_exists($key, $SITE_CONTENT_DEFAULTS)) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_key']); exit; } $content = siteContentLoad($SITE_CONTENT_FILE, $SITE_CONTENT_DEFAULTS); $content[$key] = ''; if (!siteContentPersist($SITE_CONTENT_FILE, $content)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'delete_failed']); exit; } echo json_encode(['ok' => true, 'key' => $key, 'html' => '']); exit; } if ($requestMethod === 'POST' && (isset($_POST['sitecontent_action']) ? $_POST['sitecontent_action'] : '') === 'upload_image') { header('Content-Type: application/json; charset=UTF-8'); if (!siteIsLoggedIn()) { http_response_code(403); echo json_encode(['ok' => false, 'error' => 'login_required']); exit; } if (!isset($_FILES['media']) || !is_uploaded_file($_FILES['media']['tmp_name'])) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'missing_file']); exit; } $tmp = $_FILES['media']['tmp_name']; $size = isset($_FILES['media']['size']) ? (int) $_FILES['media']['size'] : 0; if ($size <= 0 || $size > 25 * 1024 * 1024) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_size']); exit; } $mediaDir = __DIR__ . '/media'; if (!is_dir($mediaDir) && !mkdir($mediaDir, 0775, true) && !is_dir($mediaDir)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'mkdir_failed']); exit; } $imageInfo = @getimagesize($tmp); $kind = $imageInfo ? 'image' : 'video'; if ($kind === 'image') { $mimeMap = [ 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/webp' => 'webp', 'image/gif' => 'gif', ]; $mime = isset($imageInfo['mime']) ? strtolower((string) $imageInfo['mime']) : ''; if (!isset($mimeMap[$mime])) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_image_type']); exit; } $extension = $mimeMap[$mime]; } else { $extension = strtolower(pathinfo((string) $_FILES['media']['name'], PATHINFO_EXTENSION)); $allowedVideo = ['mp4', 'webm', 'mov']; if (!in_array($extension, $allowedVideo, true)) { http_response_code(400); echo json_encode(['ok' => false, 'error' => 'invalid_video_type']); exit; } } $fileName = 'sitecontent-' . date('Ymd-His') . '-' . substr(md5((string) microtime(true)), 0, 6) . '.' . $extension; $target = $mediaDir . '/' . $fileName; if (!move_uploaded_file($tmp, $target)) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'upload_failed']); exit; } echo json_encode([ 'ok' => true, 'kind' => $kind, 'url' => siteMirrorUrl('/media/' . $fileName), ], JSON_UNESCAPED_SLASHES); exit; } $siteEditorEnabled = siteIsLoggedIn(); $siteContent = siteContentLoad($SITE_CONTENT_FILE, $SITE_CONTENT_DEFAULTS); ob_start('siteRewriteInternalAnchors'); ?> Escritório de Advocacia São Paulo, Vila Olímpia e Sorocaba

      Total de Processos Defendidos
      1
      Clientes Atendidos
      1
      Setores Econômicos
      1
      Escritórios
      1

      $teamItem): ?> '/p/bp/membroremohigashibattaglia/equipe/RemoHigashiBattaglia/BP/pt', 1 => '/p/bp/membropauloandrempedrosa/equipe/PauloAndreMPedrosa/BP/pt', 2 => '/p/bp/membromarceladebrito/equipe/MarceladeBrito/BP/pt']; ?>

      Battaglia & Pedrosa Advogados é premiado como Profissional Liberal de Destaque no Prêmio Melhores do Ano da Associação Comercial de Sorocaba.

      Battaglia & Pedrosa Advogados recebe “Prêmio Análise DNA Fenalaw 2024”.

      $awardItem): ?>

      Battaglia & Pedrosa Advogados é reconhecida pela Associação Brasileira da The Rotary Foundation – ABTRF que atesta a responsabilidade social 

      Depoimentos

      Confiança que Inspira

      $testimonialItem): ?>

      0) { ob_end_flush(); } ?>