public function save() { $title = isset($_POST['title']) ? $_POST['title'] : ''; if ($this->live() && !empty($title)) { $this->loadModel('tagcloud', 'tagcloud'); $tagcloud = new TagCloud(); $term_id = $tagcloud->getTerm($title); if (empty($term_id)) { $tagcloud->setMembers(array('term' => $title, 'counter' => '1', 'last_search' => date('U'))); $tagcloud->save(); } else { $tagcloud->load($term_id); $count = $tagcloud->getMember('counter') + 1; $tagcloud->setMember('counter', $count); $tagcloud->setMember('last_search', date('U')); $tagcloud->save(); } } }