aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-03-07 16:59:55 -0800
committerzotlabs <mike@macgirvin.com>2018-03-07 16:59:55 -0800
commit48b1042347d098672e583010fe9dbf71eb81623c (patch)
treeceb68660981e533eee933c5d992c3df9882cbfd7 /Zotlabs
parenta454aad124f999e59e8bffb625c103b975aef107 (diff)
downloadvolse-hubzilla-48b1042347d098672e583010fe9dbf71eb81623c.tar.gz
volse-hubzilla-48b1042347d098672e583010fe9dbf71eb81623c.tar.bz2
volse-hubzilla-48b1042347d098672e583010fe9dbf71eb81623c.zip
hashtag autocomplete
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Hashtags.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/Zotlabs/Module/Hashtags.php b/Zotlabs/Module/Hashtags.php
new file mode 100644
index 000000000..d87a82818
--- /dev/null
+++ b/Zotlabs/Module/Hashtags.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Hashtags extends \Zotlabs\Web\Controller {
+
+ function init() {
+ $result = [];
+
+ logger(print_r($_REQUEST,true));
+
+ $t = escape_tags($_REQUEST['t']);
+ if(! $t)
+ json_return_and_die($result);
+
+ $r = q("select distinct(term) from term where term like '%s' and ttype = %d order by term",
+ dbesc($t . '%'),
+ intval(TERM_HASHTAG)
+ );
+ if($r) {
+ foreach($r as $rv) {
+ $result[] = [ 'text' => strtolower($rv['term']) ];
+ }
+ }
+ logger(print_r($result,true));
+ json_return_and_die($result);
+ }
+} \ No newline at end of file