blob: 329b2fb981664e989b8220e514b8e1c218a6a23a (
plain)
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
78
79
80
81
82
|
<div class="contentWrapper">
<?php
global $CONFIG;
if (!class_exists('SimplePie')) {
require_once $CONFIG->pluginspath . '/simplepie/simplepie.inc';
}
$allow_tags = '<a><p><br><b><i><em><del><pre><strong><ul><ol><li>';
$feed_url = $vars['entity']->feed_url;
if ($feed_url) {
// get widget settings
$excerpt = $vars['entity']->excerpt;
$num_items = $vars['entity']->num_items;
$post_date = $vars['entity']->post_date;
$cache_location = $CONFIG->dataroot . '/simplepie_cache/';
if (!file_exists($cache_location)) {
mkdir($cache_location, 0777);
}
$feed = new SimplePie($feed_url, $cache_location);
// doubles timeout if going through a proxy
//$feed->set_timeout(20);
$num_posts_in_feed = $feed->get_item_quantity();
// only display errors to profile owner
if (get_loggedin_userid() == page_owner()) {
if (!$num_posts_in_feed) {
echo '<p>' . elgg_echo('simplepie:notfind') . '</p>';
}
}
?>
<div class="simplepie_blog_title">
<h2><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h2>
</div>
<?php
// don't display more feed items than user requested
if ($num_items > $num_posts_in_feed) {
$num_items = $num_posts_in_feed;
}
foreach ($feed->get_items(0, $num_items) as $item):
?>
<div class="simplepie_item">
<div class="simplepie_title">
<h4><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h4>
</div>
<?php
if ($excerpt) {
?>
<div class="simplepie_excerpt">
<?php echo strip_tags($item->get_description(true), $allow_tags); ?>
</div>
<?php
}
if ($post_date) {
?>
<div class="simplepie_date">
<?php echo elgg_echo('simplepie:postedon'); ?>
<?php echo $item->get_date('j F Y | g:i a'); ?>
</div>
<?php
}
?>
</div>
<?php endforeach; ?>
<?php
} else {
// display message only to owner
if (get_loggedin_userid() == page_owner()) {
echo '<p>' . elgg_echo('simplepie:notset') . '</p>';
}
}
?>
</div>
|