Browse Source

Limit tagcloud

Allowing to set the tagcloud number
pull/537/head
danpros 3 years ago
parent
commit
e702617cc4
21 changed files with 234 additions and 2 deletions
  1. +3
    -0
      config/config.ini.example
  2. +1
    -1
      content/data/configList.json
  3. +14
    -0
      lang/ar_AR.ini
  4. +14
    -0
      lang/de_DE.ini
  5. +2
    -0
      lang/en_US.ini
  6. +14
    -0
      lang/es_ES.ini
  7. +14
    -0
      lang/fr_FR.ini
  8. +14
    -0
      lang/hu_HU.ini
  9. +14
    -0
      lang/id_ID.ini
  10. +14
    -0
      lang/it_IT.ini
  11. +14
    -0
      lang/ko_KO.ini
  12. +14
    -0
      lang/ms_MY.ini
  13. +14
    -0
      lang/nl_NL.ini
  14. +14
    -0
      lang/pl_PL.ini
  15. +14
    -0
      lang/pt_BR.ini
  16. +2
    -0
      lang/ru_RU.ini
  17. +14
    -0
      lang/sv_SE.ini
  18. +14
    -0
      lang/tr_TR.ini
  19. +14
    -0
      lang/zh_TW.ini
  20. +6
    -0
      system/admin/views/config-widget.html.php
  21. +10
    -1
      system/includes/functions.php

+ 3
- 0
config/config.ini.example View File

@ -81,6 +81,9 @@ recent.count = "5"
; Popular posts ; Popular posts
popular.count = "5" popular.count = "5"
; Tagcloud
tagcloud.count = "40"
; Teaser type: set "trimmed" or "full". ; Teaser type: set "trimmed" or "full".
teaser.type = "full" teaser.type = "full"


+ 1
- 1
content/data/configList.json View File

@ -1 +1 @@
["site.url","timezone","date.format","language","blog.title","blog.tagline","blog.description","blog.copyright","permalink.type","static.frontpage","blog.enable","social.twitter","social.facebook","breadcrumb.home","comment.system","fb.appid","fb.num","fb.color","disqus.shortname","google.wmt.id","google.analytics.id","google.gtag.id","google.reCaptcha","google.reCaptcha.public","google.reCaptcha.private","posts.perpage","category.perpage","tag.perpage","archive.perpage","search.perpage","profile.perpage","type.perpage","json.count","category.info","related.count","recent.count","popular.count","teaser.type","read.more","teaser.char","description.char","rss.count","rss.char","views.counter","sitemap.priority.base","sitemap.priority.post","sitemap.priority.static","sitemap.priority.category","sitemap.priority.tag","sitemap.priority.archiveDay","sitemap.priority.archiveMonth","sitemap.priority.archiveYear","sitemap.priority.author","sitemap.priority.type","prerelease","cache.expiration","cache.off","generation.time","cache.timestamp","views.root","views.layout"]
["site.url","timezone","date.format","language","blog.title","blog.tagline","blog.description","blog.copyright","permalink.type","static.frontpage","blog.enable","social.twitter","social.facebook","breadcrumb.home","comment.system","fb.appid","fb.num","fb.color","disqus.shortname","google.wmt.id","google.analytics.id","google.gtag.id","google.reCaptcha","google.reCaptcha.public","google.reCaptcha.private","posts.perpage","category.perpage","tag.perpage","archive.perpage","search.perpage","profile.perpage","type.perpage","json.count","category.info","related.count","recent.count","popular.count","tagcloud.count","teaser.type","read.more","teaser.char","description.char","rss.count","rss.char","views.counter","sitemap.priority.base","sitemap.priority.post","sitemap.priority.static","sitemap.priority.category","sitemap.priority.tag","sitemap.priority.archiveDay","sitemap.priority.archiveMonth","sitemap.priority.archiveYear","sitemap.priority.author","sitemap.priority.type","prerelease","cache.expiration","cache.off","generation.time","cache.timestamp","views.root","views.layout"]

+ 14
- 0
lang/ar_AR.ini View File

@ -258,3 +258,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/de_DE.ini View File

