|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* oledrion |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
16
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
17
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
use XoopsModules\Oledrion; |
|
21
|
|
|
|
|
22
|
|
|
if (!defined('RSSFIT_ROOT_PATH')) { |
|
23
|
|
|
exit(); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Class RssfitOledrion |
|
28
|
|
|
*/ |
|
29
|
|
|
class RssfitOledrion |
|
30
|
|
|
{ |
|
31
|
|
|
public $dirname = 'oledrion'; |
|
32
|
|
|
public $modname; |
|
33
|
|
|
public $grab; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* RssfitOledrion constructor. |
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @return bool |
|
44
|
|
|
*/ |
|
45
|
|
|
public function loadModule() |
|
46
|
|
|
{ |
|
47
|
|
|
$mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); |
|
48
|
|
|
if (!$mod || !$mod->getVar('isactive')) { |
|
49
|
|
|
return false; |
|
50
|
|
|
} |
|
51
|
|
|
$this->modname = $mod->getVar('name'); |
|
52
|
|
|
|
|
53
|
|
|
return $mod; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param $obj |
|
58
|
|
|
* @return bool |
|
59
|
|
|
*/ |
|
60
|
|
|
public function grabEntries($obj) |
|
|
|
|
|
|
61
|
|
|
{ |
|
62
|
|
|
$ret = false; |
|
63
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; |
|
64
|
|
|
$items = $productsHandler->getRecentProducts(new Oledrion\Parameters([ |
|
|
|
|
|
|
65
|
|
|
'start' => 0, |
|
66
|
|
|
'limit' => $this->grab, |
|
67
|
|
|
])); |
|
68
|
|
|
$i = 0; |
|
69
|
|
|
|
|
70
|
|
|
if (false !== $items && count($items) > 0) { |
|
71
|
|
|
foreach ($items as $item) { |
|
72
|
|
|
$ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); |
|
73
|
|
|
$ret[$i]['title'] = $item->getVar('product_title', 'n'); |
|
74
|
|
|
$ret[$i]['timestamp'] = $item->getVar('product_submitted'); |
|
75
|
|
|
if ('' !== xoops_trim($item->getVar('product_summary'))) { |
|
76
|
|
|
$description = $item->getVar('product_summary'); |
|
77
|
|
|
} else { |
|
78
|
|
|
$description = $item->getVar('product_description'); |
|
79
|
|
|
} |
|
80
|
|
|
$ret[$i]['description'] = $description; |
|
81
|
|
|
$ret[$i]['category'] = $this->modname; |
|
82
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
|
83
|
|
|
++$i; |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
return $ret; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.