Bearsampp 2025.8.29
Loading...
Searching...
No Matches
TplAppLogs Class Reference

Static Public Member Functions

static getMenuLogs ()
static process ()

Data Fields

const MENU = 'logs'

Detailed Description

Class TplAppLogs

This class provides methods to generate and manage the logs menu within the Bearsampp application. It includes functionalities for creating the logs menu and listing log files.

Definition at line 16 of file class.tpl.app.logs.php.

Member Function Documentation

◆ getMenuLogs()

getMenuLogs ( )
static

Generates the logs menu content.

This method retrieves the list of log files from the logs directory, sorts them, and generates menu items for each log file using the getItemNotepad method from the TplAestan class.

@global object $bearsamppRoot Provides access to the root directory of the application.

Returns
string The generated logs menu content as a string.

Definition at line 48 of file class.tpl.app.logs.php.

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 }
$result
global $bearsamppRoot
static getItemNotepad($caption, $path)
static endWith($string, $search)

References $bearsamppRoot, $result, Util\endWith(), and TplAestan\getItemNotepad().

◆ process()

process ( )
static

Processes and generates the logs menu.

This method generates the logs menu by retrieving the localized string for logs and calling the getMenu method from the TplApp class.

@global object $bearsamppLang Provides language support for retrieving language-specific values.

Returns
array The generated logs menu as a string.

Definition at line 31 of file class.tpl.app.logs.php.

32 {
33 global $bearsamppLang;
34
35 return TplApp::getMenu($bearsamppLang->getValue(Lang::LOGS), self::MENU, get_called_class());
36 }
global $bearsamppLang
const LOGS
static getMenu($caption, $menu, $class)

References $bearsamppLang, TplApp\getMenu(), and Lang\LOGS.

Referenced by TplApp\getSectionMenuLeft().

Field Documentation

◆ MENU

const MENU = 'logs'

Definition at line 19 of file class.tpl.app.logs.php.


The documentation for this class was generated from the following file: