PHP code example of plugpressco / plugpress-sdk

1. Go to this page and download the library: Download plugpressco/plugpress-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/ */

    

plugpressco / plugpress-sdk example snippets


add_action( 'init', function () {
    if ( ! class_exists( 'PlugPress_SDK' ) ) return;

    PlugPress_SDK::init( [
        'slug'              => 'your-plugin',
        'name'              => 'Your Plugin',
        'file'              => __FILE__,
        'version'           => YOUR_PLUGIN_VERSION,
        'server'            => 'https://updates.plugpress.co',
        'telemetry_server'  => 'https://analytics.plugpress.co',
        'activate_redirect' => admin_url( 'admin.php?page=your-plugin#/onboarding/welcome' ),
        'pro'               => false,          // true for pro plugins
        // updater, optin, feedback all default to true
        'menu_parent'       => 'your-plugin',
        'accent'            => '#4F46E5',
        'about'             => [
            'tagline' => 'One-line description.',
            'links'   => [
                'Documentation' => 'https://yourplugin.co/docs',
                'Support'       => 'https://yourplugin.co/support',
            ],
        ],
    ] );
} );

add_action( 'init', function () {
    if ( ! class_exists( 'PlugPress_SDK' ) ) return;

    PlugPress_SDK::init( [
        'slug'        => 'saddle-pro',
        'name'        => 'Saddle Pro',
        'file'        => __FILE__,
        'version'     => SADDLE_PRO_VERSION,
        'pro'         => true,
        'menu_parent' => 'saddle',
        'freemius'    => [
            'id'         => '12345',            // Freemius product id
            'public_key' => 'pk_...',
            // 'start' => __DIR__ . '/freemius/start.php',  // optional explicit path
            // 'init'  => [ 'has_addons' => true ],         // fs_dynamic_init overrides
        ],
        'about'       => [ 'tagline' => '…', 'links' => [ /* … */ ] ],
    ] );
} );

add_action( 'init', function () {
    if ( ! class_exists( 'PlugPress_SDK' ) ) return;

    PlugPress_SDK::init( [
        'slug'             => 'divi-blog-pro',
        'name'             => 'Divi Blog Pro',
        'file'             => __FILE__,
        'version'          => DBP_VERSION,
        'telemetry_server' => 'https://analytics.plugpress.co',
        'updater'          => false,   // Freemius handles updates + license
        'optin'            => true,
        'feedback'         => true,
        'menu_parent'      => 'divi-people',
        'accent'           => '#7747FF',
        'about'            => [
            'tagline' => 'Beautiful blog layouts for Divi.',
            'links'   => [
                'Documentation' => 'https://divipeople.com/docs/divi-blog-pro',
                'Support'       => 'https://divipeople.com/support',
            ],
        ],
    ] );
} );

add_action( 'init', function () {
    if ( ! class_exists( 'PlugPress_SDK' ) ) return;

    PlugPress_SDK::init( [
        'slug'             => 'divitorque',
        'name'             => 'Divi Torque Pro',
        'file'             => __FILE__,
        'version'          => DTP_VERSION,
        'telemetry_server' => 'https://analytics.plugpress.co',
        'updater'          => false,   // Freemius
        'optin'            => false,   // Freemius has its own opt-in
        'feedback'         => false,   // Freemius has its own feedback
        'menu_parent'      => 'divitorque',
        'accent'           => '#7747FF',
        'about'            => [
            'tagline' => 'Powerful Divi modules to create exceptional websites.',
            'links'   => [
                'Documentation' => 'https://divitorque.com/docs',
                'Support'       => 'https://divitorque.com/support',
                'Changelog'     => 'https://divitorque.com/changelog',
            ],
        ],
    ] );
} );

add_action( 'init', function () {
    if ( ! class_exists( 'PlugPress_SDK' ) ) return;

    PlugPress_SDK::init( [
        'slug'        => 'divi-blog-pro',
        'name'        => 'Divi Blog Pro',
        'file'        => __FILE__,
        'version'     => DBP_VERSION,
        'updater'     => false,   // ET handles
        'optin'       => false,   // no external calls on ET
        'feedback'    => false,   // no external calls on ET
        'menu_parent' => 'divi-people',
        'accent'      => '#7747FF',
        'about'       => [
            'tagline' => 'Beautiful blog layouts for Divi.',
            'links'   => [
                'Documentation' => 'https://divipeople.com/docs',
                'Support'       => 'https://divipeople.com/support',
            ],
        ],
    ] );
} );

add_action( 'init', function () {
    if ( ! class_exists( 'PlugPress_SDK' ) ) return;

    PlugPress_SDK::init( [
        'slug'             => 'your-free-plugin',
        'name'             => 'Your Free Plugin',
        'file'             => __FILE__,
        'version'          => YOUR_PLUGIN_VERSION,
        'telemetry_server' => 'https://analytics.plugpress.co',
        'updater'          => false,   // WP.org handles updates
        'pro'              => false,
        'menu_parent'      => 'your-free-plugin',
        'accent'           => '#4F46E5',
        'about'            => [
            'tagline' => 'One-line description.',
            'links'   => [
                'Documentation' => 'https://...',
                'Support'       => 'https://wordpress.org/support/plugin/your-free-plugin',
                'Rate us'       => 'https://wordpress.org/plugins/your-free-plugin/#reviews',
            ],
        ],
    ] );
} );

PlugPress_SDK::init( [
    // Required
    'slug'              => '',        // plugin text-domain slug
    'name'              => '',        // human-readable plugin name
    'file'              => __FILE__,  // path to main plugin file
    'version'           => '1.0.0',

    // Update server (only used when updater: true)
    'server'            => 'https://updates.plugpress.co',

    // Analytics endpoint (only used when optin: true, empty = disabled)
    'telemetry_server'  => 'https://analytics.plugpress.co',

    // Redirect to onboarding after first activation (only when optin: true)
    'activate_redirect' => '',

    // Pro license gate (only when updater: true)
    'pro'               => false,

    // Component toggles
    'updater'           => true,   // self-hosted update checker + license + beta channel
    'optin'             => true,   // telemetry opt-in notice + weekly ping
    'feedback'          => true,   // deactivation feedback modal
    'optin_inline'      => false,  // true when YOUR admin app renders the opt-in card
                                   // (via get_optin_js_data()) — suppresses the PHP
                                   // notice on your top-level screen

    // Admin UI
    'menu_parent'       => '',        // parent menu slug for About/License pages
    'accent'            => '#2395E7', // brand colour for buttons and highlights
    'textdomain'        => '',        // defaults to slug
    'capability'        => 'manage_options',

    // About page content
    'about'             => [
        'tagline' => '',
        'links'   => [],  // [ 'Label' => 'https://...' ]
    ],
] );

if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {