diff --git a/includes/Access.php b/includes/Access.php index 887952489..20bd61b86 100644 --- a/includes/Access.php +++ b/includes/Access.php @@ -84,28 +84,13 @@ class Access { } public function formipay_access_items() { - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - \Formipay\Admin\ReactAdmin::render_mount_point('access'); - } else { - // Classic Grid.js version - include_once FORMIPAY_PATH . 'admin/page-access-items.php'; - } + // React admin + \Formipay\Admin\ReactAdmin::render_mount_point('access'); } public function enqueue_admin() { - global $current_screen; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } - - $screen = get_current_screen(); + // Assets now handled by ReactAdmin class + return; $screen = get_current_screen(); diff --git a/includes/Admin/ReactAdmin.php b/includes/Admin/ReactAdmin.php index 97dd9b5ea..c7bd80de4 100644 --- a/includes/Admin/ReactAdmin.php +++ b/includes/Admin/ReactAdmin.php @@ -12,8 +12,6 @@ class ReactAdmin { add_action( 'admin_enqueue_scripts', [$this, 'enqueue_assets'] ); add_filter( 'formipay/admin/data', [$this, 'localize_data'] ); - add_action( 'admin_notices', [$this, 'version_notice'] ); - add_filter( 'admin_footer_text', [$this, 'footer_toggle'] ); } @@ -26,12 +24,6 @@ class ReactAdmin { return; } - // Check coexistence mode - only load React when ?react=1 or option is set - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ( ! $use_react ) { - return; // Classic mode - don't load React assets - } - // Enqueue React build assets $build_dir = FORMIPAY_PATH . 'build'; $build_url = FORMIPAY_URL . 'build'; @@ -164,58 +156,4 @@ class ReactAdmin { } - /** - * Show admin notice about current admin version - */ - public function version_notice() { - - $screen = get_current_screen(); - - // Only show on Formipay admin pages - if ( strpos( $screen->id, 'formipay' ) === false ) { - return; - } - - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - $version = $use_react ? 'React (Beta)' : 'Classic'; - - printf( - '
-

- Formipay Admin: Using %s version. - Switch to %s -

-
', - esc_html( $version ), - esc_url( add_query_arg( 'react', $use_react ? '0' : '1' ) ), - esc_html( $use_react ? 'Classic' : 'React (Beta)' ) - ); - - } - - /** - * Add toggle link to admin footer - */ - public function footer_toggle( $text ) { - - $screen = get_current_screen(); - - // Only add toggle on Formipay admin pages - if ( strpos( $screen->id, 'formipay' ) === false ) { - return $text; - } - - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - $toggle_url = add_query_arg( 'react', $use_react ? '0' : '1' ); - $toggle_text = $use_react ? 'Switch to Classic' : 'Try React (Beta)'; - - return sprintf( - '%s | %s', - $text, - esc_url( $toggle_url ), - esc_html( $toggle_text ) - ); - - } - } diff --git a/includes/Coupon.php b/includes/Coupon.php index cb28f5e89..d05938e8b 100644 --- a/includes/Coupon.php +++ b/includes/Coupon.php @@ -94,26 +94,13 @@ class Coupon { } public function formipay_coupon() { - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - \Formipay\Admin\ReactAdmin::render_mount_point('coupons'); - } else { - // Classic Grid.js version - include_once FORMIPAY_PATH . 'admin/page-coupons.php'; - } + // React admin + \Formipay\Admin\ReactAdmin::render_mount_point('coupons'); } public function enqueue_admin() { - global $current_screen; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } + // Assets now handled by ReactAdmin class + return; if($current_screen->id == 'formipay_page_formipay-coupons') { diff --git a/includes/Customer.php b/includes/Customer.php index 80e5e41cc..2212fcc04 100644 --- a/includes/Customer.php +++ b/includes/Customer.php @@ -182,16 +182,8 @@ class Customer { } public function enqueue() { - - global $current_screen; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } - - if($current_screen->id == 'formipay_page_formipay-customers') { + // Assets now handled by ReactAdmin class + return; $customer_id = intval(filter_input(INPUT_GET, 'customer_id', FILTER_SANITIZE_STRING)); if(empty($customer_id)){ @@ -225,16 +217,8 @@ class Customer { } public function customers_page() { - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - \Formipay\Admin\ReactAdmin::render_mount_point('customers'); - } else { - // Classic Grid.js version - include_once FORMIPAY_PATH . 'admin/page-customers.php'; - } + // React admin + \Formipay\Admin\ReactAdmin::render_mount_point('customers'); } public function formipay_tabledata_customers() { diff --git a/includes/Form.php b/includes/Form.php index 9b14378b2..8c2c31c88 100644 --- a/includes/Form.php +++ b/includes/Form.php @@ -93,16 +93,8 @@ class Form { } public function formipay_form() { - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - \Formipay\Admin\ReactAdmin::render_mount_point('forms'); - } else { - // Classic Grid.js version - include_once FORMIPAY_PATH . 'admin/page-forms.php'; - } + // React admin + \Formipay\Admin\ReactAdmin::render_mount_point('forms'); } public function metaboxes($post) { @@ -1257,13 +1249,8 @@ class Form { } public function enqueue_admin() { - global $current_screen, $post; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } + // Assets now handled by ReactAdmin class + return; // Check that we are on the 'Checker' post editor screen if ( $current_screen->post_type === 'formipay-form' && $current_screen->base === 'post' ) { diff --git a/includes/Init.php b/includes/Init.php index 6201ed832..8f2989f01 100644 --- a/includes/Init.php +++ b/includes/Init.php @@ -80,18 +80,6 @@ class Init { public function enqueue() { global $current_screen; - // Check coexistence mode - if React is active, don't load classic shared assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - $is_formipay_screen = strpos($current_screen->id, 'formipay') !== false; - - // Don't load classic Grid.js/shared assets when React is active on admin pages - if ($use_react && $is_formipay_screen && $current_screen->base !== 'post') { - // Still load SweetAlert2 for React mode (needed for modals) - wp_enqueue_style( 'sweetalert2', FORMIPAY_URL . 'vendor/SweetAlert2/sweetalert2.min.css', [], '11.14.4', 'all'); - wp_enqueue_script( 'sweetalert2', FORMIPAY_URL . 'vendor/SweetAlert2/sweetalert2.min.js', ['jquery'], '11.14.4', true); - return; - } - $formipayCPTs = [ 'formipay-form' => __( 'Edit Form', 'formipay' ), 'formipay-product' => __( 'Edit Product', 'formipay' ), diff --git a/includes/License.php b/includes/License.php index d319fb834..3b7c8e619 100644 --- a/includes/License.php +++ b/includes/License.php @@ -70,29 +70,14 @@ class License { } public function page_licenses() { - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - \Formipay\Admin\ReactAdmin::render_mount_point('licenses'); - } else { - // Classic Grid.js version - include_once FORMIPAY_PATH . 'admin/page-licenses.php'; - } + // React admin + \Formipay\Admin\ReactAdmin::render_mount_point('licenses'); } /** Enqueue admin assets for Licenses page */ public function enqueue() { - global $current_screen; if (!$current_screen) return; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } - - if ($current_screen->id === 'formipay_page_formipay-licenses') { + // Assets now handled by ReactAdmin class + return; wp_enqueue_style('page-licenses', FORMIPAY_URL . 'admin/assets/css/admin-licenses.css', [], FORMIPAY_VERSION, 'all'); wp_enqueue_script('page-licenses', FORMIPAY_URL . 'admin/assets/js/admin-licenses.js', ['jquery', 'gridjs'], FORMIPAY_VERSION, true); wp_localize_script('page-licenses', 'formipay_licenses_page', [ diff --git a/includes/Order.php b/includes/Order.php index 0b5f37a11..fc4b67ecd 100644 --- a/includes/Order.php +++ b/includes/Order.php @@ -644,39 +644,17 @@ class Order { $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; $page = $order_id ? 'order-detail' : 'orders'; - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - printf( - '
', - esc_attr($page) - ); - } else { - // Classic Grid.js version - if ($order_id) { - include_once FORMIPAY_PATH . 'admin/page-order-details.php'; - } else { - include_once FORMIPAY_PATH . 'admin/page-orders.php'; - } - } + // React admin + printf( + '
', + esc_attr($page) + ); } public function enqueue() { - global $current_screen; - if (!$current_screen) return; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } - - // Classic Grid.js assets would be loaded here - // (Original enqueue code was commented out, may need restoration) - } + // Assets now handled by ReactAdmin class + return; public function formipay_get_all_forms() { diff --git a/includes/Product.php b/includes/Product.php index 3c6e319ff..d232e9756 100644 --- a/includes/Product.php +++ b/includes/Product.php @@ -106,13 +106,8 @@ class Product { } public function enqueue_admin() { - global $current_screen; - - // Check coexistence mode - if React is active, don't load classic assets - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - if ($use_react) { - return; - } + // Assets now handled by ReactAdmin class + return; if($current_screen->id == 'formipay_page_formipay-products') { @@ -233,16 +228,8 @@ class Product { } public function formipay_products() { - // Coexistence mode: check query param or setting for React version - $use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false); - - if ($use_react) { - // New React version - \Formipay\Admin\ReactAdmin::render_mount_point('products'); - } else { - // Classic Grid.js version - include_once FORMIPAY_PATH . 'admin/page-products.php'; - } + // React admin + \Formipay\Admin\ReactAdmin::render_mount_point('products'); } public function cpt_post_fields_box($boxes) {