aboutsummaryrefslogtreecommitdiffstats
path: root/include/taxonomy.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2013-07-10 19:30:10 +0100
committerThomas Willingham <founder@kakste.com>2013-07-10 19:30:10 +0100
commit085be3a16f704a3f89bbe4d795c9ca915cc26e8a (patch)
treecd0a1b608630d5e819df221ed84a0fbd3755fc2f /include/taxonomy.php
parentd065135d909bf876f4c305d303de7642657f7e3e (diff)
parent72d737cc82f5987791c9ceba0c8b99a505886274 (diff)
downloadvolse-hubzilla-085be3a16f704a3f89bbe4d795c9ca915cc26e8a.tar.gz
volse-hubzilla-085be3a16f704a3f89bbe4d795c9ca915cc26e8a.tar.bz2
volse-hubzilla-085be3a16f704a3f89bbe4d795c9ca915cc26e8a.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/taxonomy.php')
-rw-r--r--include/taxonomy.php54
1 files changed, 49 insertions, 5 deletions
diff --git a/include/taxonomy.php b/include/taxonomy.php
index e9cc0faf4..b6803743a 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -96,14 +96,23 @@ function format_term_for_display($term) {
// Tag cloud functions - need to be adpated to this database format
-function tagadelic($uid, $count = 0, $flags = 0, $type = TERM_HASHTAG) {
+function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $type = TERM_HASHTAG) {
+
+ $sql_options = '';
if($flags)
- $sql_options = " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") ";
+ $sql_options .= " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") ";
+ if($authors) {
+ if(! is_array($authors))
+ $authors = array($authors);
+ stringify_array_elms($authors,true);
+ $sql_options .= " and author_xchan in (" . implode(',',$authors) . ") ";
+ }
+
// Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
where term.uid = %d and term.type = %d
- and otype = %d and item_restrict = 0
+ and otype = %d and item_restrict = 0 and item_private = 0
$sql_options
group by term order by total desc %s",
intval($uid),
@@ -148,10 +157,10 @@ function tags_sort($a,$b) {
}
-function tagblock($link,$uid,$count = 0,$flags = 0,$type = TERM_HASHTAG) {
+function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$type = TERM_HASHTAG) {
$o = '';
$tab = 0;
- $r = tagadelic($uid,$count,$flags,$type);
+ $r = tagadelic($uid,$count,$authors,$flags,$type);
if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
@@ -162,3 +171,38 @@ function tagblock($link,$uid,$count = 0,$flags = 0,$type = TERM_HASHTAG) {
}
return $o;
}
+
+
+ /**
+ * verbs: [0] = first person singular, e.g. "I want", [1] = 3rd person singular, e.g. "Bill wants"
+ * We use the first person form when creating an activity, but the third person for use in activities
+ * FIXME: There is no accounting for verb gender for languages where this is significant. We may eventually
+ * require obj_verbs() to provide full conjugations and specify which form to use in the $_REQUEST params to this module.
+ */
+
+
+
+function obj_verbs() {
+ $verbs = array(
+ 'has' => array( t('have'), t('has')),
+ 'wants' => array( t('want'), t('wants')),
+ 'likes' => array( t('like'), t('likes')),
+ 'dislikes' => array( t('dislike'), t('dislikes')),
+ );
+
+ $arr = array('verbs' => $verbs);
+ call_hooks('obj_verbs', $arr);
+ return $arr['verbs'];
+}
+
+
+function obj_verb_selector() {
+ $verbs = obj_verbs();
+ $o .= '<select class="obj-verb-selector" name="verb" >';
+ foreach($verbs as $k => $v) {
+ $o .= '<option value="' . urlencode($k) . '">' . $v[0] . '</option>';
+ }
+ $o .= '</select>';
+ return $o;
+
+} \ No newline at end of file