public function woof_shortcode($atts) { $args = array(); //this for synhronizating shortcode woof_products if its has attribute taxonomies if (isset($atts['taxonomies'])) { //$args['additional_taxes'] = $this->get_tax_query($atts['taxonomies']); $args['additional_taxes'] = $atts['taxonomies']; } else { $args['additional_taxes'] = ''; } //+++ $taxonomies = $this->get_taxonomies(); $allow_taxonomies = (array) $this->settings['tax']; $args['taxonomies'] = array(); if (!empty($taxonomies)) { foreach ($taxonomies as $tax_key => $tax) { if (!in_array($tax_key, array_keys($allow_taxonomies))) { continue; } //+++ $args['woof_settings'] = get_option('woof_settings', array()); $args['taxonomies_info'][$tax_key] = $tax; $hide_empty = false; $args['taxonomies'][$tax_key] = WOOF_HELPER::get_terms($tax_key, $hide_empty); } } //*** if (isset($atts['skin'])) { wp_enqueue_style('woof_skin_' . $atts['skin'], WOOF_LINK . 'css/shortcode_skins/' . $atts['skin'] . '.css'); } //*** if (isset($atts['sid'])) { $args['sid'] = $atts['sid']; wp_enqueue_script('woof_sid', WOOF_LINK . 'js/woof_sid.js'); } if (isset($atts['autohide'])) { $args['autohide'] = $atts['autohide']; } else { $args['autohide'] = 0; } $args['price_filter'] = get_option('woof_show_price_search', 0); //*** $args['show_woof_edit_view'] = 0; if (current_user_can('create_users')) { $args['show_woof_edit_view'] = 1; //wp_enqueue_script('jquery'); //wp_enqueue_script('jquery-ui-core', array('jquery')); //wp_enqueue_script('jquery-ui-dialog', array('jquery', 'jquery-ui-core')); //wp_enqueue_style('jquery-ui-dialog',includes_url('css/jquery-ui-dialog.min.css')); //wp_enqueue_style('jquery-ui-dialog', 'http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); } return $this->render_html(WOOF_PATH . 'views/woof.php', $args); }
<input <?php echo @in_array($key, @array_keys($this->settings['tax'])) ? 'checked="checked"' : ''; ?> type="checkbox" name="woof_settings[tax][<?php echo $key; ?> ]" value="1" /> <?php echo $tax->labels->name; ?> <?php if ($woof_settings['tax_type'][$key] == 'color') { $terms = WOOF_HELPER::get_terms($key, 0, 0, 0, 0); if (!empty($terms)) { echo '<ul class="woof_color_list">'; foreach ($terms as $t) { $color = '#000000'; if (isset($woof_settings['color'][$key][$t['slug']])) { $color = $woof_settings['color'][$key][$t['slug']]; } ?> <li> <table> <tr> <td valign="top"> <input type="text" name="woof_settings[color][<?php echo $key; ?>
public function woof_shortcode($atts) { $args = array(); //this for synhronizating shortcode woof_products if its has attribute taxonomies if (isset($atts['taxonomies'])) { //$args['additional_taxes'] = $this->get_tax_query($atts['taxonomies']); $args['additional_taxes'] = $atts['taxonomies']; } else { $args['additional_taxes'] = ''; } //+++ $taxonomies = $this->get_taxonomies(); $allow_taxonomies = (array) (isset($this->settings['tax']) ? $this->settings['tax'] : array()); $args['taxonomies'] = array(); $hide_empty = false; if (!empty($taxonomies)) { foreach ($taxonomies as $tax_key => $tax) { if (!in_array($tax_key, array_keys($allow_taxonomies))) { continue; } //+++ $args['woof_settings'] = get_option('woof_settings', array()); $args['taxonomies_info'][$tax_key] = $tax; $args['taxonomies'][$tax_key] = WOOF_HELPER::get_terms($tax_key, $hide_empty); //show only subcategories if is_really_current_term_exists if ($this->is_really_current_term_exists()) { $t = $this->get_really_current_term(); if ($tax_key == $t->taxonomy) { if (isset($args['taxonomies'][$tax_key][$t->term_id])) { $args['taxonomies'][$tax_key] = $args['taxonomies'][$tax_key][$t->term_id]['childs']; } else { $parent = get_term($t->parent, $tax_key); $parents_ids = array(); $parents_ids[] = $parent->term_id; while ($parent->parent != 0) { $parent = get_term_by('id', $parent->parent, $tax_key); $parents_ids[] = $parent->term_id; } $parents_ids = array_reverse($parents_ids); //*** $tmp = $args['taxonomies'][$tax_key]; foreach ($parents_ids as $id) { $tmp = $tmp[$id]['childs']; } $args['taxonomies'][$tax_key] = $tmp[$t->term_id]['childs']; } } } } } //*** if (isset($atts['skin'])) { wp_enqueue_style('woof_skin_' . $atts['skin'], WOOF_LINK . 'css/shortcode_skins/' . $atts['skin'] . '.css'); } //*** if (isset($atts['sid'])) { $args['sid'] = $atts['sid']; wp_enqueue_script('woof_sid', WOOF_LINK . 'js/woof_sid.js'); } if (isset($atts['autohide'])) { $args['autohide'] = $atts['autohide']; } else { $args['autohide'] = 0; } if (isset($atts['redirect'])) { $args['redirect'] = $atts['redirect']; } else { $args['redirect'] = ''; } if (isset($atts['tax_only'])) { $args['tax_only'] = explode(',', $atts['tax_only']); } else { $args['tax_only'] = array(); } if (isset($atts['by_only'])) { $args['by_only'] = explode(',', $atts['by_only']); } else { $args['by_only'] = array(); } if (isset($atts['autosubmit'])) { $args['autosubmit'] = $atts['autosubmit']; } else { $args['autosubmit'] = get_option('woof_autosubmit', 0); } if (isset($atts['ajax_redraw'])) { $args['ajax_redraw'] = $atts['ajax_redraw']; } else { $args['ajax_redraw'] = 0; } if (isset($this->settings['by_price']['show'])) { //just for compatibility from 2.1.2 to 2.1.3 $args['price_filter'] = (int) $this->settings['by_price']['show']; } else { $args['price_filter'] = (int) get_option('woof_show_price_search', 0); } //*** $args['show_woof_edit_view'] = 1; if (current_user_can('create_users')) { $args['show_woof_edit_view'] = isset($this->settings['show_woof_edit_view']) ? (int) $this->settings['show_woof_edit_view'] : 1; } //lets assemble shortcode txt for ajax mode for data-shortcode in woof.php $_REQUEST['woof_shortcode_txt'] = 'woof '; if (!empty($atts)) { foreach ($atts as $key => $value) { if (($key == 'tax_only' or $key == 'by_only') and empty($value)) { continue; } $_REQUEST['woof_shortcode_txt'] .= $key . "='" . (is_array($value) ? explode(',', $value) : $value) . "' "; } } //$_REQUEST['woof_shortcode_txt'] = "woof tax_only='pa_color' by_only='none'"; return $this->render_html(WOOF_PATH . 'views/woof.php', $args); }
public function woof_shortcode($atts) { $args = array(); $args['taxonomies'] = array(); $taxonomies = $this->get_taxonomies(); $allow_taxonomies = isset($this->settings['tax']) ? (array) $this->settings['tax'] : array(); if (!empty($taxonomies)) { foreach ($taxonomies as $tax_key => $tax) { if (!in_array($tax_key, array_keys($allow_taxonomies))) { continue; } //+++ $args['woof_settings'] = get_option('woof_settings'); $args['taxonomies_info'][$tax_key] = $tax; $args['taxonomies'][$tax_key] = WOOF_HELPER::get_terms($tax_key); } } $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_script('wc-jquery-ui-touchpunch', WC()->plugin_url() . '/assets/js/frontend/jquery-ui-touch-punch' . $suffix . '.js', array('jquery-ui-slider'), WC_VERSION, true); wp_register_script('woof_front', WOOF_LINK . 'js/front.js', array('jquery-ui-slider', 'wc-jquery-ui-touchpunch')); wp_localize_script('woof_front', 'woocommerce_price_slider_params', array('currency_symbol' => get_woocommerce_currency_symbol(), 'currency_pos' => get_option('woocommerce_currency_pos'), 'min_price' => isset($_GET['min_price']) ? esc_attr($_GET['min_price']) : '', 'max_price' => isset($_GET['max_price']) ? esc_attr($_GET['max_price']) : '')); wp_enqueue_script('woof_front'); //*** return $this->render_html(WOOF_PATH . 'views/woof.php', $args); }