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 | include dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
20 | |||
21 | $op = ''; |
||
22 | if (isset($_POST)) { |
||
23 | foreach ($_POST as $k => $v) { |
||
24 | ${$k} = $v; |
||
25 | } |
||
26 | } |
||
27 | if (isset($_GET)) { |
||
28 | foreach ($_GET as $k => $v) { |
||
29 | ${$k} = $v; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | $helper = \XoopsModules\Xoositemap\Helper::getInstance(); |
||
34 | $sitemapConfig = $helper->loadConfig(); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
35 | |||
36 | if ('' != $op) { |
||
0 ignored issues
–
show
|
|||
37 | $modules[] = $op; |
||
38 | } else { |
||
39 | $modules = $sitemapConfig['xoositemapModule']; |
||
40 | } |
||
41 | $xoops = \Xoops::getInstance(); |
||
42 | $xoops->header('xoositemap_index.tpl'); |
||
43 | $xoops->theme()->addStylesheet('modules/xoositemap/assets/css/module.css'); |
||
44 | |||
45 | $sitemap = []; |
||
46 | foreach ($modules as $k => $mod) { |
||
47 | $moduleObj = $xoops->module->getByDirname($mod); |
||
48 | |||
49 | $plugin = \Xoops\Module\Plugin::getPlugin($moduleObj->getVar('dirname'), 'xoositemap'); |
||
50 | if (is_object($plugin)) { |
||
51 | $results = $plugin->Xoositemap($sitemapConfig['xoositemap_subcat']); |
||
52 | |||
53 | $sitemap[$k]['name'] = $moduleObj->getVar('name'); |
||
54 | $sitemap[$k]['dirname'] = $moduleObj->getVar('dirname'); |
||
55 | $sitemap[$k]['image'] = \XoopsBaseConfig::get('url') . '/modules/' . $moduleObj->getVar('dirname') . '/assets/icons/logo_large.png'; |
||
56 | |||
57 | if (count($results) > 0) { |
||
58 | foreach (array_keys($results) as $i) { |
||
59 | $results[$i]['date'] = \XoopsLocale::formatTimestamp($results[$i]['time'], 's'); |
||
60 | } |
||
61 | $sitemap[$k]['sitemap'] = $results; |
||
62 | |||
63 | foreach ($results as $data) { |
||
64 | if (isset($data['category'])) { |
||
65 | $sitemap[$k]['category'] = true; |
||
66 | break; |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 | } |
||
71 | } |
||
72 | |||
73 | $xoops->tpl()->assign('moduletitle', $xoops->module->name()); |
||
74 | $xoops->tpl()->assign('xoositemap_config', $sitemapConfig); |
||
75 | $xoops->tpl()->assign('sitemap', $sitemap); |
||
76 |