Ultimate Tag Cloud Widget - Version 1.3.5

Version Description

  • Now also showing private posts when signed in.
Download this release

Release Info

Developer exz
Plugin Icon wp plugin Ultimate Tag Cloud Widget
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

Files changed (2) hide show
  1. readme.txt +10 -1
  2. ultimate-tag-cloud-widget.php +38 -20
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: exz
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 2.8
5
  Tested up to: 3.1.2
6
- Stable tag: 1.3.4
7
  Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
 
9
  This plugin aims to be the most configurable tag cloud widget out there, able to suit all your wierd tag cloud needs.
@@ -56,6 +56,10 @@ This is a new plugin, haven't had any questions yet. If you have any, be sure to
56
 
57
  == Changelog ==
58
 
 
 
 
 
59
  = 1.3.4 =
60
 
61
  * Added support for [page tagging](http://wordpress.org/extend/plugins/page-tagger/) (thanks again Andreas Bogavcic)
@@ -98,6 +102,10 @@ This is a new plugin, haven't had any questions yet. If you have any, be sure to
98
 
99
  == Upgrade Notice ==
100
 
 
 
 
 
101
  = 1.3.4 =
102
 
103
  Support for page tagging and an option for debug information
@@ -210,5 +218,6 @@ Good luck and remember to give me feedback if you run into any problems
210
  The power of the open source community is being able to help out and submitting patches when bugs are found. I would like to thank the following contributors for submitting patches and helping out with the development:
211
 
212
  * Andreas Bogavcic
 
213
 
214
  With your help this list will hopefully grow in the future ;)
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 2.8
5
  Tested up to: 3.1.2
6
+ Stable tag: 1.3.5
7
  Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
 
9
  This plugin aims to be the most configurable tag cloud widget out there, able to suit all your wierd tag cloud needs.
56
 
57
  == Changelog ==
58
 
59
+ = 1.3.5 =
60
+
61
+ * Now also showing private posts when signed in.
62
+
63
  = 1.3.4 =
64
 
65
  * Added support for [page tagging](http://wordpress.org/extend/plugins/page-tagger/) (thanks again Andreas Bogavcic)
102
 
103
  == Upgrade Notice ==
104
 
105
+ = 1.3.5 =
106
+
107
+ * Now also showing private posts when signed in.
108
+
109
  = 1.3.4 =
110
 
111
  Support for page tagging and an option for debug information
218
  The power of the open source community is being able to help out and submitting patches when bugs are found. I would like to thank the following contributors for submitting patches and helping out with the development:
219
 
220
  * Andreas Bogavcic
221
+ * Fabian Reck
222
 
223
  With your help this list will hopefully grow in the future ;)
ultimate-tag-cloud-widget.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: Ultimate tag cloud widget
4
- Plugin URI: http://www.0x539.se/wordpress
5
  Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your wierd tag cloud needs.
6
- Version: 1.3.4
7
  Author: Rickard Andersson
8
  Author URI: http://www.0x539.se
9
  License: GPLv2
