'; echo wp_kses( __( 'Heretek Control Core Pro is active. The free version stays paused to avoid a conflict — you can safely deactivate and delete it. Everything is handled by Pro.', 'emcp-tools' ), array( 'strong' => array() ) ); echo '

'; } ); return; } } // The premium build retires an active free sibling. if ( $emcp_tools_is_premium_build ) { foreach ( $emcp_tools_free_basenames as $emcp_tools_free_sibling ) { emcp_tools_retire_sibling( $emcp_tools_free_sibling ); } add_action( 'admin_notices', function () { if ( get_transient( 'emcp_tools_free_retired' ) && current_user_can( 'activate_plugins' ) ) { delete_transient( 'emcp_tools_free_retired' ); echo '

'; echo esc_html__( 'Heretek Control Core: the free version was deactivated because the Pro version is active.', 'emcp-tools' ); echo '

'; } } ); } /** * Legacy coexistence guard. */ require_once __DIR__ . '/includes/class-migration.php'; if ( EMCP_Tools_Migration::is_legacy_plugin_active() ) { if ( is_admin() ) { EMCP_Tools_Migration::migrate(); } add_action( 'admin_notices', function () { if ( ! current_user_can( 'activate_plugins' ) ) { return; } echo '

'; echo wp_kses( __( 'Heretek Control Core: A previous version of this plugin (folder elementor-mcp) is still active. Heretek Control Core has replaced it — please deactivate and delete the old plugin to finish the upgrade. Your settings carry over automatically.', 'emcp-tools' ), array( 'strong' => array(), 'code' => array(), ) ); echo '

