Tools
Tools
Shared across every PremiumPress product. 4 classes in inc/Tools.
BlockExplorer BlockExplorer.php
Block Explorer tool — a read-only catalogue of the theme's block library and page templates. Admin-only, behind a "PremiumPress → Block Explorer" screen. It derives everything live from the single sources of truth (Blocks\Registry via Studio\Picker for categories/labels/icons, and Designs\Registry for the page templates), so the counts and lists always match what the site actually ships — nothing here is hard-coded. It also serves a standalone, admin-only front-end preview of a single block (?ppt_block_preview=1&ppt_bkey=<key>) so the explorer can show each block, rendered with the real theme CSS/tokens/fonts, inside an iframe. Same self-contained template_redirect approach as Frontend\ChromePreview.
DeleteAll DeleteAll.php
Delete all data — the "start again from empty" button on the Sample Data screen. Where {@see SampleData} removes only what it seeded (rows carrying the ppt-demo marker), this removes EVERYTHING the site has accumulated: every post of every post type, every comment and review, every term in every taxonomy, every non-administrator user, the whole media library (files included) and every {prefix}ppt_* table the theme owns. CONFIGURATION is very nearly untouched. Nothing in wp_options is deleted except caches, one stale id cache and the one-shot "already seeded" markers for the vocabularies this run has just emptied — so the theme type, settings, branding, custom fields, memberships and payment config all survive intact. See purgeCleanup() for why the seed markers have to go with the terms. The ONE deliberate exception is the INSTALL RECORD. An empty site is not a configured site, so the last step hands the theme back to the setup wizard exactly as the Settings "Reset theme" control does: ppt_installed, the license key, the licence fingerprint and update cache, the active design and every saved Site-Generator design go, and the next admin request asks for the key again. purgeReset() is the copy of Installer::handleReset() that does it — change one and change the other. Irreversible and unrecoverable, so it is gated four ways: the manage_options capability, a nonce, a typed confirmation word, and a browser confirm(). Deletion runs in bounded AJAX batches (a 10,000-listing test dataset cannot be removed inside one PHP request), stepping through posts → comments → terms → users → tables → cleanup → reset, driven by a JS loop that re-asks for the current counts each time.
FillSite FillSite.php
Fill Website — the "give me something to look at everywhere" button on the Sample Data screen. Where {@see SampleData} seeds a curated, niche-flavoured demo set (real titles, real photography, believable prices) this fills the site MECHANICALLY: ten numbered rows in every registered post type and ten numbered terms in every registered taxonomy, so a template can be exercised against content that is obviously test content. Naming is deliberately boring and predictable — the post type's / taxonomy's own singular label plus an index: "Post 1…10", "Listing 1…10", "Category 1…10", "Location 1…10". If a fork relabels listings to "Property", its rows are named "Property 1…10"; the label is read from the registration, never hardcoded, so a new fork's post types and taxonomies are filled the day they are registered without this class knowing about them. Everything written carries TWO markers: - {@see \Ppt\Support\Demo::META} (ppt-demo), the canonical demo marker, so the rest of the theme already treats these rows as demo content — the live overlays hide them, and a "go live" wipe takes them; - {@see FLAG} (ppt-fill), narrower, so "Remove test content" removes exactly what this button created and never the curated demo set beside it. Filling runs in bounded AJAX units (one post type or one taxonomy per request) so a site with a dozen post types and thirty taxonomies never hits the PHP time limit, and a dropped request resumes where it stopped — every step re-reads the live counts, so pressing the button again is always safe and never duplicates.
SampleData SampleData.php
Sample data tool — seeds/removes demo listing_type posts so the search and single-listing pages can be built against real content. Admin-only, behind a "PPT → Sample Data" screen with nonce-protected actions. Every seeded listing carries the ppt-demo meta flag (the PremiumPress demo convention) so it can be removed cleanly without touching real listings.