cleantalk_ln10_reverted.ag#660
Conversation
…before init hook.
…f methods implemented.
# Conflicts: # security-malware-firewall.php
There was a problem hiding this comment.
Pull request overview
Introduces an "early translation" subsystem that lets the plugin translate a small registry of strings before WordPress's init hook (when __() is not yet safe). It adds an abstract EarlyTranslation base class that loads MO files directly, tracks errors/untranslated entities, and persists them; a WP-specific SpbcEarlyTranslation subclass that stores stats in an option and gates tracking by domain; a global __spbc() helper used at one early call site; debug exposure via RemoteCalls::action__debug; and PHPUnit coverage.
Changes:
- New
CleantalkSP\Common\EarlyTranslationabstract class andCleantalkSP\SpbctWP\SpbcEarlyTranslationsubclass implementing MO-based early translation, error tracking, and a registry-consistency validator (checkWPTranslationReady). - New
__spbc()global helper insecurity-malware-firewall.php, plus replacement of one early__()call inspbc_check_account_status, and exposure of translation stats inRemoteCalls::action__debug. - New unit tests for
EarlyTranslation(via a stub) andSpbcEarlyTranslation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/CleantalkSP/Common/EarlyTranslation.php | New abstract base for early translation, MO loading, error tracking, registry validator. |
| lib/CleantalkSP/SpbctWP/SpbcEarlyTranslation.php | WP-specific subclass: option-based persistence, domain-gated tracking, stats, registry. |
| security-malware-firewall.php | Adds __spbc() helper (lazy singleton + init hook) and uses it in spbc_check_account_status. |
| lib/CleantalkSP/SpbctWP/RemoteCalls.php | Adds translation stats to debug remote-call output. |
| tests/lib/CleantalkSP/SpbctWP/testEarlyTranslation.php | Tests EarlyTranslation behavior via an in-file stub subclass. |
| tests/common/testSpbcEarlyTranslation.php | Tests SpbcEarlyTranslation save/load, trimming, stats, and __spbc global parity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…try word. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… cleantalk_ln10_reverted.ag
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
tests/common/testSpbcEarlyTranslation.php:3
- The namespace
common(lowercase, top-level) is inconsistent with the rest of the test suite. Existing common tests usenamespace Common;(e.g.tests/сommon/SpbcCronTest.php:3) ornamespace CleantalkSP\Common;(e.g.tests/сommon/TextPlateTest.php:3), and SpbctWP tests usenamespace CleantalkSP\SpbctWP\.... Please align this file with one of those conventions (most likelyCleantalkSP\SpbctWPsince the class under test lives there, orCommon/CleantalkSP\Commonif you want to keep it grouped with common tests).
namespace common;
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… cleantalk_ln10_reverted.ag
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
https://app.doboard.com/1/task/49593