1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* **************************************************************************** |
4
|
|
|
* references - MODULE FOR XOOPS |
5
|
|
|
* Copyright (c) Hervé Thouzard of Instant Zero (http://www.instant-zero.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 of Instant Zero (http://www.instant-zero.com) |
15
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
16
|
|
|
* @package references |
17
|
|
|
* @author Hervé Thouzard of Instant Zero (http://www.instant-zero.com) |
18
|
|
|
* |
19
|
|
|
* **************************************************************************** |
20
|
|
|
*/ |
21
|
|
|
if (!defined('RSSFIT_ROOT_PATH')) { |
22
|
|
|
exit(); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
class RssfitReferences |
26
|
|
|
{ |
27
|
|
|
public $dirname = 'references'; |
28
|
|
|
public $modname; |
29
|
|
|
public $grab; |
30
|
|
|
|
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function loadModule() |
|
|
|
|
36
|
|
|
{ |
37
|
|
|
$mod =& $GLOBALS['module_handler']->getByDirname($this->dirname); |
38
|
|
|
if (!$mod || !$mod->getVar('isactive')) { |
39
|
|
|
return false; |
40
|
|
|
} |
41
|
|
|
$this->modname = $mod->getVar('name'); |
42
|
|
|
|
43
|
|
|
return $mod; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function &grabEntries(&$obj) |
47
|
|
|
{ |
48
|
|
|
$ret = false; |
49
|
|
|
require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
50
|
|
|
$start = 0; |
51
|
|
|
$limit = $this->grab; |
52
|
|
|
$items = $h_references_articles->getRecentArticles($start, $limit); |
|
|
|
|
53
|
|
|
$i = 0; |
54
|
|
|
$categories = $h_references_categories->getCategories(); |
|
|
|
|
55
|
|
|
|
56
|
|
|
if (false != $items && count($items) > 0) { |
57
|
|
|
foreach ($items as $item) { |
58
|
|
|
$ret[$i]['link'] = $item->getUrl(); |
59
|
|
|
$ret[$i]['title'] = $item->getVar('article_title'); |
60
|
|
|
$ret[$i]['timestamp'] = $item->getVar('article_timestamp'); |
61
|
|
|
$ret[$i]['description'] = references_utils::truncate_tagsafe($item->getVar('article_text'), REFERENCES_SHORTEN_TEXT); |
62
|
|
|
$categoryId = $item->getVar('article_category_id'); |
63
|
|
|
$ret[$i]['category'] = isset($categories[$categoryId]) ? $categories[$categoryId]->getVar('category_title') : ''; |
64
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
65
|
|
|
++$i; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
return $ret; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.