'16894', 'slug' => 'advance-custom-html', 'premium_slug' => 'advance-custom-html-pro', 'type' => 'plugin', 'public_key' => 'pk_e99f567863d84a62f963ac66aeb42', 'is_premium' => true, 'premium_suffix' => 'Pro', 'has_premium_version' => true, 'has_addons' => false, 'has_paid_plans' => true, 'trial' => array( 'days' => 7, 'is_require_payment' => false, ), 'menu' => array( 'slug' => 'advanced-custom-html', 'first-path' => 'tools.php?page=advanced-custom-html#/dashboard', 'contact' => false, 'support' => false, 'parent' => array( 'slug' => 'tools.php', ), ), ]; $achb_fs = ( ACHB_HAS_PRO && file_exists( $fsStartPath ) ? fs_dynamic_init( $achbConfig ) : fs_lite_dynamic_init( $achbConfig ) ); } return $achb_fs; } achb_fs(); do_action( 'achb_fs_loaded' ); } function achbIsPremium() { return ( ACHB_HAS_PRO ? achb_fs()->can_use_premium_code() : false ); } // Main Plugin Logic require_once ACHB_DIR_PATH . 'includes/AdminMenu.php'; class ACHB_Main { function __construct() { add_action( 'init', [$this, 'init'] ); add_action( 'wp_ajax_achbPipeChecker', [$this, 'achbPipeChecker'] ); add_action( 'wp_ajax_nopriv_achbPipeChecker', [$this, 'achbPipeChecker'] ); add_action( 'admin_init', [$this, 'registerSettings'] ); add_action( 'rest_api_init', [$this, 'registerSettings'] ); } function achbPipeChecker() { $nonce = $_POST['_wpnonce'] ?? null; if ( !wp_verify_nonce( $nonce, 'wp_ajax' ) ) { wp_send_json_error( 'Invalid Request' ); } wp_send_json_success( [ 'isPipe' => achbIsPremium(), ] ); } function registerSettings() { register_setting( 'achbUtils', 'achbUtils', [ 'show_in_rest' => [ 'name' => 'achbUtils', 'schema' => [ 'type' => 'string', ], ], 'type' => 'string', 'default' => wp_json_encode( [ 'nonce' => wp_create_nonce( 'wp_ajax' ), ] ), 'sanitize_callback' => 'sanitize_text_field', ] ); } function init() { register_block_type( __DIR__ . '/build' ); wp_set_script_translations( 'achb-editor', 'custom-html', plugin_dir_path( __FILE__ ) . 'languages' ); } function render( $attributes ) { extract( $attributes ); $isDisplayCodeToFrontend = $attributes["options"]["displayCodeToFrontend"]; $id = wp_unique_id( 'bPluginsCustomHtml-' ); if ( empty( $isDisplayCodeToFrontend ) ) { return $HTML; } else { return '
'; } } } new ACHB_Main(); }