From 5ed9c8924687e88dac9f749f193fa00f40f67fb6 Mon Sep 17 00:00:00 2001 From: ibes Date: Thu, 20 Nov 2014 13:42:34 +0100 Subject: [PATCH] HOTFIX: improve support for WPML This should be refactored. Unnecessary repetition. If WPML is active, than the size of the terms will be depending on the most and least popular term IN ANY LANGUAGE. So the check if a term is more popular than the most popular so far has to happen after the decision if a term in included in the tag cloud. --- src/Data.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Data.php b/src/Data.php index 5607313..fdbdb24 100644 --- a/src/Data.php +++ b/src/Data.php @@ -131,13 +131,6 @@ public function getTerms() $this->translationHandler = $this->plugin->get('translationHandler'); foreach ($this->result as $item) { - if ($item->count < $min_count) { - $min_count = $item->count; - } - - if ($item->count > $max_count) { - $max_count = $item->count; - } if ($this->translationHandler) { @@ -145,9 +138,27 @@ public function getTerms() $term = $this->translationHandler->createTerm($item, $this->plugin); if ($term) { + + if ($item->count < $min_count) { + $min_count = $item->count; + } + + if ($item->count > $max_count) { + $max_count = $item->count; + } + $this->terms[] = $term; } } else { + + if ($item->count < $min_count) { + $min_count = $item->count; + } + + if ($item->count > $max_count) { + $max_count = $item->count; + } + $this->terms[] = new UTCW_Term($item, $this->plugin); } }