aboutsummaryrefslogtreecommitdiffstats
path: root/include/contact_widgets.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/contact_widgets.php')
-rwxr-xr-xinclude/contact_widgets.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index caa0572d2..605a3eb78 100755
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -75,4 +75,33 @@ function networks_widget($baseurl,$selected = '') {
));
}
+function fileas_widget($baseurl,$selected = '') {
+ $a = get_app();
+ if(! local_user())
+ return '';
+
+ $saved = get_pconfig(local_user(),'system','filetags');
+ if(! strlen($saved))
+ return;
+
+ $matches = false;
+ $terms = array();
+ $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $unescaped = file_tag_decode($mtch[1]);
+ $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
+ }
+ }
+
+ return replace_macros(get_markup_template('fileas_widget.tpl'),array(
+ '$title' => t('File Selections'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => $baseurl,
+
+ ));
+}