@ -256,3 +256,17 @@ Posts_by="Beiträge von"
Pages="Seiten" Pages="Seiten"
Menu="Menüs" Menu="Menüs"
Popular="Zugriffe" Popular="Zugriffe"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 2
- 0
lang/en_US.ini View File

@ -268,3 +268,5 @@ Author_Description="Just another HTMLy user"
;404-search ;404-search
Search_results_not_found="Search results not found!" Search_results_not_found="Search results not found!"
No_search_results="No search results" No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = TagCloud at most

+ 14
- 0
lang/es_ES.ini View File

@ -255,3 +255,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/fr_FR.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/hu_HU.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/id_ID.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Halaman" Pages="Halaman"
Menu="Menu" Menu="Menu"
Popular="Populer" Popular="Populer"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/it_IT.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/ko_KO.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/ms_MY.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/nl_NL.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/pl_PL.ini View File

@ -257,3 +257,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/pt_BR.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 2
- 0
lang/ru_RU.ini View File

@ -269,3 +269,5 @@ Author_Description="Еще один пользователь HTMLy"
;404-search ;404-search
Search_results_not_found="По вашему запросу ничего не найдено!" Search_results_not_found="По вашему запросу ничего не найдено!"
No_search_results="Безрезультатно" No_search_results="Безрезультатно"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/sv_SE.ini View File

@ -274,3 +274,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/tr_TR.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 14
- 0
lang/zh_TW.ini View File

@ -256,3 +256,17 @@ Posts_by="Posts by"
Pages="Pages" Pages="Pages"
Menu="Menu" Menu="Menu"
Popular="Popular" Popular="Popular"
;Errors
User_Error="User field is required"
Pass_Error="Password field is required"
Token_Error="CSRF Token not correct"
Captcha_Error="reCaptcha not correct"
Invalid_Error="ERROR: Invalid username or password"
;Profile
Post_by_author="Posts by this author"
Author_Description="Just another HTMLy user"
;404-search
Search_results_not_found="Search results not found!"
No_search_results="No search results"
;TagCloud
Tagcloud_widget_at_most = "TagCloud at most"

+ 6
- 0
system/admin/views/config-widget.html.php View File

@ -51,6 +51,12 @@
<input type="number" name="-config-popular.count" class="form-control" id="popular.count" value="<?php echo config('popular.count');?>"> <input type="number" name="-config-popular.count" class="form-control" id="popular.count" value="<?php echo config('popular.count');?>">
</div> </div>
</div> </div>
<div class="form-group row">
<label for="tagcloud.count" class="col-sm-2 col-form-label"><?php echo i18n('Tagcloud_widget_at_most');?></label>
<div class="col-sm-10">
<input type="number" name="-config-tagcloud.count" class="form-control" id="tagcloud.count" value="<?php echo config('tagcloud.count');?>">
</div>
</div>
<br> <br>
<h4><?php echo i18n('Comments');?></h4> <h4><?php echo i18n('Comments');?></h4>
<hr> <hr>


+ 10
- 1
system/includes/functions.php View File

@ -1458,6 +1458,11 @@ function tag_cloud($custom = null)
$posts = get_post_unsorted(); $posts = get_post_unsorted();
$tags = array(); $tags = array();
$tagcloud_count = config('tagcloud.count');
if(empty($tagcloud_count)) {
$tagcloud_count = 40;
}
if (!empty($posts)) { if (!empty($posts)) {
@ -1497,7 +1502,11 @@ function tag_cloud($custom = null)
// this is the increase per tag quantity (times used) // this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread); $step = ($max_size - $min_size)/($spread);
foreach ($tag_collection as $tag => $count) {
arsort($tag_collection);
$sliced_tags = array_slice($tag_collection, 0, $tagcloud_count, true);
ksort($sliced_tags);
foreach ($sliced_tags as $tag => $count) {
$size = $min_size + (($count - $min_qty) * $step); $size = $min_size + (($count - $min_qty) * $step);
echo ' <a class="tag-cloud-link" href="'. site_url(). 'tag/'. $tag .'" style="font-size:'. $size .'pt;">'.tag_i18n($tag).'</a> '; echo ' <a class="tag-cloud-link" href="'. site_url(). 'tag/'. $tag .'" style="font-size:'. $size .'pt;">'.tag_i18n($tag).'</a> ';
} }


Loading…
Cancel
Save