refactor: ValueCleaner is the named choke point (H1)
The choke point moves out of AttrWriter into ValueCleaner (catalog, the composition's VariableRef, sanitizer): clean() (was AttrWriter::cleanValue), kindOf(), guardPath() and the private cleanNode/kind/unknownKind/tightens with VALUE_KEY, URL_KEY, URL_SEGMENT, STRICTNESS, BUILDER_ONLY (its docblock now sits on it; STRUCTURE stays in AttrWriter). Code of the pipeline moved unchanged. - ValueCleaner's docblock is the one canonical description: steps 0-8 with their rulings in code order, invariants I1-I3; the step comments in cleanNode carry the same numbers. AttrWriter/ShortformWriter/Composer/TextReplacer docblocks point there and keep only their own rules. - ValueCleaner::textReplacementFor($module) holds the D10 rule that was a closure in DiviReplaceTextAbility::replace (text/html only, clean() by kind). - AttrWriter, ShortformWriter and Composer take the ValueCleaner; DiviComposition builds one per composition (cleaner()). Tests: the eight AttrWriterTest methods that only exercised cleanValue/kindOf moved verbatim to ValueCleanerTest (clean/kindOf, ComposeFixture::cleaner()); mixed tests call the cleaner in place; +1 test for textReplacementFor. Every provider row and per-test assertion count unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -29,8 +29,8 @@ use WP_Error;
|
||||
* (DiviWriter::composition). Should the entry's map refuse something (an option Divi offers
|
||||
* only for other types), write() returns the errors and lit/content-create deletes the draft.
|
||||
*
|
||||
* Every client string goes through Composer (AttrWriter / ShortformWriter) – the single choke
|
||||
* point that makes the kses bypass safe (spec D7).
|
||||
* Every client string goes through Composer (AttrWriter / ShortformWriter → ValueCleaner) – the
|
||||
* single choke point that makes the kses bypass safe (spec D7).
|
||||
*/
|
||||
final class DiviContentComposer implements ContentComposer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user