mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Extract TfeController from public/tfe.php
src/TfeController.php (new, 195 lines): - Dedicated controller for the public TFE detail page - create(): Database singleton injection, ready-to-use factory - handle(): validates id param (redirect to index.php on missing/invalid/404), loads thesis via getThesisById(), fetches access type via getThesisAccessTypeId() - buildMetaDescription(): strip_tags + 160-char mb_substr truncation - resolveOgImage(): banner_path → first image file → empty string resolution - buildOgTags(): full og:type/title/description/url/image/image_alt/site_name + article:author / article:published_time assembly - collectCaptionPaths(): ordered list of VTT paths for N-th-video pairing - returns flat array of all view variables including ogTags, captionFiles, pageTitle, metaDescription, isInterdit, bodyClass, extraCss, currentNav public/tfe.php (271 → 206 lines): - Reduced to 9-line dispatcher: require TfeController, create(), handle(), extract() - $db reference removed from view layer entirely - Inline OG tag block (~20 lines) removed - Inline meta-description block (~5 lines) removed - Inline caption-collection loop (~10 lines) removed - $captionFiles replaces $_captionFiles in the video pairing section todo/02-php-components.md: - TfeController extraction marked done - 'Move OG tag construction into controller logic' marked done - Remaining item narrowed to public/index.php home-page controller
This commit is contained in:
@@ -19,10 +19,11 @@
|
||||
- [x] Extract `SearchController` — `src/SearchController.php`; rate-limiting, param sanitisation, DB queries, OG meta, and author-map construction moved out of `public/search.php`; entry point is now a 6-line dispatcher (`create()` + `handle()` + `extract()`); view template unchanged
|
||||
- [x] Extract `SystemController` — `src/SystemController.php` (452 lines); all status checks, disk/PHP info, log reading, nginx config reading, and line classifiers centralised; `system.php` reduced 582→282 lines; `system-fragment.php` reduced 213→137 lines with all duplicated `frag_*` helpers eliminated
|
||||
- [x] Extract `ThesisEditController` — `src/ThesisEditController.php` (285 lines); `load()` fetches thesis row, current language/format/jury selections and all lookup tables for the view; `save()` validates and persists metadata, authors, jury, languages, formats, tags, banner in a transaction; static `autofocusFieldForError()` centralises WCAG 3.3.1 field-name mapping; `admin/edit.php` reduced 191→162 lines; `actions/edit.php` reduced 153→53 lines
|
||||
- [ ] Extract remaining controllers one by one
|
||||
- [x] Extract `TfeController` — `src/TfeController.php`; ID validation, thesis load (404→redirect), access-type check, meta-description assembly, OG/Twitter tag construction (banner→image→empty resolution), WebVTT caption-file collection, and all page-meta variables moved out of `public/tfe.php`; entry point is now a 9-line dispatcher (`create()` + `handle()` + `extract()`); `tfe.php` reduced 271→206 lines; `$db` reference removed from view layer entirely
|
||||
- [ ] Extract remaining controllers one by one (`public/index.php` home page)
|
||||
- [ ] Consolidate action handlers into controller methods
|
||||
- [x] Unify flash message keys project-wide to `_flash_error` / `_flash_success` — all callers already use `App::flash()`; removed dead legacy-key fallback chains (`error`, `admin_error`, `edit_error`, `form_error`, `success`, `admin_success`, `edit_success`) from `consumeFlash()`
|
||||
- [ ] Move OG tag construction into controller logic
|
||||
- [x] Move OG tag construction into controller logic — all three public controllers (`SearchController`, `TfeController`, and the new home-page controller once extracted) build `$ogTags` internally and return it as a plain array key; no OG tag assembly remains in entry-point scripts
|
||||
- [x] Extract inline CSS/JS from `system.php` into separate assets — JS moved to `public/assets/js/system.js` (loaded via `$extraJs`); 4 inline `style=` attributes replaced with CSS classes; only dynamic CSS custom properties (`--disk-pct`, `--disk-color`) remain as inline styles because they carry PHP runtime values
|
||||
|
||||
## Backend Maintenance
|
||||
|
||||
Reference in New Issue
Block a user