v0.7.3 — WordPress.org guideline 8 compliance + Privacy section
Adds the Update URI guard pattern so one source tree produces two compliant build artifacts: * Gitea install (default): `Update URI:` header points at git.davidtkeane.com → wp.org skips this plugin → self-hosted updater runs normally. * WordPress.org submission zip (build script strips that line): header is empty → `radio_should_skip_custom_updater()` returns true → entire updater file short-circuits at load time → wp.org takes over update delivery as guideline 8 requires. Settings page now guards the Updates panel render with `function_exists()` because the panel function only exists when the updater was allowed to load. Also adds a dedicated `== Privacy ==` section to readme.txt covering every outbound connection (none from the plugin itself; SomaFM audio + 30s songs.json poll while playing) and adds an explicit link to SomaFM's terms of use (somafm.com/legal/). No user-visible behaviour change in either distribution.
This commit is contained in:
@@ -14,6 +14,39 @@
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
/**
|
||||
* v0.7.3 — wp.org guideline 8 guard.
|
||||
*
|
||||
* If the plugin's `Update URI:` header is empty or points to wordpress.org,
|
||||
* the plugin is being distributed via WordPress.org and core handles updates.
|
||||
* In that case the self-hosted updater MUST stay dormant — serving updates
|
||||
* from a non-wp.org server is explicitly prohibited by guideline 8.
|
||||
*
|
||||
* When `Update URI` points at our Gitea (the default for self-hosted /
|
||||
* pre-submission installs), wp.org skips this plugin and our updater runs
|
||||
* normally.
|
||||
*
|
||||
* The submission build script strips the `Update URI:` line from
|
||||
* `radio.php` so this check trips and the entire updater becomes a no-op.
|
||||
*/
|
||||
function radio_should_skip_custom_updater() {
|
||||
static $cached = null;
|
||||
if ( null !== $cached ) { return $cached; }
|
||||
if ( ! defined( 'RADIO_FILE' ) || ! function_exists( 'get_file_data' ) ) {
|
||||
$cached = false;
|
||||
return $cached;
|
||||
}
|
||||
$data = get_file_data( RADIO_FILE, array( 'UpdateURI' => 'Update URI' ) );
|
||||
$uri = isset( $data['UpdateURI'] ) ? trim( $data['UpdateURI'] ) : '';
|
||||
if ( '' === $uri ) { $cached = true; return $cached; } // empty → wp.org default
|
||||
if ( false !== stripos( $uri, 'wordpress.org' ) ) { $cached = true; return $cached; } // explicit wp.org
|
||||
$cached = false; // points at Gitea / other → custom updater runs
|
||||
return $cached;
|
||||
}
|
||||
|
||||
// Short-circuit: stop here entirely if wp.org is handling updates.
|
||||
if ( radio_should_skip_custom_updater() ) { return; }
|
||||
|
||||
if ( ! defined( 'RADIO_GITEA_HOST' ) ) { define( 'RADIO_GITEA_HOST', 'https://git.davidtkeane.com' ); }
|
||||
if ( ! defined( 'RADIO_GITEA_OWNER' ) ) { define( 'RADIO_GITEA_OWNER', 'ranger' ); }
|
||||
if ( ! defined( 'RADIO_GITEA_REPO' ) ) { define( 'RADIO_GITEA_REPO', 'a-radio' ); }
|
||||
|
||||
Reference in New Issue
Block a user