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
|
|
|
/** |
26
|
|
|
* About this RSSFit plug-in |
27
|
|
|
* Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) |
28
|
|
|
* Requirements (Tested with): |
29
|
|
|
* Module: Buyersguide |
30
|
|
|
* Version: 1.33 |
31
|
|
|
* Flux RSS : Derniers Fabricants |
32
|
|
|
* RSSFit verision: 1.22 |
33
|
|
|
* XOOPS version: 2.0.18.1 |
34
|
|
|
*/ |
35
|
|
|
if (!\defined('RSSFIT_ROOT_PATH')) { |
36
|
|
|
exit(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Class Buyersguidenews |
41
|
|
|
*/ |
42
|
|
|
class Buyersguidenews |
43
|
|
|
{ |
44
|
|
|
public $dirname = 'buyersguide'; |
45
|
|
|
public $modname; |
46
|
|
|
public $grab; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return \XoopsModule |
50
|
|
|
*/ |
51
|
|
|
public function loadModule():?\XoopsModule |
52
|
|
|
{ |
53
|
|
|
$mod = $GLOBALS['module_handler']->getByDirname($this->dirname); |
54
|
|
|
if (!$mod || !$mod->getVar('isactive')) { |
55
|
|
|
return null; |
56
|
|
|
} |
57
|
|
|
$this->modname = $mod->getVar('name'); |
58
|
|
|
|
59
|
|
|
return $mod; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array |
|
|
|
|
66
|
|
|
{ |
67
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
68
|
|
|
$ret = null; |
69
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; |
70
|
|
|
$items = $hBgNews->getRecentNews(0, $this->grab); |
|
|
|
|
71
|
|
|
$i = 0; |
72
|
|
|
|
73
|
|
|
if (false !== $items && \count($items) > 0) { |
74
|
|
|
$ret = []; |
75
|
|
|
foreach ($items as $item) { |
76
|
|
|
$ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); |
77
|
|
|
$ret[$i]['title'] = $item->getVar('news_title', 'n'); |
78
|
|
|
$ret[$i]['timestamp'] = $item->getVar('news_date'); |
79
|
|
|
$ret[$i]['description'] = $item->getShortenText(); |
80
|
|
|
$ret[$i]['category'] = $this->modname; |
81
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
82
|
|
|
$i++; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
return $ret; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.