mirror of
https://github.com/Heretek-AI/heretek-control-core.git
synced 2026-10-12 02:03:55 +00:00
Registers the free Cloud module, boots the connect/callback/disconnect admin-post handlers, renders the Connect/Disconnect card on the Connection tab, adds the authenticated Cloud REST client, and cleans up cloud options on uninstall. Co-Authored-By: Claude Opus 4.8 <[email protected]>
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* EMCP Cloud module (free, on by default). Boots the OAuth client admin flow.
|
|
*
|
|
* @package EMCP_Tools
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
class EMCP_Tools_Cloud_Module extends EMCP_Tools_Module {
|
|
public function id(): string {
|
|
return 'cloud';
|
|
}
|
|
|
|
public function title(): string {
|
|
return __( 'EMCP Cloud', 'emcp-tools' );
|
|
}
|
|
|
|
public function description(): string {
|
|
return __( 'Connect this site to your EMCP Cloud account to back up and sync your work.', 'emcp-tools' );
|
|
}
|
|
|
|
public function tier(): string {
|
|
return 'free';
|
|
}
|
|
|
|
public function default_active(): bool {
|
|
return true;
|
|
}
|
|
|
|
public function register(): void {
|
|
EMCP_Tools_Cloud_Connect::init();
|
|
}
|
|
|
|
public function render_settings(): void {
|
|
echo '<p>' . esc_html__( 'Connect or disconnect on the Connection tab.', 'emcp-tools' ) . '</p>';
|
|
}
|
|
|
|
public function settings_url(): string {
|
|
return admin_url( 'admin.php?page=emcp-tools-connection#emcp-conn-main' );
|
|
}
|
|
|
|
/**
|
|
* Static gate for the Connection-tab card (runs before init:5).
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function is_enabled(): bool {
|
|
$active = (array) get_option( EMCP_Tools_Module::OPTION_ACTIVE, array() );
|
|
return in_array( 'cloud', $active, true );
|
|
}
|
|
}
|