| 1 |
<?php |
| 2 |
|
| 3 |
if (class_exists('RabbitLoader_21_Tab_Log')) { |
| 4 |
#it seems we have a conflict |
| 5 |
return; |
| 6 |
} |
| 7 |
|
| 8 |
class RabbitLoader_21_Tab_Log |
| 9 |
{ |
| 10 |
public static function init() |
| 11 |
{ |
| 12 |
add_settings_section( |
| 13 |
'rabbitloader_section_log', |
| 14 |
' ', |
| 15 |
'', |
| 16 |
'rabbitloader-log' |
| 17 |
); |
| 18 |
} |
| 19 |
|
| 20 |
// private static function getLogsV2() |
| 21 |
// { |
| 22 |
// $activity_log = get_transient('rabbitloader_trans_activity_log'); |
| 23 |
// if (!is_array($activity_log)) { |
| 24 |
// $http = RabbitLoader_21_Core::callGETAPIV2("activitylog/domain/{domain_id}", $apiError, $apiMessage); |
| 25 |
// if (!empty($http['body']['logs'])) { |
| 26 |
// $activity_log = $http['body']['logs']; |
| 27 |
// } |
| 28 |
// set_transient('rabbitloader_trans_activity_log', $activity_log, 300); |
| 29 |
// } |
| 30 |
// return $activity_log; |
| 31 |
// } |
| 32 |
|
| 33 |
public static function echoMainContent() |
| 34 |
{ |
| 35 |
do_settings_sections('rabbitloader-log'); |
| 36 |
//$activity_log = self::getLogsV2(); |
| 37 |
// $activity_log = [ |
| 38 |
// ['level' => 'I', 'time' => time(), 'desc' => 'Summy log'] |
| 39 |
// ]; |
| 40 |
|
| 41 |
?> |
| 42 |
<div class="" style="max-width: 1160px; margin:40px auto;"> |
| 43 |
<div class="row mb-4"> |
| 44 |
<!-- <div class="col"> |
| 45 |
<div class="bg-white rounded p-4"> |
| 46 |
<div class="row"> |
| 47 |
<div class="col-12 text-secondary"> |
| 48 |
<h5 class="mt-0">Recent Notifications Messages</h5> |
| 49 |
<span class="mb-4 d-block">These are system generated log messages to get more insights on things running under the hood.</span> |
| 50 |
</div> |
| 51 |
<div class="col-12"> |
| 52 |
<?php |
| 53 |
if (empty($activity_log)) { |
| 54 |
_e('Everything looks good. No messages to show here.'); |
| 55 |
} else { |
| 56 |
$alert_class = ['I' => 'info', 'W' => 'warning', 'E' => 'danger']; |
| 57 |
$alert_icon = ['I' => 'info', 'W' => 'warning', 'E' => 'bell']; |
| 58 |
foreach ($activity_log as $log) { |
| 59 |
printf('<div class="alert alert-%s" role="alert"><span class="d-block "><span class="dashicons dashicons-%s align-middle"></span> %s UTC</span><hr><p class="fs-6 mb-0">%s</p></div>', $alert_class[$log['level']], $alert_icon[$log['level']], date('F j, Y h:i A', strtotime($log['time'])), $log['desc']); |
| 60 |
} |
| 61 |
} |
| 62 |
?> |
| 63 |
<a href="https://rabbitloader.com/account/#activity_log" target="_blank" class="rl-btn rl-btn-primary">Check older notifications <span class="dashicons dashicons-external mt-1"></span></a> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
</div> --> |
| 68 |
<div class="col"> |
| 69 |
<div class="rl-mfe-comp" id="mfe_activity_log"> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
|
| 75 |
|
| 76 |
<?php |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
?> |