Use PHP rendering for statistics page

Skip Twig template and use direct PHP rendering for
better stability and debugging.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 00:02:53 +01:00
parent f8b88e4c98
commit 79b9c2cefd

View File

@@ -303,27 +303,7 @@ class AnalyticsController
{
$stats = $this->licenseManager->getStatistics();
// Render using Twig if available
$plugin = \Jeremias\WcLicensedProduct\Plugin::getInstance();
$twig = $plugin->getTwig();
if ($twig) {
try {
echo $twig->render('admin/statistics.html.twig', [
'stats' => $stats,
'admin_url' => admin_url('admin.php'),
'rest_url' => rest_url('wc-licensed-product/v1/analytics/'),
]);
return;
} catch (\Twig\Error\Error $e) {
// Any Twig error - fall through to PHP fallback
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('WC Licensed Product Twig Error: ' . $e->getMessage());
}
}
}
// Fallback PHP rendering
// Use PHP rendering directly for stability
$this->renderStatisticsPageFallback($stats);
}