|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace XoopsModules\Rssfit\Plugins; |
|
6
|
|
|
|
|
7
|
|
|
/* |
|
8
|
|
|
* You may not change or alter any portion of this comment or credits |
|
9
|
|
|
* of supporting developers from this source code or any supporting source code |
|
10
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
19
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
20
|
|
|
* @package RSSFit - Extendable XML news feed generator |
|
21
|
|
|
* @author NS Tai (aka tuff) <http://www.brandycoke.com> |
|
22
|
|
|
* @author XOOPS Development Team |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
use XoopsModules\Oledrion\Helper as PluginHelper; |
|
26
|
|
|
use XoopsModules\Oledrion\Parameters; |
|
27
|
|
|
use XoopsModules\Rssfit\{ |
|
28
|
|
|
AbstractPlugin |
|
29
|
|
|
}; |
|
30
|
|
|
|
|
31
|
|
|
if (!\defined('RSSFIT_ROOT_PATH')) { |
|
32
|
|
|
exit(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Class Oledrion |
|
37
|
|
|
* @package XoopsModules\Rssfit\Plugins |
|
38
|
|
|
*/ |
|
39
|
|
|
final class Oledrion extends AbstractPlugin |
|
40
|
|
|
{ |
|
41
|
|
|
public function __construct() { |
|
42
|
|
|
if (\class_exists(PluginHelper::class)) { |
|
43
|
|
|
$this->helper = PluginHelper::getInstance(); |
|
44
|
|
|
$this->dirname = $this->helper->dirname(); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array |
|
50
|
|
|
{ |
|
51
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
|
|
52
|
|
|
$ret = null; |
|
53
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; |
|
54
|
|
|
$helper = PluginHelper::getInstance(); |
|
55
|
|
|
$productsHandler = $helper->getHandler('Products'); |
|
56
|
|
|
$items = $productsHandler->getRecentProducts(new Parameters(['start' => 0, 'limit' => $this->grab])); |
|
57
|
|
|
$i = 0; |
|
58
|
|
|
|
|
59
|
|
|
if (false !== $items && \count($items) > 0) { |
|
60
|
|
|
$ret = []; |
|
61
|
|
|
foreach ($items as $item) { |
|
62
|
|
|
$ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); |
|
63
|
|
|
$ret[$i]['title'] = $item->getVar('product_title', 'n'); |
|
64
|
|
|
$ret[$i]['timestamp'] = $item->getVar('product_submitted'); |
|
65
|
|
|
if ('' !== \xoops_trim($item->getVar('product_summary'))) { |
|
66
|
|
|
$description = $item->getVar('product_summary'); |
|
67
|
|
|
} else { |
|
68
|
|
|
$description = $item->getVar('product_description'); |
|
69
|
|
|
} |
|
70
|
|
|
$ret[$i]['description'] = $description; |
|
71
|
|
|
$ret[$i]['category'] = $this->modname; |
|
72
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
|
73
|
|
|
$i++; |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
return $ret; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|