]> git.mxchange.org Git - friendica.git/blob - include/contact_widgets.php
Merge commit 'upstream/master'
[friendica.git] / include / contact_widgets.php
1 <?php
2
3 function follow_widget() {
4
5         return replace_macros(get_markup_template('follow.tpl'),array(
6                 '$connect' => t('Add New Contact'),
7                 '$desc' => t('Enter address or web location'),
8                 '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
9                 '$follow' => t('Connect')
10         ));
11
12 }
13
14 function findpeople_widget() {
15
16         $a = get_app();
17
18         if(get_config('system','invitation_only')) {
19                 $x = get_pconfig(local_user(),'system','invites_remaining');
20                 if($x || is_site_admin()) {
21                         $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">' 
22                         . sprintf( tt('%d invitation available','%d invitations available',$x), $x) 
23                         . '</div>' . $inv;
24                 }
25         }
26  
27         return replace_macros(get_markup_template('peoplefind.tpl'),array(
28                 '$findpeople' => t('Find People'),
29                 '$desc' => t('Enter name or interest'),
30                 '$label' => t('Connect/Follow'),
31                 '$hint' => t('Examples: Robert Morgenstein, Fishing'),
32                 '$findthem' => t('Find'),
33                 '$suggest' => t('Friend Suggestions'),
34                 '$similar' => t('Similar Interests'),
35                 '$inv' => t('Invite Friends')
36         ));
37
38 }
39
40
41 function networks_widget($baseurl,$selected = '') {
42
43         $a = get_app();
44
45         if(! local_user())
46                 return '';
47
48         
49         $r = q("select distinct(network) from contact where uid = %d and self = 0",
50                 intval(local_user())
51         );
52
53         $nets = array();
54         if(count($r)) {
55                 require_once('include/contact_selectors.php');
56                 foreach($r as $rr) {
57                                 if($rr['network'])
58                                         $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
59                 }
60         }
61
62         if(count($nets) < 2)
63                 return '';
64
65         return replace_macros(get_markup_template('nets.tpl'),array(
66                 '$title' => t('Networks'),
67                 '$desc' => '',
68                 '$sel_all' => (($selected == '') ? 'selected' : ''),
69                 '$all' => t('All Networks'),
70                 '$nets' => $nets,
71                 '$base' => $baseurl,
72
73         ));
74 }
75
76 function fileas_widget($baseurl,$selected = '') {
77         $a = get_app();
78         if(! local_user())
79                 return '';
80
81         $saved = get_pconfig(local_user(),'system','filetags');
82         if(! strlen($saved))
83                 return;
84
85         $matches = false;
86         $terms = array();
87     $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
88     if($cnt) {
89                 foreach($matches as $mtch) {
90                         $unescaped = xmlify(file_tag_decode($mtch[1]));
91                         $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
92                 }
93         }
94
95         return replace_macros(get_markup_template('fileas_widget.tpl'),array(
96                 '$title' => t('Saved Folders'),
97                 '$desc' => '',
98                 '$sel_all' => (($selected == '') ? 'selected' : ''),
99                 '$all' => t('Everything'),
100                 '$terms' => $terms,
101                 '$base' => $baseurl,
102
103         ));
104 }
105