'; } ); return; } // Plugin constants. define( 'EMCP_TOOLS_VERSION', '3.16.1' ); define( 'HERETEK_CONTROL_CORE_VERSION', EMCP_TOOLS_VERSION ); define( 'EMCP_TOOLS_DIR', plugin_dir_path( __FILE__ ) ); define( 'HERETEK_CONTROL_CORE_DIR', EMCP_TOOLS_DIR ); define( 'EMCP_TOOLS_URL', plugin_dir_url( __FILE__ ) ); define( 'HERETEK_CONTROL_CORE_URL', EMCP_TOOLS_URL ); define( 'EMCP_TOOLS_BASENAME', plugin_basename( __FILE__ ) ); define( 'HERETEK_CONTROL_CORE_BASENAME', EMCP_TOOLS_BASENAME ); // Claim the WP\MCP namespace for our bundled MCP Adapter copy, at file-load. require_once EMCP_TOOLS_DIR . 'includes/class-mcp-adapter-bootstrap.php'; EMCP_Tools_Adapter_Bootstrap::preload_bundled_namespace(); if ( ! function_exists( 'emcp_tools_fs' ) ) { if ( file_exists( dirname( __FILE__ ) . '/includes/vendors/fremius/start.php' ) && ! defined( 'EMCP_WPORG_BUILD' ) ) { function emcp_tools_fs() { global $emcp_tools_fs; if ( ! isset( $emcp_tools_fs ) ) { if ( ! defined( 'WP_FS__PRODUCT_30577_MULTISITE' ) ) { define( 'WP_FS__PRODUCT_30577_MULTISITE', true ); } require_once dirname( __FILE__ ) . '/includes/vendors/fremius/start.php'; $emcp_tools_is_premium = file_exists( dirname( __FILE__ ) . '/.emcp-pro' ); $emcp_tools_fs = fs_dynamic_init( array( 'id' => '30577', 'slug' => 'emcp-tools', 'premium_slug' => 'emcp-pro', 'type' => 'plugin', 'public_key' => 'pk_2b2a026d5c27655581635abcd4556', 'is_premium' => $emcp_tools_is_premium, 'premium_suffix' => 'Pro', 'has_premium_version' => false, 'has_addons' => false, 'has_paid_plans' => false, 'is_org_compliant' => false, 'has_affiliation' => false, 'menu' => array( 'slug' => 'emcp-tools', 'support' => false, ), ) ); } return $emcp_tools_fs; } emcp_tools_fs(); do_action( 'emcp_tools_fs_loaded' ); /* * This build answers Freemius's licensing questions itself — the bundled * SDK's is_premium()/can_use_premium_code() are hard-wired to true — so * the SDK must not own the admin UX: * * - `_prepare_admin_menu` swaps the render callback of our own * `emcp-tools` page for its opt-in/connect screen while the site has * never been connected (`is_activation_mode()`), hiding the plugin's * real screens; * - its post-activation redirect sends the admin to * admin.php?page=emcp-tools, a URL that exists only if this plugin * finished booting — the dead end in the activation bug report. * * Both exist to sell a license this fork doesn't use, so both are * dropped. Nothing else depends on them: every licensing answer is * already hard-coded. */ if ( defined( 'WP_FS__LOWEST_PRIORITY' ) ) { $emcp_tools_fs_instance = emcp_tools_fs(); if ( is_object( $emcp_tools_fs_instance ) && method_exists( $emcp_tools_fs_instance, '_prepare_admin_menu' ) ) { remove_action( 'admin_menu', array( $emcp_tools_fs_instance, '_prepare_admin_menu' ), WP_FS__LOWEST_PRIORITY ); remove_action( 'network_admin_menu', array( $emcp_tools_fs_instance, '_prepare_admin_menu' ), WP_FS__LOWEST_PRIORITY ); } } emcp_tools_fs()->add_filter( 'redirect_on_activation', '__return_false' ); if ( is_admin() ) { add_action( 'admin_init', static function () { $updates = get_site_transient( 'update_plugins' ); if ( is_object( $updates ) && isset( $updates->response[ EMCP_TOOLS_BASENAME ] ) ) { $entry = $updates->response[ EMCP_TOOLS_BASENAME ]; if ( empty( $entry->package ) || ( isset( $entry->url ) && false !== strpos( $entry->url, 'freemius' ) ) ) { unset( $updates->response[ EMCP_TOOLS_BASENAME ] ); set_site_transient( 'update_plugins', $updates ); } } }, 5 ); } emcp_tools_fs()->add_filter( 'is_submenu_visible', function ( $is_visible, $menu_id ) { if ( 'contact' === $menu_id || 'affiliation' === $menu_id ) { return false; } if ( 'pricing' === $menu_id && emcp_tools_fs()->can_use_premium_code() ) { return false; } return $is_visible; }, 10, 2 ); } else { // Zero-dependency unlocked stub for official WordPress.org distribution. function emcp_tools_fs() { static $emcp_fs_stub = null; if ( null === $emcp_fs_stub ) { $emcp_fs_stub = new class { public function can_use_premium_code(): bool { return true; } public function is_premium(): bool { return true; } public function is_plan(): bool { return true; } public function has_features(): bool { return true; } public function add_filter( $hook, $callback, $priority = 10, $accepted_args = 1 ): void {} public function add_action( $hook, $callback, $priority = 10, $accepted_args = 1 ): void {} public function _get_license() { return (object) array( 'secret_key' => 'unlocked' ); } public function get_upgrade_url(): string { return 'https://github.com/Heretek-AI/heretek-control-core'; } }; } return $emcp_fs_stub; } do_action( 'emcp_tools_fs_loaded' ); } } // Uninstall cleanup runs via Freemius's after_uninstall action or WordPress uninstaller. require_once EMCP_TOOLS_DIR . 'includes/class-uninstaller.php'; if ( function_exists( 'emcp_tools_fs' ) && method_exists( emcp_tools_fs(), 'add_action' ) ) { emcp_tools_fs()->add_action( 'after_uninstall', array( 'EMCP_Tools_Uninstaller', 'run' ) ); } if ( ! function_exists( 'emcp_tools_upgrade_url' ) ) { function emcp_tools_upgrade_url(): string { return 'https://github.com/Heretek-AI/heretek-control-core'; } } // Hand off to the bootstrap (loads classes + wires hooks) once dependencies are available. require_once EMCP_TOOLS_DIR . 'includes/class-bootstrap.php'; add_action( 'plugins_loaded', array( 'EMCP_Tools_Bootstrap', 'boot' ), 20 );