' .
sprintf(
/* translators: %s: minimum PHP version */ esc_html__( 'Wardpair requires PHP %s or higher.', 'wardpair' ),
esc_html( WARDPAIR_MIN_PHP )
) .
'
';
} );
return;
}
// ─── Freemius SDK ─────────────────────────────────────────────────────────────
if ( ! function_exists( 'wardpair_fs' ) ) {
function wardpair_fs() {
global $wardpair_fs;
if ( ! isset( $wardpair_fs ) ) {
$sdk_path = WARDPAIR_DIR . 'vendor/freemius/start.php';
// The deployment may ship the SDK under another folder name (for example
// vendor/wordpress-sdk-2.13.5/), so fall back to any vendor/wordpress-sdk*/ folder.
if ( ! file_exists( $sdk_path ) ) {
$sdk_found = glob( WARDPAIR_DIR . 'vendor/wordpress-sdk*/start.php' );
if ( ! empty( $sdk_found ) ) {
$sdk_path = $sdk_found[0];
}
}
if ( ! file_exists( $sdk_path ) ) {
add_action( 'admin_notices', function () {
echo '' .
esc_html__( 'Wardpair: Freemius SDK not found. Place it in vendor/freemius/.', 'wardpair' ) .
'
';
} );
return null;
}
require_once $sdk_path;
$wardpair_fs = fs_dynamic_init( array(
'id' => '26860',
'slug' => 'wardpair',
'premium_slug' => 'wardpair-premium',
'type' => 'plugin',
'public_key' => 'pk_4e0450073b062b35315173b9f3236',
// true in the source: this is the full (paid) codebase. The Freemius deployment makes the
// free version out of it and sets this to false there (see bin/freemius-sim.php).
'is_premium' => false,
'has_premium_version' => true,
'has_addons' => false,
'has_paid_plans' => true,
'is_org_compliant' => true,
'menu' => array(
'slug' => 'wardpair',
'support' => true,
'contact' => true,
'affiliation' => false,
'account' => true,
'pricing' => true,
),
) );
// Uninstall cleanup. Freemius fires `after_uninstall` when the plugin is deleted from the
// Plugins screen (and skips it while the other free/premium version is still active).
// This replaces uninstall.php, which Freemius does not allow in the plugin's main folder.
$wardpair_fs->add_action( 'after_uninstall', array( 'Sentinel_Uninstall', 'run' ) );
// Support routes. Free users are sent to the wordpress.org forum (Freemius's default
// "Support Forum" link). Customers, paying or on a trial, also get "Contact Us", which
// sends their message to the support email set in the Freemius dashboard.
// This only decides which menu item shows; it does not switch any feature on or off.
$wardpair_fs->add_filter( 'is_submenu_visible', function ( $visible, $menu_id ) use ( $wardpair_fs ) {
if ( 'contact' === $menu_id ) {
return $wardpair_fs->is_paying() || $wardpair_fs->is_trial();
}
return $visible;
}, 10, 2 );
}
return $wardpair_fs;
}
wardpair_fs();
do_action( 'wardpair_fs_loaded' );
}
// ─── Action Scheduler ─────────────────────────────────────────────────────────
add_filter( 'cron_schedules', function( $schedules ) {
if ( ! isset( $schedules['every_minute'] ) ) {
$schedules['every_minute'] = array(
'interval' => 60,
// This filter can fire on plugins_loaded (any wp_next_scheduled() /
// wp_schedule_event() call builds the schedule list). Translating
// before init triggers WP 6.7's early-textdomain notice, so fall
// back to the plain English label until init has run.
'display' => did_action( 'init' ) ? __( 'Every Minute', 'wardpair' ) : 'Every Minute',
);
}
return $schedules;
} );
if ( ! class_exists( 'ActionScheduler' ) ) {
$wardpair_as_path = WARDPAIR_DIR . 'vendor/action-scheduler/action-scheduler.php';
if ( file_exists( $wardpair_as_path ) ) {
require_once $wardpair_as_path;
}
}
add_action( 'wp_loaded', function () {
if ( ! class_exists( 'ActionScheduler' ) ) {
add_action( 'admin_notices', function () {
echo '' .
esc_html__( 'Wardpair requires Action Scheduler. Place it in vendor/action-scheduler/.', 'wardpair' ) .
'
';
} );
}
}, 5 );
// ─── Autoloader ───────────────────────────────────────────────────────────────
spl_autoload_register( function ( $class ) {
$map = array(
'Sentinel_Core' => 'includes/class-sentinel-core.php',
'Sentinel_Crypto' => 'includes/class-sentinel-crypto.php',
'Sentinel_Transport' => 'includes/class-sentinel-transport.php',
'Sentinel_Pairing' => 'includes/class-sentinel-pairing.php',
'Sentinel_Sync' => 'includes/class-sentinel-sync.php',
'Sentinel_Backup' => 'includes/class-sentinel-backup.php',
'Sentinel_Backup_Files' => 'includes/class-sentinel-backup-files.php',
'Sentinel_Backup_DB' => 'includes/class-sentinel-backup-db.php',
'Sentinel_Backup_Crypt' => 'includes/class-sentinel-backup-crypt.php',
'Sentinel_Activity_Logger' => 'includes/class-sentinel-activity-logger.php',
'Sentinel_Admin' => 'admin/class-sentinel-admin.php',
'Sentinel_Clone_Sync' => 'includes/class-sentinel-clone-sync.php',
'Sentinel_Clone_Primary' => 'includes/class-sentinel-clone-primary.php',
'Sentinel_Clone_Secondary' => 'includes/class-sentinel-clone-secondary.php',
'Sentinel_Clone_Verify' => 'includes/class-sentinel-clone-verify.php',
'Sentinel_Utils' => 'includes/class-sentinel-utils.php',
'Sentinel_Limits' => 'includes/class-sentinel-limits.php',
'Sentinel_SEO' => 'includes/class-sentinel-seo.php',
'Sentinel_Identity' => 'includes/class-sentinel-identity.php',
'Sentinel_Cron' => 'includes/class-sentinel-cron.php',
'Sentinel_Epoch' => 'includes/class-sentinel-epoch.php',
'Sentinel_History' => 'includes/class-sentinel-history.php',
'Sentinel_Log_Viewer' => 'includes/class-sentinel-log-viewer.php',
'Sentinel_Connections' => 'includes/class-sentinel-connections.php',
'Sentinel_Replay' => 'includes/class-sentinel-replay.php',
'Sentinel_Notices' => 'includes/class-sentinel-notices.php',
'Sentinel_Migrate' => 'includes/class-sentinel-migrate.php',
'Sentinel_Compat' => 'includes/class-sentinel-compat.php',
'Sentinel_Support' => 'includes/class-sentinel-support.php',
'Sentinel_Uninstall' => 'includes/class-sentinel-uninstall.php',
);
// Paid classes. This whole block, and the folders listed after @fs_premium_only in the
// plugin header, are removed from the free version by the Freemius deployment.
if ( isset( $map[ $class ] ) ) {
$file = WARDPAIR_DIR . $map[ $class ];
if ( file_exists( $file ) ) {
require_once $file;
}
}
} );
// ─── Failover Worker host override ────────────────────────────────────────────
// Runs on every request, before WordPress decides whether to redirect. Does
// nothing unless the request carries the Worker's secret (see Sentinel_Cloudflare).
// ─── Activation / Deactivation ────────────────────────────────────────────────
register_activation_hook( __FILE__, array( 'Sentinel_Core', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'Sentinel_Core', 'deactivate' ) );
// ─── Boot ─────────────────────────────────────────────────────────────────────
add_action( 'plugins_loaded', array( 'Sentinel_Core', 'get_instance' ) );
// ─── Upload Restore Handler ───────────────────────────────────────────────────
add_action( 'admin_post_wardpair_restore_upload', array( 'Sentinel_Backup', 'handle_restore_upload' ) );