31 lines
790 B
PHP
31 lines
790 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Cf7stg;
|
|
|
|
final class Dashboard_Widget
|
|
{
|
|
public function register(): void
|
|
{
|
|
add_action('wp_dashboard_setup', [$this, 'maybe_register_widget']);
|
|
}
|
|
|
|
public function maybe_register_widget(): void
|
|
{
|
|
if (Queue::count_failed() === 0) return;
|
|
wp_add_dashboard_widget(
|
|
'cf7stg_dashboard_errors',
|
|
'⚠️ CF7 Spam → Telegram: ошибки доставки',
|
|
[$this, 'render']
|
|
);
|
|
}
|
|
|
|
public function render(): void
|
|
{
|
|
$failed = Queue::list_failed(10);
|
|
$count = Queue::count_failed();
|
|
$settings_url = admin_url('options-general.php?page=cf7stg-settings');
|
|
include CF7STG_PLUGIN_DIR . 'admin/views/dashboard-widget.php';
|
|
}
|
|
}
|