Fix another corner case
If $counter == $def_count and the next tag in the list is a used tag, the tagcloud_extra div would be printed twice, breaking the list. This solution feels ugly, perhaps there's a better way to do this?
This commit is contained in:
parent
8732f1a9ef
commit
e93785339f
@ -57,6 +57,7 @@ class TagEditCloud extends Extension {
|
|||||||
$html = "";
|
$html = "";
|
||||||
$cloud = "";
|
$cloud = "";
|
||||||
$precloud = "";
|
$precloud = "";
|
||||||
|
$postcloud = "";
|
||||||
|
|
||||||
$sort_method = $config->get_string("tageditcloud_sort");
|
$sort_method = $config->get_string("tageditcloud_sort");
|
||||||
$tags_min = $config->get_int("tageditcloud_minusage");
|
$tags_min = $config->get_int("tageditcloud_minusage");
|
||||||
@ -92,10 +93,6 @@ class TagEditCloud extends Extension {
|
|||||||
|
|
||||||
$counter = 1;
|
$counter = 1;
|
||||||
foreach($tag_data as $row) {
|
foreach($tag_data as $row) {
|
||||||
if($sort_method != 'a' && $counter == $def_count) {
|
|
||||||
$cloud .= "<div id='tagcloud_extra' style='display: none;'>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(class_exists("TagCategories")){
|
if(class_exists("TagCategories")){
|
||||||
$full_tag = $row['tag'];
|
$full_tag = $row['tag'];
|
||||||
$tc = explode(':',$full_tag);
|
$tc = explode(':',$full_tag);
|
||||||
@ -117,13 +114,18 @@ class TagEditCloud extends Extension {
|
|||||||
if(array_search($row['tag'],$image->tag_array) !== FALSE) {
|
if(array_search($row['tag'],$image->tag_array) !== FALSE) {
|
||||||
if($used_first) {
|
if($used_first) {
|
||||||
$precloud .= " <span onclick='tageditcloud_toggle_tag(this,\"$full_tag\")' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span> \n";
|
$precloud .= " <span onclick='tageditcloud_toggle_tag(this,\"$full_tag\")' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span> \n";
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
$counter++;
|
$entry = " <span onclick='tageditcloud_toggle_tag(this,\"$full_tag\")' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span> \n";
|
||||||
$cloud .= " <span onclick='tageditcloud_toggle_tag(this,\"$full_tag\")' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span> \n";
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$counter++;
|
$entry = " <span onclick='tageditcloud_toggle_tag(this,\"$full_tag\")' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span> \n";
|
||||||
$cloud .= " <span onclick='tageditcloud_toggle_tag(this,\"$full_tag\")' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span> \n";
|
}
|
||||||
|
|
||||||
|
if($counter++ <= $def_count) {
|
||||||
|
$cloud .= $entry;
|
||||||
|
} else {
|
||||||
|
$postcloud .= $entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +133,11 @@ class TagEditCloud extends Extension {
|
|||||||
$html .= "<div id='tagcloud_set'>$precloud</div>";
|
$html .= "<div id='tagcloud_set'>$precloud</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= "<div id='tagcloud_unset'>$cloud</div>";
|
if($postcloud != '') {
|
||||||
|
$postcloud = "<div id='tagcloud_extra' style='display: none;'>$postcloud</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= "<div id='tagcloud_unset'>$cloud$postcloud</div>";
|
||||||
|
|
||||||
if($sort_method != 'a' && $counter > $def_count) {
|
if($sort_method != 'a' && $counter > $def_count) {
|
||||||
$rem = $counter - $def_count;
|
$rem = $counter - $def_count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user