PHP code example of pattonwebz / signed-releases-client-for-edd

1. Go to this page and download the library: Download pattonwebz/signed-releases-client-for-edd library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pattonwebz / signed-releases-client-for-edd example snippets


use PattonWebz\SignedReleases\UpdaterGuard;

add_action( 'init', function () {
    UpdaterGuard::register( array(
        'plugin_file'     => plugin_basename( MY_PLUGIN_FILE ),
        'slug'            => 'my-plugin', // must equal the slug CI signs.
        'store_url'       => 'https://store.example',
        'public_keys'     => array( 'RWS...base64 public key...' ),
        'item_id'         => 123,
        'current_version' => MY_PLUGIN_VERSION,
        'mode'            => 'log', // 'enforce' once a clean cycle is observed.
    ) );
} );

'current_version' => get_plugin_data( MY_PLUGIN_FILE )['Version'],

add_filter( 'srcl/mode', fn( $mode, $slug ) => 'log', 10, 2 );

UpdaterGuard::register( array(
    // ... args as above ...
    'public_keys'         => array( $active_key, $successor_key ),
    'revocation_root_key' => 'RWS...revocation root public key...',
    'revocation_mode'     => 'log', // its own rollout, independent of 'mode'.
) );


// wp-content/mu-plugins/signed-releases-loaded-from.php

add_action(
	'init',
	function () {
		if ( ! class_exists( '\PattonWebz\SignedReleases\UpdaterGuard' ) ) {
			return;
		}

		$loaded = new ReflectionClass( \PattonWebz\SignedReleases\UpdaterGuard::class );

		error_log( 'signed-releases: guard loaded from ' . $loaded->getFileName() );
	}
);