Bearsampp
2025.8.29
Loading...
Searching...
No Matches
class.tpl.app.logs.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2024 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
16
class
TplAppLogs
17
{
18
// Constant for the logs menu identifier
19
const
MENU
=
'logs'
;
20
31
public
static
function
process
()
32
{
33
global
$bearsamppLang
;
34
35
return
TplApp::getMenu
(
$bearsamppLang
->getValue(
Lang::LOGS
), self::MENU, get_called_class());
36
}
37
48
public
static
function
getMenuLogs
()
49
{
50
global
$bearsamppRoot
;
51
52
$files = array();
53
54
// Open the logs directory
55
$handle = @opendir(
$bearsamppRoot
->getLogsPath());
56
if
(!$handle) {
57
return
''
;
58
}
59
60
// Read log files from the directory
61
while
(
false
!== ($file = readdir($handle))) {
62
if
($file !=
"."
&& $file !=
".."
&&
Util::endWith
($file,
'.log'
)) {
63
$files[] = $file;
64
}
65
}
66
67
// Close the directory handle
68
closedir($handle);
69
ksort($files);
70
71
// Generate menu items for each log file
72
$result
=
''
;
73
foreach
($files as $file) {
74
$result
.=
TplAestan::getItemNotepad
(basename($file),
$bearsamppRoot
->getLogsPath() .
'/'
. $file) . PHP_EOL;
75
}
76
return
$result
;
77
}
78
}
$result
$result
Definition
ajax.apache.php:19
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
Lang\LOGS
const LOGS
Definition
class.lang.php:55
TplAestan\getItemNotepad
static getItemNotepad($caption, $path)
Definition
class.tpl.aestan.php:199
TplApp\getMenu
static getMenu($caption, $menu, $class)
Definition
class.tpl.app.php:190
TplAppLogs
Definition
class.tpl.app.logs.php:17
TplAppLogs\MENU
const MENU
Definition
class.tpl.app.logs.php:19
TplAppLogs\process
static process()
Definition
class.tpl.app.logs.php:31
TplAppLogs\getMenuLogs
static getMenuLogs()
Definition
class.tpl.app.logs.php:48
Util\endWith
static endWith($string, $search)
Definition
class.util.php:177
Bearsampp-development
sandbox
core
classes
tpls
app
class.tpl.app.logs.php
Generated by
1.14.0