From f3c9ca3e65c0e5e80f0b034959b1910e7e848a5d Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 26 Apr 2010 05:49:11 +0100 Subject: [PATCH] tag completion internal api --- ext/tag_list/main.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 95a8cfdb..32000351 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -44,6 +44,19 @@ class TagList implements Extension { $this->theme->display_page($page); } + if(($event instanceof PageRequestEvent) && $event->page_matches("api/internal/tag_list/complete")) { + $all = $database->get_all( + "SELECT tag FROM tags WHERE tag LIKE ? AND count > 0 LIMIT 10", + array($_GET["s"]."%")); + + $res = array(); + foreach($all as $row) {$res[] = $row["tag"];} + + $page->set_mode("data"); + $page->set_type("text/plain"); + $page->set_data(implode("\n", $res)); + } + if($event instanceof PostListBuildingEvent) { if($config->get_int('tag_list_length') > 0) { if(!empty($event->search_terms)) {