function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $to_lower = serendipity_db_bool($this->get_config('lowercase_tags', 'true'));
     if ($this->get_config('max_tags', 0) != 0) {
         $limit = "LIMIT " . $this->get_config('max_tags', 0);
     } else {
         $limit = '';
     }
     $query = "SELECT et.tag, count(et.tag) AS total\n                    FROM {$serendipity['dbPrefix']}entrytags AS et\n         LEFT OUTER JOIN {$serendipity['dbPrefix']}entries AS e\n                      ON et.entryid = e.id\n                   WHERE e.isdraft = 'false' " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp <= " . time() : '') . "\n                GROUP BY et.tag\n                  HAVING count(et.tag) >= " . $this->get_config('treshold_tag_count') . "\n                ORDER BY total DESC {$limit}";
     $rows = serendipity_db_query($query);
     if (!is_array($rows)) {
         return;
     }
     // not sure if we can optimize this loop... :/
     // Probably through some SQL magick.
     foreach ($rows as $r) {
         if ($to_lower) {
             // set to_lower for frontend sidebar list/clouds (new)
             foreach ($r as &$t) {
                 if (function_exists('mb_strtolower')) {
                     $t = mb_strtolower($t);
                 } else {
                     $t = strtolower($t);
                 }
             }
         }
         $tags[$r['tag']] = $r['total'];
     }
     if ($this->get_config('order_by') == 'tag') {
         uksort($tags, 'strnatcasecmp');
         serendipity_plugin_api::hook_event('sort', $tags);
     } else {
         if ($this->get_config('order_by') == 'total') {
             serendipity_db_bool($this->get_config('sort_desc', 'false')) ? arsort($tags) : asort($tags);
         }
     }
     $xml = serendipity_db_bool($this->get_config('show_xml', 'true'));
     $nl = serendipity_db_bool($this->get_config('show_newline', 'true'));
     $scaling = serendipity_db_bool($this->get_config('scale_tag', 'false'));
     $useRotCanvas = serendipity_db_bool($this->get_config('use_rotacloud', 'false'));
     $useWordCloud = serendipity_db_bool($this->get_config('use_wordcloud', 'false'));
     serendipity_event_freetag::displayTags($tags, $xml, $nl, $scaling, $this->get_config('max_percent', 300), $this->get_config('min_percent', 100), serendipity_db_bool($this->get_config('use_flash')), serendipity_db_bool($this->get_config('flash_bg_trans', 'false')), $this->get_config('flash_tag_color', 'ff6600'), $this->get_config('flash_bg_color', 'ffffff'), $this->get_config('flash_width', 190), $this->get_config('flash_speed', 100), $this->get_config('taglink'), $this->get_config('template'), $this->get_config('xml_image', 'img/xml.gif'), $useRotCanvas, $this->get_config('rotacloud_tag_color', '3E5F81'), $this->get_config('rotacloud_tag_border_color', 'B1C1D1'), $this->get_config('rotacloud_width', '300'), $useWordCloud);
 }
 function displayTagCloud($tag)
 {
     global $serendipity;
     $tags = $this->getTagCloudTags($tag);
     $serendipity['smarty']->assign('freetag_tagTitle', function_exists('serendipity_specialchars') ? serendipity_specialchars(is_array($this->displayTag) ? implode(' + ', $this->displayTag) : $this->displayTag) : htmlspecialchars(is_array($this->displayTag) ? implode(' + ', $this->displayTag) : $this->displayTag, ENT_COMPAT, LANG_CHARSET));
     if (!empty($tags)) {
         $serendipity['smarty']->assign('freetag_hasTags', true);
         $min = $this->get_config('min_percent', 100);
         $max = $this->get_config('max_percent', 300);
         ob_start();
         serendipity_event_freetag::displayTags($tags, false, false, true, $max, $min, serendipity_db_bool($this->get_config('use_flash')), serendipity_db_bool($this->get_config('flash_bg_trans', true)), $this->get_config('flash_tag_color', 'ff6600'), $this->get_config('flash_bg_color', 'ffffff'), $this->get_config('flash_width', 600), $this->get_config('flash_speed', 100), $this->get_config('taglink'), $this->get_config('template'), $this->get_config('xml_image', 'img/xml.gif'));
         $tagout = ob_get_contents();
         ob_end_clean();
         $serendipity['smarty']->assign('freetag_displayTags', $tagout);
     } else {
         $serendipity['smarty']->assign('freetag_hasTags', false);
     }
     $content = $this->parseTemplate('plugin_freetag.tpl');
     echo $content;
 }