function woof_draw_mselect_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, 'mselect'); } 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_mselect_childs($tax_slug, $term['childs'], $level + 1, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos); } ?> <?php } ?> <?php }
function woof_draw_mselect_childs(&$collector, $taxonomy_info, $tax_slug, $childs, $level, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos) { global $WOOF; $woof_hide_dynamic_empty_pos = 0; $current_request = array(); if (isset($_GET[$tax_slug])) { $current_request = $_GET[$tax_slug]; $current_request = explode(',', urldecode($current_request)); } //excluding hidden terms $hidden_terms = array(); if (isset($WOOF->settings['excluded_terms'][$tax_slug])) { $hidden_terms = explode(',', $WOOF->settings['excluded_terms'][$tax_slug]); } ?> <?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, 'mselect', $_REQUEST['additional_taxes']); } else { $count = $term['count']; } $count_string = '(' . $count . ')'; } //+++ if ($hide_dynamic_empty_pos and $count == 0) { continue; } } //excluding hidden terms if (in_array($term['term_id'], $hidden_terms)) { continue; } ?> <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_mselect_childs($collector, $taxonomy_info, $tax_slug, $term['childs'], $level + 1, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos); } ?> <?php } ?> <?php }