docs(cms): update specifications for SW_FILE helper and restore system

- Renamed file() helper to sw_file() to avoid PHP conflict.

- Added Restore System specification to CMS notes and specs.
This commit is contained in:
Funky Waddle 2026-04-13 12:47:41 -05:00
parent d0214eb2fd
commit 42ddb5cf1a
2 changed files with 5 additions and 2 deletions

View file

@ -38,6 +38,7 @@
- Performance (Full-Page Caching, Image Optimization)
- Security (2FA, Security Audits)
- Backups (Database & Files accessible via Admin and `sw site:backup`)
- Restore System (Restore from backup via Admin or `sw site:restore`)
- Settings (Site Title/Description, SEO, Configurable Blog "Home" segment)
## Architectural Decisions
@ -57,4 +58,4 @@
- **Reserved Slugs**: `loom`, `admin`, `api`, `login`, `logout`, `register`, `sw-admin`, `dashboard`.
- **Multi-Tenancy**: Architecture allows for future expansion.
- **Unified Vite Build Pipeline**: Shared pipeline for Core and Official Plugins.
- **Asset Conflict Management**: Each Plugin/Theme uses custom root-level CSS class (e.g., `.blog`) for styles and JS.
- **Asset Conflict Management**: Each Plugin/Theme uses custom root-level CSS class (e.g., `.blog`) for styles and JS.

View file

@ -51,10 +51,11 @@ Content is stored as a JSON array of block objects:
- **Helpers**:
- `css('path', $attributes)`: Outputs a `<link>` tag.
- `js('path', $attributes)`: Outputs a `<script>` tag.
- `file('path', $attributes)`: **Smart Asset Helper**. Automatically detects file type (via extension/metadata) and outputs the appropriate HTML tag (`<img>` with `srcset` support, `<video>`, `<audio>`, or `<a>` for documents like PDF).
- `sw_file('path', $attributes)`: **Smart Asset Helper**. Automatically detects file type (via extension/metadata) and outputs the appropriate HTML tag (`<img>` with `srcset` support, `<video>`, `<audio>`, or `<a>` for documents like PDF).
- **JIT Image Parameters**: For images, special keys in the `$attributes` array like `w`, `h`, `fit`, `q` (quality), and `fm` (format) are automatically intercepted and passed to the JIT image generation engine.
- **Functionality**: These helpers output the **FULL HTML TAG**.
- **Attributes**: The optional `$attributes` array allows for specifying `defer`, `async`, `media`, `id`, `class`, `alt`, `w`, `h`, etc.
- **Note**: `sw_file()` is used instead of `file()` to avoid conflicts with PHP's built-in `file()` function.
- **Recursive Search**: The engine first looks in the current Theme folder. If a Child Theme is active and the file is missing, it automatically falls back to the Parent Theme folder.
## 5. Media Manager Specification
@ -78,3 +79,4 @@ Content is stored as a JSON array of block objects:
- **Full-Page Caching**: Native public-route caching.
- **Security Audits**: Automated periodic auditing for activated plugins.
- **Backups**: `sw site:backup` and Admin-side trigger to snapshot the SQLite DB and project root.
- **Restore**: `sw site:restore` and Admin-side UI to select and restore from existing backup files.