function woof_draw_select_childs($tax_slug, $childs, $level, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos) { $current_request = array(); if (isset($_REQUEST[$tax_slug])) { $current_request = $_REQUEST[$tax_slug]; $current_request = explode(',', $current_request); } ?> <?php foreach ($childs as $term) { ?> <?php $count_string = ""; if ($show_count) { if ($show_count_dynamic) { $count = WOOF::dynamic_count($term, 'select'); } else { $count = $term['count']; } $count_string = '<span class="count">(' . $count . ')</span>'; } //+++ if ($hide_dynamic_empty_pos and $count == 0) { continue; } ?> <option value="<?php echo $term['slug']; ?> " <?php echo selected(in_array($term['slug'], $current_request)); ?> ><?php echo str_repeat(' ', $level); echo $term['name']; ?> <?php echo $count_string; ?> </option> <?php if (!empty($term['childs'])) { woof_draw_select_childs($tax_slug, $term['childs'], $level + 1, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos); } ?> <?php } ?> <?php }
function woof_draw_select_childs(&$collector, $taxonomy_info, $tax_slug, $childs, $level, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos) { global $WOOF; $request = $WOOF->get_request_data(); $woof_hide_dynamic_empty_pos = false; //*** $current_request = array(); if ($WOOF->is_isset_in_request_data($tax_slug)) { $current_request = $request[$tax_slug]; $current_request = explode(',', urldecode($current_request)); } $childs = apply_filters('woof_sort_terms_before_out', $childs, 'select'); ?> <?php foreach ($childs as $term) { ?> <?php $count_string = ""; $count = 0; if (!in_array($term['slug'], $current_request)) { if ($show_count) { if ($show_count_dynamic) { $count = $WOOF->dynamic_count($term, 'select', $_REQUEST['additional_taxes']); } else { $count = $term['count']; } $count_string = '(' . $count . ')'; } //+++ if ($hide_dynamic_empty_pos and $count == 0) { continue; } } if ($_REQUEST['hide_terms_count_txt']) { $count_string = ""; } ?> <option <?php if ($show_count and $count == 0 and !in_array($term['slug'], $current_request)) { ?> disabled=""<?php } ?> value="<?php echo $term['slug']; ?> " <?php echo selected(in_array($term['slug'], $current_request)); ?> ><?php echo str_repeat(' ', $level); if (has_filter('woof_before_term_name')) { echo apply_filters('woof_before_term_name', $term, $taxonomy_info); } else { echo $term['name']; } ?> <?php echo $count_string; ?> </option> <?php if (!isset($collector[$tax_slug])) { $collector[$tax_slug] = array(); } $collector[$tax_slug][] = array('name' => $term['name'], 'slug' => $term['slug']); //+++ if (!empty($term['childs'])) { woof_draw_select_childs($collector, $taxonomy_info, $tax_slug, $term['childs'], $level + 1, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos); } ?> <?php } ?> <?php }