}
            }
        }
    }
}
$pf_structure = get_option('permalink_structure');
$curr_cat_query = get_option('wc_settings_prdctfltr_force_categories', 'no');
if (isset($curr_options['wc_settings_prdctfltr_custom_action']) && !empty($curr_options['wc_settings_prdctfltr_custom_action'])) {
    $curr_action = esc_url($curr_options['wc_settings_prdctfltr_custom_action']);
} else {
    if (is_shop() || is_product_taxonomy() || is_product()) {
        if (is_product()) {
            $curr_action = get_permalink(WC_Prdctfltr::prdctfltr_wpml_get_id(wc_get_page_id('shop')));
        } else {
            if (is_shop() || WC_Prdctfltr::$settings['wc_settings_prdctfltr_filtering_mode'] == 'simple' && WC_Prdctfltr::$settings['permalink_structure'] !== '' && is_product_taxonomy()) {
                $curr_action = get_permalink(WC_Prdctfltr::prdctfltr_wpml_get_id(wc_get_page_id('shop')));
            } else {
                if ($pf_structure == '') {
                    $curr_action = esc_url(remove_query_arg(array('page', 'paged'), esc_url(add_query_arg($wp->query_string, '', home_url($wp->request)))));
                } else {
                    $curr_action = preg_replace('%\\/page/[0-9]+%', '', home_url($wp->request));
                }
            }
        }
    } else {
        if (!isset($prdctfltr_global['action']) || $prdctfltr_global['action'] == '') {
            if ($pf_structure == '') {
                $curr_action = esc_url(remove_query_arg(array('page', 'paged'), esc_url(add_query_arg($wp->query_string, '', home_url($wp->request)))));
            } else {
                $curr_action = preg_replace('%\\/page/[0-9]+%', '', home_url($wp->request));
            }
Exemple #2
0
    function form($instance)
    {
        $vars = array('preset' => 'pf_default', 'template' => '', 'disable_overrides' => 'no', 'widget_action' => '');
        $instance = wp_parse_args((array) $instance, $vars);
        $preset = strip_tags($instance['preset']);
        $template = strip_tags($instance['template']);
        $disable_overrides = strip_tags($instance['disable_overrides']);
        $widget_action = strip_tags($instance['widget_action']);
        ?>
			<div>
				<p class="prdctfltr-box">
					<label for="<?php 
        echo $this->get_field_id('preset');
        ?>
" class="prdctfltr-label"><?php 
        _e('Style', 'prdctfltr');
        ?>
 :</label>
					<select name="<?php 
        echo $this->get_field_name('preset');
        ?>
" id="<?php 
        echo $this->get_field_id('preset');
        ?>
" class="widefat">
						<option value="pf_default_inline"<?php 
        echo $preset == 'pf_default_inline' ? ' selected="selected"' : '';
        ?>
><?php 
        _e('Flat Inline', 'prdctfltr');
        ?>
</option>
						<option value="pf_default"<?php 
        echo $preset == 'pf_default' ? ' selected="selected"' : '';
        ?>
><?php 
        _e('Flat Block', 'prdctfltr');
        ?>
</option>
						<option value="pf_default_select"<?php 
        echo $preset == 'pf_default_select' ? ' selected="selected"' : '';
        ?>
><?php 
        _e('Flat Select', 'prdctfltr');
        ?>
</option>
					</select>
				</p>
				<p class="prdctfltr-box"> 
					<label for="<?php 
        echo $this->get_field_id('template');
        ?>
" class="prdctfltr-label"><?php 
        _e('Preset', 'prdctfltr');
        ?>
 :</label>
					<select name="<?php 
        echo $this->get_field_name('template');
        ?>
" id="<?php 
        echo $this->get_field_id('template');
        ?>
" class="widefat">
						<option value="default"<?php 
        echo $template == 'default' ? ' selected="selected"' : '';
        ?>
><?php 
        _e('Default', 'prdctfltr');
        ?>
</option>
					<?php 
        $curr_templates = get_option('prdctfltr_templates', array());
        foreach ($curr_templates as $k => $v) {
            ?>
						<option value="<?php 
            echo $k;
            ?>
"<?php 
            echo $template == $k ? ' selected="selected"' : '';
            ?>
><?php 
            echo $k;
            ?>
</option>
					<?php 
        }
        ?>
					</select>
				</p>
				<p class="prdctfltr-box">
					<label for="<?php 
        echo $this->get_field_id('disable_overrides');
        ?>
" class="prdctfltr-label"><?php 
        _e('Disable Overrides', 'prdctfltr');
        ?>
 :</label>
					<input type="checkbox" name="<?php 
        echo $this->get_field_name('disable_overrides');
        ?>
" id="<?php 
        echo $this->get_field_id('disable_overrides');
        ?>
" value="yes" <?php 
        echo $disable_overrides == 'yes' ? ' checked' : '';
        ?>
 />
				</p>
				<p class="prdctfltr-box">
					<label for="<?php 
        echo $this->get_field_id('widget_action');
        ?>
" class="prdctfltr-label"><?php 
        _e('Widget Action URL', 'prdctfltr');
        ?>
 :</label>
					<input type="text" name="<?php 
        echo $this->get_field_name('widget_action');
        ?>
" id="<?php 
        echo $this->get_field_id('widget_action');
        ?>
" value="<?php 
        echo $widget_action;
        ?>
" class="widefat" /><br/>
					<small><?php 
        _e('Custom action is used if the widget is not used in shop, product archives or pages with Product Filter shortcodes. This way you can redirect filtering to your shop page or a custom page. Enter URL to redirect. For example your shop page URL', 'prdctfltr');
        ?>
 <?php 
        echo get_permalink(WC_Prdctfltr::prdctfltr_wpml_get_id(woocommerce_get_page_id('shop')));
        ?>
</small>
				</p>

			</div>

	<?php 
    }