1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* **************************************************************************** |
4
|
|
|
* marquee - MODULE FOR XOOPS |
5
|
|
|
* Copyright (c) Hervé Thouzard (https://www.herve-thouzard.com) |
6
|
|
|
* |
7
|
|
|
* You may not change or alter any portion of this comment or credits |
8
|
|
|
* of supporting developers from this source code or any supporting source code |
9
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
* |
14
|
|
|
* @copyright Hervé Thouzard (https://www.herve-thouzard.com) |
15
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
16
|
|
|
* @author Hervé Thouzard (https://www.herve-thouzard.com) |
17
|
|
|
* |
18
|
|
|
* Version : |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
/* |
22
|
|
|
* @param $limit |
23
|
|
|
* @param $dateFormat |
24
|
|
|
* @param $itemsSize |
25
|
|
|
* |
26
|
|
|
* @return array|bool |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
// Script to list recent articles from the Smartsection module (tested with Smartsection 2.1) |
30
|
|
|
function b_marquee_smartsection($limit, $dateFormat, $itemsSize) |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
|
33
|
|
|
if (!class_exists('XoopsModules\Smartsection\Helper')) { |
34
|
|
|
return false; |
35
|
|
|
} |
36
|
|
|
// require_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; |
37
|
|
|
|
38
|
|
|
$block = []; |
|
|
|
|
39
|
|
|
|
40
|
|
|
xoops_load('xoopsuserutility'); |
41
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
42
|
|
|
$smartModule = smartsection_getModuleInfo(); |
|
|
|
|
43
|
|
|
$block = []; |
44
|
|
|
$categoryid = -1; |
45
|
|
|
$sort = 'datesub'; |
46
|
|
|
$order = XoopsModules\Smartsection\Utility::getOrderBy($sort); |
|
|
|
|
47
|
|
|
$smartsectionItemHandler = XoopsModules\Smartsection\Helper::getInstance()->getHandler('Item'); |
|
|
|
|
48
|
|
|
$itemsObj = $smartsectionItemHandler->getAllPublished($limit, 0, $categoryid, $sort, $order); |
49
|
|
|
$totalItems = count($itemsObj); |
50
|
|
|
if ($itemsObj) { |
51
|
|
|
for ($i = 0; $i < $totalItems; ++$i) { |
52
|
|
|
if ($itemsSize > 0) { |
53
|
|
|
$title = xoops_substr($itemsObj[$i]->title(), 0, $itemsSize + 3); |
54
|
|
|
} else { |
55
|
|
|
$title = $itemsObj[$i]->title(); |
56
|
|
|
} |
57
|
|
|
$block[] = [ |
58
|
|
|
'date' => $itemsObj[$i]->datesub(), |
59
|
|
|
'category' => $itemsObj[$i]->getCategoryName(), |
60
|
|
|
'author' => \XoopsUserUtility::getUnameFromId($itemsObj[$i]->uid()), |
61
|
|
|
'title' => $title, |
62
|
|
|
'link' => "<a href='" . XOOPS_URL . '/modules/smartsection/item.php?itemid=' . $itemsObj[$i]->itemid() . "'>" . $title . '</a>', |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
return $block; |
68
|
|
|
} |
69
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.