Path in the Gestor bibliotecas/gestor.php
bibliotecas/gestor.php is the support library used across the whole Gestor and is always loaded. Do not confuse it with gestor/gestor.php, the router, which builds the page on every request and calls these functions. When loaded, it also includes recursos.php if it is not present yet, because every <script>/<link> tag resolves its URL through recursos_url().
Many functions are pure, with no global state: they were extracted from the router (which ends in exit and cannot be included by a test) precisely to be testable.
Basic utilities
-
existe($dado)is the "does it have content?" check used across the core: an array with elements, a string with at least one character, or any truthy value. Beware:existe('0')istrue, butexiste(0)isfalse. -
gestor_asset_version($owner = null, $fallback = null)returns the cache token of an assets directory. It looks in$_GESTOR['asset-versions']['owners'][$owner], then in$_GESTOR['asset-version'], the$fallbackand the system version. -
gestor_modulo_asset_version($modulo)returns the cache token of a module's JS/CSS:asset_versionfrom the module JSON, otherwiseversao, otherwise the global token. -
gestor_modulos_dados($modulo_id)reads and decodesgestor/modulos/<id>/<id>.json. It returnsnullwhen the file does not exist, without emitting a warning. -
gestor_js_variavel_incluir($variavel, $valor)publishes a value to the page's JavaScript in$_GESTOR['javascript-vars'], which the router serializes as a global object. When the variable already exists and both values are arrays, it runsarray_merge_recursive; otherwise it overwrites.
System State and Global Variables (GestorState)
The state access layer (GestorState) provides standardized and safe access to the system's global state ($_GESTOR), with fallback support, dot notation and critical key protection:
-
gestor_get(string $chave, mixed $padrao = null): mixed— Retrieves value from global state. Supports dot notation (e.g.gestor_get('banco.conexao.host', 'localhost')). -
gestor_set(string $chave, mixed $valor): bool— Sets or updates value safely. Blocks accidental mutations of critical system keys. -
gestor_has(string $chave): bool— Checks key existence in global state (supports dot notation). -
gestor_contexto(string $escopo): array— Extracts delimited context slice (modulo,usuario,sistema, etc.).
Protected Core Keys
-
raiz-absoluta,url-raiz,linguagem-codigo,versao-num. -
Modification attempts via
gestor_set()are blocked and logged for auditing.
OOP API of GestorState Class
-
GestorState::get($chave, $padrao) -
GestorState::set($chave, $valor) -
GestorState::has($chave) -
GestorState::contexto($escopo) -
GestorState::proteger(...$chaves)/GestorState::desproteger(...$chaves) -
GestorState::isProtegida($chave)/GestorState::getChavesProtegidas() -
GestorState::getAuditoria()/GestorState::reset()
Libraries
gestor_incluir_bibliotecas() and gestor_incluir_biblioteca($name) load libraries by logical name. See Gestor libraries.
A page's CSS framework
A final page is layout + page, and both have framework_css.
-
gestor_framework_css_resolver($layout, $pagina)decides what to load:-
Fomantic is included when either one declares it, or when neither declares anything (legacy);
-
Tailwind is included when either one declares it.
-
It returns
['fomantic' => bool, 'tailwind' => bool, 'modo' => 'fomantic-ui'|'tailwindcss'|'hibrido'].
-
-
gestor_framework_css_atual()applies the rule to$_GESTOR['layout#framework_css']and$_GESTOR['pagina#framework_css'].
Database schema without a 500 error
New code can reach an old database (a failed migration, a files-only update, --skip-migrate, the deploy window). So that the new feature disappears instead of breaking the screen:
-
gestor_schema_tabela_existe($tabela)runs oneSHOW TABLESper request (memoized) and also answersfalsewhen the database could not be queried; -
gestor_schema_campo_existe($campo, $tabela)checks the table first and memoizes pertable.field, without throwing.
Components and layouts
gestor_componente($params)
Fetches components from the componentes table, in the current language (or in linguagem).
| Parameter | Effect |
|---|---|
id |
Textual id, or an array of ids (returns [id => ['html' => …]]) |
id_componentes |
Numeric id (alternative) |
modulo |
Restricts to the module |
return_css |
Also returns css, css_precompiled, css_compiled and html_extra_head, without adding them to the page |
modulosExtra |
Modules whose variables will also be resolved on the page |
-
Without
return_css, the component's CSS andhtml_extra_headgo into<head>throughgestor_pagina_recursos_incluir(), deduplicated, and only the HTML is returned. -
With
$_GESTOR['development-env']enabled, the HTML and CSS come from the files inresources/(core or module), not from the database. -
Not found:
''(or[]with an array of ids). The query does not filterstatus. -
gestor_componente_ids_condicao($ids)builds the escaped(id='a' OR id='b')used by the multiple lookup.
To append components to the end of the page: mark them with gestor_componentes_incluir(['id' => …]) or (['componentes' => [...]]); the router calls gestor_componentes_incluir_pagina(), which renders each marked component and appends it to $_GESTOR['pagina'].
gestor_layout($params)
Same model, on the layouts table (id, id_layouts, return_css, modulosExtra). Differences:
-
it stores the layout's
framework_cssin$_GESTOR['layout#framework_css']; -
it includes the precompiled CSS with the
layout-precompiledrole, so the layout comes first in the cascade; -
in development, it also reads plugin layouts (
plugins/<plugin>/modules/<module>/resources/…); -
when the layout does not exist, it returns a minimal HTML (
<!-- pagina#titulo -->,<!-- pagina#css -->,<!-- pagina#js -->and@[[pagina#corpo]]@).
Page resources (CSS and <head>)
gestor_pagina_recursos_incluir(['css' => …, 'css_precompiled' => …, 'css_precompiled_role' => …, 'css_compiled' => …, 'html_extra_head' => …]) is the only right way for widgets and components to bring CSS into <head>. Each fragment is included only once, deduplicated by MD5 in $_GESTOR['recursos-incluidos-hashes'], and tagged in the DOM:
-
cssbecomes<style data-c2f-css-role="authored">; -
css_compiledbecomesdata-c2f-css-role="compiled"; -
css_precompiledbecomes<style data-tailwind-role="…">, with the rolelayout-precompiled,dependency-precompiled,page-precompiledorresource-precompiled(the default).
gestor_css_precompiled_ordenar($styles) orders the precompiled <style> blocks by role: layout, dependencies, page, resources and the rest. Tailwind v4 cascade layers are defined on first appearance, and the layout must declare theme, base, components, utilities before everything else. With $_GESTOR['tailwind-page-bundle'] (canonical per-page bundle), only the page's blocks and those without a role are kept. Discarded resource-precompiled blocks produce a single log_disco entry in the tailwind category.
CSS audit and provenance
Used by the css:audit and css:rebuild commands and by the CRUDs that store resources:
-
gestor_css_classes_usadas($html)lists the markup's classes, ignoring template markers ([,{,@). That includes Tailwind arbitrary variants such asbg-[rgb(…)]. -
gestor_css_classes_definidas($css)lists the classes a stylesheet defines, unescapingmd\:flex. -
gestor_css_classes_descobertas($html, $css)lists the used-but-undefined ones, except thegroupandpeermarkers. -
gestor_css_classes_em_codigo($codigo)finds classes built in PHP/JS (class="…",classList.add/remove/toggle,className =): the debt that forces declaringtailwind_sources. -
gestor_css_procedencia_assinatura(['html','css','baseline','compilador'])producesv2:<sha1>: the stamp of which input the derived CSS was generated from. Thebaselineis the layout's CSS and thecompiladoris the Tailwind version. -
gestor_css_compilador_versao()reads that version from theassets-externos.phpregistry (tailwindcss-browser). -
gestor_css_procedencia_para_recurso($html, $css, $layout_id, $tabela)returns the signature ready to store incss_source_hash, or''when the column does not exist yet. -
gestor_css_procedencia_valida($stored, $params)compares. A missing signature counts as invalid, on purpose.
Text variables (i18n)
Interface texts live in the variaveis table, per language and modulo.
-
gestor_variaveis(['modulo' => …, 'id' => …])returns the text in the current language. Withoutmodulo, it uses_global_(modulo IS NULL). It loads the whole module on the first call and caches it in$_GESTOR['variaveis'][$modulo]. Missing:''. Withconjunto => trueit returns every variable of the module;padraofilters the ids by a substring, case-insensitively, andresetreloads from the database. -
gestor_variaveis_globais(['id' => …])does the single lookup by id and returnsnullwhen not found. -
gestor_variaveis_alterar(['modulo', 'id', 'tipo', 'valor', 'linguagem'])updates the value. Withtipo = 'bool', it stores1/NULL.
gestor_pagina_variaveis_globais(['html' => …]) resolves the @[[…]]@ markers of an HTML, in this order:
-
the current module's variables (
$_GESTOR['modulo-id']); -
the extra modules' variables (
$_GESTOR['paginas-variaveis']); -
the system markers
pagina#url-raiz,pagina#url-full-http,pagina#titulo,pagina#contato-urlandpagina#url-caminho.
Whatever is not resolved stays in the HTML.
Routes, redirection and query string
-
gestor_redirecionar($local = false, $queryString = '', $externo = false)sendsLocationand ends withexit.-
An internal
$localis prefixed with$_GESTOR['url-raiz']. -
Without
$local, it uses theredirecionar-localsession variable (and deletes it) or the root. -
The alert in
$_GESTOR['pagina-alerta']is stored in the session for the next page.
-
-
gestor_redirecionar_montar_url($local, $queryString)joins destination and query with?or&depending on the destination (req-173). -
gestor_redirecionar_raiz()goes to the current module's page marked asraiz(or to/). -
gestor_reload_url()reloads the current path. -
gestor_querystring($remove = '')returns the current query without the internal_gestor-caminhoparameter (and without$remove). -
gestor_querystring_variavel($qs, $name)reads one parameter. -
gestor_querystring_remover_variavel($qs, $name)removes one parameter. Values come back decoded, withouturlencode. -
gestor_querystring_before_submit($field, $default)reads the query the form stored in a hidden field (_c2f_query_string_before_submit), already escaped for SQL. -
gestor_roteador_erro_terminal($codigo, $caminho)tells whether the 404 is already on the404/route, to avoid a 404 → 404 loop. -
gestor_roteador_pagina_status_http($caminho)returns 404 for that page. -
gestor_pagina_301_registrar($id_paginas, $caminho)records inpaginas_301that the old path belongs to the page, deduplicating by the (path, page) pair. -
gestor_pagina_rota_sistema($caminho)recognizes the routes that are not content:cookies-is-mandatory,_gestor-cookie-verify,404,403,500and503. Tracking scripts are not added to them.
Robots, OpenGraph and SEO
-
gestor_crawler_detectar($userAgent, $tokensExtra = null)compares the lowercased User-Agent, by substring, with:-
gestor_crawler_tokens_padrao(): WhatsApp, Meta, Googlebot, Bing, Lighthouse, Ahrefs, uptime monitors…; -
gestor_crawler_tokens_extra(): the list from Environment → Site Settings, which only applies withcrawler-tokens-extra-ativo.
-
-
gestor_crawler_tokens_normalizar($raw)turns text separated by commas, semicolons or line breaks into a list without repetition. -
gestor_cookie_verificacao_desfecho(['crawler','tem_cookie','exigir_sessao','caminho'])decides betweenignorar,emitirandredirecionarin the cookie check. On a system route it never redirects, which avoids the "cookies are mandatory" loop. -
gestor_open_graph_tags([...])buildsog:title,og:description,og:image,og:url,og:site_nameandog:type, plustwitter:card. It never emits an empty tag. -
gestor_open_graph_existe($html)detects whether the HTML already carries its own; in that case the core does not inject its set. -
gestor_pagina_og_do_registro($pagina)extracts the filledog_titulo,og_descricao,imagem_destaque,meta_descricaoandmeta_keywordsfrom the page record. -
gestor_meta_seo_tags(['description','keywords'])generates the classic meta tags;gestor_meta_seo_existe($html)avoids duplicating them;gestor_meta_keywords_normalizar($raw)cleans up keywords (no repetition, case preserved). -
gestor_pdf_viewer_detectar($html)checks whether the page has the PDF.js viewer (conn2flow-pdfjsclass), andgestor_pdf_viewer_assets($urlRoot, $version)returns the<script>tags (PDF.js 3.11.174 from cdnjs andinterface/pdf-viewer.js).
Restricted site access (req-163)
With SITE_RESTRICTED_ACCESS=true in .env, only logged-in users can see the site:
-
gestor_site_acesso_restrito_ativo()reads the key from$_CONFIGand falls back to$_ENV/getenv(); -
gestor_site_acesso_restrito_perfis()returns theid_usuarios_perfisallowed inSITE_RESTRICTED_PROFILES(positive integers only); -
gestor_site_acesso_restrito_perfil_autorizado($profile, $list)lets any logged-in user in when the list is empty; anonymous users never; -
gestor_site_acesso_restrito_rota_isenta($caminho)exempts the identity routes (login, sign-up, password recovery, OAuth),_api,api,_gatewaysand the system routes.
CSRF and menu icons
-
gestor_csrf_rotas_identidade()lists the screens with a single-use token (signin,signin-2fa,signup,forgot-password,reset-password,validate-user). -
gestor_csrf_destino_recarregamento($path, $referer, $urlRoot)picks which of those screens the CSRF error page should reload, using the current path first and then the referer. -
gestor_pagina_menu_icone_lucide_valido($name)only accepts kebab-case names, the only ones Lucide resolves. -
gestor_pagina_menu_icone_lucide_atributo($name)returnsdata-lucide="…", or nothing for an invalid name, which avoids theicon name was not foundwarning.
Session
The Gestor session lives in the database: the sessoes and sessoes_variaveis tables. It does not use $_SESSION.
-
gestor_sessao_iniciar()creates the$_CONFIG['session-authname']cookie with 32 random bytes (seguranca_token_aleatorio()),HttpOnly,SameSite=Lax, domainSERVER_NAMEand lifetimesession-lifetime(10800 s by default). -
gestor_cookie_is_secure()decidesSecure: always on HTTPS (including behind a proxy, viaX-Forwarded-Proto) and always in production; the cookie only goes withoutSecureon HTTP and withdevelopment-env. -
gestor_sessao_id()returns the numeric session id, creating the row if needed, and updatesacessoonce per request. In 1 out of every 51 requests it deletes the sessions (and variables) with no access for longer thansession-lifetime. -
gestor_sessao_variavel($name, $value = null)stores (JSON) or reads a value. Missing:''. There is no way to storenull: it means a read. -
gestor_sessao_variavel_del($name)deletes one variable;gestor_sessao_del()deletes the current session and expires the cookie. -
gestor_sessao_del_all()deletes every session of every user.
Sanitization of the served HTML (req-132)
In production, the delivered HTML goes out without comments and without indentation.
-
gestor_pagina_higienizar_ativo()readsHTML_SANITIZE:-
auto(the default) is on in production and off in development; -
onis always on; -
offis always off; -
an unknown value becomes
auto. -
With the live editing bar (
gestor_dashboard_toolbar_ativo()), it never sanitizes.
-
-
gestor_html_higienizar($html)keeps<pre>,<textarea>,<script>and conditional comments; removes HTML comments and CSS comments/indentation inside<style>; replaces indentation with a line break, because whitespace between inline elements is rendered. -
gestor_js_higienizar($js)is a scanner (not a regex) that respects strings, template literals and regex literals, and keeps line breaks because of ASI.gestor_js_barra_inicia_regex($previous)decides whether a/opens a regex or is a division. -
gestor_pagina_higienizar_js_ativo()is the dedicatedHTML_SANITIZE_JSkey to turn off only the JavaScript part. -
gestor_html_script_e_javascript($tag)only accepts inline JavaScript<script>tags. It ignoressrc,application/json,text/templateand other types used as data storage.
See also
Functions (generated reference)
Generated from gestor/bibliotecas/gestor.php · 84 functions
existe
view source · line 45 ↗existe(mixed $dado = false): boolVerifica se um dado existe e não está vazio.
Parameters
$dadomixed- Dado a ser verificado.
Returns
gestor_asset_version
view source · line 71 ↗gestor_asset_version($owner = null, $fallback = null)Resolve token de cache de um diretório de assets, com fallback semântico.
Parameters
$owner$fallback
gestor_modulo_asset_version
view source · line 82 ↗gestor_modulo_asset_version($modulo)Resolve token de cache do módulo sem alterar sua versão semântica.
Parameters
$modulo
gestor_get
view source · line 452 ↗gestor_get(string $chave, mixed $padrao = null): mixedRecupera um valor de configuração/estado do sistema com suporte a fallback e notação pontuada. Exemplo: gestor_get('usuario-id') ou gestor_get('banco.conexao.host', 'localhost')
Parameters
$chavestring- Chave simples ou caminho delimitado por pontos.
$padraomixed- Valor padrão retornado se a chave não existir.
Returns
gestor_set
view source · line 464 ↗gestor_set(string $chave, mixed $valor): boolDefine ou atualiza um valor no estado global de forma segura e controlada. Se a chave for protegida/read-only, emite alerta no log e bloqueia mutação acidental.
Parameters
$chavestring- Chave simples ou caminho delimitado por pontos.
$valormixed- Valor a ser definido.
Returns
gestor_has
view source · line 474 ↗gestor_has(string $chave): boolVerifica a existência de uma chave no estado global.
Parameters
$chavestring- Chave simples ou caminho delimitado por pontos.
Returns
gestor_contexto
view source · line 484 ↗gestor_contexto(string $escopo): arrayRetorna uma fatia de contexto delimitada (ex.: dados do módulo ativo ou usuário ativo).
Parameters
$escopostring- Identificador do escopo ('modulo', 'usuario', 'sistema', etc.).
Returns
gestor_framework_css_resolver
view source · line 510 ↗gestor_framework_css_resolver(string|null $layoutFramework = null, string|null $paginaFramework = null): array{fomantic:bool,tailwind:bool,modo:string}Resolve o framework CSS efetivo de uma requisição a partir do layout E da página (req-118).
Parameters
$layoutFrameworkstring|null- Valor de
layouts.framework_css. $paginaFrameworkstring|null- Valor de
paginas.framework_css.
Returns
modo é fomantic-ui, tailwindcss ougestor_framework_css_atual
view source · line 537 ↗gestor_framework_css_atual(): array{fomantic:bool,tailwind:bool,modo:string}Atalho para a resolução de framework da requisição corrente.
Returns
gestor_schema_tabela_existe
view source · line 573 ↗gestor_schema_tabela_existe(string $tabela): boolDiz se uma tabela existe no banco corrente.
Parameters
$tabelastring- Nome da tabela.
Returns
gestor_schema_campo_existe
view source · line 609 ↗gestor_schema_campo_existe(string $campo, string $tabela): boolDiz se um campo existe em uma tabela do banco corrente.
Parameters
$campostring- Nome da coluna.
$tabelastring- Nome da tabela.
Returns
gestor_css_precompiled_ordenar
view source · line 645 ↗gestor_css_precompiled_ordenar($styles)Ordena sidecars Tailwind pela responsabilidade na cascata.
Parameters
$styles
gestor_layouts_perfis_mapa
view source · line 711 ↗gestor_layouts_perfis_mapa(mixed $mapeamento): array<string,string>Mapa perfil => layout de uma página (coluna paginas.layouts_users_profiles).
Parameters
$mapeamentomixed
Returns
gestor_css_layouts_marcador
view source · line 738 ↗gestor_css_layouts_marcador(array $layouts): stringMarcador gravado no início do CSS derivado de uma página compilada com mais de um layout.
Parameters
$layoutsarray- Ids dos layouts compilados junto.
Returns
gestor_css_layouts_cobertos
view source · line 757 ↗gestor_css_layouts_cobertos(string $css): arrayLayouts cobertos por um CSS derivado, lidos do marcador de gestor_css_layouts_marcador().
Parameters
$cssstring
Returns
gestor_pagina_recursos_incluir
view source · line 775 ↗gestor_pagina_recursos_incluir(array $params = false)Inclui recursos de página (CSS, CSS compilado e HTML extra head) no pipeline global. Controla duplicidades via hash MD5 para evitar inclusão redundante quando múltiplos blocos do mesmo widget/componente são inseridos na mesma página (req-028 / DEC-041).
Parameters
$paramsarray
gestor_crawler_detectar
view source · line 859 ↗gestor_crawler_detectar(string|null $userAgent = null, $tokensExtra = null): boolDetecta crawlers/scrapers sociais e de busca pelo User-Agent (req-109 / BATCH-109).
Parameters
$userAgentstring|null- User-Agent da requisição ($_SERVER['HTTP_USER_AGENT']).
$tokensExtra
Returns
gestor_crawler_tokens_padrao
view source · line 890 ↗gestor_crawler_tokens_padrao(): arrayLista embutida de tokens de robô (req-109, ampliada no req-111 / CR-001).
Returns
gestor_crawler_tokens_extra
view source · line 964 ↗gestor_crawler_tokens_extra(): arrayTokens adicionais definidos pelo operador em Ambiente → Configurações do Site (req-111 / CR-001).
Returns
gestor_crawler_tokens_normalizar
view source · line 985 ↗gestor_crawler_tokens_normalizar(string $bruto): arrayConverte o texto livre da configuração numa lista de tokens.
Parameters
$brutostring
Returns
gestor_pagina_rota_sistema
view source · line 1015 ↗gestor_pagina_rota_sistema(string $caminho = ''): boolIdentifica páginas de sistema que NÃO devem receber scripts de rastreamento (req-109 / BATCH-109).
Parameters
$caminhostring- Caminho da página já normalizado (
$_GESTOR['caminho-total']com barra final).
Returns
gestor_site_acesso_restrito_ativo
view source · line 1046 ↗gestor_site_acesso_restrito_ativo(): boolAcesso Restrito ao Site está ligado? (req-163 / BATCH-168)
Returns
gestor_site_acesso_restrito_perfis
view source · line 1067 ↗gestor_site_acesso_restrito_perfis(string|array|null $bruto = null): arrayPerfis (id_usuarios_perfis) autorizados pelo Acesso Restrito ao Site (req-163).
Parameters
$brutostring|array|null
Returns
gestor_site_acesso_restrito_rota_isenta
view source · line 1105 ↗gestor_site_acesso_restrito_rota_isenta(string $caminho = ''): boolRotas que o Acesso Restrito ao Site NUNCA bloqueia (req-163).
Parameters
$caminhostring- Caminho da requisição (
$_GESTOR['caminho-total']).
Returns
gestor_site_acesso_restrito_perfil_autorizado
view source · line 1158 ↗gestor_site_acesso_restrito_perfil_autorizado(string|int $perfilId, array $perfisAutorizados): boolDecide se um perfil entra no site restrito (req-163).
Parameters
$perfilIdstring|intid_usuarios_perfisdo usuário autenticado.$perfisAutorizadosarray- Saída de
gestor_site_acesso_restrito_perfis().
Returns
gestor_roteador_erro_terminal
view source · line 1176 ↗gestor_roteador_erro_terminal(int|string $codigo, mixed $caminho = ''): boolDetecta o fallback terminal da rota de erro para impedir redirecionamento 404 -> 404.
Parameters
$codigoint|string- Codigo HTTP em processamento.
$caminhomixed- Caminho atual recebido pelo roteador.
Returns
gestor_roteador_pagina_status_http
view source · line 1188 ↗gestor_roteador_pagina_status_http(mixed $caminho = ''): int|nullRetorna o status HTTP que deve ser preservado ao renderizar uma pagina de erro existente.
Parameters
$caminhomixed- Caminho da pagina encontrada pelo roteador.
Returns
gestor_pagina_301_registrar
view source · line 1214 ↗gestor_pagina_301_registrar(int|string $id_paginas, string $caminho): boolRegistra um redirecionamento 301 de um caminho liberado por uma página (F10 do review 2026-08-15).
Parameters
$id_paginasint|string- Id NUMÉRICO da página que liberou o caminho.
$caminhostring- Caminho antigo.
Returns
gestor_open_graph_tags
view source · line 1261 ↗gestor_open_graph_tags(array $params = false): arrayMonta as metatags OpenGraph do <head> (req-109 / BATCH-109).
Parameters
$paramsarray
Returns
<meta …>.gestor_cookie_verificacao_desfecho
view source · line 1320 ↗gestor_cookie_verificacao_desfecho(array $params = false): stringDecide o desfecho da verificação de cookie do navegador (req-111 / CR-001).
Parameters
$paramsarray
Returns
gestor_pagina_og_do_registro
view source · line 1345 ↗gestor_pagina_og_do_registro(array $pagina = Array()): arrayExtrai os metadados OpenGraph gravados no registro da página (req-110 / BATCH-110).
Parameters
$paginaarray- Linha da tabela
paginas.
Returns
gestor_meta_seo_tags
view source · line 1387 ↗gestor_meta_seo_tags(array $params = false): arrayMonta as meta tags clássicas de SEO do <head> (req-112 / BATCH-112).
Parameters
$paramsarray
Returns
<meta …>.gestor_meta_keywords_normalizar
view source · line 1415 ↗gestor_meta_keywords_normalizar(string|array $bruto): stringNormaliza a lista de palavras-chave digitada pelo usuário (req-112 / BATCH-112).
Parameters
$brutostring|array
Returns
gestor_meta_seo_existe
view source · line 1448 ↗gestor_meta_seo_existe(string|array $html): boolDetecta se um HTML já traz metatags de descrição/keywords próprias (req-112 / BATCH-112).
Parameters
$htmlstring|array
Returns
gestor_open_graph_existe
view source · line 1466 ↗gestor_open_graph_existe(string|array $html): boolDetecta se um HTML já traz metatags OpenGraph próprias (req-109 / BATCH-109).
Parameters
$htmlstring|array- HTML (ou lista de trechos) já enfileirado para o
<head>.
Returns
gestor_pdf_viewer_detectar
view source · line 1485 ↗gestor_pdf_viewer_detectar(string $html): boolDetecta se um HTML de página usa o motor de exibição PDF.js (req-096 / BATCH-096).
Parameters
$htmlstring- HTML da página já montada.
Returns
gestor_pdf_viewer_assets
view source · line 1514 ↗gestor_pdf_viewer_assets(string $urlRaiz = '', string $versao = ''): arrayTags de inclusão dos assets do motor PDF.js (req-096 / BATCH-096).
Parameters
$urlRaizstring- Raiz pública do projeto ($_GESTOR['url-raiz']).
$versaostring- Versão do sistema, usada para cache-bust.
Returns
gestor_css_classes_usadas
view source · line 1533 ↗gestor_css_classes_usadas(string $html): arrayClasses efetivamente usadas no markup (BATCH-144 / req-141).
Parameters
$htmlstring- HTML da página ou do recurso.
Returns
gestor_css_classes_definidas
view source · line 1563 ↗gestor_css_classes_definidas(string $css): arrayClasses definidas por uma folha de estilo (BATCH-144 / req-141).
Parameters
$cssstring- CSS concatenado das folhas entregues.
Returns
gestor_css_classes_descobertas
view source · line 1590 ↗gestor_css_classes_descobertas(string $html, string $css): arrayClasses que o HTML usa e nenhuma folha define (BATCH-144 / req-141).
Parameters
$htmlstring- HTML entregue.
$cssstring- CSS entregue.
Returns
gestor_css_classes_em_codigo
view source · line 1630 ↗gestor_css_classes_em_codigo(string $codigo): arrayClasses de estilo embutidas em código PHP/JS (BATCH-144 / req-141).
Parameters
$codigostring- Conteúdo de um arquivo PHP ou JS.
Returns
gestor_css_procedencia_assinatura
view source · line 1709 ↗gestor_css_procedencia_assinatura(array $params = false): stringAssinatura de procedência do CSS derivado (BATCH-144 / req-141 / CR-002).
Parameters
$paramsarray
Returns
gestor_css_compilador_versao
view source · line 1748 ↗gestor_css_compilador_versao(): stringVersão do compilador Tailwind vigente, para a assinatura de procedência (req-156).
Returns
gestor_css_procedencia_para_recurso
view source · line 1783 ↗gestor_css_procedencia_para_recurso(string $html, string $css, string $layout_id = '', string $tabela = 'paginas'): stringPar campo=valor da procedência, pronto para entrar num INSERT/UPDATE de recurso (req-141).
Parameters
$htmlstring- HTML autoral que está sendo gravado.
$cssstring- CSS autoral que está sendo gravado.
$layout_idstring- Layout do recurso; vazio para layouts (eles SÃO a base).
$tabelastring- Tabela de destino, para checar a coluna.
Returns
gestor_css_procedencia_valida
view source · line 1830 ↗gestor_css_procedencia_valida(string $assinaturaGravada, array $params = false): boolO CSS derivado corresponde à autoria vigente? (BATCH-144 / req-141)
Parameters
$assinaturaGravadastring- Valor da coluna
css_source_hash. $paramsarray- Mesmas entradas de gestor_css_procedencia_assinatura().
Returns
gestor_componente_ids_condicao
view source · line 1842 ↗gestor_componente_ids_condicao($ids, $escape = null)Monta a condição agrupada de IDs usada pela inclusão múltipla de componentes.
Parameters
$ids$escape
gestor_componente
view source · line 1876 ↗gestor_componente(array|false $params = false): string|array|falseRenderiza um componente HTML/CSS dinâmico.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_layout
view source · line 2108 ↗gestor_layout(array|false $params = false): string|array|falseRenderiza um layout HTML/CSS completo da página.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_incluir_bibliotecas
view source · line 2370 ↗gestor_incluir_bibliotecas(): voidInclui todas as bibliotecas do sistema.
Returns
gestor_incluir_biblioteca
view source · line 2397 ↗gestor_incluir_biblioteca(string $biblioteca): voidInclui uma biblioteca específica do sistema.
Parameters
$bibliotecastring- Nome do arquivo da biblioteca (sem .php).
Returns
gestor_variaveis
view source · line 2454 ↗gestor_variaveis(array|false $params = false): string|arrayObtém variáveis do sistema por módulo e idioma.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_variaveis_globais
view source · line 2543 ↗gestor_variaveis_globais(array|false $params = false): string|nullObtém uma variável global específica do sistema.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_variaveis_alterar
view source · line 2606 ↗gestor_variaveis_alterar(array|false $params = false): voidAltera o valor de uma variável no banco de dados.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_redirecionar_raiz
view source · line 2655 ↗gestor_redirecionar_raiz(): voidRedireciona para a página raiz do módulo atual.
Returns
gestor_reload_url
view source · line 2686 ↗gestor_reload_url(): voidRecarrega a URL atual.
Returns
gestor_csrf_rotas_identidade
view source · line 2707 ↗gestor_csrf_rotas_identidade(): array<int,string>Rotas públicas de identidade cujo formulário carrega um token CSRF de uso único.
Returns
gestor_csrf_destino_recarregamento
view source · line 2735 ↗gestor_csrf_destino_recarregamento(string $caminhoTotal, string|null $referer, string $urlRaiz): stringDestino de recarregamento limpo para a tela de erro de CSRF (req-125 / BATCH-127).
Parameters
$caminhoTotalstring- Caminho da requisição corrente, já sem o prefixo de idioma.
$refererstring|null- Conteúdo de
HTTP_REFERER, se houver. $urlRaizstring- Raiz do gestor, com barra final e com idioma quando houver.
Returns
gestor_pagina_menu_icone_lucide_valido
view source · line 2794 ↗gestor_pagina_menu_icone_lucide_valido(string $nome): boolUm nome é endereçável no catálogo do Lucide? (req-125 / BATCH-127)
Parameters
$nomestring- Valor já resolvido do ícone.
Returns
gestor_pagina_menu_icone_lucide_atributo
view source · line 2814 ↗gestor_pagina_menu_icone_lucide_atributo(string $nome): stringAtributo data-lucide pronto para interpolação — ou string vazia (req-125 / BATCH-127).
Parameters
$nomestring- Valor já resolvido do ícone.
Returns
data-lucide="…" ou ''.gestor_querystring_remover_variavel
view source · line 2832 ↗gestor_querystring_remover_variavel(string $queryString, string $removerVariavel = ''): stringRemove uma variável específica da query string.
Parameters
$queryStringstring- Query string completa (formato: var1=val1&var2=val2).
$removerVariavelstring- Nome da variável a ser removida.
Returns
gestor_querystring_variavel
view source · line 2861 ↗gestor_querystring_variavel(string $queryString, string $variavel = ''): stringObtém o valor de uma variável específica da query string.
Parameters
$queryStringstring- Query string completa.
$variavelstring- Nome da variável a buscar.
Returns
gestor_querystring_before_submit
view source · line 2886 ↗gestor_querystring_before_submit(string $fieldName = '_c2f_query_string_before_submit', string $default = ''): stringRecupera a query string antes do envio do formulário via campo hidden.
Parameters
$fieldNamestring- Nome do campo hidden enviado pelo formulário.
$defaultstring- Valor padrão se o campo não estiver definido.
Returns
gestor_querystring
view source · line 2909 ↗gestor_querystring(string $removerVariavel = ''): stringObtém a query string atual da requisição.
Parameters
$removerVariavelstring- Nome da variável adicional a remover (opcional).
Returns
gestor_redirecionar
view source · line 2941 ↗gestor_redirecionar(string|false $local = false, string $queryString = '', bool $externo = false): voidRedireciona para um local específico.
Parameters
$localstring|false- Caminho de destino (false = usar sessão ou raiz).
$queryStringstring- Query string adicional.
$externobool- Se true, trata como URL externa (não adiciona url-raiz).
Returns
gestor_redirecionar_montar_url
view source · line 2981 ↗gestor_redirecionar_montar_url(string $local, string $queryString = ''): stringMonta a URL de destino de um redirecionamento (req-173).
Parameters
$localstring- Destino já resolvido (interno ou externo).
$queryStringstring- Query string a anexar, com ou sem
?/&à frente.
Returns
? órfão).gestor_pagina_variaveis_globais
view source · line 3006 ↗gestor_pagina_variaveis_globais(array|false $params = false): stringSubstitui variáveis globais em HTML.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_js_variavel_incluir
view source · line 3101 ↗gestor_js_variavel_incluir(string $variavel, mixed $valor): voidInclui uma variável JavaScript global na página.
Parameters
$variavelstring- Nome da variável JavaScript.
$valormixed- Valor da variável (será convertido para JSON).
Returns
gestor_componentes_incluir
view source · line 3131 ↗gestor_componentes_incluir(array|false $params = false): voidMarca componentes para inclusão na página.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
gestor_componentes_incluir_pagina
view source · line 3172 ↗gestor_componentes_incluir_pagina(array|false $params = false): voidRenderiza componentes marcados na página.
Parameters
$paramsarray|false- Parâmetros da função (atualmente não utilizados).
Returns
gestor_cookie_emitir
view source · line 3225 ↗gestor_cookie_emitir($nome, $valor, array $opcoes)Distributed iframe cookies are host-only and partitioned by the embedding site.
Parameters
$nome$valor$opcoesarray
gestor_cookie_is_secure
view source · line 3236 ↗gestor_cookie_is_secure(): boolReturns
gestor_sessao_iniciar
view source · line 3258 ↗gestor_sessao_iniciar()gestor_sessao_id
view source · line 3292 ↗gestor_sessao_id(): intObtém ou cria o ID numérico da sessão no banco de dados.
Returns
gestor_sessao_del
view source · line 3368 ↗gestor_sessao_del(): voidDeleta a sessão atual do usuário.
Returns
gestor_sessao_variavel
view source · line 3419 ↗gestor_sessao_variavel(string $variavel, mixed $valor = NULL): mixedObtém ou define uma variável de sessão.
Parameters
$variavelstring- Nome da variável de sessão.
$valormixed- Valor a ser armazenado (NULL para apenas leitura).
Returns
gestor_sessao_variavel_del
view source · line 3487 ↗gestor_sessao_variavel_del(string $variavel): voidRemove uma variável específica da sessão.
Parameters
$variavelstring- Nome da variável a ser removida.
Returns
gestor_sessao_del_all
view source · line 3520 ↗gestor_sessao_del_all(): voidRemove TODAS as sessões do sistema.
Returns
gestor_modulos_dados
view source · line 3543 ↗gestor_modulos_dados(string $modulo_id = ''): array|nullPega os dados de um módulo.
Parameters
$modulo_idstring- ID do módulo.
Returns
gestor_pagina_higienizar_ativo
view source · line 3576 ↗gestor_pagina_higienizar_ativo()Decide se o HTML entregue ao navegador deve sair higienizado (req-132).
gestor_html_higienizar
view source · line 3615 ↗gestor_html_higienizar($html)Remove do HTML o que so interessa a quem escreveu o codigo (req-132).
Parameters
$html
gestor_js_higienizar
view source · line 3721 ↗gestor_js_higienizar($js)Remove comentarios e indentacao de JavaScript (req-132, 2a rodada).
Parameters
$js
gestor_js_barra_inicia_regex
view source · line 3826 ↗gestor_js_barra_inicia_regex($anterior)Decide se uma / abre um regex literal ou e o operador de divisao (req-132).
Parameters
$anterior
gestor_pagina_higienizar_js_ativo
view source · line 3844 ↗gestor_pagina_higienizar_js_ativo()Gate proprio para a limpeza do JavaScript (req-132, 2a rodada).
gestor_html_script_e_javascript
view source · line 3865 ↗gestor_html_script_e_javascript($tagCompleta)Diz se a tag <script> carrega JavaScript de verdade (req-132, 2a rodada).
Parameters
$tagCompleta
Controlled state, profile layouts and cookies
GestorState exposes gestor_get, gestor_set, gestor_has and gestor_contexto. Reads prefer a literal key, then resolve dot notation; writes block raiz-absoluta, url-raiz, linguagem-codigo and versao-num and record audit entries. This does not prevent direct superglobal assignment: it protects facade writes.
gestor_layouts_perfis_mapa normalizes JSON/object/array into a profile-to-layout map, discarding non-scalar or empty entries. gestor_css_layouts_marcador emits valid, unique, sorted IDs in a c2f-layouts comment; gestor_css_layouts_cobertos reads that marker from the first 2048 CSS bytes.
gestor_cookie_emitir uses setcookie in ordinary mode. Distributed mode requires secure transport and emits Path=/_distributed/, Secure, SameSite=None and Partitioned, with HttpOnly/Expires when requested.