docs: map existing codebase

This commit is contained in:
2026-05-07 10:15:04 +02:00
parent f7afb4e4dc
commit 04de2ac558
9 changed files with 999 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
# Architecture
**Analysis Date:** 2026-05-07
## Pattern Overview
**Overall:** WordPress monolith with theme/plugin architecture and Elementor as the page-building layer.
**Key Characteristics:**
- Full WordPress core is present in the repository: `wp-admin/`, `wp-includes/`, and root `wp-*.php` files.
- Site behavior is split between WordPress configuration, theme files, normal plugins, and a must-use plugin.
- Landing page content/layout is likely stored mostly in the WordPress database through Elementor.
- Custom lead-generation/consent behavior is concentrated in Hello Elementor assets and the Cookie Notice Pro MU plugin.
## Layers
**WordPress Core:**
- Purpose: bootstrap, routing, template loading, admin, database API, plugin/theme lifecycle.
- Contains: `wp-admin/`, `wp-includes/`, `wp-settings.php`, `wp-load.php`, `wp-blog-header.php`.
- Depends on: PHP runtime and MySQL/MariaDB.
- Used by: every frontend/admin request.
**Configuration:**
- Purpose: database constants, salts, table prefix, debug flags.
- Contains: `wp-config.php`.
- Depends on: hosting environment.
- Used by: `wp-load.php` and WordPress bootstrap.
**Theme Layer:**
- Purpose: frontend shell, template files, theme support, local styles/scripts.
- Contains: `wp-content/themes/hello-elementor/`.
- Depends on: WordPress core and Elementor.
- Used by: public page rendering.
**Plugin Layer:**
- Purpose: page builder, forms, anti-spam, icon/SVG support, backups, content utilities.
- Contains: `wp-content/plugins/elementor/`, `wp-content/plugins/elementor-pro/`, `wp-content/plugins/akismet/`, `wp-content/plugins/lordicon/`, `wp-content/plugins/svg-support/`, `wp-content/plugins/duplicator-pro-v4.5.16.2/`, `wp-content/plugins/copy-delete-posts/`.
- Depends on: WordPress plugin lifecycle.
- Used by: frontend, admin, forms, backup workflows.
**Must-Use Plugin Layer:**
- Purpose: always-loaded site-specific consent/GTM behavior.
- Contains: `wp-content/mu-plugins/cookie-notice-pro-loader.php`, `wp-content/mu-plugins/cookie-notice-pro/cookie-notice-pro.php`, and assets under `wp-content/mu-plugins/cookie-notice-pro/assets/`.
- Depends on: WordPress hooks and frontend assets.
- Used by: every frontend request.
## Data Flow
**Frontend Request:**
1. Request enters `index.php`.
2. `index.php` loads `wp-blog-header.php`.
3. `wp-blog-header.php` loads WordPress via `wp-load.php`.
4. `wp-load.php` resolves `wp-config.php`.
5. `wp-config.php` defines DB settings and loads `wp-settings.php`.
6. `wp-settings.php` boots core, loads MU plugins from `wp-content/mu-plugins/`, normal plugins from `wp-content/plugins/`, then the active theme from `wp-content/themes/`.
7. WordPress resolves the query/template through core files such as `wp-includes/template-loader.php`.
8. Hello Elementor templates render the shell while Elementor/Elementor Pro render page builder content stored in DB.
**State Management:**
- Persistent state lives in the WordPress database.
- Elementor page layout, form definitions, options, menus, and active plugin/theme state are database-resident and not fully visible in files.
- Filesystem state includes themes, plugins, MU plugin code, translations, and backup artifacts.
## Key Abstractions
**WordPress Hooks:**
- Purpose: attach behavior to WordPress lifecycle events.
- Examples: enqueue hooks and setup hooks in `wp-content/themes/hello-elementor/functions.php`; consent/GTM hooks in `wp-content/mu-plugins/cookie-notice-pro/cookie-notice-pro.php`.
- Pattern: `add_action` / `add_filter`.
**Theme Bootstrap:**
- Purpose: declare theme support, menus, Elementor locations, and frontend assets.
- Examples: `wp-content/themes/hello-elementor/functions.php`, `wp-content/themes/hello-elementor/theme.php`.
- Pattern: procedural WordPress functions plus Hello Elementor namespaced modules.
**Elementor Modules:**
- Purpose: page builder, forms, theme builder, popups, widgets, Pro features.
- Examples: `wp-content/plugins/elementor/modules/`, `wp-content/plugins/elementor-pro/modules/forms/`.
- Pattern: plugin module architecture controlled by Elementor.
**MU Plugin:**
- Purpose: site-specific behavior loaded automatically before normal plugins.
- Examples: `wp-content/mu-plugins/cookie-notice-pro-loader.php`, `wp-content/mu-plugins/cookie-notice-pro/cookie-notice-pro.php`.
- Pattern: loader file includes plugin implementation.
## Entry Points
**Frontend:**
- Location: `index.php`.
- Triggers: public HTTP requests.
- Responsibilities: load WordPress and render the resolved page.
**WordPress Bootstrap:**
- Location: `wp-blog-header.php`, `wp-load.php`, `wp-config.php`, `wp-settings.php`.
- Triggers: frontend/admin/core request lifecycle.
- Responsibilities: configure and initialize WordPress.
**Admin:**
- Location: `wp-admin/index.php`, `wp-admin/admin.php`, `wp-admin/admin-ajax.php`, `wp-admin/admin-post.php`.
- Triggers: WordPress admin and AJAX/action requests.
- Responsibilities: admin UI, plugin/theme settings, AJAX endpoints.
**Theme:**
- Location: `wp-content/themes/hello-elementor/functions.php`, `wp-content/themes/hello-elementor/index.php`, `wp-content/themes/hello-elementor/header.php`, `wp-content/themes/hello-elementor/footer.php`, `wp-content/themes/hello-elementor/theme.php`.
- Triggers: theme loading and template rendering.
- Responsibilities: theme support, templates, assets.
**Plugins:**
- Location: `wp-content/plugins/elementor/elementor.php`, `wp-content/plugins/elementor-pro/elementor-pro.php`, `wp-content/plugins/lordicon/lordicon.php`, `wp-content/plugins/svg-support/svg-support.php`, `wp-content/plugins/akismet/akismet.php`, `wp-content/plugins/copy-delete-posts/copy-delete-posts.php`, `wp-content/plugins/duplicator-pro-v4.5.16.2/duplicator-pro.php`.
- Triggers: WordPress plugin loading.
- Responsibilities: plugin-specific features.
**MU Plugin:**
- Location: `wp-content/mu-plugins/cookie-notice-pro-loader.php`.
- Triggers: must-use plugin bootstrap.
- Responsibilities: load cookie notice/GTM logic.
## Error Handling
**Strategy:** WordPress/PHP runtime handles most errors; custom code should fail quietly on the frontend and avoid breaking public lead capture.
**Patterns:**
- `WP_DEBUG` is false in `wp-config.php`.
- Custom JS currently uses direct `JSON.parse()` in `wp-content/mu-plugins/cookie-notice-pro/assets/cookienoticepro.script.js`; malformed cookie handling needs hardening.
## Cross-Cutting Concerns
**Logging:**
- No dedicated application logger detected.
- Browser console logging exists in `wp-content/mu-plugins/cookie-notice-pro/assets/cookienoticepro.script.js`.
**Validation:**
- WordPress and Elementor handle most admin/form validation.
- Cookie notice JS should validate cookie JSON more defensively.
**Authentication:**
- WordPress native authentication via `wp-login.php` and core user/session APIs.
---
*Architecture analysis: 2026-05-07*
*Update when major patterns change*