--repo * * and its own tests go red on a hand edit (`test-more-plugins-drift.sh` * against `more-plugins.lock`). Edit the source, never a copy. The design * and every rule below: Dashboard `docs/wporg-more-plugins.md`. * * ── What it is for (the owner, 2026-11-18, T-20261118-368) ────────────────── * * Someone who installed one of our plugins opens "More plugins" from that * plugin's own menu and finds our other free plugins: the ones related to * what they installed first, then all the others, each with WordPress's own * Install Now, Activate or Update now button. Grown from Burnpedia's * `Burnpedia_Family_2` (live since 2026-10-09), with the two design reads' * conditions (Hawkeye and Judy, 2026-11-21, both ALLOWED IF). * * ── ⚠️ HOW IT STAYS INSIDE THE WORDPRESS.ORG GUIDELINES ───────────────────── * * - Guideline 7 (no contact without consent): the ONE request, core's own * `plugins_api( 'query_plugins' )` to api.wordpress.org, runs only while * the page is drawn (render()), never on another screen, at activation, * in cron or by AJAX. Opening the page is the consent (both reads). It * sends what core sends on Plugins › Add New: our query (author, per * page, fields) plus core's own additions, the admin's locale and the * WordPress version, and core's User-Agent with the site's address. No * http_request_args filter, no User-Agent of ours. A card's "More * Details" opens core's own details window, which asks api.wordpress.org * once more and shows that plugin's banner from WordPress.org: only on * that click. A readme names all of it (Hawkeye, Site Answers 1.1.3 F2). * A failure is remembered 15 minutes, an answer 12 hours. * - Guideline 7 / "Calling files remotely": NO remote image. Each card draws * a local dashicon by its group; the answer's icons are never read. * - Guideline 8 (installs only from WordPress.org): every button is core's * own URL with core's own nonce (installer, activator, upgrader), which * re-checks the capability itself. This file downloads nothing. * - Guideline 9 (honest words): the related heading is "Related to * ", never a claim that two plugins work together. * - Guideline 11 (do not hijack the dashboard): a page the person OPENS from * the plugin's own menu, last and plain. No notice, banner, widget, badge. * Core's Plugins › Add New is never touched (no plugins_api filters), and * nothing here runs core's update check: "Update available" reads the * update_plugins transient core already keeps. * - Each action is the user's own click: never chained, never automatic. * - No tracking: no UTM, no ref, no request to any server of ours. * * ── Why the class carries markup but no words ────────────────────────────── * * A translated string cannot be shared: `__( 'x', $domain )` with a variable * domain is a Plugin Check error, and a literal domain cannot be right in * sixteen plugins. render() takes every word already translated by the * plugin and escapes each value where it prints it. * * ── Why one copy per plugin, stamped, and not one family class ───────────── * * Each plugin told the review team its one prefix; a shared class name would * break that sentence, and two of our plugins at different versions on one * site would run whichever copy PHP loaded first. Stamped copies never meet. */ class More_Plugins { /** The WordPress.org account that publishes every one of our plugins. */ const AUTHOR = 'lalokupfer'; /** Transient holding the directory's normalised answer. */ const CACHE_KEY = 'agevow_more_plugins'; /** Transient set for fifteen minutes after a failed or empty answer. */ const FAIL_KEY = 'agevow_more_plugins_failed'; /** Twelve hours: the directory changes rarely. */ const CACHE_TTL = 43200; /** A failed fetch is retried after fifteen minutes, not on every page view. */ const FAIL_TTL = 900; /** At most this many plugins are asked for (we publish 16). */ const PER_PAGE = 100; /** The one link of the source line: WordPress.org's privacy policy. */ const PRIVACY_URL = 'https://wordpress.org/about/privacy/'; /** * The tie-break after shared directory tags, and the only ranking a site * that cannot reach WordPress.org has. One slug may be in two groups; a * new plugin of ours gets its row here (sync.mjs --check names a slug of * ours missing from it). * * @var array */ const GROUPS = array( 'pinterest' => array( 'burnpedia-pin-scheduler-for-pinterest', 'burnpedia-image-maker', 'burnpedia-image-save-button-analytics', 'catalune-product-catalog-feed-checker', ), 'store' => array( 'agevow-age-verification-age-gate', 'carthound-stop-card-testing-fake-orders', 'catalune-product-catalog-feed-checker', 'purlace-pfas-state-ban-tracker', ), 'forms' => array( 'captvane-captcha-errors-lost-form-leads', 'fromwell-lead-source-for-contact-form-7', 'inkslip-liability-waiver-release-forms', ), 'restaurant' => array( 'tureenmead-restaurant-online-ordering', 'showtile-digital-signage-tv-menu-board', ), 'content' => array( 'site-answers-llms-txt-ai-crawler-log-markdown', 'vouchlog-accessibility-logbook', 'linkhale-affiliate-link-checker-for-amazon', 'notewake-editor-notes-inbox-digest', 'satchmere-media-library-export-to-zip', ), ); /** * Each card's local icon, by the plugin's first group (Judy, 2026-11-21: * no image from the network). * * @var array */ const ICONS = array( 'pinterest' => 'dashicons-pinterest', 'store' => 'dashicons-store', 'forms' => 'dashicons-forms', 'restaurant' => 'dashicons-food', 'content' => 'dashicons-admin-page', ); /** The icon of a plugin in no group. */ const DEFAULT_ICON = 'dashicons-admin-plugins'; /** * Names only, for a site that cannot reach WordPress.org. Only plugins the * directory publishes: a name here is offered with Install Now. * * @var array */ const KNOWN = array( 'agevow-age-verification-age-gate' => 'Agevow – Age Verification & Age Gate', 'burnpedia-image-maker' => 'Burnpedia Image Maker – Social Image Designer with 130 Templates', 'burnpedia-image-save-button-analytics' => 'Burnpedia Image Save Button Analytics', 'burnpedia-pin-scheduler-for-pinterest' => 'Burnpedia Scheduler – Visual Posts from Your Content', 'captvane-captcha-errors-lost-form-leads' => 'Captvane – Captcha Errors & Lost Form Leads', 'carthound-stop-card-testing-fake-orders' => 'Carthound – Stop Card Testing & Fake Orders', 'catalune-product-catalog-feed-checker' => 'Catalune – Product Catalog Feed Checker', 'fromwell-lead-source-for-contact-form-7' => 'Fromwell – Lead Source for Contact Form 7', 'inkslip-liability-waiver-release-forms' => 'Inkslip – Liability Waiver & Release Forms', 'linkhale-affiliate-link-checker-for-amazon' => 'Linkhale – Affiliate Link Checker for Amazon', 'notewake-editor-notes-inbox-digest' => 'Notewake – Editor Notes Inbox & Digest', 'purlace-pfas-state-ban-tracker' => 'Purlace – PFAS State Ban Tracker', 'showtile-digital-signage-tv-menu-board' => 'Showtile – Digital Signage & TV Menu Board', 'site-answers-llms-txt-ai-crawler-log-markdown' => 'Site Answers – MCP Server, llms.txt & AI Crawler Log', 'tureenmead-restaurant-online-ordering' => 'Tureenmead – Restaurant Online Ordering', 'vouchlog-accessibility-logbook' => 'Vouchlog – Accessibility Logbook, Scanner & Color Contrast Checker', ); /** * Every plugin of ours except `$self_slug`, ranked, each with the action * this user may take here. * * ⚠️ Called from render() only: this is what makes the one request. * * @param string $self_slug The calling plugin's own slug — never listed. * @return array{reached:bool,plugins:array>} */ public static function plugins( $self_slug ) { $directory = self::directory(); $installed = self::installed_files(); $updates = self::updates(); $out = array(); foreach ( self::rank( $self_slug, $directory['plugins'] ) as $plugin ) { $file = isset( $installed[ $plugin['slug'] ] ) ? $installed[ $plugin['slug'] ] : ''; $plugin['update'] = '' !== $file && isset( $updates[ $file ] ); $plugin['details_url'] = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . rawurlencode( $plugin['slug'] ) . '&TB_iframe=true&width=772&height=650' ); list( $plugin['state'], $plugin['action_url'] ) = self::action_for( $plugin['slug'], $file, $plugin['update'] ); $out[] = $plugin; } return array( 'reached' => $directory['reached'], 'plugins' => $out, ); } /** * Rank the list for the calling plugin: shared directory tags (most * first), then shared groups, then the name A to Z. A plugin with a shared * tag or group is "related". The calling plugin never appears, however * often the answer lists it. Pure: no WordPress call. * * @param string $self_slug The calling plugin's slug. * @param array> $entries normalise()'s list (or the names fallback). * @return array> */ public static function rank( $self_slug, array $entries ) { $self_tags = array(); $self_groups = self::groups_of( $self_slug ); foreach ( $entries as $plugin ) { if ( $plugin['slug'] === $self_slug ) { $self_tags = array_merge( $self_tags, $plugin['tags'] ); } } $out = array(); foreach ( $entries as $plugin ) { if ( $plugin['slug'] === $self_slug ) { continue; } $groups = self::groups_of( $plugin['slug'] ); $plugin['shared_tags'] = count( array_intersect( array_unique( $plugin['tags'] ), array_unique( $self_tags ) ) ); $plugin['shared_groups'] = count( array_intersect( $groups, $self_groups ) ); $plugin['related'] = $plugin['shared_tags'] > 0 || $plugin['shared_groups'] > 0; $plugin['icon'] = empty( $groups ) ? self::DEFAULT_ICON : self::ICONS[ $groups[0] ]; $out[] = $plugin; } usort( $out, function ( $a, $b ) { if ( $a['shared_tags'] !== $b['shared_tags'] ) { return $b['shared_tags'] - $a['shared_tags']; } if ( $a['shared_groups'] !== $b['shared_groups'] ) { return $b['shared_groups'] - $a['shared_groups']; } $by_name = strcasecmp( $a['name'], $b['name'] ); return 0 !== $by_name ? $by_name : strcmp( $a['slug'], $b['slug'] ); } ); return $out; } /** * The groups a slug is in, in GROUPS' order. * * @param string $slug Directory slug. * @return string[] */ public static function groups_of( $slug ) { $out = array(); foreach ( self::GROUPS as $group => $slugs ) { if ( in_array( $slug, $slugs, true ) ) { $out[] = $group; } } return $out; } /** * What this user may do with one plugin, and the core URL that does it. * * ⚠️ The URLs are WordPress core's own, with core's own nonces: the * installer, the activator and the upgrader re-check the capability * themselves, so a forged link is refused by core, not merely hidden here. * `$file` is the installed plugin's file from get_plugins(), never built * from the slug. * * @param string $slug Directory slug. * @param string $file Installed plugin file (`dir/main.php`), or '' when absent. * @param bool $update Core's update_plugins transient holds an update for `$file`. * @return array{0:string,1:string} The state ('install' | 'update' | 'active' | 'activate' | 'installed') and its URL ('' = no button). */ public static function action_for( $slug, $file, $update = false ) { if ( '' === $file ) { if ( ! current_user_can( 'install_plugins' ) ) { return array( 'install', '' ); } return array( 'install', wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . rawurlencode( $slug ) ), 'install-plugin_' . $slug ), ); } if ( $update && current_user_can( 'update_plugins' ) ) { return array( 'update', wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . rawurlencode( $file ) ), 'upgrade-plugin_' . $file ), ); } if ( self::is_active( $file ) ) { return array( 'active', '' ); } if ( ! current_user_can( 'activate_plugin', $file ) ) { return array( 'installed', '' ); } return array( 'activate', wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . rawurlencode( $file ) ), 'activate-plugin_' . $file ), ); } /** * The directory's list: from the 12-hour cache, from WordPress.org, or the * names fallback (`reached` false) for fifteen minutes after a failure. * * @return array{reached:bool,plugins:array>} */ public static function directory() { $cached = get_transient( self::CACHE_KEY ); if ( is_array( $cached ) && ! empty( $cached ) ) { return array( 'reached' => true, 'plugins' => $cached, ); } if ( false !== get_transient( self::FAIL_KEY ) ) { return self::fallback(); } if ( ! function_exists( 'plugins_api' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; } $result = plugins_api( 'query_plugins', array( 'author' => self::AUTHOR, 'per_page' => self::PER_PAGE, 'fields' => array( 'short_description' => true, 'tags' => true, 'icons' => false, 'description' => false, 'sections' => false, 'versions' => false, 'banners' => false, 'screenshots' => false, 'reviews' => false, 'contributors' => false, 'compatibility' => false, 'donate_link' => false, ), ) ); $list = self::normalise( is_wp_error( $result ) ? null : $result ); if ( ! empty( $list ) ) { set_transient( self::CACHE_KEY, $list, self::CACHE_TTL ); return array( 'reached' => true, 'plugins' => $list, ); } set_transient( self::FAIL_KEY, 1, self::FAIL_TTL ); return self::fallback(); } /** * The names fallback: KNOWN, with no description and no tags. * * @return array{reached:bool,plugins:array>} */ public static function fallback() { $list = array(); foreach ( self::KNOWN as $slug => $name ) { $list[] = array( 'slug' => $slug, 'name' => $name, 'description' => '', 'tags' => array(), ); } return array( 'reached' => false, 'plugins' => $list, ); } /** * Turn a `plugins_api` answer into plain arrays of safe strings. * * ⚠️ The answer is data from the network. A slug that is not already a * plain slug is dropped (never "cleaned" into another one), an entry whose * author profile is not ours is dropped, names and descriptions lose every * tag, tags become sanitize_key strings, the icons are never read, and a * slug listed twice is kept once. * * @param object|array|null $result The `plugins_api` result. * @return array> */ public static function normalise( $result ) { $plugins = array(); if ( is_object( $result ) && isset( $result->plugins ) ) { $plugins = $result->plugins; } elseif ( is_array( $result ) && isset( $result['plugins'] ) ) { $plugins = $result['plugins']; } if ( is_object( $plugins ) ) { $plugins = get_object_vars( $plugins ); } if ( ! is_array( $plugins ) ) { return array(); } $list = array(); $seen = array(); foreach ( $plugins as $raw ) { if ( ! is_array( $raw ) && ! is_object( $raw ) ) { continue; } $p = is_object( $raw ) ? get_object_vars( $raw ) : $raw; $slug = isset( $p['slug'] ) && is_string( $p['slug'] ) ? $p['slug'] : ''; if ( '' === $slug || sanitize_key( $slug ) !== $slug || isset( $seen[ $slug ] ) || ! self::is_ours( $p ) ) { continue; } $seen[ $slug ] = true; $name = isset( $p['name'] ) && is_scalar( $p['name'] ) ? self::plain( (string) $p['name'] ) : ''; $list[] = array( 'slug' => $slug, 'name' => '' !== $name ? $name : $slug, 'description' => isset( $p['short_description'] ) && is_scalar( $p['short_description'] ) ? self::plain( (string) $p['short_description'] ) : '', 'tags' => self::tags( isset( $p['tags'] ) ? $p['tags'] : array() ), ); } return $list; } /** * Is this entry by our author? Read from its profile URL's last segment; * an entry that names no profile is the author query's own answer. * * @param array $p One raw entry. * @return bool */ private static function is_ours( array $p ) { if ( ! isset( $p['author_profile'] ) || '' === $p['author_profile'] ) { return true; } if ( ! is_string( $p['author_profile'] ) ) { return false; } $path = (string) wp_parse_url( $p['author_profile'], PHP_URL_PATH ); $path = trim( $path, '/' ); $last = substr( $path, (int) strrpos( '/' . $path, '/' ) ); return 0 === strcasecmp( $last, self::AUTHOR ); } /** * Text from the network as plain text: entities decoded, tags stripped. * * @param string $text Raw text. * @return string */ private static function plain( $text ) { return trim( wp_strip_all_tags( html_entity_decode( $text, ENT_QUOTES, 'UTF-8' ) ) ); } /** * The directory's tags as slugs: a map's keys (its usual shape) or a * list's values. * * @param mixed $tags The answer's `tags`. * @return string[] */ private static function tags( $tags ) { if ( is_object( $tags ) ) { $tags = get_object_vars( $tags ); } if ( ! is_array( $tags ) ) { return array(); } $out = array(); foreach ( $tags as $key => $value ) { $tag = is_string( $key ) ? $key : ( is_string( $value ) ? $value : '' ); $tag = sanitize_key( $tag ); if ( '' !== $tag ) { $out[] = $tag; } } return array_values( array_unique( $out ) ); } /** * Updates core already found, keyed by plugin file. Reads core's * update_plugins transient ONLY: nothing here runs core's update check. * * @return array */ private static function updates() { $transient = get_site_transient( 'update_plugins' ); $out = array(); if ( is_object( $transient ) && isset( $transient->response ) && is_array( $transient->response ) ) { foreach ( array_keys( $transient->response ) as $file ) { $out[ (string) $file ] = true; } } return $out; } /** * Installed plugins keyed by their directory slug. * * @return array slug => plugin file */ private static function installed_files() { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $out = array(); foreach ( array_keys( get_plugins() ) as $file ) { $dir = dirname( $file ); if ( '.' !== $dir && ! isset( $out[ $dir ] ) ) { $out[ $dir ] = $file; } } return $out; } /** * Active here, or network-active on a multisite. * * @param string $file Plugin file. * @return bool */ private static function is_active( $file ) { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } return is_plugin_active( $file ); } /** * Print the page. Every word comes translated from the calling plugin: * * Keys: title, source, privacy, related (e.g. "Related to Site Answers"), others, * unreachable, install, install_label (%s = name), activate, * activate_label (%s), update, update_label (%s), update_available, * active, installed, details, details_label (%s). * * ⚠️ Nothing for a user who cannot install plugins (the menu entry asks * for the same capability). This is the only caller of plugins(), so the * one request is made while this page is drawn and at no other time. * * @param string $self_slug The calling plugin's slug. * @param array $words The page's words, already translated. * @return void */ public static function render( $self_slug, array $words ) { if ( ! current_user_can( 'install_plugins' ) ) { return; } $w = self::words( $words ); $answer = self::plugins( $self_slug ); $related = array(); $others = array(); foreach ( $answer['plugins'] as $plugin ) { if ( $plugin['related'] ) { $related[] = $plugin; } else { $others[] = $plugin; } } ?>

$words The plugin's words. * @return array */ private static function words( array $words ) { $keys = array( 'title', 'source', 'privacy', 'related', 'others', 'unreachable', 'install', 'install_label', 'activate', 'activate_label', 'update', 'update_label', 'update_available', 'active', 'installed', 'details', 'details_label' ); $out = array(); foreach ( $keys as $key ) { $out[ $key ] = isset( $words[ $key ] ) && is_string( $words[ $key ] ) ? $words[ $key ] : ''; } return $out; } /** * A label with the plugin's name in it ('%s' in the plugin's own string). * * @param string $pattern The plugin's translated pattern. * @param string $name The card's plugin name. * @return string */ private static function label( $pattern, $name ) { return false !== strpos( $pattern, '%s' ) ? sprintf( $pattern, $name ) : $pattern; } /** * One plugin card, in core's own markup so core's styles and core's * install script apply to it unchanged; a local dashicon, never an image. * * @param array $plugin One entry from plugins(). * @param array $w The page's words. * @return void */ private static function card( array $plugin, array $w ) { $details_label = self::label( $w['details_label'], $plugin['name'] ); ?> $plugin One entry from plugins(). * @param array $w The page's words. * @return void */ private static function button( array $plugin, array $w ) { // Written as HTML with each value escaped where it is printed (no printf, no // echo of a built string), so a review test that wants an escaping function // first after every echo passes it in every plugin that carries this file. $state = $plugin['state']; if ( 'install' === $state && '' === $plugin['action_url'] ) { return; } if ( 'install' === $state ) { ?>