Last active
August 29, 2015 14:06
-
-
Save pupi1985/13ad393cc4439c2da684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) | |
{ | |
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; | |
$populartags=qa_db_single_select(qa_db_popular_tags_selectspec(0, (int)qa_opt('tag_cloud_count_tags'))); | |
reset($populartags); | |
$maxcount=current($populartags); | |
$themeobject->output( | |
'<h2 style="margin-top:0; padding-top:0;">', | |
qa_lang_html('main/popular_tags'), | |
'</h2>' | |
); | |
$themeobject->output('<div style="font-size:10px;">'); | |
$maxsize=qa_opt('tag_cloud_font_size'); | |
$scale=qa_opt('tag_cloud_size_popular'); | |
$blockwordspreg=qa_get_block_words_preg(); | |
foreach ($populartags as $tag => $count) { | |
if (count(qa_block_words_match_all($tag, $blockwordspreg))) | |
continue; // skip censored tags | |
$size=number_format(($scale ? ($maxsize*$count/$maxcount) : $maxsize), 1); | |
$uppercaseTag = function_exists('mb_strtoupper') | |
? mb_strtoupper($tag, 'UTF-8') | |
: strtoupper($tag); | |
if (($size>=5) || !$scale) | |
$themeobject->output('<a href="'.qa_path_html('tag/'.$uppercaseTag).'" style="font-size:'.$size.'px; vertical-align:baseline;">'.qa_html($tag).'</a>'); | |
} | |
$themeobject->output('</div>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment