Пример #1
0
    function woof_draw_radio_childs($taxonomy_info, $tax_slug, $childs, $show_count, $show_count_dynamic, $hide_dynamic_empty_pos)
    {
        global $WOOF;
        $request = $WOOF->get_request_data();
        $current_request = array();
        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, 'radio');
        ?>
        <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, 'radio', $_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="radio" <?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_radio_term" data-slug="<?php 
            echo $term['slug'];
            ?>
" name="<?php 
            echo $tax_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>
                    <a href="#" name="<?php 
            echo $tax_slug;
            ?>
" style="<?php 
            if (!in_array($term['slug'], $current_request)) {
                ?>
display: none;<?php 
            }
            ?>
" class="woof_radio_term_reset"><img src="<?php 
            echo WOOF_LINK;
            ?>
/img/delete.png" height="12" width="12" /></a>
                    <?php 
            if (!empty($term['childs'])) {
                woof_draw_radio_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 
    }
Пример #2
0
    function woof_draw_radio_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, 'radio');
                } 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="radio" id="<?php 
            echo 'woof_' . $inique_id;
            ?>
" class="woof_radio_term" data-slug="<?php 
            echo $term['slug'];
            ?>
" name="<?php 
            echo $tax_slug;
            ?>
" value="<?php 
            echo $term['term_id'];
            ?>
" <?php 
            echo checked(in_array($term['slug'], $current_request));
            ?>
 />
                            &nbsp;<?php 
            echo $term['name'];
            ?>
 <?php 
            echo $count_string;
            ?>
                        </label>
                        <a href="#" data-name="<?php 
            echo $tax_slug;
            ?>
" class="woof_radio_term_reset"><i class="fa fa-times"></i></a>
                    </div>
                    <?php 
            if (!empty($term['childs'])) {
                woof_draw_radio_childs($tax_slug, $term['childs'], $show_count, $show_count_dynamic, $hide_dynamic_empty_pos);
            }
            ?>
                </li>
        <?php 
        }
        ?>
        </ul>
        <?php 
    }