feat: Complete analytics implementation with all 7 pages, ROI calculation, conversion rate formatting, and chart improvements
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -29,4 +29,12 @@ class Permissions {
|
||||
$nonce = $_SERVER['HTTP_X_WP_NONCE'] ?? '';
|
||||
return (bool) wp_verify_nonce($nonce, 'wp_rest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has admin/manage_woocommerce permission
|
||||
* Used for analytics and admin-only endpoints
|
||||
*/
|
||||
public static function check_admin_permission(): bool {
|
||||
return current_user_can('manage_woocommerce') || current_user_can('manage_options');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace WooNooW\Api;
|
||||
|
||||
use WP_REST_Request;
|
||||
use WP_REST_Response;
|
||||
use WooNooW\Api\CheckoutController;
|
||||
use WooNooW\Api\OrdersController;
|
||||
use WooNooW\Api\AnalyticsController;
|
||||
|
||||
class Routes {
|
||||
public static function init() {
|
||||
// Initialize controllers (register action hooks)
|
||||
OrdersController::init();
|
||||
|
||||
add_action('rest_api_init', function () {
|
||||
$namespace = 'woonoow/v1';
|
||||
// Defer to controllers to register their endpoints
|
||||
CheckoutController::register();
|
||||
OrdersController::register();
|
||||
AnalyticsController::register_routes();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user