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 XOOPS Project (https://xoops.org) |
||||
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 | |||||
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'; |
||||
0 ignored issues
–
show
|
|||||
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
It seems like
$dirname can also be of type string[] ; however, parameter $dirname of Xoops\Module\Plugin::getPlugin() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
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 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.