forked from melvincarvalho/foafme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tabactivity2.php
124 lines (99 loc) · 4.68 KB
/
tabactivity2.php
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
//-----------------------------------------------------------------------------------------------------------------------------------
//
// Filename : tabactivity.php
// Date : 15th October 2009
//
//
// Copyright 2008-2009 foaf.me
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// "Everything should be made as simple as possible, but no simpler."
// -- Albert Einstein
//
//-----------------------------------------------------------------------------------------------------------------------------------
// Include the SimplePie library, and the one that handles internationalized domain names.
require_once('simplepie/1.1.3/simplepie.inc');
require_once('simplepie/1.1.3/idn/idna_convert.class.php');
require_once('lib/Authentication.php');
require_once('lib/libActivity.php');
if ($_REQUEST['webid']) {
$pageAgent = new Authentication_AgentARC($GLOBALS['config'], $_REQUEST['webid']);
$agent = $pageAgent->getAgent();
}
$knows = $agent['knows'];
foreach ($knows as $k => $v) {
$auth = new Authentication_AgentARC($GLOBALS['config'], $v['webid']);
$authAgent = $auth->getAgent();
$a1 = replace_with_rss($authAgent['holdsAccount']);
$a2 = replace_with_rss($authAgent['accountProfilePage']);
$a3 = (array)$authAgent['weblog'];
$feedArray = array_merge( (array)$feedArray, (array)$a1, (array)$a2, (array) $a3 );
}
//$a1 = replace_with_rss($auth['agent']['holdsAccount']);
//$a2 = replace_with_rss($auth['agent']['accountProfilePage']);
//$a3 = (array)$auth['agent']['weblog'];
//$feedArray = array_merge( (array)$a1, (array)$a2, (array) $a3 );
$feedArray = array_unique ($feedArray);
if ( !empty($feedArray) ) {
// Initialize some feeds for use.
$feed = new SimplePie();
$feed->set_feed_url($feedArray);
$no_feed = FALSE;
// When we set these, we need to make sure that the handler_image.php file is also trying to read from the same cache directory that we are.
$feed->set_favicon_handler('./handler_image.php');
$feed->set_image_handler('./handler_image.php');
// Initialize the feed.
$feed->init();
// Make sure the page is being served with the UTF-8 headers.
$feed->handle_content_type();
} else {
// $feed->set_feed_url( "http://example.com" );
$no_feed = TRUE;
$feed = NULL;
}
// Begin the (X)HTML page.
?>
<h2>Activity</h2>
<?php if ( ($no_feed) || ($feed->error) ): ?>
<p>No Activity Discovered Yet...</p>
<?php endif ?>
<?php if ($feed): ?>
<?php
// Let's loop through each item in the feed.
foreach($feed->get_items(0,0) as $item):
// Let's give ourselves a reference to the parent $feed object for this particular item.
$feed = $item->get_feed();
?>
<div class="chunk">
<?php $icon = $feed->get_favicon(); ?>
<?php if (!empty($icon)) { ?>
<img src="<?php echo $feed->get_favicon(); ?>" width="16" height="16" class="activity-favicon" alt="[icon]" />
<?php } ?>
<h4><a href="<?php echo $item->get_permalink(); ?>"><?php echo html_entity_decode($item->get_title(), ENT_QUOTES, 'UTF-8'); ?></a></h4>
<!-- get_content() prefers full content over summaries -->
<?php echo $item->get_content(); ?>
<?php if ($enclosure = $item->get_enclosure()): ?>
<div>
<?php echo $enclosure->native_embed(array(
// New 'mediaplayer' attribute shows off Flash-based MP3 and FLV playback.
'mediaplayer' => '../demo/for_the_demo/mediaplayer.swf'
)); ?>
</div>
<?php endif; ?>
<p class="footnote">Source: <a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a> | <?php echo $item->get_date('j M Y | g:i a'); ?></p>
</div>
<?php endforeach ?>
<?php endif ?>