LEPTON CMS 7.4.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
lepton_basics.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
25{
26 const SYSTEM_DEFAULT_STR = 'System Default';
33 public static $instance;
34
41 public static function getInstance(): object
42 {
43 if (null === static::$instance)
44 {
45 static::$instance = new static();
46 }
47
48 return static::$instance;
49 }
50
51
52
59 static function get_errorlevels(): array
60 {
61 global $TEXT;
62 // Create array
63 $ER_LEVELS = [];
64
65 // Add values to list
66 if (isset($TEXT['SYSTEM_DEFAULT']))
67 {
68 $ER_LEVELS[''] = $TEXT['SYSTEM_DEFAULT'];
69 }
70 else
71 {
72 $ER_LEVELS[''] = self::SYSTEM_DEFAULT_STR;
73 }
74
75 $ER_LEVELS['0'] = 'E_NONE'; // standard for productive use
76 $ER_LEVELS[E_NOTICE] = 'E_NOTICE';
77 $ER_LEVELS[E_WARNING] = 'E_WARNING';
78 $ER_LEVELS['-1'] = 'E_EVERYTHING'; // highest level
79
80 return $ER_LEVELS;
81 }
82
92 static function get_backend_translation(string $sKey = ""): string
93 {
94 global $TEXT, $THEME;
95
96 $sLanguagePath_user = THEME_PATH."/languages/".LANGUAGE.".php";
97 $sLanguagePath_default = THEME_PATH."/languages/EN.php";
98
99 if (!isset($THEME))
100 {
104 if (file_exists($sLanguagePath_user))
105 {
106 require_once $sLanguagePath_user;
107 }
108 elseif( file_exists( $sLanguagePath_default ) )
109 {
110 require_once $sLanguagePath_default;
111 }
112 else
113 {
114 // avoid errors and conflicts for non existing $THEME
115 $THEME = [];
116 }
117 }
118
119 if (isset($THEME[$sKey]))
120 {
121 return $THEME[$sKey];
122 }
123 elseif (isset($TEXT[$sKey]))
124 {
125 return $TEXT[$sKey];
126 }
127 else
128 {
129 return "** ".$sKey." (Key not found in Languages!)";
130 }
131 }
132
140 static function getLanguagePath(string $sRootDir = ""): string
141 {
142 $lang = $sRootDir."/languages/".LANGUAGE.".php";
143 return (file_exists($lang))
144 ? $lang
145 : $sRootDir."/languages/EN.php"
146 ;
147 }
148}
static getLanguagePath(string $sRootDir="")
static get_errorlevels()
static getInstance()
static get_backend_translation(string $sKey="")
const SYSTEM_DEFAULT_STR
const THEME_PATH