This commit is contained in:
2026-05-19 20:05:59 +02:00
parent 82fb5ad653
commit e90c251d0b
28 changed files with 777 additions and 2158 deletions

View File

@@ -1,142 +1,72 @@
# Architecture — krolewskie-miody.pl
# Architektura
## Repository Structure
**Data analizy:** 2026-05-19
Only `wp-content/` and WordPress root files are tracked in Git.
`wp-includes/` and `wp-admin/` core directories are present but represent standard WordPress core.
## Przegląd Wzorca
```
krolewskie-miody.pl/
├── wp-config.php # DB config + constants
├── .htaccess # Rewrites, max_input_vars=10000
├── index.php # WP entry point
├── wp-blog-header.php # WP bootstrap
├── wp-content/
│ ├── themes/
│ │ ├── betheme/ # Active theme (parent, no child)
│ │ ├── twentytwentyfive/
│ │ ├── twentytwentyfour/
│ │ └── twentytwentythree/
│ └── plugins/ # 76 plugins
├── .paul/ # PAUL project management
├── .serena/ # Serena AI tooling
├── .vscode/ # VS Code + FTP config
└── CLAUDE.md # AI assistant instructions
```
**Ogólnie:** monolityczna aplikacja WordPress/WooCommerce z dużą liczbą pluginów i vendorowym motywem.
## Theme Architecture: BeTheme (betheme/)
**Kluczowe cechy:**
- Request lifecycle kontroluje WordPress core przez `index.php`, `wp-blog-header.php`, `wp-load.php` i `wp-settings.php`.
- Logika sprzedażowa przechodzi przez WooCommerce w `wp-content/plugins/woocommerce/`.
- Customizacja rozpoznana w kodzie to plugin `wp-content/plugins/ws-inpost-map/`.
- Motyw `wp-content/themes/betheme/` dostarcza dużą część warstwy prezentacji i shortcodeów.
```
betheme/
├── functions.php # Theme bootstrap (defines MFN_THEME_VERSION)
├── style.css # Theme header metadata only
├── woocommerce.php # WooCommerce template root
├── header.php / header-shop.php # Header templates
├── footer.php # Footer template (19KB)
├── style.php / style-colors.php # Dynamic PHP-generated CSS
├── functions/ # Core theme PHP logic
│ ├── theme-functions.php # 119KB — main hooks & functions
│ ├── theme-head.php # 79KB — HEAD/frontend logic
│ ├── theme-woocommerce.php # 72KB — WooCommerce customization (1,752 lines)
│ ├── theme-shortcodes.php # 405KB / 13,793 lines — visual builder shortcodes
│ ├── theme-hooks.php # Hook definitions
│ ├── theme-menu.php # Menu handling (350 lines)
│ ├── admin/ # Admin-side classes
│ ├── builder/ # Visual builder (class-mfn-builder*.php)
│ ├── modules/ # Dynamic data module
│ ├── plugins/
│ │ ├── visual-composer.php # 81KB VC integration
│ │ └── elementor/ # Elementor support
│ ├── post-types/ # Custom post type classes
│ └── widgets/ # Theme widgets
├── woocommerce/ # 27 WooCommerce template overrides
│ ├── archive-product.php
│ ├── content-product.php
│ ├── content-single-product.php
│ ├── cart/ (5 files)
│ ├── checkout/form-checkout.php
│ ├── single-product/ (6+ files)
│ ├── loop/ (4 files)
│ ├── myaccount/downloads.php
│ └── notices/ (2 files)
├── muffin-options/
│ └── theme-options.php # 337KB master options panel
├── visual-builder/ # Muffin's visual page builder
├── css/ # Pre-compiled stylesheets
├── js/ # Pre-compiled JavaScript
├── includes/ # Template partials
├── templates/ # Page templates
├── languages/ # Translations
└── wpml/wpml-config.xml # WPML multilingual config
```
## Warstwy
## Class Architecture (BeTheme)
**WordPress Core:**
- Cel: bootstrap aplikacji, ładowanie konfiguracji, pluginów, motywów i hooków.
- Lokalizacje: `index.php`, `wp-load.php`, `wp-settings.php`, `wp-config.php`.
- Uwaga: w repozytorium nie ma pełnego `wp-admin/` ani `wp-includes/`, więc snapshot jest niepełnym drzewem WordPress.
BeTheme uses a class-per-feature pattern with `mfn_` prefix on all functions:
**WooCommerce:**
- Cel: koszyk, checkout, zamówienia, płatności, wysyłki i model danych sklepu.
- Lokalizacje: `wp-content/plugins/woocommerce/`, pluginy `woo-*`, `woocommerce-*`.
- Używane przez: customowy plugin `wp-content/plugins/ws-inpost-map/` oraz liczne integracje płatności/dostaw.
**Admin classes** (`functions/admin/`):
- `class-mfn-api.php`, `class-mfn-dashboard.php`, `class-mfn-helper.php`
- `class-mfn-update.php`, `class-mfn-plugins.php`, `class-mfn-setup.php`
**Motyw:**
- Cel: frontend, szablony, shortcode'y i builder.
- Lokalizacje: `wp-content/themes/betheme/`, `wp-content/themes/twentytwenty*/`.
- Ryzyko: brak widocznego child theme; customizacje w `wp-content/themes/betheme/` utrudnią aktualizacje.
**Builder classes** (`functions/builder/`):
- `class-mfn-builder.php` — main builder
- `class-mfn-builder-fields.php` — 2.4MB field definitions
- `class-mfn-builder-admin.php` — 154KB
- `class-mfn-builder-front.php` — 136KB
- `class-mfn-builder-woo-helper.php` — WooCommerce builder integration
**Custom Plugin: `ws-inpost-map`:**
- Cel: dodać wybór Paczkomatu InPost na checkout i zapisać wybrany punkt do zamówienia.
- Entry point: `wp-content/plugins/ws-inpost-map/ws-inpost-map.php`.
- Manager: `wp-content/plugins/ws-inpost-map/App/WsInpostMap.php`.
- Hooki checkoutu: `wp-content/plugins/ws-inpost-map/App/WsInpostActions.php`.
- Metoda wysyłki: `wp-content/plugins/ws-inpost-map/App/WsInpostShippingMethod.php`.
- Panel ustawień: `wp-content/plugins/ws-inpost-map/App/WSInpostSettings.php`.
- Assety: `wp-content/plugins/ws-inpost-map/App/Assets.php`.
**Post type classes** (`functions/post-types/`):
- `class-mfn-post-type-page.php`, `class-mfn-post-type-product.php`
- `class-mfn-post-type-template.php` — 84KB
- 10+ additional post type classes
## Przepływ Danych
**Elementor widget classes** (`functions/plugins/elementor/`):
- `class-mfn-elementor.php` + 80+ widget classes
**Checkout z Paczkomatem:**
1. WordPress ładuje plugin przez `wp-content/plugins/ws-inpost-map/ws-inpost-map.php`.
2. `WSIM_InpostMapPlugin` uruchamia `WsInpostMapOnCheckout\App\WsInpostMap`.
3. `WsInpostMap` tworzy `WsInpostActions`, `Assets` i `WSInpostSettings`.
4. `WsInpostActions` rejestruje hooki WooCommerce, jeśli istnieje klasa `woocommerce` i opcja `active-button` jest włączona.
5. Frontend checkoutu ładuje mapę i pole `billing__paczkomat_id`.
6. `saveCustomFieldOrderMeta` zapisuje wartość jako order meta `paczkomat_id`.
7. `displayPaczkomatFieldInOrder` pokazuje zapisany Paczkomat w adminie zamówienia.
## WordPress Request Flow
**Metoda dostawy:**
1. `woocommerce_shipping_init` ładuje `App/WsInpostShippingMethod.php`.
2. `woocommerce_shipping_methods` rejestruje `wsim_inpost_shipping_method`.
3. `WSIM_InpostShippingMethod` pobiera ustawienia instancji WooCommerce i dodaje rate przez `calculate_shipping`.
```
HTTP Request
→ index.php (defines WP_USE_THEMES = true)
→ wp-blog-header.php
→ wp-load.php → wp-config.php (DB + constants)
→ wp-settings.php (load plugins + theme)
→ betheme/functions.php (theme init: MFN_THEME_VERSION = 27.6.4)
→ Loads theme-options.php, theme-functions.php, theme-head.php
→ WordPress template hierarchy selects template file
→ WooCommerce hooks modify product/cart/checkout rendering
```
## Entry Points
## WooCommerce Integration Points
- `index.php` - web entry point WordPress.
- `wp-login.php`, `xmlrpc.php`, `wp-cron.php` - standardowe entry pointy WordPress.
- `wp-content/plugins/ws-inpost-map/ws-inpost-map.php` - entry point customowego pluginu.
- `wp-content/themes/betheme/functions.php` - bootstrap motywu.
1. **Theme support declared** in `theme-woocommerce.php`:
- `wc-product-gallery-zoom`, `wc-product-gallery-lightbox`, `wc-product-gallery-slider`
- Custom image sizes for thumbnails and single product
## Cross-Cutting Concerns
2. **Hooks removed** (theme replaces defaults):
- `woocommerce_before_main_content` wrappers, breadcrumb, sidebar, sale flash, product thumbnail
- Hooki WordPress/WooCommerce są głównym mechanizmem integracji.
- Dane sklepu żyją w bazie WordPress/WooCommerce, a customowe dane InPost są w order meta `paczkomat_id`.
- Tłumaczenia przez text domain `ws-inpost-map` i katalog `wp-content/plugins/ws-inpost-map/languages/`.
- Assety frontendowe pluginu InPost są ładowane globalnie przez `wp_enqueue_scripts`, a nie tylko na checkout.
3. **Hooks added** (theme enhancements):
- Quantity buttons, wishlist button, excerpt in loop, cart fragment AJAX
4. **Template overrides** (`betheme/woocommerce/`):
- 27 files override WooCommerce default templates
## Custom Code Locations
| Location | Purpose |
|----------|---------|
| `betheme/functions/theme-woocommerce.php` | WooCommerce hooks & filters |
| `betheme/functions/theme-functions.php` | Theme hooks, helpers, shortcodes |
| `betheme/woocommerce/` | WooCommerce template overrides |
| `code-snippets` plugin | DB-stored PHP snippets (admin-managed) |
| `head-footer-code` plugin | Header/footer injection |
| `wp-headers-and-footers` plugin | Global header/footer scripts |
## Database
- **Engine:** MariaDB at `mariadb114.miody.nazwa.pl`
- **Database:** `miody_miodynew`
- **Table prefix:** `wp_` (default — not hardened)
- **Custom tables:** None confirmed outside standard WordPress/WooCommerce tables
- **Schema doc:** `.paul/codebase/db_schema.md`
---
*Aktualizuj po zmianie aktywnego motywu, checkoutu, płatności, dostaw albo custom pluginów.*

View File

@@ -1,165 +0,0 @@
# Concerns — krolewskie-miody.pl
## CRITICAL (Immediate Action Required)
### C1 — Credentials Exposed in Version Control
- **wp-config.php** contains live database credentials committed to Git
- **.vscode/ftp-kr.json** contains live FTP credentials committed to Git
- **wp-config.php** line 3: `RSSSL_KEY` (Really Simple SSL API key) committed
- **Action:** Rotate all credentials immediately. Add `.gitignore`. Remove from Git history (`git filter-branch` or `git filter-repo`).
### C2 — No .gitignore
- Entire WordPress installation tracked in Git with no exclusions
- Sensitive files: `wp-config.php`, `.vscode/ftp-kr.json`
- Large vendor code: all 76 plugin directories, all theme files
- **Action:** Create `.gitignore` excluding at minimum: `wp-config.php`, `.vscode/ftp-kr.json`, `/wp-content/uploads/`, `/wp-content/plugins/*/` (third-party), WordPress core dirs
### C3 — FTP Instead of SFTP
- `.vscode/ftp-kr.json` uses plain FTP (port 21) — credentials and file contents transmitted unencrypted
- **Action:** Switch to SFTP in deploy config
---
## HIGH (Address Soon)
### H1 — No Child Theme
- All customizations are in the BeTheme parent theme directly
- Any BeTheme update will overwrite custom code in `functions/`, WooCommerce overrides, etc.
- Violates CLAUDE.md rule: *"Customizations only in child theme or dedicated plugin"*
- **Files at risk:** `betheme/functions/theme-woocommerce.php`, `betheme/woocommerce/` (27 templates)
- **Action:** Create a child theme; migrate project-specific hooks and template overrides
### H2 — Duplicate SEO Plugins (2 full suites active)
- Yoast SEO + Yoast SEO Premium
- All in One SEO + AIOSEO Pro (same plugin, free + paid simultaneously)
- Plus: broken-link-checker-seo, buffor-seo, aioseo-index-now
- **Impact:** Conflicting meta tag output, duplicate sitemap generation, DB bloat
- **Action:** Pick one suite (Yoast recommended as it's newer and at v27.4). Deactivate and delete AIOSEO free/pro
### H3 — Duplicate Analytics Plugins (7 implementations)
- `ga-google-analytics`, `google-analytics-for-wordpress`, `google-analytics-premium`, `google-site-kit`, `woo-ecommerce-tracking-for-google-and-facebook`, `pixelyoursite`, and GTM plugin
- **Impact:** GA4 events firing multiple times, inflated conversion data, page speed degradation
- **Action:** Consolidate to Google Site Kit (official) + GTM for custom events. Remove legacy GA plugins
### H4 — Duplicate Cookie Consent Plugins
- `complianz-gdpr` (primary, comprehensive)
- `cookie-notice` (separate plugin)
- `wpconsent-cookies-banner-privacy-suite` (third plugin)
- **Impact:** Multiple consent banners shown, conflicting consent state, GDPR compliance uncertainty
- **Action:** Keep Complianz only; deactivate and remove cookie-notice and wpconsent
### H5 — Duplicate SMTP Plugins
- `easy-wp-smtp` (primary, configured)
- `wp-mail-smtp` (secondary)
- **Impact:** Email delivery conflicts, double configuration
- **Action:** Deactivate and remove wp-mail-smtp
### H6 — Duplicate Coupon Plugins (free + pro simultaneously)
- `flexible-coupons` (free v1.14.4)
- `flexible-coupons-pro` (pro v2.5.3)
- **Impact:** Plugin conflicts — pro version should replace free
- **Action:** Deactivate and delete flexible-coupons free; keep pro only
### H7 — SQL Injection Risk in Builder Queries
- **File:** `wp-content/themes/betheme/functions/builder/` — 82+ `$wpdb->query()` / `$wpdb->get_results()` calls
- Some queries use direct variable interpolation without `$wpdb->prepare()`:
```php
$wpdb->get_results("... and m.meta_value IN ( '{$type}' )");
```
- **Impact:** SQL injection if `$type` is user-controlled
- **Action:** Audit all `$wpdb` calls in builder files; wrap dynamic values in `$wpdb->prepare()`
### H8 — Duplicator Installer Files Present
- `wp-content/plugins/duplicator/installer/` contains active installer scripts
- Known security risk — Duplicator installers have been exploited historically
- `.htaccess` protections are in place but installer framework is accessible
- **Action:** Delete installer directory after backups are complete
### H9 — No Caching Layer
- 76 plugins with zero caching plugin installed
- Shared hosting (Nazwa.pl) without built-in object cache
- **Impact:** Every page request hits database with full plugin stack
- **Action:** Install LiteSpeed Cache (if host supports LiteSpeed) or WP Super Cache
---
## MEDIUM (Plan to Address)
### M1 — Security Constants Missing from wp-config.php
- `DISALLOW_FILE_EDIT` not set — theme/plugin editor accessible in WP admin
- `FORCE_SSL_ADMIN` not set — admin login may occur over HTTP
- `WP_MEMORY_LIMIT` not set — using PHP default
- **Action:** Add to wp-config.php:
```php
define('DISALLOW_FILE_EDIT', true);
define('FORCE_SSL_ADMIN', true);
define('WP_MEMORY_LIMIT', '256M');
```
### M2 — Default Table Prefix
- Tables use `wp_` prefix — slightly easier for automated attacks to target
- Changing after installation requires DB migration
- **Action:** Note for future migration during next major maintenance
### M3 — xmlrpc.php Present
- `xmlrpc.php` is a common brute-force and DDoS vector
- Not needed if no XML-RPC integrations are active
- **Action:** Block via .htaccess or disable via plugin if not used
### M4 — No Code Quality Tooling
- No `.phpcs.xml`, no ESLint, no PHPStan
- No pre-commit hooks enforcing standards
- **Action:** Add PHPCS with WordPress ruleset; configure in CI
### M5 — Plugin Count (76 plugins)
- Industry best practice: under 20-25 plugins for performance
- 76 plugins = significant memory and execution time overhead
- Audit has identified at least 10-15 redundant plugins (see H1-H6)
- **Action:** After deduplication, target 50-55 active plugins
### M6 — No Automated Tests
- No PHPUnit, no CI/CD pipeline
- Custom WooCommerce hooks and checkout modifications untested
- See `testing.md` for setup recommendations
---
## LOW (Nice to Have)
### L1 — Code Snippets Plugin on Production
- `code-snippets` stores PHP in the database — not version-controlled
- Snippets invisible in Git history; changes untracked
- **Action:** Migrate any production snippets to a custom plugin or child theme functions
### L2 — Multiple Form Plugins
- `contact-form-7` and `wpforms-lite` both installed
- **Action:** Pick one and remove the other
### L3 — Duplicate Popup Plugins
- `optinmonster` and `popup-maker` both installed
- **Action:** Consolidate to one popup solution
---
## Summary Matrix
| ID | Severity | Issue | Effort |
|----|----------|-------|--------|
| C1 | CRITICAL | Credentials in Git | Low (rotate + gitignore) |
| C2 | CRITICAL | No .gitignore | Low |
| C3 | CRITICAL | FTP unencrypted | Low |
| H1 | HIGH | No child theme | High |
| H2 | HIGH | Duplicate SEO plugins | Low |
| H3 | HIGH | Duplicate analytics (7x) | Low |
| H4 | HIGH | Duplicate cookie consent | Low |
| H5 | HIGH | Duplicate SMTP | Low |
| H6 | HIGH | Duplicate coupon plugins | Low |
| H7 | HIGH | SQL injection in builder | Medium |
| H8 | HIGH | Duplicator installer exposed | Low |
| H9 | HIGH | No caching | Low |
| M1 | MEDIUM | Security constants missing | Low |
| M2 | MEDIUM | Default table prefix | High |
| M3 | MEDIUM | xmlrpc.php active | Low |
| M4 | MEDIUM | No code quality tooling | Medium |
| M5 | MEDIUM | 76 plugins | Medium |
| M6 | MEDIUM | No automated tests | High |

View File

@@ -1,94 +1,49 @@
# Conventions — krolewskie-miody.pl
# Konwencje Kodu
## PHP Conventions (CLAUDE.md)
**Data analizy:** 2026-05-19
- **Standard:** PSR-12 formatting
- **Classes:** PascalCase — e.g. `MfnDynamicData`, `class-mfn-builder.php`
- **Methods/Functions:** snake_case — e.g. `mfn_woocommerce_product_reviews_tab_title()`
- **Database variables:** snake_case
- **Theme function prefix:** `mfn_` for all BeTheme functions
- **Max nesting depth:** 3 levels — extract deeper logic to named methods
- **Comments:** Only when explaining *why*, never *what*
- **Customizations:** Child theme or dedicated plugin only — never in WordPress core or parent theme directly
## Reguły Projektowe
## File Naming
Źródło: `CLAUDE.md`.
- Plugin/theme files: kebab-case — `class-mfn-builder.php`
- Class files: prefixed with `class-``class-mfn-dynamic-data.php`
- PHP powinien stosować PSR-12.
- Klasy: PascalCase.
- Metody: camelCase.
- Zmienne DB: snake_case.
- Unikać zagnieżdżeń powyżej 3 poziomów.
- Komentarze mają wyjaśniać "dlaczego", nie "co".
- Customizacje tylko w child theme albo dedykowanym pluginie, nigdy w core WordPress.
## WordPress Hook Usage
## Aktualne Wzorce W Kodzie
Hooks registered in `wp-content/themes/betheme/functions/`:
**WordPress/WooCommerce:**
- Integracja przez `add_action`, `add_filter`, `register_activation_hook`, `register_deactivation_hook`.
- Escaping i sanitizacja przez funkcje WordPress: `esc_html`, `esc_attr`, `sanitize_text_field`, `wp_verify_nonce`.
- Ustawienia przez WordPress Settings API w `wp-content/plugins/ws-inpost-map/App/WSInpostSettings.php`.
**Core hooks used:**
- `after_setup_theme` — theme init
- `init` — WP initialization
- `wp_enqueue_scripts` — script/style loading
- `pre_get_posts` — query modification
- `admin_menu` — admin customization
**Custom plugin `ws-inpost-map`:**
- Namespace: `WsInpostMapOnCheckout\App`.
- Autoloading PSR-4 w `wp-content/plugins/ws-inpost-map/composer.json`.
- Stałe pluginu: `WSIM_INPOST_MAP_PLUGIN_DIR_PATH`, `WSIM_INPOST_MAP_PLUGIN_DIR_URL`.
- Klasa shipping method `WSIM_InpostShippingMethod` nie jest namespacowana, bo WooCommerce ładuje ją jako nazwę klasy metody wysyłki.
**Custom theme hooks (mfn_):**
- `mfn_before_content` / `mfn_after_content`
- `mfn_before_shop_content` / `mfn_after_shop_content`
- `mfn_hook_bottom`
## Odchylenia I Miejsca Do Uważania
## WooCommerce Hook Pattern
- `wp-content/plugins/ws-inpost-map/App/WsInpostActions.php` używa mieszanki wcięć 2 spacje i stylu odbiegającego od PSR-12.
- `wp-content/plugins/ws-inpost-map/App/WSInpostSettings.php` jest duży względem reszty custom pluginu i łączy definicje pól, rendering admina, ustawienia oraz style dynamiczne.
- Brak widocznego child theme w `wp-content/themes/`; nie należy modyfikować `wp-content/themes/betheme/` bez wyraźnego powodu i planu aktualizacji.
- Kod vendorowy w `wp-content/plugins/` ma własne standardy; nie traktować go jako stylu dla nowych customizacji.
See `wp-content/themes/betheme/functions/theme-woocommerce.php`.
## Zalecany Kierunek Dla Nowych Zmian
**Remove defaults, then add custom:**
```php
// Remove WooCommerce defaults
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
- Nowe customizacje sklepu dodawać w dedykowanym pluginie albo child theme.
- Dla zmian checkoutu najpierw sprawdzić kolizje z pluginami:
- `wp-content/plugins/flexible-checkout-fields/`
- `wp-content/plugins/woo-checkout-field-editor-pro/`
- `wp-content/plugins/woocommerce-checkout-manager/`
- `wp-content/plugins/ws-inpost-map/`
- Sanitizować dane wejściowe na granicy requestu i escape'ować przy renderowaniu HTML.
- Nie zapisywać sekretów w dokumentacji PAUL.
// Add theme equivalents
add_action('woocommerce_before_quantity_input_field', 'mfn_woocommerce_before_quantity_input_field');
add_action('woocommerce_after_add_to_cart_button', 'mfn_append_wishlist_button');
add_filter('loop_shop_columns', 'mfn_woo_loop_shop_columns', 20);
add_filter('woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
```
## CSS / JS Conventions
- **No build tooling** — no SASS, Webpack, or Gulp
- CSS and JS are pre-compiled and committed directly
- Main files: `betheme/css/be.css`, `betheme/js/scripts.js`
- Both minified and unminified versions maintained
- Custom CSS should go in child theme `style.css` (once child theme is created)
## Configuration Constants (wp-config.php)
Currently defined:
```php
define('RSSSL_KEY', '...'); // Really Simple SSL API key
define('WP_DEBUG', false); // Production mode
```
**Not yet defined (recommended):**
```php
define('DISALLOW_FILE_EDIT', true);
define('FORCE_SSL_ADMIN', true);
define('WP_MEMORY_LIMIT', '256M');
```
## Database Conventions
- Schema documented in `.paul/codebase/db_schema.md`
- Every schema change requires a new migration — never modify existing ones
- Use `$wpdb->prepare()` for all dynamic queries
- Table prefix: `wp_` (default)
## Version Control
- **Remote:** `https://git.project-pro.pl/Project-Pro/krolewskie-miody.pl.git`
- **Branch:** `main`
- **No `.gitignore`** — currently all files tracked (security risk; see concerns.md)
- Excluded from FTP deploy: `.git`, `.vscode`, `.paul`, `.serena`, `CLAUDE.md`
## Code Quality Tools
None configured. Recommended additions:
- `.phpcs.xml` — PHP CodeSniffer with WordPress/PSR-12 ruleset
- `phpstan.neon` — Static analysis
- `.eslintrc` — JavaScript linting
---
*Aktualizuj po ustaleniu automatycznego formatowania albo po wydzieleniu child theme/custom pluginu.*

View File

@@ -1,82 +1,41 @@
# Database Schema — krolewskie-miody.pl
# Schemat Danych
## Connection
**Data analizy:** 2026-05-19
- **Engine:** MariaDB
- **Host:** `mariadb114.miody.nazwa.pl`
- **Database:** `miody_miodynew`
- **Table prefix:** `wp_` (default WordPress prefix)
- **Charset:** `utf8mb4`
## Główne Źródło Danych
## Standard WordPress Tables
- Aplikacja używa bazy WordPress skonfigurowanej w `wp-config.php`.
- `wp-config.php` zawiera `$table_prefix`; wartości DB credentials nie są dokumentowane.
- Standardowe tabele WordPress i WooCommerce nie są zdefiniowane w repo jako migracje.
| Table | Purpose |
|-------|---------|
| `wp_posts` | All content (pages, products, orders, templates) |
| `wp_postmeta` | Post metadata (product price, order items, etc.) |
| `wp_terms` | Taxonomy terms (categories, tags, product attributes) |
| `wp_term_taxonomy` | Term-taxonomy relationships |
| `wp_term_relationships` | Object-term relationships |
| `wp_options` | Site configuration, plugin settings |
| `wp_users` | Customer and admin accounts |
| `wp_usermeta` | User metadata (shipping address, billing, roles) |
| `wp_comments` | Product reviews, order notes |
| `wp_commentmeta` | Comment metadata |
| `wp_links` | Blogroll (legacy, rarely used) |
## Customowe Dane Projektu
## WooCommerce Tables
**`ws-inpost-map`:**
- Opcje pluginu: `ws_inpost_plugin_options`, używane w `wp-content/plugins/ws-inpost-map/App/WSInpostSettings.php`.
- Order meta: `paczkomat_id`, zapisywane w `wp-content/plugins/ws-inpost-map/App/WsInpostActions.php`.
- Pole checkoutu: `billing__paczkomat_id`, renderowane w `WsInpostActions::registerCustomField`.
- Metoda dostawy: `wsim_inpost_shipping_method`, rejestrowana w `WsInpostActions::addCustomShippingMethod`.
| Table | Purpose |
|-------|---------|
| `wp_woocommerce_sessions` | Cart sessions |
| `wp_woocommerce_api_keys` | REST API authentication |
| `wp_woocommerce_attribute_taxonomies` | Product attribute definitions |
| `wp_woocommerce_downloadable_product_permissions` | Digital product access |
| `wp_woocommerce_order_items` | Line items per order |
| `wp_woocommerce_order_itemmeta` | Metadata for order items |
| `wp_woocommerce_tax_rates` | Tax rate definitions |
| `wp_woocommerce_tax_rate_locations` | Tax rate geographic zones |
| `wp_woocommerce_shipping_zones` | Shipping zone definitions |
| `wp_woocommerce_shipping_zone_locations` | Zone geographic areas |
| `wp_woocommerce_shipping_zone_methods` | Methods per zone |
| `wp_woocommerce_payment_tokens` | Saved payment methods |
| `wp_woocommerce_payment_tokenmeta` | Payment token metadata |
| `wp_woocommerce_log` | WooCommerce action log |
## Tabele Tworzone Przez Pluginy
## Plugin Tables (selected)
Repo zawiera wiele vendorowych pluginów, które mogą tworzyć własne tabele. Przykłady znalezione w kodzie:
| Table | Plugin | Purpose |
|-------|--------|---------|
| `wp_code_snippets` | Code Snippets | Custom PHP snippet storage |
| `wp_complianz_*` | Complianz GDPR | Cookie consent records |
| `wp_wfpk_*` or similar | PixelYourSite | Tracking pixel config |
- `wp-content/plugins/broken-link-checker-seo/app/Main/Updates.php` - tworzy tabele dla Broken Link Checker by AIOSEO.
- `wp-content/plugins/broken-link-checker-seo/app/Main/PreUpdates.php` - pre-update/migracje tabel BLC.
- `wp-content/plugins/wpforms-lite/uninstall.php` - usuwa tabele `wpforms_*` przy uninstall.
- WooCommerce i Action Scheduler zarządzają własnymi tabelami wewnątrz `wp-content/plugins/woocommerce/`.
## Key Relationships
## Migracje
### Products
- `wp_posts` (post_type = 'product' or 'product_variation')
- `wp_postmeta``_price`, `_regular_price`, `_sale_price`, `_sku`, `_stock`
- `wp_term_relationships``wp_terms` (product categories, tags, attributes)
- Brak projektowego katalogu migracji dla custom code.
- Custom plugin `ws-inpost-map` nie tworzy własnych tabel; zapisuje ustawienia w `wp_options` i dane zamówień w meta WooCommerce.
- Vendorowe migracje należy traktować jako własność pluginów i nie modyfikować ich ręcznie.
### Orders
- `wp_posts` (post_type = 'shop_order')
- `wp_postmeta``_billing_*`, `_shipping_*`, `_order_total`, `_payment_method`
- `wp_woocommerce_order_items` + `wp_woocommerce_order_itemmeta`
## Ryzyka
### Customers
- `wp_users` — account
- `wp_usermeta``billing_address_1`, `shipping_city`, etc.
## Migration Rules
Per CLAUDE.md:
1. Schema changes require a new migration file
2. Never modify existing migrations
3. Document all custom schema changes in this file
## Custom Schema Changes
*No custom tables or schema changes recorded yet.*
- Zmiany checkoutu i order meta muszą być zgodne z WooCommerce HPOS, jeśli HPOS jest włączone w środowisku.
- Ustawienia i sekrety mogą żyć w `wp_options`; nie należy zakładać, że repo zawiera pełny stan runtime.
- Bez dumpa bazy nie można potwierdzić aktywnego motywu, aktywnych pluginów, statusu HPOS ani rzeczywistych wartości ustawień.
---
*Update this file whenever schema changes are made.*
*Aktualizuj po każdej zmianie zapisów do bazy, order meta, ustawień pluginów albo migracji.*

View File

@@ -0,0 +1,69 @@
# Impact Map
**Data analizy:** 2026-05-19
**Tryb radaru:** `full`
**Scope:** `entire repository`
## Najważniejsze Obszary Wpływu
**Checkout WooCommerce:**
- `wp-content/plugins/woocommerce/`
- `wp-content/plugins/ws-inpost-map/App/WsInpostActions.php`
- `wp-content/plugins/ws-inpost-map/assets/js/frontend/checkout.js`
- `wp-content/plugins/flexible-checkout-fields/`
- `wp-content/plugins/woo-checkout-field-editor-pro/`
- `wp-content/plugins/woocommerce-checkout-manager/`
**Dostawy i Paczkomaty:**
- `wp-content/plugins/ws-inpost-map/`
- `wp-content/plugins/woocommerce-paczkomaty-inpost/`
- `wp-content/plugins/inpost-for-woocommerce/`
- `wp-content/plugins/inpost-paczkomaty/`
- `wp-content/plugins/inpost-pay/`
**Płatności:**
- `wp-content/plugins/woo-payu-payment-gateway/`
- `wp-content/plugins/woocommerce-gateway-przelewy24/`
- `wp-content/plugins/woocommerce-paypal-payments/`
- `wp-content/plugins/woocommerce-payments/`
- `wp-content/plugins/woocommerce-active-payments/`
**Frontend i motyw:**
- `wp-content/themes/betheme/`
- `wp-content/plugins/ws-inpost-map/assets/css/frontend/style.css`
- `wp-content/plugins/ws-inpost-map/assets/css/frontend/easypack.css`
- `wp-content/plugins/ws-inpost-map/assets/js/frontend/geowidget.js`
**SEO, tracking i feedy:**
- `wp-content/plugins/all-in-one-seo-pack/`
- `wp-content/plugins/all-in-one-seo-pack-pro/`
- `wp-content/plugins/wordpress-seo/`
- `wp-content/plugins/wordpress-seo-premium/`
- `wp-content/plugins/google-listings-and-ads/`
- `wp-content/plugins/duracelltomi-google-tag-manager/`
- `wp-content/plugins/pixelyoursite/`
- `wp-content/plugins/official-facebook-pixel/`
## Powiązane Dane I Konfiguracja
- `wp-config.php` - połączenie z bazą, `WP_DEBUG`.
- `.htaccess` - reguły Apache.
- `.vscode/ftp-kr.json` - deploy FTP/SFTP.
- `wp-content/plugins/ws-inpost-map/App/WSInpostSettings.php` - opcje `ws_inpost_plugin_options`.
- `wp-content/plugins/ws-inpost-map/App/WsInpostActions.php` - order meta `paczkomat_id`.
## Weryfikacja Po Zmianach
- Checkout z produktem fizycznym i metodą dostawy InPost.
- Zapis i wyświetlanie `paczkomat_id` w zamówieniu.
- Koszyk, checkout, strona podziękowania i e-mail zamówienia.
- Płatność testowa dla aktywnej bramki.
- Tracking konwersji po płatności.
- Zgody cookies i skrypty marketingowe po zmianach frontendowych.
## Ukryte Sprzężenia
- Kilka pluginów może modyfikować te same pola checkoutu.
- Kilka pluginów obsługuje InPost, więc zmiana w `ws-inpost-map` może kolidować z gotowymi integracjami.
- Tracking i płatności zależą od poprawnych eventów WooCommerce po checkout.
- Brak dumpa bazy utrudnia potwierdzenie, które pluginy są aktywne w środowisku.

View File

@@ -1,117 +1,68 @@
# Integrations — krolewskie-miody.pl
# Integracje Zewnętrzne
## Payment Gateways
**Data analizy:** 2026-05-19
| Integration | Plugin | Version | Notes |
|-------------|--------|---------|-------|
| Przelewy24 | woocommerce-gateway-przelewy24 | 4.1.16 | Polish market primary |
| PayU | woo-payu-payment-gateway | 2.10.1 | Polish market secondary |
| PayPal | woocommerce-paypal-payments | 4.0.3 | International |
| WooCommerce Payments | woocommerce-payments | 10.7.1 | WordPress.com |
| InPost Pay | inpost-pay | 2.0.7 | Linked to InPost shipping |
## Płatności
## Shipping & Logistics
- `wp-content/plugins/woo-payu-payment-gateway/` - PayU Payment Gateway for WooCommerce.
- `wp-content/plugins/woocommerce-gateway-przelewy24/` - WooCommerce Przelewy24.
- `wp-content/plugins/woocommerce-paypal-payments/` - PayPal dla WooCommerce.
- `wp-content/plugins/woocommerce-payments/` - WooPayments.
- `wp-content/plugins/woocommerce-active-payments/` - dodatkowa logika aktywnych płatności.
| Integration | Plugin | Version | Notes |
|-------------|--------|---------|-------|
| InPost Paczkomaty | woocommerce-paczkomaty-inpost | 4.6.30 | Parcel lockers (paczkomaty) |
| InPost for WooCommerce | inpost-for-woocommerce | — | Courier + locker |
| InPost Map | ws-inpost-map | 1.0.0 | Interactive locker map widget |
| PolKurier | woocommerce-polkurier | — | Polish courier network |
| WooCommerce Services | woocommerce-services | 3.6.1 | Shipping labels + tax |
## Dostawy I Logistyka
## Analytics & Tracking
- `wp-content/plugins/ws-inpost-map/` - customowy wybór Paczkomatu na checkout.
- `wp-content/plugins/woocommerce-paczkomaty-inpost/` - InPost dla WooCommerce.
- `wp-content/plugins/inpost-for-woocommerce/` - integracja InPost.
- `wp-content/plugins/inpost-paczkomaty/` - integracja Paczkomatów.
- `wp-content/plugins/inpost-pay/` - InPost Pay.
- `wp-content/plugins/woocommerce-polkurier/` - Polkurier.
- `wp-content/plugins/woocommerce-services/` - WooCommerce Tax/Services.
| Integration | Plugin | Version | Notes |
|-------------|--------|---------|-------|
| Google Tag Manager | duracelltomi-google-tag-manager | 1.22.3 | GTM container injection |
| Google Site Kit | google-site-kit | 1.177.0 | GA4 + GSC + PageSpeed |
| MonsterInsights | google-analytics-for-wordpress | — | GA dashboard in WP admin |
| MonsterInsights Premium | google-analytics-premium | 10.1.3 | Advanced GA features |
| GA4 snippet | ga-google-analytics | 20260421 | Simple GA snippet (legacy) |
| PixelYourSite | pixelyoursite | 11.2.0.4 | Multi-pixel management |
| Meta Pixel | official-facebook-pixel | 5.0.1 | Facebook/Instagram tracking |
| Meta for WooCommerce | facebook-for-woocommerce | 3.6.3 | Product catalog + pixel |
| TikTok for Business | tiktok-for-business | — | TikTok pixel + catalog |
| WC Google & Facebook tracking | woo-ecommerce-tracking-for-google-and-facebook | — | Enhanced e-commerce events |
## SEO, Feed I Widoczność
**Warning:** Significant tracking duplication — 4+ Google Analytics implementations. Review needed.
- `wp-content/plugins/all-in-one-seo-pack/` i `wp-content/plugins/all-in-one-seo-pack-pro/`.
- `wp-content/plugins/aioseo-index-now/`.
- `wp-content/plugins/broken-link-checker-seo/`.
- `wp-content/plugins/wordpress-seo/` i `wp-content/plugins/wordpress-seo-premium/`.
- `wp-content/plugins/google-listings-and-ads/`.
- `wp-content/plugins/webappick-product-feed-for-woocommerce/`.
- `wp-content/plugins/wp-product-feed-manager/`.
- `wp-content/plugins/woocommerce-ceneo-official/`.
## SEO
## Analytics, Tracking I Reklama
| Integration | Plugin | Version | Notes |
|-------------|--------|---------|-------|
| Yoast SEO | wordpress-seo | 27.4 | Primary SEO |
| Yoast SEO Premium | wordpress-seo-premium | — | Premium features |
| AIOSEO | all-in-one-seo-pack | 4.9.6.2 | Duplicate — should remove |
| AIOSEO Pro | all-in-one-seo-pack-pro | 4.9.6.2 | Duplicate — should remove |
| AIOSEO IndexNow | aioseo-index-now | 1.0.13 | Instant indexing |
| Broken Link Checker | broken-link-checker-seo | 1.2.10 | SEO link audit |
| Google Listings & Ads | google-listings-and-ads | 3.6.1 | Google Shopping / Merchant |
| Buffor SEO | buffor-seo | — | Social media scheduling |
- `wp-content/plugins/duracelltomi-google-tag-manager/` - GTM4WP.
- `wp-content/plugins/google-site-kit/`.
- `wp-content/plugins/ga-google-analytics/`.
- `wp-content/plugins/official-facebook-pixel/`.
- `wp-content/plugins/facebook-for-woocommerce/`.
- `wp-content/plugins/pixelyoursite/`.
- `wp-content/plugins/tiktok-for-business/`.
- `wp-content/plugins/woo-ecommerce-tracking-for-google-and-facebook/`.
**Warning:** Both Yoast and AIOSEO active simultaneously — meta tag conflicts likely.
## Formularze, Zgody, Mail
## Email / SMTP
- `wp-content/plugins/contact-form-7/`.
- `wp-content/plugins/wpforms-lite/`.
- `wp-content/plugins/complianz-gdpr/`.
- `wp-content/plugins/complianz-terms-conditions/`.
- `wp-content/plugins/cookie-notice/`.
- `wp-content/plugins/wpconsent-cookies-banner-privacy-suite/`.
- `wp-content/plugins/easy-wp-smtp/`.
- `wp-content/plugins/wp-mail-smtp/`.
| Integration | Plugin | Notes |
|-------------|--------|-------|
| Easy WP SMTP | easy-wp-smtp 2.14.0 | Primary — configured |
| WP Mail SMTP | wp-mail-smtp | Secondary — potential conflict |
## Deploy I Operacje
## Reviews & Ratings
- `.vscode/ftp-kr.json` - konfiguracja FTP/SFTP według `CLAUDE.md`.
- `wp-config.php` - połączenie z bazą i ustawienia WordPress; sekrety nie są dokumentowane.
- `.htaccess` - reguły Apache.
| Integration | Plugin | Version |
|-------------|--------|---------|
| eKomi | ekomi | 3.4.0 |
| Google Reviews | wp-reviews-plugin-for-google | 13.2.9 |
| Facebook Reviews | free-facebook-reviews-and-recommendations-widgets | 13.2.9 |
## Webhooki I API
## Product Feeds (Polish Marketplaces)
- `codebase-memory-mcp` wykrył 78 route nodes w grafie, ale szerokie zapytania o konkretne route/API timeoutowały na dużym vendorowym indeksie.
- W customowym `ws-inpost-map` nie znaleziono własnych REST route; integracja działa przez hooki WooCommerce i formularz checkout.
| Integration | Plugin | Notes |
|-------------|--------|-------|
| Ceneo.pl | woocommerce-ceneo-official | Polish price comparison |
| WebAppick Feed | webappick-product-feed-for-woocommerce | Multi-platform (Google, Facebook, etc.) |
| WP Product Feed Manager | wp-product-feed-manager | Additional feed management |
## Security & Compliance
| Integration | Plugin | Version | Notes |
|-------------|--------|---------|-------|
| Really Simple SSL | really-simple-ssl | 9.5.9 | SSL + 2FA + hardening |
| Complianz GDPR | complianz-gdpr | 7.4.5 | Cookie consent (primary) |
| Complianz T&C | complianz-terms-conditions | — | Legal document generator |
| Cookie Notice | cookie-notice | 3.0.2 | Cookie banner (potential duplicate) |
| WPConsent | wpconsent-cookies-banner-privacy-suite | — | Privacy suite (potential duplicate) |
| Cloudflare Turnstile | simple-cloudflare-turnstile | 1.39.0 | Bot protection / CAPTCHA |
**Warning:** 3 cookie/consent plugins active simultaneously.
## Marketing & Automation
| Integration | Plugin | Version |
|-------------|--------|---------|
| ShopMagic | shopmagic-for-woocommerce | — | WooCommerce email automation |
| Uncanny Automator | uncanny-automator | 7.1.0.1 | No-code automation |
| OptinMonster | optinmonster | 2.16.22 | Lead capture / popups |
| Popup Maker | popup-maker | 1.22.0 | Popup builder |
## Checkout & Cart
| Integration | Plugin | Version |
|-------------|--------|---------|
| Flexible Checkout Fields | flexible-checkout-fields | 4.1.36 | Custom checkout fields |
| WC Checkout Field Editor Pro | woo-checkout-field-editor-pro | 2.1.8 | Checkout customization |
| WC Checkout Manager | woocommerce-checkout-manager | 7.8.9 | Checkout manager |
| Flexible Coupons | flexible-coupons | 1.14.4 | Advanced coupons |
| Flexible Coupons Pro | flexible-coupons-pro | 2.5.3 | Pro coupons (conflicts with free) |
| WC Auto-Added Coupons | woocommerce-auto-added-coupons | 3.4.2 | Auto-apply coupons |
| WC Active Payments | woocommerce-active-payments | 3.9.18 | Payment method manager |
## Hosting
- **Provider:** Nazwa.pl (Polish hosting)
- **FTP host:** `ftp.miody.nazwa.pl`
- **Database host:** `mariadb114.miody.nazwa.pl`
- **Git remote:** `https://git.project-pro.pl/Project-Pro/krolewskie-miody.pl.git`
---
*Aktualizuj przy dodaniu płatności, trackingów, dostaw, formularzy albo zmianie deployu.*

View File

@@ -0,0 +1,54 @@
# Quality Risks
**Data analizy:** 2026-05-19
## Status Radaru
- `codebase-memory-mcp`: częściowo ok. Indeks został utworzony, a architektura grafu zwróciła podsumowanie, ale szerokie `search_graph` i `index_status` timeoutowały na dużym repozytorium.
- `jscpd`: disabled by policy (`quality_radar.tools.jscpd: false`).
- `ast-grep`: disabled by policy (`quality_radar.tools.ast_grep: false`).
- Fallback: użyto zawężonych skanów `rg` i odczytu konkretnych plików.
## Najważniejsze Ryzyka
**Brak child theme:**
- W `wp-content/themes/` widać `betheme` oraz motywy domyślne WordPress, ale nie widać child theme.
- Ryzyko: zmiany w `wp-content/themes/betheme/` mogą zostać nadpisane przy aktualizacji motywu.
**Custom plugin checkout jest mały, ale krytyczny:**
- `wp-content/plugins/ws-inpost-map/App/WsInpostActions.php` dotyka checkoutu, shipping methods i order meta.
- `wp-content/plugins/ws-inpost-map/App/WSInpostSettings.php` jest duży i łączy kilka odpowiedzialności.
- `wp-content/plugins/ws-inpost-map/App/Assets.php` ładuje assety frontendowe globalnie przez `wp_enqueue_scripts`.
**Wiele pluginów dotyka checkoutu:**
- `wp-content/plugins/flexible-checkout-fields/`
- `wp-content/plugins/woo-checkout-field-editor-pro/`
- `wp-content/plugins/woocommerce-checkout-manager/`
- `wp-content/plugins/ws-inpost-map/`
**Wiele pluginów dotyka tracking/konwersji:**
- `wp-content/plugins/duracelltomi-google-tag-manager/`
- `wp-content/plugins/pixelyoursite/`
- `wp-content/plugins/official-facebook-pixel/`
- `wp-content/plugins/facebook-for-woocommerce/`
- `wp-content/plugins/google-site-kit/`
**Debug w konfiguracji:**
- `wp-config.php` zawiera `WP_DEBUG` ustawione na `true`; trzeba potwierdzić, czy tak ma być na środowisku docelowym.
**Vendor-heavy repo:**
- Repo zawiera dziesiątki tysięcy plików PHP i pełne pluginy vendorowe.
- Szerokie skany generują dużo szumu; planowanie powinno zaczynać od zawężenia do custom pluginu, aktywnego motywu i integracji dotkniętych zmianą.
## Dług Techniczny / Kandydaci Do Porządkowania
- Wydzielić child theme, jeśli projekt wymaga zmian w warstwie motywu.
- Ograniczyć ładowanie assetów `ws-inpost-map` tylko do checkoutu, jeśli nie są potrzebne globalnie.
- Rozważyć rozbicie `WSInpostSettings.php` na definicje pól, rendering i zapis/validację.
- Dodać projektowy test/manual checklist dla checkoutu i InPost.
## Znane False Positives / Akceptowane Ryzyka
- Duplikaty i duże pliki w vendorowych pluginach są oczekiwane i nie powinny automatycznie prowadzić do refaktoryzacji.
- Motywy `twentytwenty*` mogą być nieaktywne; pozostają w repo jako standardowe motywy WordPress.
- Brak pełnej informacji z bazy oznacza, że "zainstalowany" nie znaczy "aktywny".

View File

@@ -0,0 +1,23 @@
Mode: full
Scope: entire repository
Timestamp: 2026-05-19 14:47:48 +02:00
codebase-memory-mcp:
- CLI version: 0.6.1
- Project: C-visual-studio-code-projekty-krolewskie-miody.pl
- Root: C:/visual-studio-code/projekty/krolewskie-miody.pl
- Nodes: 292163
- Edges: 823931
- Node labels: Method 154690, File 32478, Module 32467, Variable 28627, Class 25654, Function 9719, Folder 6494, Interface 1556, Section 380, Route 78
- Edge types: CALLS 369589, DEFINES 253118, DEFINES_METHOD 154690, CONTAINS_FILE 32484, CONTAINS_FOLDER 5881, THROWS 3139, USAGE 1845, IMPORTS 1208
Degraded notes:
- Broad search_graph queries for checkout/payment/API/database timed out after 120s.
- index_status timed out after 120s.
- Repository is vendor-heavy WordPress/WooCommerce tree, so targeted scope is required for future scans.
Fallback findings:
- 73 plugin directories in wp-content/plugins.
- 4 theme directories in wp-content/themes.
- Main custom plugin identified: wp-content/plugins/ws-inpost-map.
- jscpd and ast-grep skipped by policy.

View File

@@ -0,0 +1,14 @@
Mode: plan
Scope: inpost-pay IPPWidgetOptions missing / wp_body_open in Betheme header
Timestamp: 2026-05-19T15:32:42+02:00
Findings:
- wp-content/themes/betheme/header.php contains `<body <?php body_class(); ?>>` and does not call `wp_body_open()`.
- wp-content/plugins/inpost-pay/src/hooks/front/FrontWidgetV2.php registers `add_root_script_after_body_open` on `wp_body_open`.
- FrontWidgetV2::add_root_script_after_body_open outputs `const IPPWidgetOptions = {...}`.
- wp-content/plugins/inpost-pay/src/InpostPay.php enqueues `assets/js/woocommerceizi.js`, which matches the console error source.
Tool status:
- Targeted rg/file reads used.
- codebase-memory-mcp broad searches are avoided for this plan because previous full-map broad queries timed out on the vendor-heavy repository.
- jscpd and ast-grep disabled by policy in .paul/config.md.

View File

@@ -0,0 +1,20 @@
Mode: post-apply
Scope: .paul/plans/20260519-1532-naprawa-inpost-pay-wp-body-open/PLAN.md
Timestamp: 2026-05-19T15:35:26+02:00
Modified by this apply:
- wp-content/themes/betheme/header.php
Verification:
- rg confirmed:
- line 37: <body <?php body_class(); ?>>
- line 38: <?php wp_body_open(); ?>
- php -l was not run because PHP CLI is not available in PATH.
- Manual frontend checkpoint remains required on an environment where WordPress and inpost-pay are active.
Boundary check:
- No planned edit was made to wp-content/plugins/inpost-pay/.
- Existing git status already contains many modified inpost-pay files unrelated to this apply; they were not reverted or edited by this apply.
Radar status:
- post-apply degraded: targeted file verification completed; no broad codebase-memory search due known timeout risk on vendor-heavy repository.

View File

@@ -1,104 +1,58 @@
# Stack — krolewskie-miody.pl
# Stack Technologiczny
## Core Platform
**Data analizy:** 2026-05-19
| Layer | Technology | Version |
|-------|-----------|---------|
| CMS | WordPress | Check `wp-includes/version.php` |
| E-commerce | WooCommerce | 10.7.0 |
| Theme | BeTheme (Muffin Group) | 27.6.4 |
| Language | PHP | 7.4+ (WooCommerce requirement) |
| Database | MariaDB | mariadb114.miody.nazwa.pl |
| Hosting | Nazwa.pl (shared hosting) | FTP deploy |
## Języki
## Theme
**Główne:**
- PHP - WordPress, WooCommerce, motywy i pluginy w `wp-content/`.
- JavaScript - skrypty frontend/admin w pluginach i motywach, między innymi `wp-content/plugins/ws-inpost-map/assets/js/frontend/checkout.js`.
- CSS/SCSS - style motywów i pluginów, między innymi `wp-content/plugins/ws-inpost-map/assets/css/frontend/style.css`.
- **Parent theme:** `wp-content/themes/betheme/` — BeTheme v27.6.4 by Muffin Group
- **Child theme:** None — customizations live directly in parent theme (violation of CLAUDE.md; see concerns.md)
- **Visual builder:** Muffin's proprietary builder (`wp-content/themes/betheme/visual-builder/`)
- **WooCommerce overrides:** 27 template files in `wp-content/themes/betheme/woocommerce/`
**Dodatkowe:**
- JSON - konfiguracje narzędzi, `composer.json`, dane buildów i manifesty pluginów.
- PO/MO/POT - tłumaczenia WordPress, między innymi `wp-content/plugins/ws-inpost-map/languages/`.
## Payment Gateways
## Runtime
| Plugin | Version | Provider |
|--------|---------|----------|
| woocommerce-gateway-przelewy24 | 4.1.16 | Przelewy24 (P24) — Polish |
| woo-payu-payment-gateway | 2.10.1 | PayU — Polish |
| woocommerce-paypal-payments | 4.0.3 | PayPal |
| woocommerce-payments | 10.7.1 | WordPress.com Payments |
| inpost-pay | 2.0.7 | InPost Pay |
**Środowisko:**
- WordPress + WooCommerce na PHP.
- W repozytorium brakuje `wp-includes/version.php`, więc wersja WordPress nie została potwierdzona z kodu core.
- `wp-config.php` ustawia `WP_DEBUG` na `true`; przed produkcyjnym wdrożeniem trzeba potwierdzić, czy to jest zamierzone.
## Shipping
**Package manager:**
- Brak root `composer.json` i root `package.json`.
- Composer występuje wewnątrz pluginów vendorowych oraz w `wp-content/plugins/ws-inpost-map/composer.json`.
- `ws-inpost-map` używa PSR-4 autoloadingu: `WsInpostMapOnCheckout\App\` -> `App/`.
| Plugin | Version | Provider |
|--------|---------|----------|
| woocommerce-paczkomaty-inpost | 4.6.30 | InPost Paczkomaty (lockers) |
| inpost-for-woocommerce | — | InPost |
| ws-inpost-map | 1.0.0 | InPost map widget |
| woocommerce-polkurier | — | PolKurier courier |
| woocommerce-services | 3.6.1 | WooCommerce Services (tax/shipping) |
## Frameworki I Platforma
## Analytics & Tracking
**Core:**
- WordPress - główna aplikacja, entry point przez `index.php`, `wp-load.php`, `wp-settings.php`.
- WooCommerce - sprzedaż, checkout, koszyk, zamówienia i metody dostawy w `wp-content/plugins/woocommerce/`.
- Betheme - vendorowy motyw w `wp-content/themes/betheme/`.
| Plugin | Version | Purpose |
|--------|---------|---------|
| google-site-kit | 1.177.0 | GA4 + GSC + PageSpeed |
| duracelltomi-google-tag-manager | 1.22.3 | GTM container |
| pixelyoursite | 11.2.0.4 | Multi-pixel manager |
| official-facebook-pixel | 5.0.1 | Meta Pixel |
| facebook-for-woocommerce | 3.6.3 | Meta Catalog + Pixel |
| tiktok-for-business | — | TikTok Pixel |
| woo-ecommerce-tracking-for-google-and-facebook | — | Dual tracking |
| ga-google-analytics | 20260421 | GA snippet injection |
| google-analytics-for-wordpress | — | MonsterInsights |
| google-analytics-premium | 10.1.3 | MonsterInsights Premium |
**Pluginy krytyczne funkcjonalnie:**
- `wp-content/plugins/woocommerce/` - core e-commerce.
- `wp-content/plugins/ws-inpost-map/` - customowa integracja wyboru Paczkomatu na checkout.
- `wp-content/plugins/woo-payu-payment-gateway/` - PayU.
- `wp-content/plugins/woocommerce-gateway-przelewy24/` - Przelewy24.
- `wp-content/plugins/woocommerce-paypal-payments/` i `wp-content/plugins/woocommerce-payments/` - płatności PayPal/WooPayments.
- `wp-content/plugins/inpost-*` oraz `wp-content/plugins/woocommerce-paczkomaty-inpost/` - dostawy/InPost.
## SEO
## Konfiguracja
| Plugin | Version |
|--------|---------|
| wordpress-seo (Yoast) | 27.4 |
| wordpress-seo-premium | — |
| all-in-one-seo-pack | 4.9.6.2 |
| all-in-one-seo-pack-pro | 4.9.6.2 |
| aioseo-index-now | 1.0.13 |
| broken-link-checker-seo | 1.2.10 |
| buffor-seo | — |
| google-listings-and-ads | 3.6.1 |
- `wp-config.php` zawiera konfigurację bazy i WordPress; wartości sekretów nie są dokumentowane.
- `.htaccess` i `.htaccess.bk` zawierają konfigurację serwera Apache.
- `.vscode/ftp-kr.json` wygląda na lokalną konfigurację FTP/SFTP deployu i jest zmodyfikowany w working tree.
- `CLAUDE.md` opisuje reguły projektu: PHP, WordPress + WooCommerce, PSR-12, customizacje tylko w child theme albo dedykowanym pluginie.
## GDPR / Compliance
## Skala Repozytorium
| Plugin | Version |
|--------|---------|
| complianz-gdpr | 7.4.5 |
| complianz-terms-conditions | — |
| cookie-notice | 3.0.2 |
| wpconsent-cookies-banner-privacy-suite | — |
| really-simple-ssl | 9.5.9 |
| simple-cloudflare-turnstile | 1.39.0 |
- Plugin directories: 73 w `wp-content/plugins/`.
- Theme directories: 4 w `wp-content/themes/`.
- Najliczniejsze typy plików: `.php`, `.svg`, `.js`, `.css`, `.png`, `.json`.
- Repozytorium zawiera dużo kodu vendorowego; przy planowaniu zmian trzeba zawężać analizę do custom code i aktywnych integracji.
## Email
| Plugin | Version |
|--------|---------|
| easy-wp-smtp | 2.14.0 (primary) |
| wp-mail-smtp | — (secondary — potential conflict) |
## Frontend Assets
- **CSS:** Pre-compiled plain CSS — `wp-content/themes/betheme/css/be.css` (496KB), responsive.css, woocommerce.css
- **JS:** Pre-compiled plain JS — `wp-content/themes/betheme/js/scripts.js`, woocommerce.js
- **No build tooling:** No SASS, Webpack, or Gulp — assets are version-controlled compiled files
- **Skins:** 12 colour skins in `wp-content/themes/betheme/css/skins/`
## Deployment
- **Protocol:** FTP (plain, unencrypted) to `ftp.miody.nazwa.pl`
- **Remote path:** `/nowa`
- **Config:** `.vscode/ftp-kr.json` (credentials stored in file — security risk)
- **Strategy:** Manual upload — autoUpload disabled
- **Excluded from deploy:** `.git`, `.vscode`, `.paul`, `.serena`, `CLAUDE.md`
## Plugin Count
**76 plugins total** — heavy stack with significant duplication (see concerns.md)
---
*Aktualizuj po zmianie runtime, głównych pluginów, motywu albo sposobu deployu.*

View File

@@ -1,54 +1,60 @@
# Testing — krolewskie-miody.pl
# Testowanie
## Current Status
**Data analizy:** 2026-05-19
**No testing infrastructure is configured.**
## Status
CLAUDE.md acknowledges this: *"Testy — Uzupełnij jak uruchamiać testy"* (incomplete placeholder).
Nie znaleziono root konfiguracji testów dla projektu:
## What's Missing
- brak root `composer.json`;
- brak root `package.json`;
- brak root `phpunit.xml`;
- brak root konfiguracji lint/test dla custom code.
- No `phpunit.xml` or `phpunit.xml.dist`
- No `tests/` directory
- No `.github/workflows/` CI/CD pipelines
- No PHPUnit dependency in any `composer.json`
- No JavaScript test runner (Jest, Mocha, etc.)
- No automated code quality checks on commit
W katalogach vendorowych pluginów istnieją własne `phpunit.xml`, `composer.json`, `package.json`, `webpack.config.js`, `vite.config.ts` i podobne pliki, ale należą do zewnętrznych pluginów, a nie do wspólnego test runnera tego projektu.
## Recommended Setup
## Obszary Do Manualnej Weryfikacji
### PHPUnit (WordPress unit tests)
**Checkout i zamówienie:**
- dodanie produktu do koszyka;
- przejście checkoutu z aktywną metodą dostawy InPost;
- wybór Paczkomatu przez UI z `wp-content/plugins/ws-inpost-map/assets/js/frontend/checkout.js`;
- zapis order meta `paczkomat_id`;
- widoczność Paczkomatu w adminie zamówienia.
1. Install PHPUnit via Composer in a custom plugin or child theme:
```bash
composer require --dev phpunit/phpunit wp-phpunit/wp-phpunit
```
**Płatności:**
- PayU przez `wp-content/plugins/woo-payu-payment-gateway/`;
- Przelewy24 przez `wp-content/plugins/woocommerce-gateway-przelewy24/`;
- PayPal/WooPayments przez `wp-content/plugins/woocommerce-paypal-payments/` i `wp-content/plugins/woocommerce-payments/`.
2. Create `phpunit.xml`:
```xml
<phpunit bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="krolewskie-miody">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
```
**Dostawy:**
- `wp-content/plugins/ws-inpost-map/`;
- `wp-content/plugins/woocommerce-paczkomaty-inpost/`;
- `wp-content/plugins/inpost-for-woocommerce/`;
- `wp-content/plugins/inpost-paczkomaty/`;
- `wp-content/plugins/inpost-pay/`.
3. Place test files in `tests/` with `Test` suffix: `tests/class-checkout-test.php`
**Frontend i zgody:**
- render strony produktu, koszyka i checkoutu w aktywnym motywie;
- popup/cookie consent po zmianach trackingowych;
- brak konfliktu z GTM, Meta Pixel, PixelYourSite i Google Site Kit.
### Manual Testing Checklist (current practice)
## Zalecany Minimalny Setup
Since no automated tests exist, manual testing covers:
- Product listing and filtering
- Add to cart / cart updates
- Checkout flow (Przelewy24, PayU, PayPal)
- InPost locker selection
- Order confirmation emails (via Easy WP SMTP)
- Coupon application (flexible-coupons-pro)
- GDPR consent banner (Complianz)
- Dodać projektowy sposób uruchamiania testów w root, jeśli repo ma być rozwijane dłużej niż jednorazowo.
- Dla `wp-content/plugins/ws-inpost-map/` rozważyć testy jednostkowe PHP dla klas ustawień i zapisu order meta.
- Dla checkoutu używać testu e2e/manualnego scenariusza z prawdziwym koszykiem WooCommerce.
- Każda zmiana w checkout/dostawy/płatności powinna mieć checklistę regresji w planie PAUL.
## Notes
## Komendy
- WooCommerce 10.x ships with its own test utilities — can be leveraged for integration tests
- Code Snippets plugin stores custom PHP in DB — these snippets are not version-controlled or testable via standard tooling
Brak potwierdzonej komendy testowej dla całego projektu.
```bash
# Do ustalenia po dodaniu runnera:
# composer test
# npm test
```
---
*Aktualizuj po dodaniu root test runnera albo po ustaleniu środowiska staging.*

View File

@@ -1,87 +0,0 @@
# TODO — krolewskie-miody.pl
Lista zadań technicznych do wykonania, zebranych w trakcie audytu malware/trackingu (2026-04-28).
---
## Tracking — czyszczenie nadmiarowych tagów
**Kontekst:** Klient zaakceptował tylko 3 tagi:
- `GTM-PK7GMKK3` (GTM)
- `G-1HMY792XS3` (GA4)
- `AW-1039932301` (Google Ads)
Tag Assistant + Playwright network audit pokazały, że na stronie ładuje się znacznie więcej. Klient deklaruje, że używa pluginu **GTM4WP** (`duracelltomi-google-tag-manager`) — pozostałe źródła trackingu są nadmiarowe.
### 1. Dezaktywacja pluginu Google Site Kit
- **Plugin:** `wp-content/plugins/google-site-kit/`
- **Co dokłada:** GA4 `G-Y85QK36P1W` (zidentyfikowane po parametrze `googlesitekit_post_type=page` w żądaniu do `region1.google-analytics.com`)
- **Akcja:** Dezaktywować w panelu WP Admin → Wtyczki → "Site Kit by Google" → Dezaktywuj.
- Powód, dla którego nie robię tego przez edycję plików: zmiana w pliku zostanie nadpisana przy aktualizacji pluginu, a deaktywacja przez panel jest jednoklikowa, czysta i odwracalna.
- Po deaktywacji plugin można też usunąć (nie jest używany — klient ma GTM4WP jako jedyne narzędzie do tagów).
### 2. Linked destinations w kontenerze GTM-PK7GMKK3
W panelu **tagmanager.google.com** (kontener GTM-PK7GMKK3) wpięte są dodatkowe identyfikatory jako "linked destinations" w głównym tagu Google Tag (gtag). Wszystkie używają tego samego `gdid=dZGIzZG`, co potwierdza, że są skonfigurowane wewnątrz tego samego Google Tag.
**Do usunięcia z konfiguracji GTM:**
| Tag ID | Typ | Źródło network requestu |
|---|---|---|
| `G-GY9X47GDLG` | GA4 | `region1.google-analytics.com/g/collect?tid=G-GY9X47GDLG` |
| `G-HS6220BG6P` | GA4 | `region1.google-analytics.com/g/collect?tid=G-HS6220BG6P` |
| `G-QR9KQ1JQVB` | GA4 | `region1.google-analytics.com/g/collect?tid=G-QR9KQ1JQVB` |
| `GT-PZZ9FWF` | Google Tag | widoczne w Tag Assistant |
| `GT-TNSNL57S` | Google Tag | widoczne w Tag Assistant |
| `157146814` | Floodlight / DV360 | widoczne w Tag Assistant |
**Akcja:**
1. Wejść do `tagmanager.google.com` → kontener `GTM-PK7GMKK3`.
2. Tags → znaleźć główny Google Tag (gtag).
3. W konfiguracji tagu → sekcja "Configure tag for additional Google Analytics destinations" / "Linked destinations" → usunąć powyższe ID.
4. Zostawić tylko `G-1HMY792XS3` i `AW-1039932301`.
5. Zapisać i opublikować nową wersję kontenera.
**Zależność:** wymaga dostępu do konta Google Tag Manager klienta. Sprawdzić, kto ma uprawnienia administratora kontenera GTM-PK7GMKK3.
### 3. Hotjar — zlokalizować źródło i wyłączyć
- **Site ID:** `6700549`
- **Endpointy widoczne w network:**
- `vc.hotjar.io/sessions/6700549`
- `content.hotjar.io/?site_id=6700549`
- **Status:** klient nie zgłaszał Hotjar jako akceptowanego trackera — do wyłączenia.
- **Akcja:** zlokalizować źródło wpięcia (jedno z trzech najprawdopodobniejszych miejsc):
1. **Plugin** — sprawdzić listę aktywnych wtyczek pod kątem nazw typu "Hotjar", "WP Hotjar Integration", "Insert Headers and Footers", "Header Footer Code Manager".
2. **GTM** — sprawdzić w `GTM-PK7GMKK3` czy nie ma Custom HTML tagu z `static.hotjar.com/c/hotjar-6700549.js`.
3. **BeTheme Custom Code** — Theme Options → Custom Code → Header/Footer JS.
- Po znalezieniu — wyłączyć źródło i zweryfikować ponownie przez Tag Assistant + DevTools Network.
---
## Bezpieczeństwo / wcześniejsze ustalenia z tej sesji
### 4. Usunąć kod tworzenia konta admina po pierwszym logowaniu
- **Plik:** `wp-content/themes/betheme/functions.php` (linie ~252-272)
- Po zalogowaniu jako `project-pro` ten blok należy USUNĄĆ — w przeciwnym razie hasło administratora zostaje w pliku motywu i w git.
### 5. Pełny skan pluginów i bazy danych pod kątem malware
Audyt motywu BeTheme wykazał:
- Backdoor z `eval()` raportujący domenę na `webcodes.pl/aktywacje/lista.php` (usunięty z `functions.php`)
- 2 ukryte bloki SEO-spamu z linkami do kasyn (`fontan.kiev.ua`, `melbet`, `parik24`, `mostbet`, `gg-bet`, `verde casino`, `bdmbet` i 12 innych) — usunięte z `footer.php`
- Pirackie BeTheme z dystrybucji `gpltimes.com` (kod był w `functions.php`, częściowo zostawiony tylko w `class-mfn-importer-api.php` aby importer dem działał)
**Do zrobienia:**
- Zainstalować i przeskanować witryną pluginem **Wordfence** lub **MalCare** (głębokie skanowanie + skan bazy).
- Sprawdzić tabelę `wp_users` pod kątem nieautoryzowanych kont admina.
- Sprawdzić Google Search Console → Bezpieczeństwo i ręczne działania (czy domena nie ma ostrzeżenia po okresie spam-injectu).
- **Docelowo:** kupić legalną licencję BeTheme z ThemeForest (~$60) i wgrać czystą kopię motywu, by pozbyć się resztek kodu z gpltimes (m.in. `class-mfn-importer-api.php` linie ze ściąganiem dem z f004.backblazeb2.com/file/gpltimes/).
### 6. Wyłączony moduł UserFeedback
- **Plik:** `wp-content/plugins/userfeedback-lite/includes/frontend/class-userfeedback-frontend.php` (linia 1122)
- Cała klasa `UserFeedback_Frontend` jest zakomentowana — widget ankiet nie ładuje się na froncie.
- **Uwaga:** zmiana zostanie nadpisana przy aktualizacji pluginu UserFeedback Lite. Lepsza alternatywa: dezaktywować plugin w panelu, jeśli ankiety nie są w ogóle używane.

View File

@@ -0,0 +1,53 @@
# Tooling Status
## Ostatni Skan
- Timestamp: 2026-05-19 14:47:48 +02:00
- Scan mode: `full`
- Scope: `entire repository`
- Status: degraded
## Narzędzia
- `codebase-memory-mcp` CLI: `0.6.1`.
- `codebase-memory-mcp` MCP server: dostępny; projekt `C-visual-studio-code-projekty-krolewskie-miody.pl` został dodany do listy projektów.
- `jscpd`: disabled by policy (`quality_radar.tools.jscpd: false`).
- `ast-grep`: disabled by policy (`quality_radar.tools.ast_grep: false`).
- `rg`: użyte jako fallback dla zawężonych wyszukiwań.
## Wyniki MCP
- `get_architecture` zwróciło podsumowanie grafu:
- nodes: 292163
- edges: 823931
- najwięcej node labels: `Method`, `File`, `Module`, `Variable`, `Class`, `Function`
- route nodes: 78
- Szerokie `search_graph` dla checkout/payment/API/database timeoutowały po 120s.
- `index_status` timeoutował po 120s.
## Komendy / Akcje
- `codebase-memory-mcp --version`
- `codebase-memory-mcp/index_repository` w init zakończył się timeoutem, ale indeks pojawił się później w `list_projects`.
- `get_architecture` przez MCP.
- Zawężone odczyty plików `wp-content/plugins/ws-inpost-map/`.
- Zawężone skany `rg` po hookach, DB i TODO/FIXME z wyłączeniem części vendorów.
## Raw Output Paths
- `.paul/codebase/radar/codebase-memory-full.txt`
## Next Action
Użyj `$paul-plan [work]` dla konkretnej zmiany. Przy planowaniu zawęź radar do konkretnych plików, bo szerokie zapytania po całym vendor-heavy repo są wolne.
## Post-Apply: InPost Pay / `wp_body_open`
- Timestamp: 2026-05-19T15:35:26+02:00
- Scan mode: `post-apply`
- Scope: `.paul/plans/20260519-1532-naprawa-inpost-pay-wp-body-open/PLAN.md`
- Status: degraded
- Modified by apply: `wp-content/themes/betheme/header.php`
- Verification: `rg` potwierdził `wp_body_open()` bezpośrednio po `<body <?php body_class(); ?>>`.
- PHP lint: skipped, `php` nie jest dostępny w PATH.
- Raw output: `.paul/codebase/radar/codebase-memory-post-apply-20260519-1532-naprawa-inpost-pay-wp-body-open.txt`