Core and platforms

Silvertrail is one core with a small adapter for each platform. The core holds every rule, and an adapter connects it to a platform: it hands over the setup, keeps what the core saves and prints what the core builds. So a site behaves the same on WordPress, on Kirby and on a plain HTML page, and a fix in the core reaches every platform at once.

The core

The core is PHP in core/ and calls nothing but PHP and its Host interface, which each adapter implements. It knows:

  • the services, the presets, the groups and the config that combines them;
  • the consent, the revision that asks every visitor again, and Global Privacy Control;
  • the settings, their values, ranges and defaults, and the texts in every language;
  • the gate that holds back scripts and embeds, the design values and the banner's data;
  • the consent records, the checks that report a mistake, and what the shell lists.

The script and the stylesheet in assets/, and the templates of the banner, the embed placeholder and the floating button in templates/, are shared by every platform as well.

WordPress is the reference. A rule lives in the core once, and every adapter gives the same result. Tests set one site up in code on each platform and compare the script's data, the banner and a held-back embed with WordPress's, and they save the same decisions through each admin and compare the settings the core reads.

The adapters

WordPress

The WordPress plugin wires the core into WordPress's hooks. It keeps the settings as options and the records in a database table, reads the design from the theme's theme.json, and adds the admin, the WP-CLI commands, the abilities for MCP, the WP Consent API and the Leak check in the admin.

Kirby

The Kirby plugin takes its setup from the site config and the Panel's Privacy tab. Kirby cannot print into a page while it builds it, so the plugin hands the finished page to the core, which holds back its scripts and embeds and adds the banner. It keeps what the core saves as JSON files, the records included, and adds the Kirby CLI commands and the Leak check for Panel users.

HTML

An HTML page has no server, so the core runs ahead of time. The package for HTML pages carries the core's presets, groups, texts and setting rules as data, and turns the config in a page's head into the script's data in the browser. The banner, the placeholders and the floating button are the core's templates, rendered once as reference markup that a page carries. npx @mawiswiss/silvertrail check holds a site to the same rules on the shell.

Licences

Part Licence
The WordPress plugin as a whole GPL-2.0-or-later
core/, assets/, templates/, testing/, docs/ and web/ MIT, each with its own LICENSE file
The Kirby plugin and the package for HTML pages, built from the MIT parts MIT throughout

The code is on GitHub.