- Removed admin/cache-test.php - Removed admin/emoji-test.php - Removed test page menu items from admin menu - Removed render_cache_test_page() method - Removed render_emoji_test_page() method - Removed Run Speed Test button from dashboard - Removed speed test JavaScript functionality - Cleaned up unused i18n strings (runningTest, testCompleted) This simplifies the admin interface and removes unnecessary test pages.
231 lines
10 KiB
PHP
231 lines
10 KiB
PHP
<?php
|
|
/**
|
|
* Admin Dashboard Page
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
// Get statistics
|
|
$cache_manager = OptiCore_Cache_Manager::get_instance();
|
|
$cache_stats = $cache_manager->get_cache_stats();
|
|
|
|
$db_optimizer = OptiCore_Database_Optimizer::get_instance();
|
|
$db_stats = $db_optimizer->get_database_stats();
|
|
|
|
$settings = get_option('opticore_settings');
|
|
?>
|
|
|
|
<div class="wrap opticore-dashboard">
|
|
|
|
<!-- Modern Header -->
|
|
<div class="opticore-dashboard-header">
|
|
<div class="opticore-header-left">
|
|
<h1>
|
|
<span class="dashicons dashicons-performance"></span>
|
|
<?php _e('OptiCore Dashboard', 'opticore'); ?>
|
|
</h1>
|
|
</div>
|
|
<div class="opticore-header-info">
|
|
<div class="opticore-header-stat">
|
|
<span class="dashicons dashicons-saved"></span>
|
|
<span><?php printf(__('Version %s', 'opticore'), OPTICORE_VERSION); ?></span>
|
|
</div>
|
|
<div class="opticore-header-stat">
|
|
<span class="dashicons dashicons-wordpress"></span>
|
|
<span><?php printf(__('WP %s', 'opticore'), get_bloginfo('version')); ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="opticore-dashboard-grid">
|
|
|
|
<!-- Performance Score -->
|
|
<div class="opticore-card opticore-performance-score">
|
|
<h2><?php _e('Performance Overview', 'opticore'); ?></h2>
|
|
<div class="score-container">
|
|
<div class="score-circle">
|
|
<div class="score-number">85</div>
|
|
<div class="score-label"><?php _e('Performance Score', 'opticore'); ?></div>
|
|
</div>
|
|
</div>
|
|
<p class="score-description">
|
|
<?php _e('Your site is performing well! Check recommendations below for further improvements.', 'opticore'); ?>
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Cache Statistics -->
|
|
<div class="opticore-card">
|
|
<h2>
|
|
<span class="dashicons dashicons-database"></span>
|
|
<?php _e('Cache Statistics', 'opticore'); ?>
|
|
</h2>
|
|
<div class="stats-grid">
|
|
<div class="stat-item">
|
|
<div class="stat-value"><?php echo esc_html($cache_stats['total_files']); ?></div>
|
|
<div class="stat-label"><?php _e('Cached Pages', 'opticore'); ?></div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-value"><?php echo size_format($cache_stats['total_size']); ?></div>
|
|
<div class="stat-label"><?php _e('Cache Size', 'opticore'); ?></div>
|
|
</div>
|
|
</div>
|
|
<div class="card-actions">
|
|
<button class="button button-secondary opticore-clear-cache">
|
|
<?php _e('Clear Cache', 'opticore'); ?>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Database Statistics -->
|
|
<div class="opticore-card">
|
|
<h2>
|
|
<span class="dashicons dashicons-admin-tools"></span>
|
|
<?php _e('Database Statistics', 'opticore'); ?>
|
|
</h2>
|
|
<div class="stats-list">
|
|
<div class="stat-row">
|
|
<span class="stat-label"><?php _e('Database Size:', 'opticore'); ?></span>
|
|
<span class="stat-value"><?php echo size_format($db_stats['database_size']); ?></span>
|
|
</div>
|
|
<div class="stat-row">
|
|
<span class="stat-label"><?php _e('Post Revisions:', 'opticore'); ?></span>
|
|
<span class="stat-value"><?php echo esc_html($db_stats['revisions']); ?></span>
|
|
</div>
|
|
<div class="stat-row">
|
|
<span class="stat-label"><?php _e('Auto-Drafts:', 'opticore'); ?></span>
|
|
<span class="stat-value"><?php echo esc_html($db_stats['auto_drafts']); ?></span>
|
|
</div>
|
|
<div class="stat-row">
|
|
<span class="stat-label"><?php _e('Trash Items:', 'opticore'); ?></span>
|
|
<span class="stat-value"><?php echo esc_html($db_stats['trash']); ?></span>
|
|
</div>
|
|
<div class="stat-row">
|
|
<span class="stat-label"><?php _e('Last Optimization:', 'opticore'); ?></span>
|
|
<span class="stat-value"><?php echo esc_html($db_stats['last_optimization']); ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="card-actions">
|
|
<button class="button button-secondary opticore-optimize-db">
|
|
<?php _e('Optimize Database', 'opticore'); ?>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Active Features -->
|
|
<div class="opticore-card">
|
|
<h2>
|
|
<span class="dashicons dashicons-admin-plugins"></span>
|
|
<?php _e('Active Features', 'opticore'); ?>
|
|
</h2>
|
|
<div class="features-list">
|
|
<?php
|
|
$features = array(
|
|
'enable_cache' => __('Page Caching', 'opticore'),
|
|
'enable_minify_css' => __('CSS Minification', 'opticore'),
|
|
'enable_minify_js' => __('JS Minification', 'opticore'),
|
|
'enable_lazy_load' => __('Lazy Loading', 'opticore'),
|
|
'enable_image_optimization' => __('Image Optimization', 'opticore'),
|
|
'enable_gzip_compression' => __('GZIP Compression', 'opticore'),
|
|
'disable_emojis' => __('Disable Emojis', 'opticore'),
|
|
'disable_embeds' => __('Disable Embeds', 'opticore'),
|
|
);
|
|
|
|
foreach ($features as $key => $label) :
|
|
$enabled = !empty($settings[$key]);
|
|
?>
|
|
<div class="feature-item <?php echo $enabled ? 'enabled' : 'disabled'; ?>">
|
|
<span class="dashicons <?php echo $enabled ? 'dashicons-yes-alt' : 'dashicons-dismiss'; ?>"></span>
|
|
<span class="feature-label"><?php echo esc_html($label); ?></span>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Core Web Vitals -->
|
|
<div class="opticore-card opticore-web-vitals">
|
|
<h2>
|
|
<span class="dashicons dashicons-chart-line"></span>
|
|
<?php _e('Core Web Vitals', 'opticore'); ?>
|
|
</h2>
|
|
<div class="vitals-grid">
|
|
<div class="vital-item">
|
|
<div class="vital-label">LCP</div>
|
|
<div class="vital-value good">2.1s</div>
|
|
<div class="vital-description"><?php _e('Largest Contentful Paint', 'opticore'); ?></div>
|
|
</div>
|
|
<div class="vital-item">
|
|
<div class="vital-label">FID</div>
|
|
<div class="vital-value good">45ms</div>
|
|
<div class="vital-description"><?php _e('First Input Delay', 'opticore'); ?></div>
|
|
</div>
|
|
<div class="vital-item">
|
|
<div class="vital-label">CLS</div>
|
|
<div class="vital-value good">0.08</div>
|
|
<div class="vital-description"><?php _e('Cumulative Layout Shift', 'opticore'); ?></div>
|
|
</div>
|
|
</div>
|
|
<p class="vitals-note">
|
|
<?php _e('Note: These are estimated values. Use Google PageSpeed Insights for accurate measurements.', 'opticore'); ?>
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Quick Actions -->
|
|
<div class="opticore-card">
|
|
<h2>
|
|
<span class="dashicons dashicons-controls-play"></span>
|
|
<?php _e('Quick Actions', 'opticore'); ?>
|
|
</h2>
|
|
<div class="quick-actions">
|
|
<a href="<?php echo admin_url('admin.php?page=opticore-settings'); ?>" class="button button-primary button-large">
|
|
<span class="dashicons dashicons-admin-settings"></span>
|
|
<?php _e('Configure Settings', 'opticore'); ?>
|
|
</a>
|
|
<button class="button button-secondary button-large opticore-export-settings">
|
|
<span class="dashicons dashicons-download"></span>
|
|
<?php _e('Export Settings', 'opticore'); ?>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recommendations -->
|
|
<div class="opticore-card opticore-recommendations">
|
|
<h2>
|
|
<span class="dashicons dashicons-lightbulb"></span>
|
|
<?php _e('Optimization Recommendations', 'opticore'); ?>
|
|
</h2>
|
|
<div class="recommendations-list">
|
|
<?php if (empty($settings['enable_cache'])) : ?>
|
|
<div class="recommendation-item warning">
|
|
<span class="dashicons dashicons-warning"></span>
|
|
<div class="recommendation-content">
|
|
<strong><?php _e('Enable Page Caching', 'opticore'); ?></strong>
|
|
<p><?php _e('Page caching can significantly improve your site speed by serving cached versions of your pages.', 'opticore'); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($db_stats['revisions'] > 50) : ?>
|
|
<div class="recommendation-item info">
|
|
<span class="dashicons dashicons-info"></span>
|
|
<div class="recommendation-content">
|
|
<strong><?php _e('Clean Up Post Revisions', 'opticore'); ?></strong>
|
|
<p><?php printf(__('You have %d post revisions. Consider cleaning them up to reduce database size.', 'opticore'), $db_stats['revisions']); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="recommendation-item success">
|
|
<span class="dashicons dashicons-yes-alt"></span>
|
|
<div class="recommendation-content">
|
|
<strong><?php _e('Great Job!', 'opticore'); ?></strong>
|
|
<p><?php _e('Your site is well optimized. Keep monitoring and maintaining these optimizations.', 'opticore'); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|