ServerStats   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A getServerStats() 0 36 5
1
<?php namespace XoopsModules\Cardealer\Common;
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 * Module: cardealer
15
 *
16
 * @category        Module
17
 * @package         cardealer
18
 * @author          XOOPS Development Team <[email protected]> - <https://xoops.org>
19
 * @copyright       {@link https://xoops.org/ XOOPS Project}
20
 * @license         GPL 2.0 or later
21
 * @link            https://xoops.org/
22
 * @since           1.0.0
23
 */
24
trait ServerStats
25
{
26
    /**
27
     * serverStats()
28
     *
29
     * @return string
30
     */
31
    public static function getServerStats()
32
    {
33
        $moduleDirName      = basename(dirname(dirname(__DIR__)));
34
        $moduleDirNameUpper = strtoupper($moduleDirName);
35
        xoops_loadLanguage('common', $moduleDirName);
36
        $html = '';
37
        $html .= '<fieldset>';
38
        $html .= "<legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>';
39
        $html .= "<div style='padding: 8px;'>";
40
        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>';
41
        $html .= '<ul>';
42
43
        $gdlib = function_exists('gd_info') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
44
        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
45
        if (function_exists('gd_info')) {
46
            if (true === ($gdlib = gd_info())) {
47
                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
48
            }
49
        }
50
51
        $downloads = ini_get('file_uploads') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
52
        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
53
54
        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . '</span></b>';
55
        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . '</span></b>';
56
        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . '</span></b>';
57
        $html .= '</ul>';
58
        $html .= '<ul>';
59
        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>';
60
        $html .= '</ul>';
61
        $html .= '<br>';
62
        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . '';
63
        $html .= '</div>';
64
        $html .= '</fieldset><br>';
65
66
        return $html;
67
    }
68
}
69