Api
Api
Shared across every PremiumPress product. 29 classes in inc/Api.
Auth Auth.php
Sign-in for the app: the site's own WordPress accounts, reached by email + password, Sign in with Apple, or Google Sign-In. All three end in the same place — a WP user and an Api\App\Tokens session for this device. Social sign-in verifies the provider's identity token server-side (Api\App\Jwt) and links it to an existing account ONLY when the provider vouches for the email (email_verified) — the same rule the website's Account\Social enforces, for the same reason: an unverified email match is an account-takeover path. The provider subject id is remembered in user meta so later sign-ins match even when Apple hides or rotates the relay email.
Blog Blog.php
API operations for blog posts — the standard WordPress post type (the theme adds no custom post meta for blog; see inc/Frontend/Blog.php). Plain wp_insert_post / wp_update_post with the native category/post_tag taxonomies + featured image.
Catalog Catalog.php
Public catalogue routes: categories, home feeds, search, a listing, its reviews. Everything here works for guests; a signed-in member just gets is_favourite set. Search rebuilds the website's own query rules (Directory\SearchPage) from REST parameters instead of $_GET — same meta keys, same taxonomy semantics, same sold/expired exclusions, same haversine radius SQL — so the app and the site agree on what "results for X near Y" means.
Cimd Cimd.php
OAuth Client ID Metadata Documents (CIMD) — the MCP authorization spec's alternative to dynamic client registration. The client's client_id IS an https URL; this server fetches the JSON document at that URL and treats it as the client's registration. Why it matters here: the Connectors Directory lists this server under a per-customer URL pattern, and Anthropic prefers CIMD over DCR for that case. DCR mints a new stored client on every fresh connection (see Store::MAX_CLIENTS pruning); CIMD stores nothing and identifies the client by a URL on its own domain (e.g. claude.ai). The fetch is an SSRF surface, so it is deliberately narrow: https only, a real path, no credentials/fragment/dot-segments in the URL, wp_safe_remote_get (refuses private and loopback hosts), no redirects, a short timeout, a small size cap, and a cache so one client can't make the site fetch on every request.
Config Config.php
GET /app/config — the one call the app makes on launch. Everything a white-label build needs to become THIS site's app at runtime: name, colours, logo, which features and sign-in methods are on, currency and units, legal URLs for the store forms, and the search vocabulary (sorts, filters, taxonomies) so the app never hard-codes what the site can do.
Design Design.php
API operations for site-level design: switch the active ready-made design, and set the brand colours / logo. Reuses the same options the admin Design screen writes — Frontend\Preview::OPTION_ACTIVE (active design) and Design\Branding's ppt_design option — so an API change is identical to an admin change. Per-PAGE block editing (the Studio working-plan / builder exports) is intentionally out of scope here; this is site-wide design only.
Jwt Jwt.php
Minimal RS256 JWT verification against a provider's published JWKS — enough to validate the identity tokens Sign in with Apple and Google Sign-In hand the app, without a Composer dependency (the bundled HybridAuth vendor tree does not ship firebase/php-jwt). Verifies: header alg RS256 + a kid present in the JWKS; the RSA signature via OpenSSL; exp (required) / nbf (60 s leeway); iss in the allowed list; aud (string or array) intersects the allowed list. Returns the payload claims, or a WP_Error. Key sets are cached for 12 hours and refetched once on an unknown kid, so a provider key rotation does not lock members out until the cache expires.
Keys Keys.php
API key store for the PPT management API. Keys are bearer tokens an admin generates (see Api\Loader's settings page) and pastes into their AI agent / MCP client. A valid key authorises admin-equivalent calls (see Api\Server::authenticate). Only a HASH of each token is stored (wp_hash, keyed by the site's secret salt); the plaintext is shown ONCE at creation and never recoverable. A short display prefix is kept so a key is recognisable in the admin table. Everything lives in the theme's own option ppt_api_keys (not the shared ppt_settings sanitiser) — the self-contained model used by Admin\Payments.
Listings Listings.php
API operations for directory listings. Thin adapters that translate a clean API payload into the shape Ppt\Directory\ListingEditor::save() expects, so the API reuses the exact same validation/persistence path as the admin + member editors (no duplicated field logic). Runs as an admin (mode 'admin').
Loader Loader.php
Wires the companion-app API into WordPress: the REST routes (Api\App\Server), the sessions table, the push triggers, the deep-link verification files (/.well-known/apple-app-site-association, /.well-known/assetlinks.json), the Settings ▸ Mobile app admin screen, and the daily session purge. Registered from inc/Theme.php $services. Everything stays dormant until the admin switches the app on (Api\App\Settings::enabled()).