@@ -72,6 +72,7 @@ $utcw_allowed_border_styles = array('none', 'dotted', 'dashed', 'solid', 'doub
72
  * @package UTCW
73
  * @author Rickard Andersson <rickard@0x539.se>
74
  * @todo http://wordpress.org/support/topic/plugin-ultimate-tag-cloud-widget-tag-cloud-styling?replies=2
 
75
  */
76
  class UTCW extends WP_Widget {
77
 
@@ -507,40 +508,57 @@ function do_utcw($args) {
507
  $tag_array = array();
508
 
509
  // Build SQL query
510
- $q = "SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count` ";
511
- $q .= "FROM `$wpdb->posts` AS p ";
512
- $q .= "LEFT JOIN `$wpdb->term_relationships` AS tr ON tr.object_id = p.ID ";
513
- $q .= "LEFT JOIN `$wpdb->term_taxonomy` AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id ";
514
- $q .= "LEFT JOIN `$wpdb->terms` AS t ON t.term_id = tt.term_id ";
515
- $q .= "WHERE tt.taxonomy = '$taxonomy' ";
516
- $q .= "AND (post_type = 'post' ";
 
517
  if ($page_tags === true) {
518
- $q .= "OR post_type = 'page' ";
 
 
 
 
 
 
 
 
 
519
  }
520
- $q .= ") AND post_status = 'publish' ";
521
 
 
522
  if (count($authors) > 0) {
523
- $q .= "AND post_author IN (" . implode(",", $authors) . ") ";
524
  }
 
 
525
  if (count($tags_list) > 0) {
526
 
527
  $tags_list_operator = ($tags_list_type == "include") ? "IN" : "NOT IN";
528
 
529
  if (is_array_numeric($tags_list)) {
530
- $q .= "AND t.term_id ". $tags_list_operator ." ('" . implode("', '", $tags_list) . "') ";
531
  } else {
532
- $q .= "AND t.name ". $tags_list_operator ." ('" . implode("', '", $tags_list) . "') ";
533
  }
534
  }
 
 
535
  if (is_numeric($minimum)) {
536
- $q .= "AND count >= $minimum ";
 
 
537
  }
538
 
539
- $q .= "GROUP BY tr.term_taxonomy_id ";
540
- $q .= "ORDER BY count DESC ";
541
- $q .= "LIMIT $max;";
 
542
 
543
- $tag_data = $wpdb->get_results($q);
544
 
545
  if (count($tag_data) > 0) {
546
 
@@ -751,7 +769,7 @@ function do_utcw($args) {
751
 
752
  if ($debug === true) {
753
  echo "<!-- Ultimate Tag Cloud Debug information: "; var_dump($args);
754
- echo "\n\n SQL Query:" . nl2br($q);
755
  echo "\n\n Tag Data: "; var_dump($tag_data);
756
  echo "-->";
757
  }
1
  <?php
2
  /*
3
  Plugin Name: Ultimate tag cloud widget
4
+ Plugin URI: http://www.0x539.se/wordpress/ultimate-tag-cloud-widget/
5
  Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your wierd tag cloud needs.
6
+ Version: 1.3.5
7
  Author: Rickard Andersson
8
  Author URI: http://www.0x539.se
9
  License: GPLv2
72
  * @package UTCW
73
  * @author Rickard Andersson <rickard@0x539.se>
74
  * @todo http://wordpress.org/support/topic/plugin-ultimate-tag-cloud-widget-tag-cloud-styling?replies=2
75
+ * @todo Split functionality into different widgets, simple, advanced and content aware
76
  */
77
  class UTCW extends WP_Widget {
78
 
508
  $tag_array = array();
509
 
510
  // Build SQL query
511
+ $sql[] = "SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count`";
512
+ $sql[] = "FROM `$wpdb->posts` AS p";
513
+ $sql[] = "LEFT JOIN `$wpdb->term_relationships` AS tr ON tr.object_id = p.ID";
514
+ $sql[] = "LEFT JOIN `$wpdb->term_taxonomy` AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
515
+ $sql[] = "LEFT JOIN `$wpdb->terms` AS t ON t.term_id = tt.term_id";
516
+ $sql[] = "WHERE tt.taxonomy = '$taxonomy'";
517
+
518
+ // Setting post_type directive
519
  if ($page_tags === true) {
520
+ $sql[] = "AND (post_type = 'post' OR post_type = 'page')";
521
+ } else {
522
+ $sql[] = "AND post_type = 'post'";
523
+ }
524
+
525
+ // Setting post status directive
526
+ if (is_user_logged_in() === true) {
527
+ $sql[] = "AND (post_status = 'publish' OR post_status = 'private')";
528
+ } else {
529
+ $sql[] = "AND post_status = 'publish'";
530
  }
 
531
 
532
+ // Setting post author directive
533
  if (count($authors) > 0) {
534
+ $sql[] = "AND post_author IN (" . implode(",", $authors) . ")";
535
  }
536
+
537
+ // Setting include or exclude directive
538
  if (count($tags_list) > 0) {
539
 
540
  $tags_list_operator = ($tags_list_type == "include") ? "IN" : "NOT IN";
541
 
542
  if (is_array_numeric($tags_list)) {
543
+ $sql[] = "AND t.term_id ". $tags_list_operator ." ('" . implode("', '", $tags_list) . "')";
544
  } else {
545
+ $sql[] = "AND t.name ". $tags_list_operator ." ('" . implode("', '", $tags_list) . "')";
546
  }
547
  }
548
+
549
+ // Setting minimum post count directive
550
  if (is_numeric($minimum)) {
551
+ $sql[] = "GROUP BY tr.term_taxonomy_id HAVING count >= $minimum";
552
+ } else {
553
+ $sql[] = "GROUP BY tr.term_taxonomy_id";
554
  }
555
 
556
+ $sql[] = "ORDER BY count DESC";
557
+ $sql[] = "LIMIT $max";
558
+
559
+ $query = implode("\n", $sql);
560
 
561
+ $tag_data = $wpdb->get_results($query);
562
 
563
  if (count($tag_data) > 0) {
564
 
769
 
770
  if ($debug === true) {
771
  echo "<!-- Ultimate Tag Cloud Debug information: "; var_dump($args);
772
+ echo "\n\n SQL Query:" . $query;
773
  echo "\n\n Tag Data: "; var_dump($tag_data);
774
  echo "-->";
775
  }