<?php namespace MailPoet\AdminPages\Pages; if (!defined('ABSPATH')) exit; use MailPoet\AdminPages\PageRenderer; use MailPoet\Logging\LogRepository; use MailPoetVendor\Carbon\Carbon; class Logs { /** @var PageRenderer */ private $pageRenderer; /** @var LogRepository */ private $logRepository; public function __construct( LogRepository $logRepository, PageRenderer $pageRenderer ) { $this->pageRenderer = $pageRenderer; $this->logRepository = $logRepository; } public function render() { $search = isset($_GET['search']) ? $_GET['search'] : null; $from = isset($_GET['from']) ? $_GET['from'] : null; $to = isset($_GET['to']) ? $_GET['to'] : null; $offset = isset($_GET['offset']) ? $_GET['offset'] : null; $limit = isset($_GET['limit']) ? $_GET['limit'] : null; $dateFrom = (new Carbon())->subDays(7); if (isset($from)) { $dateFrom = new Carbon($from); } $dateTo = null; if (isset($to)) { $dateTo = new Carbon($to); } $logs = $this->logRepository->getLogs($dateFrom, $dateTo, $search, $offset, $limit); $data = ['logs' => []]; foreach ($logs as $log) { $data['logs'][] = [ 'id' => $log->getId(), 'name' => $log->getName(), 'message' => $log->getMessage(), 'created_at' => $log->getCreatedAt()->format('Y-m-d H:i:s'), ]; } $this->pageRenderer->displayPage('logs.html', $data); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
ExperimentalFeatures.php | File | 420 B | 0644 |
|
FormEditor.php | File | 13.31 KB | 0644 |
|
Forms.php | File | 2.2 KB | 0644 |
|
Help.php | File | 1.96 KB | 0644 |
|
Logs.php | File | 1.41 KB | 0644 |
|
MP2Migration.php | File | 730 B | 0644 |
|
NewsletterEditor.php | File | 5.93 KB | 0644 |
|
Newsletters.php | File | 6.84 KB | 0644 |
|
Premium.php | File | 923 B | 0644 |
|
Segments.php | File | 5.42 KB | 0644 |
|
Settings.php | File | 3.48 KB | 0644 |
|
Subscribers.php | File | 3.88 KB | 0644 |
|
SubscribersExport.php | File | 646 B | 0644 |
|
SubscribersImport.php | File | 1.3 KB | 0644 |
|
WelcomeWizard.php | File | 2.15 KB | 0644 |
|
WooCommerceSetup.php | File | 741 B | 0644 |
|
index.php | File | 0 B | 0644 |
|