plugin = $plugin; $this->init(); } /** * Initialize admin functionality */ public function init() { // Admin hooks add_action('admin_post_update_dash_settings', array($this, 'handle_form_submission')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); add_action('admin_footer', array($this, 'render_admin_assets')); } /** * Enqueue admin scripts and styles */ public function enqueue_admin_scripts($hook) { if (strpos($hook, 'tigerstyle-dash') === false) { return; } wp_enqueue_script( 'tigerstyle-dash-admin', TIGERSTYLE_DASH_URL . 'assets/js/admin.js', array('jquery'), TIGERSTYLE_DASH_VERSION, true ); wp_localize_script('tigerstyle-dash-admin', 'tigerStyleDash', array( 'ajaxUrl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('tigerstyle_dash_nonce'), 'strings' => array( 'analyzing' => __('Analyzing performance...', 'tigerstyle-dash'), 'clearing' => __('Clearing cache...', 'tigerstyle-dash'), 'success' => __('Success!', 'tigerstyle-dash'), 'error' => __('Error occurred', 'tigerstyle-dash') ) )); wp_enqueue_style( 'tigerstyle-dash-admin', TIGERSTYLE_DASH_URL . 'assets/css/admin.css', array(), TIGERSTYLE_DASH_VERSION ); } /** * Render main admin page */ public function render_main_page() { // Check user permissions if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.', 'tigerstyle-dash')); } // Get current tab $current_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'performance'; // Get current settings $compression_enabled = get_option('tigerstyle_dash_compression_enabled', true); $compression_method = get_option('tigerstyle_dash_compression_method', 'auto'); $compression_level = get_option('tigerstyle_dash_compression_level', 6); $cache_enabled = get_option('tigerstyle_dash_cache_enabled', true); $cache_ttl = get_option('tigerstyle_dash_cache_ttl', 3600); // Get performance statistics $stats = $this->get_performance_stats(); ?>

render_cdn_tab(); break; case 'analytics': $this->render_analytics_tab(); break; case 'performance': default: $this->render_performance_tab($stats, $compression_enabled, $compression_method, $compression_level, $cache_enabled, $cache_ttl); break; } ?>

plugin->get_cdn(); $cdn_settings = $cdn->get_cdn_settings(); $cdn_analytics = $cdn->get_cdn_analytics(); $vultr_info = $cdn->get_vultr_info(); ?>

RECOMMENDED

🚀

99.9%
Uptime SLA
<50ms
Global Latency
24+
Edge Locations
$0.01
Per GB
$benefit): ?>

$step): ?>

🚀

🛡️



$this->format_bytes(get_option('tigerstyle_dash_bandwidth_saved', 0)), 'files_compressed' => number_format(get_option('tigerstyle_dash_files_compressed', 0)), 'avg_compression_ratio' => get_option('tigerstyle_dash_avg_compression_ratio', 0) . '%', 'cache_hit_ratio' => get_option('tigerstyle_dash_cache_hit_ratio', 0) . '%' ); } /** * Format bytes into human readable format */ private function format_bytes($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); for ($i = 0; $bytes > 1024 && $i < count($units) - 1; $i++) { $bytes /= 1024; } return round($bytes, $precision) . ' ' . $units[$i]; } /** * Handle form submission */ public function handle_form_submission() { // Verify nonce if (!wp_verify_nonce($_POST['dash_settings_nonce'], 'update_dash_settings')) { wp_die(__('Security check failed.', 'tigerstyle-dash')); } // Check user permissions if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions.', 'tigerstyle-dash')); } // Update settings update_option('tigerstyle_dash_compression_enabled', isset($_POST['compression_enabled'])); update_option('tigerstyle_dash_compression_method', sanitize_text_field($_POST['compression_method'])); update_option('tigerstyle_dash_compression_level', intval($_POST['compression_level'])); update_option('tigerstyle_dash_cache_enabled', isset($_POST['cache_enabled'])); update_option('tigerstyle_dash_cache_ttl', intval($_POST['cache_ttl'])); // Redirect back with success message wp_redirect(add_query_arg(array( 'page' => 'tigerstyle-dash', 'message' => 'settings_updated' ), admin_url('admin.php'))); exit; } }