Merge pull request #1097 from annando/acvlang
[friendica-addons.git/.git] / widgets / widget_friends.php
1 <?php
2
3 use Friendica\Content\Text\HTML;
4 use Friendica\Core\L10n;
5 use Friendica\DI;
6
7 function friends_widget_name()
8 {
9         return "Shows profile contacts";
10 }
11
12 function friends_widget_help()
13 {
14         return "";
15 }
16
17 function friends_widget_args()
18 {
19         return [];
20 }
21
22 function friends_widget_size()
23 {
24         return ['100%', '200px'];
25 }
26
27
28 function friends_widget_content(&$a, $conf)
29 {
30         $r = q("SELECT `profile`.* , `user`.* FROM `profile`
31                         LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
32                         WHERE `user`.`uid` = %s LIMIT 1",
33                 intval($conf['uid'])
34         );
35
36         if (!count($r)) {
37                 return;
38         }
39         
40         $a->profile = $r[0];
41
42         $o = "";
43         $o .= "<style>
44                 body {font-size: 0.8em; margin: 0px; padding: 0px;}
45                 #contact-block { overflow: hidden; height: auto; }
46                 .contact-block-h4 { float: left; margin: 0px; }
47                 .allcontact-link { float: right; margin: 0px; }
48                 .contact-block-content { clear:both; }
49                 .contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
50
51         </style>";
52         $o .= _abs_url(HTML::contactBlock());
53         $o .= "<a href='".DI::baseUrl()->get().'/profile/'.$a->profile['nickname']."'>". DI::l10n()->t('Connect on Friendica!') ."</a>";
54         return $o;
55 }