set_basename( false, __FILE__ ); } else { if ( !function_exists( 'dprcu_fs' ) ) { require_once plugin_dir_path( __FILE__ ) . 'includes/freemius.php'; } // The free version relies on WordPress.org auto-loading translations (WP 4.6+). // The premium version runs under a different folder name (3d-product-customizer-premium), // so WordPress won't auto-load the free text domain — load it explicitly instead. // We also load the premium slug as an alias pointing to the same translation files // so that the Text Domain header in the premium plugin file matches PCP expectations. if ( strpos( plugin_basename( __FILE__ ), '3d-product-customizer/' ) === false ) { add_action( 'init', function () { $lang_dir = dirname( plugin_basename( __FILE__ ) ) . '/languages'; load_plugin_textdomain( '3d-product-customizer', false, $lang_dir ); // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Required: premium runs under a different folder and is not auto-loaded by WordPress.org. load_plugin_textdomain( '3d-customizer-premium', false, $lang_dir ); // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Alias for the premium Text Domain header. } ); } // Init customizer block for block-based themes (FSE) add_action( 'init', function () { register_block_type_from_metadata( plugin_dir_path( __FILE__ ) . 'blocks/customizer', [ 'render_callback' => 'dprcu_block_render', ] ); } ); /** * Check if WooCommerce is active. If not, show admin notice and deactivate plugin. */ if ( !function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) { add_action( 'admin_notices', function () { echo '
'; echo esc_html__( '3D Product Customizer requires WooCommerce to be installed and activated.', '3d-product-customizer' ); echo '