Skip to content

cleantalk_ln10_reverted.ag#660

Open
alexandergull wants to merge 23 commits into
devfrom
cleantalk_ln10_reverted.ag
Open

cleantalk_ln10_reverted.ag#660
alexandergull wants to merge 23 commits into
devfrom
cleantalk_ln10_reverted.ag

Conversation

@alexandergull
Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\EarlyTranslation abstract class and CleantalkSP\SpbctWP\SpbcEarlyTranslation subclass implementing MO-based early translation, error tracking, and a registry-consistency validator (checkWPTranslationReady).
  • New __spbc() global helper in security-malware-firewall.php, plus replacement of one early __() call in spbc_check_account_status, and exposure of translation stats in RemoteCalls::action__debug.
  • New unit tests for EarlyTranslation (via a stub) and SpbcEarlyTranslation.

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.

Comment thread lib/CleantalkSP/Common/EarlyTranslation.php Outdated
Comment thread lib/CleantalkSP/Common/EarlyTranslation.php Outdated
Comment thread tests/lib/CleantalkSP/SpbctWP/testEarlyTranslation.php Outdated
Comment thread lib/CleantalkSP/SpbctWP/SpbcEarlyTranslation.php
Comment thread security-malware-firewall.php Outdated
Comment thread lib/CleantalkSP/SpbctWP/RemoteCalls.php
Comment thread lib/CleantalkSP/Common/EarlyTranslation.php Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 use namespace Common; (e.g. tests/сommon/SpbcCronTest.php:3) or namespace CleantalkSP\Common; (e.g. tests/сommon/TextPlateTest.php:3), and SpbctWP tests use namespace CleantalkSP\SpbctWP\.... Please align this file with one of those conventions (most likely CleantalkSP\SpbctWP since the class under test lives there, or Common/CleantalkSP\Common if you want to keep it grouped with common tests).
namespace common;

Comment thread tests/common/testSpbcEarlyTranslation.php
Comment thread tests/lib/CleantalkSP/SpbctWP/testEarlyTranslation.php
Comment thread security-malware-firewall.php Outdated
Comment thread lib/CleantalkSP/Common/EarlyTranslation.php
Comment thread security-malware-firewall.php
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread lib/CleantalkSP/Common/EarlyTranslation.php Outdated
Comment thread lib/CleantalkSP/Common/EarlyTranslation.php Outdated
Comment thread tests/lib/CleantalkSP/SpbctWP/testEarlyTranslation.php
alexandergull and others added 3 commits May 19, 2026 16:10
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants