Passed
Push — master ( b1f89f...0b7c80 )
by Michael
02:32 queued 11s
created

sitemap.xml.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Xoositemap module
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
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
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
13
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
14
 * @package         Xoositemap
15
 * @since           2.6.0
16
 * @author          Laurent JEN (Aka DuGris)
17
 * @version         $Id$
18
 */
19
if (file_exists('mainfile.php')) {
20
    include __DIR__ . '/mainfile.php';
21
} else {
22
    require  dirname(dirname(__DIR__)) . '/mainfile.php';
23
}
24
$xoops = \Xoops::getInstance();
25
$xoops->disableErrorReporting();
26
27
if (function_exists('mb_http_output')) {
28
    mb_http_output('pass');
29
}
30
header('Content-Type:text/xml; charset=utf-8');
31
32
$dirname = $xoops->isModule() ? $xoops->module->getVar('dirname') : 'system';
33
$tpl = new \XoopsTpl();
34
//$tpl->caching = 2;
35
//$tpl->cache_lifetime = 3600;
36
//if (!$tpl->is_cached('module:xoositemap/xoositemap_xml.html')) {
37
38
if ($xoops->isModule()) {
39
    $plugin = \Xoops\Module\Plugin::getPlugin($dirname, 'xoositemap');
0 ignored issues
show
The type Xoops\Module\Plugin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
    $res = $plugin->Xoositemap_xml(true);
41
    if (is_array($res)) {
42
        $time = isset($res['time']) ? $res['time'] : time();
43
        $mod_time[] = ['time' => $time];
44
        $modules[] = [
45
            'time' => $time,
46
            'dirname' => $res['dirname'],
47
            'date' => gmdate('Y-m-d\TH:i:s\Z', $time),
48
        ];
49
        if (count($res['items']) > 0) {
50
            foreach ($res['items'] as $item) {
51
                $times[] = ['time' => $item['time']];
52
                $items[] = [
53
                    'time' => $item['time'],
54
                    'date' => gmdate('Y-m-d\TH:i:s\Z', $item['time']),
55
                    'link' => $item['url'],
56
                ];
57
            }
58
        }
59
    }
60
} else {
61
    $plugins = \Xoops\Module\Plugin::getPlugins('xoositemap');
62
    foreach ($plugins as $plugin) {
63
        $res = $plugin->Xoositemap_xml(true);
64
        if (is_array($res)) {
65
            $time = isset($res['time']) ? $res['time'] : time();
66
            $mod_time[] = ['time' => $time];
67
            $modules[] = [
68
                'time' => $time,
69
                'dirname' => $res['dirname'],
70
                'date' => gmdate('Y-m-d\TH:i:s\Z', $time),
71
            ];
72
            if (count($res['items']) > 0) {
73
                foreach ($res['items'] as $item) {
74
                    $times[] = ['time' => $item['time']];
75
                    $items[] = [
76
                        'time' => $item['time'],
77
                        'date' => gmdate('Y-m-d\TH:i:s\Z', $item['time']),
78
                        'link' => $item['url'],
79
                    ];
80
                }
81
            }
82
        }
83
    }
84
}
85
86
array_multisort($times, SORT_DESC, $items);
87
array_multisort($mod_time, SORT_DESC, $modules);
88
$tpl->assign('items', $items);
89
$tpl->assign('modules', $modules);
90
$tpl->assign('modification', gmdate('Y-m-d\TH:i:s\Z'));
91
//}
92
$tpl->display('module:xoositemap/xoositemap_xml.tpl');
93