feat: v2.3.0#10
Conversation
Composer package changes
|
0b6724b to
0857188
Compare
b097303 to
ec47013
Compare
9ee1e91 to
e363840
Compare
| <?php | ||
|
|
||
| <?php | ||
| $cronLastRun = \Yard\PageGuard\WPCron\WPCronServiceProvider::lastRun(); |
There was a problem hiding this comment.
Zou ook mooi vanuit een controller kunnen komen.
228d3d0 to
e0a7400
Compare
SimonvanWijhe
left a comment
There was a problem hiding this comment.
We moeten het even hebben over de TipTap editor..
Heb je dat echt nodig? Ik zit er een beetje mee dat dit onderhouden moet worden en we het verder nergens gebruiken. Wat kan er niet met wisywig?
There was a problem hiding this comment.
Pull request overview
This PR bumps Yard Page Guard to v2.2.0, focusing on modernising the admin experience (settings page + rich editor), adding an admin-visible email log, and tightening core logic around scheduling, tokens, and content-owner handling—backed by a new PHPUnit suite and CI.
Changes:
- Adds an Email log CPT + recorder + retention purge, and extends email sending to emit structured context for logging.
- Rebuilds the settings page UI and replaces the WYSIWYG with a Tiptap editor (incl. placeholder/button migrations and cron status UI).
- Refactors metabox logic (access/renderer/saver), introduces a dedicated admin capability granted on activation, and adds extensive unit tests + PHP CI.
Reviewed changes
Copilot reviewed 64 out of 75 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| yard-page-guard.php | Version bump and adds activation hook wiring. |
| activate.php | Grants the plugin admin capability on activation. |
| deactivate.php | Unschedules cron and removes the plugin admin capability on deactivation. |
| vite.config.js | Switches to isolated per-entry IIFE builds to avoid WP global collisions. |
| package.json | Updates build script to run two builds; adds Tiptap deps. |
| composer.json | Adds platform config, expands translate script scope, adds dev stubs. |
| composer.lock | Locks updated dependencies/platform override. |
| config/core.php | Registers the new EmailLog service provider. |
| README.md | Major documentation refresh (configuration, security, architecture, testing). |
| LICENSE.md | Removes the MIT license file. |
| .gitattributes | Adds export-ignore rules to keep archives lean. |
| .gitignore | Stops ignoring sourcemaps; ensures .gitattributes is tracked. |
| .prettierignore | Ignores generated translation JSON files. |
| .github/workflows/test-php.yml | Adds PHPUnit CI matrix (PHP 7.4 + 8.3). |
| .github/workflows/npm-lock-diff.yml | Adds lockfile diff workflow reuse. |
| .github/workflows/format-php.yml | Pins PHP version for formatting workflow. |
| languages/yard-page-guard-en_GB-4a13f87bb595e0a1be4d755d78dacc88.json | Adds admin.js translation JSON output. |
| resources/js/admin.js | Adds Tiptap mounting, time input masking, and cron countdown. |
| resources/js/tiptap-editor.js | New Tiptap editor implementation for settings page fields. |
| resources/js/button-mark.js | Adds a custom “button link” mark for Tiptap output. |
| resources/css/admin.css | New settings page styling, editor UI styling, and email log styling. |
| resources/css/frontend.css | Updates CTA/button styling for footer buttons. |
| build/admin.css | Rebuilt compiled admin CSS output. |
| build/frontend.css | Rebuilt compiled frontend CSS output. |
| src/PageGuard/Foundation/AdminCapability.php | Introduces a plugin-specific capability gate with filters + role grant helpers. |
| src/PageGuard/Admin/AdminServiceProvider.php | Adds migrations, script translations handling, and email log screen asset loading. |
| src/PageGuard/Admin/Controllers/AdminSettingsController.php | Gates settings behind AdminCapability; adds cron send time option sanitization. |
| src/PageGuard/Admin/Controllers/AdminOverviewController.php | Gates overview/menu; adds submenu entries for Email log + Settings. |
| src/PageGuard/Admin/Services/AdminOverviewService.php | Updates bulk-edit parsing to use the new ContentOwner value object. |
| src/PageGuard/Admin/Views/AdminSettingsPage.php | Replaces old table layout with card UI + Tiptap editor mounts + cron status. |
| src/PageGuard/Admin/EmailPlaceholderMigration.php | Migrates {1}/{2} placeholders to {name}/{item_list} in stored templates. |
| src/PageGuard/Admin/FooterButtonMigration.php | Migrates legacy “bold-link button” markup to <a class="ypg-button">…</a>. |
| src/PageGuard/EmailLog/EmailLogServiceProvider.php | Registers email log post type, recorder, and retention. |
| src/PageGuard/EmailLog/EmailLog.php | Implements the ypg_email_log CPT, UI columns, filters, and read-only behaviours. |
| src/PageGuard/EmailLog/EmailLogRecorder.php | Records each outgoing mail into the CPT (via ypg/email_sent). |
| src/PageGuard/EmailLog/EmailLogRetention.php | Purges email log entries older than the retention window on daily cron. |
| src/PageGuard/WPCron/WPCronServiceProvider.php | Adds configurable send time, last-run tracking, and rescheduling logic. |
| src/PageGuard/WPCron/Events/ReviewNotification.php | Uses named placeholders and passes items context into email logging. |
| src/PageGuard/WPCron/Events/ReminderNotification.php | Uses named placeholders, passes items context, and advances reminder dates robustly. |
| src/PageGuard/Traits/Email.php | Adds ypg/email_sent action + logging context; adds item flattening helper. |
| src/PageGuard/Traits/Text.php | Switches to named placeholders and parses owners via ContentOwner::fromString(). |
| src/PageGuard/Traits/Token.php | Tightens query parsing and requires YPG_AUTH_SALT for token generation. |
| src/PageGuard/Traits/Date.php | Refactors date logic, adds validation, unit resolution, and “advanceToFuture” behaviour. |
| src/PageGuard/Enums/DateUnit.php | Adds a closed set enum-like helper for date units. |
| src/PageGuard/Enums/ContentOwnerType.php | Adds enum-like helpers (cases/tryFrom/from) with validation. |
| src/PageGuard/Models/ContentOwner.php | Converts owner to an immutable validated value object with factories. |
| src/PageGuard/Models/ReviewItem.php | Uses ContentOwner::fromPostMeta() for reconstruction. |
| src/PageGuard/Metabox/MetaboxServiceProvider.php | Splits metabox responsibilities and registers migration. |
| src/PageGuard/Metabox/MetaboxAccess.php | Centralises auth/save gating for metabox-related handlers. |
| src/PageGuard/Metabox/MetaboxRenderer.php | Renders metabox UI using the new access checks. |
| src/PageGuard/Metabox/MetaboxSaver.php | Persists metabox fields using ContentOwner + updated date logic. |
| src/PageGuard/Metabox/InternalDataSync.php | Extracts third-party “internal data” mirroring into a dedicated class. |
| src/PageGuard/Metabox/InternalDataSyncMigration.php | One-off migration to rewrite legacy internal-data title keys. |
| src/PageGuard/Metabox/Metabox.php | Removes the old monolithic Metabox implementation. |
| src/PageGuard/Taxonomy/ExternalOwnerTaxonomy.php | Triggers post updates when external owner details change. |
| src/PageGuard/Frontend/FrontendServiceProvider.php | Uses plugin version for frontend asset cache-busting. |
| tests/bootstrap.php | Improves test bootstrapping stubs for WP classes. |
| tests/TestCase.php | Adds WP_Mock lifecycle wiring and modernises reflection helper behaviour. |
| tests/Traits/TokenTest.php | Adds unit tests for token generation/verification and query parsing. |
| tests/Traits/TextTest.php | Adds tests for placeholder replacement, HTML minify, and owner parsing. |
| tests/Traits/DateTest.php | Adds tests covering date validation, recompute rules, and recurrence logic. |
| tests/Models/ContentOwnerTest.php | Adds tests for ContentOwner invariants and factories. |
| tests/Metabox/MetaboxAccessTest.php | Adds tests for save gating and access rules. |
| tests/Foundation/AdminCapabilityTest.php | Adds tests for capability name/roles behaviour and role grants. |
| tests/Enums/DateUnitTest.php | Adds tests for DateUnit validation helpers. |
| tests/Enums/ContentOwnerTypeTest.php | Adds tests for ContentOwnerType validation helpers. |
Files not reviewed (2)
- build/admin.css: Generated file
- build/frontend.css: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public function register(): void | ||
| { | ||
| add_action('ypg/email_sent', [$this, 'record'], 10, 6); | ||
| } |
| makeButton( | ||
| '<u>U</u>', | ||
| 'Onderlijnd (Ctrl+U)', | ||
| () => editor.chain().focus().toggleUnderline().run(), | ||
| { isActive: () => editor.isActive('underline') } | ||
| ), |
| <div class="ypg-field"> | ||
| <label for="ypg_review_email_subject"><?= esc_html(__('Onderwerp', 'yard-page-guard')) ?></label> | ||
| <input type="text" id="ypg_review_email_subject" name="ypg_review_email_subject" value="<?= esc_attr(get_option('ypg_review_email_subject', __('Controleer jouw webpagina(\'s)', 'yard-page-guard'))); ?>" /> | ||
| </div> |
| <div class="ypg-field"> | ||
| <label for="ypg_reminder_email_subject"><?= esc_html(__('Onderwerp', 'yard-page-guard')) ?></label> | ||
| <input type="text" id="ypg_reminder_email_subject" name="ypg_reminder_email_subject" value="<?= esc_attr(get_option('ypg_reminder_email_subject', __('Herinnering controle webpagina(\'s)', 'yard-page-guard'))); ?>" /> | ||
| </div> |
| if (! $this->access->currentUserHasAccess($postId)) { | ||
| return $html . sprintf('<p><b>%s</b></p>', __('U heeft geen toestemming om de houdbaarsheids module te bewerken.', 'yard-page-guard')); | ||
| } |
| add_menu_page( | ||
| __('Houdbaarheids Overzicht', 'yard-page-guard'), | ||
| __('Houdbaarheids Overzicht', 'yard-page-guard'), | ||
| apply_filters('yard::page-guard/capability/admin', 'edit_pages'), | ||
| AdminCapability::name(), |
dc959ac to
9345c4b
Compare
dbfe023 to
eba663f
Compare
Rebase the v2.2 feature work onto the open-sourced main (which took the
2.2 release), squashed and released as 2.3.0.
Feature work brought over:
- Email log CPT (ypg_email_log) with recorder + daily retention sweep
- Settings-page rich editing via WordPress' bundled TinyMCE (wp.editor),
replacing the earlier Tiptap/ProseMirror editor; custom {name}/{item_list}
placeholder buttons and a styled ypg-button CTA
- Metabox monolith split into Access / Renderer / Saver / InternalDataSync
- Stricter review-token query handling + immutable ContentOwner value object
- PHPUnit suite (wp_mock)
Reconciled with main's open-source hardening:
- Kept generateKeyedHash salt cascade (YPG_AUTH_SALT/AUTH_SALT wp-config
constants + env fallback) and wp-config endpoint constants in Token
- Kept the filterable review-user login (ReviewUser trait, FrontendServiceProvider)
- Ported main's internal-data-sync changes into the new InternalDataSync:
OWC-host detection, enable-internal-data-sync filter, and the
after-internal-data-synced / -removed actions
- Kept EUPL-1.2 license, newer devDeps (Vite 8), README open-source docs
4dccab3 to
a358c66
Compare
b9e3946 to
278c50f
Compare
278c50f to
734323d
Compare
Wijzigingen samengevat:
.gitattributestoegevoegd