mirror of
https://github.com/Heretek-AI/heretek-control-core.git
synced 2026-10-12 02:03:55 +00:00
Rebrand as the product grows beyond Elementor. Renames the main file (emcp-tools.php; ships as the emcp-tools/ folder), text domain, and all internal PHP identifiers: EMCP_Tools_* classes, emcp_tools_* functions/ options/hooks/AJAX actions, EMCP_TOOLS_* constants, the emcp_tools_fs() Freemius helper, and the emcpToolsAdmin JS handle. Intentionally PRESERVED (no client/skill breakage): - MCP ability namespace elementor-mcp/... - MCP server name elementor-mcp-server - CSS class prefix elementor-mcp- and DOM ids Freemius: slug -> emcp-tools (the dashboard slug must be updated to match before shipping); product id 30577 and premium_slug emcp-pro unchanged. Migration safety: - Legacy guard: if the old elementor-mcp plugin is still active, the new plugin bails before registering anything and shows a notice to remove it. Symbols are uniquely re-prefixed, so no "cannot redeclare" fatals. - emcp_tools_migrate_legacy_data() copies elementor_mcp_* options + dismissal user-meta to emcp_tools_* keys, captured while the old plugin is still present (before its uninstall can wipe them) and again as a fallback on normal boot. Also carries unreleased work already on this branch: Facebook community banner, Sandbox tab rename, and the URL guard. Tests: 409, 18 errors/15 failures — unchanged pre-existing baseline. Co-Authored-By: Claude Opus 4.8 <[email protected]>
35 lines
606 B
PHP
35 lines
606 B
PHP
<?php
|
|
/**
|
|
* Unique element ID generation.
|
|
*
|
|
* Generates 7-character hex IDs matching Elementor's internal format.
|
|
*
|
|
* @package EMCP_Tools
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Generates unique element IDs for Elementor elements.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class EMCP_Tools_Id_Generator {
|
|
|
|
/**
|
|
* Generates a 7-character random hex string.
|
|
*
|
|
* Matches Elementor's internal element ID format.
|
|
*
|
|
* @since 1.0.0
|
|
*
|
|
* @return string 7-character hex ID.
|
|
*/
|
|
public static function generate(): string {
|
|
return substr( bin2hex( random_bytes( 4 ) ), 0, 7 );
|
|
}
|
|
}
|