4 Developers
Robin edited this page 2026-11-22 21:33:33 +01:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Developers

Hooks and commands

WP-CLI commands: see Command line.

lrob_pluginception_project_changed

Fired when what the blocks show of a project changed (a release added, changed or removed, its name, excerpt, image or visibility), after the plugin emptied the page cache of the pages that show it. Use it to empty another cache (a server cache, a CDN) for these pages.

add_action( 'lrob_pluginception_project_changed', function ( int $project_id, array $page_ids ) {
	foreach ( $page_ids as $page_id ) {
		my_cdn_purge( get_permalink( $page_id ) ); // Your own purge.
	}
}, 10, 2 );

$page_ids: the published contents with a Projects index or a Recent activity block, the ones whose Project buttons or Release notes name this project, and the project's own page. Fired after a reading of the forge (scheduled, webhook, button, command line) and after a change made in Pluginception (administration, wp lrob-pluginception project set, import); never when nothing a visitor sees changed. The number of downloads alone does not count.

Before it, each page goes through clean_post_cache() and, when they are active, the single-page purge of W3 Total Cache, WP Rocket, LiteSpeed Cache, WP Super Cache, WP Fastest Cache and Cache Enabler. The whole cache is never emptied.

The plugin knows which contents carry its blocks from their saving (synced patterns included); blocks placed in a theme template are not known: empty those pages yourself, or in this action.

No other PHP filter or action yet; if you need one, open an issue describing your use.

REST routes

Namespace lrob-pluginception/v1.

Route Access Purpose
POST /webhook/<source> HMAC signature the webhook
GET /activity public items of the Recent activity block
GET /releases public the next previous versions of the Release notes block
/admin/* administrators (manage_options) the administration screen

The public routes answer X-Robots-Tag: noindex and Cache-Control: public, max-age=300, and read only the site's database.

GET /activity parameters: type (releases or commits), projects (ids, comma-separated), categories (slugs, comma-separated), offset, count (1–50). Answer: a list of items as plain text and addresses, never HTML.

GET https://www.example.com/wp-json/lrob-pluginception/v1/activity?count=5

GET /releases parameters: project (id, required), offset (previous versions already shown), count (1–50), level (heading level 2–5), dates and prereleases (0 or 1). Answer: { "html": "…", "more": true }.

Styling

The blocks use your theme's button classes (wp-element-button) and inherit its colours: every text is currentColor, every tint is derived from it with color-mix(), so they follow a light or a dark mode by themselves. Classes to target in your theme start with lrob-pc-:

Class Element
.lrob-pc-buttons, .lrob-pc-group the Project buttons block, its group of buttons and texts
.is-lrob-pc-soft the tinted (secondary) button
.lrob-pc-text-link the Source code link
.lrob-pc-pill a version
.lrob-pc-new the New badge
.lrob-pc-card, .lrob-pc-fallback a card of the index, the visual of a project without image
[data-tone="1"] … [data-tone="4"] a category's tint
.lrob-pc-activity the Recent activity block

The blocks also accept WordPress's colour, spacing and typography settings.

Data

  • Tables (with your prefix): lrob_pc_projects, lrob_pc_releases, lrob_pc_commits, lrob_pc_log; created and updated by the plugin itself.
  • In lrob_pc_projects, the auto_* columns are written by the reading only, the others by the administration only: what you type is never overwritten. Texts typed per language (audience, tagline, highlights) are stored as JSON, locale => text.
  • Languages: those of LRob - AI Translator, else Polylang, else the site's; a page's language is WordPress's locale.
  • Plugin header: besides the WordPress fields, the plugin reads Audience: (who the project is for), its own convention.
  • Images are media library attachments; those imported from a repository carry the meta _lrob_pluginception_banner and are the only ones the plugin ever deletes.
  • Scheduled events: lrob_pluginception_tick (every five minutes) and lrob_pluginception_sync (a pass for one source).

A real cron instead of wp-cron, for example every five minutes:

*/5 * * * * wget -qO- https://www.example.com/wp-cron.php > /dev/null

with define( 'DISABLE_WP_CRON', true ); in wp-config.php.

Updates of the plugin itself

The plugin updates from the releases of its repository (header Update URI), asset lrob-pluginception-<version>.zip. While a repository is private, define LROB_PLUGINCEPTION_UPDATE_TOKEN (a read-only token) in wp-config.php.

Building

No dependency, no build step: plain PHP, CSS and JavaScript on the wp.* globals. The Markdown renderer is LRob Markdown, bundled in src/lib/markdown.

  • Tests: php tests/run.php (or php tests/run.php <filter>); they run in under a second, with forge answers recorded in tests/fixtures/.
  • Package: sh release.sh checks versions, tests, syntax and translations, then builds the zip.
  • Translations: sh release.sh pot regenerates languages/lrob-pluginception.pot.