1. Go to this page and download the library: Download meumouse/mds-php-sdk 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/ */
register_deactivation_hook( __FILE__, function () {
$integration = \MeuMouse\MDS\SDK\SDK::get( 'my-plugin' );
if ( $integration ) {
$integration->shutdown();
}
} );
SDK::register( array(
// …', // preset
'features' => array( // per-flag override on top of it
'update_details' => false,
),
) );
// All products, once, before boot.
add_filter( 'mds_sdk_features', function ( array $features, $slug ) {
if ( 'my-plugin' === $slug ) {
$features['notices'] = false;
}
return $features;
}, 10, 2 );
// One flag of one product.
add_filter( 'mds_my_plugin_feature_rollback', '__return_false' );
// wp-config.php — the site owner's kill switch. Constants are the final word:
// no filter can turn them back on.
define( 'MDS_MY_PLUGIN_FEATURE_NOTICES', false ); // one product
define( 'MDS_SDK_FEATURE_LOGGING', true ); // every product
$features = \MeuMouse\MDS\SDK\SDK::get( 'my-plugin' )->features();
$features->enabled( 'rollback' ); // bool, dependencies included
$features->mode(); // "full" | "license_only" | "updates_only"
$features->active(); // names of the currently active flags
$features->conflicts(); // rows of { feature,
$license = \MeuMouse\MDS\SDK\SDK::get( 'my-plugin' )->license();
$license->activate( 'MDS-XXXX-XXXX' ); // returns LicenseStatus, throws ApiException on transport failure
$license->deactivate(); // releases this site and clears local state
$license->validate(); // heartbeat: re-checks against the server
$license->status(); // last persisted LicenseStatus, no network call
$license->is_active(); // effective validity (honours expiry)
$license->has_key();
$license->get_key();
$license->is_enabled(); // false when the `license` feature is off
$status = $license->status();
$status->is_valid(); // the server's last verdict
$status->status(); // one of the constants above
$status->expires_at(); // ISO-8601 string, or null for lifetime
$status->is_expired();
$status->is_signed(); // whether the last verdict came from a verified response
$status->is_
// Show it on your own settings screen too.
add_filter( 'mds_my_plugin_notice_screens', function ( array $screens ) {
$screens[] = 'settings_page_my-plugin';
return $screens;
} );
// Reword it, and make it dismissible.
add_filter( 'mds_my_plugin_notice_message', fn() => 'Ative sua licença para receber atualizações.' );
add_filter( 'mds_my_plugin_notice_args', function ( array $args ) {
$args['dismissible'] = true;
return $args;
} );
$scheduler = \MeuMouse\MDS\SDK\SDK::get( 'my-plugin' )->scheduler();
$scheduler->hook(); // the per-product cron hook name
$scheduler->schedule();
$scheduler->unschedule(); // also called by Integration::shutdown()
$scheduler->run(); // run the heartbeat now
$scheduler->recurrence(); // the filtered cron schedule, "daily" by default
$scheduler->is_enabled(); // whether the heartbeat feature is on
bash
composer
preset (mode) → features array → filters → constants