]> git.mxchange.org Git - friendica.git/blob - mod/hcard.php
Updated hcard with the new feed links
[friendica.git] / mod / hcard.php
1 <?php
2
3 use Friendica\App;
4 use Friendica\Core\Config;
5 use Friendica\Core\System;
6
7 function hcard_init(App $a) {
8
9         $blocked = (((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
10
11         if ($a->argc > 1) {
12                 $which = $a->argv[1];
13         }
14         else {
15                 notice( t('No profile') . EOL );
16                 $a->error = 404;
17                 return;
18         }
19
20         $profile = 0;
21         if ((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
22                 $which   = $a->user['nickname'];
23                 $profile = $a->argv[1];
24         }
25
26         profile_load($a,$which,$profile);
27
28         if ((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
29                 $a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
30         }
31         if (x($a->profile,'openidserver')) {
32                 $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
33         }
34         if (x($a->profile,'openid')) {
35                 $delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
36                 $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
37         }
38
39         if (! $blocked) {
40                 $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
41                 $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords);
42                 if (strlen($keywords)) {
43                         $a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
44                 }
45         }
46
47         $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
48         $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
49         $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
50         $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
51         $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
52         $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
53         header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
54
55         $dfrn_pages = array('request', 'confirm', 'notify', 'poll');
56         foreach ($dfrn_pages as $dfrn) {
57                 $a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".System::baseUrl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
58         }
59
60 }