function woof_draw_checkbox_childs($tax_slug, $childs, $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);
        }
        ?>
        <ul class="woof_childs_list">
            <?php 
        foreach ($childs as $term) {
            $inique_id = uniqid();
            ?>
                <?php 
            $count_string = "";
            if ($show_count) {
                if ($show_count_dynamic) {
                    $count = WOOF::dynamic_count($term, 'checkbox');
                } else {
                    $count = $term['count'];
                }
                $count_string = '<span class="count">(' . $count . ')</span>';
            }
            //+++
            if ($hide_dynamic_empty_pos and $count == 0) {
                continue;
            }
            $thumb = woof_get_tax_thumb($term['term_id'], $tax_slug);
            ?>
                <li>
                    <div class="iw">
                        <label for="<?php 
            echo 'woof_' . $inique_id;
            ?>
">
                            <?php 
            echo $thumb;
            ?>
                            <input type="checkbox" id="<?php 
            echo 'woof_' . $inique_id;
            ?>
" class="woof_checkbox_term" data-tax="<?php 
            echo $tax_slug;
            ?>
" name="<?php 
            echo $term['slug'];
            ?>
" value="<?php 
            echo $term['term_id'];
            ?>
" <?php 
            checked(in_array($term['slug'], $current_request));
            ?>
 />
                            &nbsp;<?php 
            echo $term['name'];
            ?>
 <?php 
            echo $count_string;
            ?>
                        </label>
                    </div>
                    <?php 
            if (!empty($term['childs'])) {
                woof_draw_checkbox_childs($tax_slug, $term['childs'], $show_count, $show_count_dynamic, $hide_dynamic_empty_pos);
            }
            ?>
                </li>
            <?php 
        }
        ?>
        </ul>
        <?php 
    }
Exemple #2
0
    function woof_draw_checkbox_childs($taxonomy_info, $tax_slug, $childs, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos)
    {
        $current_request = array();
        global $WOOF;
        $request = $WOOF->get_request_data();
        if ($WOOF->is_isset_in_request_data($tax_slug)) {
            $current_request = $request[$tax_slug];
            $current_request = explode(',', urldecode($current_request));
        }
        //***
        static $hide_childs = -1;
        if ($hide_childs == -1) {
            $hide_childs = (int) get_option('woof_checkboxes_slide');
        }
        //excluding hidden terms
        $hidden_terms = array();
        if (isset($WOOF->settings['excluded_terms'][$tax_slug])) {
            $hidden_terms = explode(',', $WOOF->settings['excluded_terms'][$tax_slug]);
        }
        $childs = apply_filters('woof_sort_terms_before_out', $childs, 'checkbox');
        ?>
        <ul class="woof_childs_list" <?php 
        if ($hide_childs == 1) {
            ?>
style="display: none;"<?php 
        }
        ?>
>
            <?php 
        foreach ($childs as $term) {
            $inique_id = uniqid();
            ?>
                <?php 
            $count_string = "";
            $count = 0;
            if (!in_array($term['slug'], $current_request)) {
                if ($show_count) {
                    if ($show_count_dynamic) {
                        $count = $WOOF->dynamic_count($term, 'checkbox', $_REQUEST['additional_taxes']);
                    } else {
                        $count = $term['count'];
                    }
                    $count_string = '<span>(' . $count . ')</span>';
                }
                //+++
                if ($hide_dynamic_empty_pos and $count == 0) {
                    continue;
                }
            }
            if ($_REQUEST['hide_terms_count_txt']) {
                $count_string = "";
            }
            //excluding hidden terms
            if (in_array($term['term_id'], $hidden_terms)) {
                continue;
            }
            ?>
                <li <?php 
            if ($WOOF->settings['dispay_in_row'][$tax_slug] and empty($term['childs'])) {
                ?>
style="display: inline-block !important;"<?php 
            }
            ?>
><input type="checkbox" <?php 
            if (!$count and !in_array($term['slug'], $current_request) and $show_count) {
                ?>
disabled=""<?php 
            }
            ?>
 id="<?php 
            echo 'woof_' . $term['term_id'] . '_' . $inique_id;
            ?>
" class="woof_checkbox_term" data-tax="<?php 
            echo $tax_slug;
            ?>
" name="<?php 
            echo $term['slug'];
            ?>
" value="<?php 
            echo $term['term_id'];
            ?>
" <?php 
            echo checked(in_array($term['slug'], $current_request));
            ?>
 />&nbsp;<label for="<?php 
            echo 'woof_' . $term['term_id'] . '_' . $inique_id;
            ?>
" <?php 
            if (checked(in_array($term['slug'], $current_request))) {
                ?>
style="font-weight: bold;"<?php 
            }
            ?>
><?php 
            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;
            ?>
</label>
                    <?php 
            if (!empty($term['childs'])) {
                woof_draw_checkbox_childs($taxonomy_info, $tax_slug, $term['childs'], $show_count, $show_count_dynamic, $hide_dynamic_empty_pos);
            }
            ?>
                    <input type="hidden" value="<?php 
            echo $term['name'];
            ?>
" class="woof_n_<?php 
            echo $tax_slug;
            ?>
_<?php 
            echo $term['slug'];
            ?>
" />

                </li>
        <?php 
        }
        ?>
        </ul>
        <?php 
    }