Source
173
173
* Convert time to a string representation. Return 'Never' if timestamp is 0.
174
174
*
175
175
* @param $format
176
176
* @param null $time
177
177
* @param string|null $timezone
178
178
*
179
179
* @throws Exception
180
180
*
181
181
* @return string
182
182
*/
183
-
function zbx_date2str($format, $time = null, string $timezone = null) {
183
+
function zbx_date2str($format, $time = null, ?string $timezone = null) {
184
184
static $weekdaynames, $weekdaynameslong, $months, $monthslong;
185
185
186
186
if ($time === null) {
187
187
$time = time();
188
188
}
189
189
190
190
if ($time == 0) {
191
191
return _('Never');
192
192
}
193
193
1750
1750
* @param string $class CSS class of the message box. Possible values:
1751
1751
* ZBX_STYLE_MSG_GOOD, ZBX_STYLE_MSG_BAD, ZBX_STYLE_MSG_WARNING.
1752
1752
* @param array $messages An array of messages.
1753
1753
* @param string $messages[]['message'] Message text.
1754
1754
* @param string|null $title (optional) Message box title.
1755
1755
* @param bool $show_close_box (optional) Show or hide close button in error message box.
1756
1756
* @param bool $show_details (optional) Show or hide message details.
1757
1757
*
1758
1758
* @return CTag
1759
1759
*/
1760
-
function makeMessageBox(string $class, array $messages, string $title = null, bool $show_close_box = true,
1760
+
function makeMessageBox(string $class, array $messages, ?string $title = null, bool $show_close_box = true,
1761
1761
bool $show_details = false): CTag {
1762
1762
1763
1763
$aria_labels = [
1764
1764
ZBX_STYLE_MSG_GOOD => _('Success message'),
1765
1765
ZBX_STYLE_MSG_BAD => _('Error message'),
1766
1766
ZBX_STYLE_MSG_WARNING => _('Warning message')
1767
1767
];
1768
1768
1769
1769
$message_box = (new CTag('output', true))
1770
1770
->addClass($class)
1851
1851
1852
1852
/**
1853
1853
* Returns a message box if there are messages. Otherwise, null.
1854
1854
*
1855
1855
* @param bool $good Parameter passed to makeMessageBox to specify message box style.
1856
1856
* @param string $title Message box title.
1857
1857
* @param bool $show_close_box Show or hide close button in error message box.
1858
1858
*
1859
1859
* @return CTag|null
1860
1860
*/
1861
-
function getMessages(bool $good = false, string $title = null, bool $show_close_box = true): ?CTag {
1861
+
function getMessages(bool $good = false, ?string $title = null, bool $show_close_box = true): ?CTag {
1862
1862
$messages = get_and_clear_messages();
1863
1863
1864
1864
$message_box = ($title || $messages)
1865
1865
? makeMessageBox($good ? ZBX_STYLE_MSG_GOOD : ZBX_STYLE_MSG_BAD, $messages, $title, $show_close_box, !$good)
1866
1866
: null;
1867
1867
1868
1868
return $message_box;
1869
1869
}
1870
1870
1871
1871
function show_messages($good = null, $okmsg = null, $errmsg = null) {