refactor: DiviSaver docblocks, one diviWritable field, REASON_CREATE with the constants (M-4, M-5, M-13)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,18 +40,19 @@ defined('ABSPATH') || exit;
|
||||
* those hooks except the content itself (already cleaned); anything a third-party hook writes
|
||||
* there is saved without kses, as it would be for an administrator. The rollback write in
|
||||
* restore() uses the same window with the previous stored content; saveNew() (the first layout
|
||||
* of a new draft, lit/content-create) uses it for its single wp_update_post().
|
||||
* of a new post – a draft of lit/content-create or a library entry of lit/library-save) uses it
|
||||
* for its single wp_update_post().
|
||||
*
|
||||
* Divi's own save filters are NOT kses and are never removed (ruling S7, defense in depth):
|
||||
* Security::initialize() (Divi 5.2.1 Security.php:74-81) registers on wp_insert_post_data
|
||||
* AttributeSecurity (priority 5, always), HtmlSecurity (priority 6, by capability) and
|
||||
* DynamicContentFixes (priority 10: strips enable_html for users without unfiltered_html). The first two re-serialize
|
||||
* the whole page when it holds custom attributes or htmlBefore/htmlAfter/elementType, so on such
|
||||
* DynamicContentFixes (priority 10: strips enable_html for users without unfiltered_html). The first
|
||||
* two re-serialize the whole page when it holds custom attributes or htmlBefore/htmlAfter/elementType, so on such
|
||||
* pages the bytes change for every user – reported as CHANGED_ON_SAVE. Finding R2 / rulings
|
||||
* S5, S7: docs/superpowers/notes/2026-09-26-etappe-2-entscheidungen.md.
|
||||
*
|
||||
* SaveScope: Bibliothekseinträge bekommen keine Divi-Flags; ein globaler Eintrag leert zusätzlich den CSS-Cache
|
||||
* aller Seiten und den Theme-Builder-Cache.
|
||||
* SaveScope: library entries get no Divi flags; a global (or referenced) entry additionally clears
|
||||
* the static CSS of every page and the Theme Builder cache.
|
||||
*
|
||||
* If saving throws, the previous content is written back (WriteFailed: rolled back or not).
|
||||
* Not final so abilities can be tested with a mock.
|
||||
@@ -131,12 +132,13 @@ class DiviSaver
|
||||
}
|
||||
|
||||
/**
|
||||
* The first content of a brand-new draft (lit/content-create with divi, which inserted the
|
||||
* draft with its normal WordPress fields – title and excerpt went through kses as usual).
|
||||
* Same kses window as save(), holding only this wp_update_post() and its hooks; no restore
|
||||
* point (the draft has no earlier state) and no static CSS to clear. The Divi flags are part
|
||||
* of the write here: without them the new entry is no Divi layout. Every failure throws –
|
||||
* the caller deletes the draft (all or nothing).
|
||||
* The first content of a brand-new post: a draft of lit/content-create with divi or a library
|
||||
* entry of lit/library-save, both inserted with their normal WordPress fields first (title and
|
||||
* excerpt went through kses as usual). Same kses window as save(), holding only this
|
||||
* wp_update_post() and its hooks; no restore point (the post has no earlier state) and no
|
||||
* static CSS to clear. With SaveScope::Page the Divi flags are part of the write (without them
|
||||
* a new page is no Divi layout); SaveScope::LibraryItem sets none. Every failure throws – the
|
||||
* caller deletes the new post (all or nothing).
|
||||
*
|
||||
* @return list<string> Warnings (CHANGED_ON_SAVE).
|
||||
* @throws RuntimeException
|
||||
|
||||
Reference in New Issue
Block a user