1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<?php
/**
* @version $Revision: 1.7 $
* @package liberty
* @subpackage plugins_data
*/
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Oliver Hertel <ohertel@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
// $Id: data.rss.php,v 1.7 2006/08/07 22:14:58 squareing Exp $
/**
* definitions
*/
global $gLibertySystem;
define( 'PLUGIN_GUID_DATARSS', 'datarss' );
global $gLibertySystem;
$pluginParams = array (
'tag' => 'RSS',
'auto_activate' => TRUE,
'requires_pair' => FALSE,
'load_function' => 'rss_parse_data',
'title' => 'RSS Feed',
'help_page' => 'DataPluginRSS',
'description' => tra("Display RSS Feeds"),
'help_function' => 'rss_extended_help',
'syntax' => "{RSS id= max= }",
'path' => LIBERTY_PKG_PATH.'plugins/data.rss.php',
'security' => 'registered',
'plugin_type' => DATA_PLUGIN
);
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATARSS, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATARSS );
function rss_extended_help() {
return 'NO HELP WRITTEN FOR {RSS}';
}
function rss_parse_data( $data, $params ) {
$repl = '';
if( @BitBase::verifyId( $params['id'] ) ) {
global $rsslib;
require_once( RSS_PKG_PATH.'rss_lib.php' );
$max = !empty( $params['max'] ) ? $params['max'] : 99;
$rssdata = $rsslib->get_rss_module_content( $params['id'] );
$items = $rsslib->parse_rss_data( $rssdata, $params['id'] );
$repl = '<ul class="rsslist">';
for ($j = 1; $j < count($items) && $j < $max; $j++) {
$repl .= '<li><a href="' . $items[$j]["link"] . '">' . $items[$j]["title"] . '</a>';
if ($items[$j]["pubdate"] <> '') {
$repl .= ' <small>('.$items[$j]["pubdate"].')</small>';
}
$repl .= '</li>';
}
$repl .= '</ul>';
}else{
$repl = '<b>rss can not be found, id must be a number</b>';
}
return $repl;
}
?>
|