From 55907cf5991843d1952eecc0386ac09d1b7dd3a7 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 5 Jul 2012 22:06:42 -0700 Subject: [PATCH] tag lister --- include/widget.php | 9 +++++++++ mod/tags.php | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 mod/tags.php diff --git a/include/widget.php b/include/widget.php index fbbd213a..efb29adc 100644 --- a/include/widget.php +++ b/include/widget.php @@ -32,3 +32,12 @@ function country_widget() { } return $o; } + + +function get_taglist($limit = 50) { + $r = q("select distinct(term), count(term) as total from tag group by term order by count(term) desc limit %d", + intval($limit) + ); + + return $r; +} diff --git a/mod/tags.php b/mod/tags.php new file mode 100644 index 00000000..b2213f9c --- /dev/null +++ b/mod/tags.php @@ -0,0 +1,12 @@ +argc > 1) + $limit = intval($a->argv[1]); + + require_once('widget.php'); + + echo json_encode(get_taglist(($limit) ? $limit : 50)); + killme(); +}