aboutsummaryrefslogtreecommitdiffstats
path: root/include/contact_widgets.php
diff options
context:
space:
mode:
authorMichael Johnston <michaelgeorgejohnston@gmail.com>2012-04-01 21:28:31 -0400
committerMichael Johnston <michaelgeorgejohnston@gmail.com>2012-04-01 21:28:31 -0400
commit581b54c974a9b9a050a8a0b9a17a19bd41b1f2f5 (patch)
treec2a3f1e1d1aaf5e3e2f6d9b194e91d6b8b401cdd /include/contact_widgets.php
parent06e9a8b7a0d6b5be141563c77ae3a71e9998b81f (diff)
downloadvolse-hubzilla-581b54c974a9b9a050a8a0b9a17a19bd41b1f2f5.tar.gz
volse-hubzilla-581b54c974a9b9a050a8a0b9a17a19bd41b1f2f5.tar.bz2
volse-hubzilla-581b54c974a9b9a050a8a0b9a17a19bd41b1f2f5.zip
allow users to set categories on their posts
Diffstat (limited to 'include/contact_widgets.php')
-rwxr-xr-xinclude/contact_widgets.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 7346b95af..e0f37f078 100755
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -103,3 +103,31 @@ function fileas_widget($baseurl,$selected = '') {
));
}
+function categories_widget($baseurl,$selected = '') {
+ $a = get_app();
+
+ $saved = get_pconfig($a->profile['profile_uid'],'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 = xmlify(file_tag_decode($mtch[1]));
+ $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
+ }
+ }
+
+ return replace_macros(get_markup_template('categories_widget.tpl'),array(
+ '$title' => t('Categories'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => $baseurl,
+
+ ));
+}
+