public function generateAttributeFilterHtml( $filter, $filterSettings, $blockStyle, $key = 1, $viewId = '' ) {
$settings = $this->getFilterSetting($filter, 'settings', array());
$labels = FrameWpf::_()->getModule('woofilters')->getModel('woofilters')->getFilterLabels('Attribute');
$frontendTypes = array('list', 'radio', 'dropdown', 'mul_dropdown');
$type = $this->getFilterSetting($settings, 'f_frontend_type', 'list', null, DispatcherWpf::applyFilters('getFrontendFilterTypes', $frontendTypes, $filter['id']));
$filter['settings']['f_frontend_type'] = $type;
$hidden_atts = isset($filter['settings']['f_hidden_attributes']) ? $filter['settings']['f_hidden_attributes'] : false;
$includeAttsId = ( !empty($settings['f_mlist[]']) ) ? explode(',', $settings['f_mlist[]']) : false;
$attrId = $this->getFilterSetting($settings, 'f_list', 0, true);
$order = $this->getFilterSetting($settings, 'f_sort_by', 'asc');
$orderByInclude = !empty($settings['f_order_custom']) ? 'include' : 'name';
$excludeIds = $this->getFilterSetting($settings, 'f_exclude_terms', false);
$args = array(
'parent' => 0,
'hide_empty' => !empty($filter['settings']['f_hide_empty']) ? $filter['settings']['f_hide_empty'] : false,
'orderby' => $orderByInclude,
'order' => $order,
'include' => $includeAttsId
);
$isCustom = !empty($filter['custom_taxonomy']);
if ($isCustom) {
$customTaxonomy = $filter['custom_taxonomy'];
$attrName = $customTaxonomy->attribute_name;
$attrSlug = $customTaxonomy->attribute_slug;
$attrLabel = strtolower($customTaxonomy->attribute_label);
$filterNameSlug = $attrSlug;
$filterName = $customTaxonomy->filter_name;
} else {
$attrName = wc_attribute_taxonomy_name_by_id((int) $attrId);
$attrLabel = strtolower(wc_attribute_label($attrName));
$filterNameSlug = str_replace('pa_', '', $attrName);
$filterName = 'filter_' . $filterNameSlug;
}
$logic = FrameWpf::_()->getModule('woofilters')->getAttrFilterLogic();
$logicSlug = $this->getFilterSetting($settings, 'f_query_logic', 'or', false, array_keys($logic['loop']));
$show_all_atts = isset($filter['settings']['f_show_all_attributes']) ? $filter['settings']['f_show_all_attributes'] : false;
// add additional slug for filter name if logic is out of standard woocmmerce filter
if ('not_in' == $logicSlug) {
$filterName = 'pr_' . $filterName;
$show_all_atts = true;
}
list($showedTerms, $countsTerms, $showFilter) = $this->getShowedTerms($attrName, $show_all_atts);
//doing the sorting through the hook while some themes/plugins impose their own
if ( false !== $includeAttsId && 'include' == $orderByInclude ) {
$args['wpf_orderby'] = implode(',', $includeAttsId);
add_filter('get_terms_orderby', array($this, 'wpfGetTermsOrderby'), 99, 2);
}
$productAttr = $isCustom ? DispatcherWpf::applyFilters('getCustomTerms', array(), $attrSlug, $args) : $this->getTaxonomyHierarchy($attrName, $args);
remove_filter('get_terms_orderby', array($this, 'wpfGetTermsOrderby'), 99, 2);
if (!$productAttr) {
return '';
}
$attrSelected = ReqWpf::getVar($filterName);
if ($attrSelected) {
$delimetrList = array_values( $logic['delimetr'] );
foreach ( $delimetrList as $delimetr ) {
$slugs = explode( $delimetr, $attrSelected );
if ( count( $slugs ) > 1 ) {
break;
}
}
} elseif ( $hidden_atts && $includeAttsId ) {
$attrSelected = $includeAttsId;
}
if ( ! empty( $slugs ) ) {
$attrSelected = $slugs;
}
$layout = $this->getFilterLayout($settings, $filterSettings);
$inLineClass = $layout['class'];
$htmlOpt = '';
if (in_array($type, $frontendTypes)) {
$htmlOpt = $this->generateTaxonomyOptionsHtml($productAttr, $filter, $attrSelected, $excludeIds, '', $layout, false, $showedTerms, $countsTerms);
if ('list' == $type || 'radio' == $type) {
$maxHeight = $this->getFilterSetting($settings, 'f_max_height', 0, true);
if ($maxHeight > 0) {
$this->setFilterCss('#' . self::$blockId . ' .wpfFilterVerScroll {max-height:' . $maxHeight . 'px;}');
}
$htmlOpt = '<ul class="wpfFilterVerScroll' . $inLineClass . '">' . $htmlOpt . '</ul>';
} elseif ('dropdown' == $type) {
$htmlOpt =
'<select><option value="" data-slug="">' .
esc_html($this->getFilterSetting($settings, 'f_dropdown_first_option_text', esc_attr__('Select all', 'woo-product-filter'))) .
'</option>' . $htmlOpt . '</select>';
} elseif ('mul_dropdown' == $type) {
$search = array(
'show' => $this->getFilterSetting($settings, 'f_dropdown_search', 0),
'placeholder' => $this->getFilterSetting($settings, 'f_dropdown_search_text', 'Search')
);
$htmlOpt =
'<select multiple data-placeholder="' .
esc_attr($this->getFilterSetting($settings, 'f_dropdown_first_option_text', esc_attr__('Select all', 'woo-product-filter'))) .
'" data-search="' . esc_attr(json_encode($search, JSON_UNESCAPED_UNICODE)) . '">' .
$htmlOpt .
'</select>';
}
} else {
$htmlOpt = DispatcherWpf::applyFilters('getTaxonomyOptionsHtml', $htmlOpt, array(
'type' => $type,
'settings' => $filter,
'terms' => $productAttr,
'selected' => $attrSelected,
'showed' => $showedTerms,
'counts' => $countsTerms,
'excludes' => $excludeIds,
'includes' => false,
'display' => $layout,
'class' => $inLineClass
));
}
$blockStyle = ( !$showFilter || ( !$show_all_atts && self::$isLeerFilter ) ? 'display:none;' : '' ) . $blockStyle;
if (!empty($blockStyle)) {
$this->setFilterCss('#' . self::$blockId . ' {' . $blockStyle . '}');
}
$noActive = ReqWpf::getVar($filterName) ? '' : 'wpfNotActive';
$noActive = !ReqWpf::getVar($filterName) && $hidden_atts ? 'wpfHidden' : $noActive;
$showCount = $filter['settings']['f_show_count'] ? ' wpfShowCount' : '';
$html =
'<div id="' . self::$blockId .
'" class="wpfFilterWrapper ' . $noActive . $showCount .
'" data-filter-type="' . $filter['id'] .
'" data-display-type="' . $type .
'" data-get-attribute="' . $filterName .
'" data-query-logic="' . $logicSlug .
'" data-slug="' . esc_attr($filterNameSlug) .
'" data-radio="' . ( 'radio' === $type ? '1' : '0' ) .
'" data-taxonomy="' . $attrName .
'" data-label="' . $attrLabel .
'" data-show-all="' . ( (int) $show_all_atts ) . '"' . $filter['blockAttributes'] .
'>';
$html .= $this->generateFilterHeaderHtml($filter, $filterSettings);
$html .= $this->generateDescriptionHtml($filter);
$html .= $this->generateSearchFieldList('<div class="wpfCheckboxHier">' . $htmlOpt1 . '</div>', $settings, $labels);
$html .= '</div>';//end wpfFilterContent
$html .= '</div>';//end wpfFilterWrapper
return $html;
}
if (in_array($type, $frontendTypes)) {
...
} else { //фильтры загружаются начиная с этого момента
$htmlOpt = DispatcherWpf::applyFilters('getTaxonomyOptionsHtml', $htmlOpt, array(
'type' => $type,
'settings' => $filter,
'terms' => $productAttr,
'selected' => $attrSelected,
'showed' => $showedTerms,
'counts' => $countsTerms,
'excludes' => $excludeIds,
'includes' => false,
'display' => $layout,
'class' => $inLineClass
));
}
$blockStyle = ( !$showFilter || ( !$show_all_atts && self::$isLeerFilter ) ? 'display:none;' : '' ) . $blockStyle;
if (!empty($blockStyle)) {
$this->setFilterCss('#' . self::$blockId . ' {' . $blockStyle . '}');
}
$noActive = ReqWpf::getVar($filterName) ? '' : 'wpfNotActive';
$noActive = !ReqWpf::getVar($filterName) && $hidden_atts ? 'wpfHidden' : $noActive;
$showCount = $filter['settings']['f_show_count'] ? ' wpfShowCount' : '';
$html =
'<div id="' . self::$blockId .
'" class="wpfFilterWrapper ' . $noActive . $showCount .
'" data-filter-type="' . $filter['id'] .
'" data-display-type="' . $type .
'" data-get-attribute="' . $filterName .
'" data-query-logic="' . $logicSlug .
'" data-slug="' . esc_attr($filterNameSlug) .
'" data-radio="' . ( 'radio' === $type ? '1' : '0' ) .
'" data-taxonomy="' . $attrName .
'" data-label="' . $attrLabel .
'" data-show-all="' . ( (int) $show_all_atts ) . '"' . $filter['blockAttributes'] .
'>';
$html .= $this->generateFilterHeaderHtml($filter, $filterSettings);
$html .= $this->generateDescriptionHtml($filter);
$html .= $this->generateSearchFieldList('<div class="wpfCheckboxHier">' . $htmlOpt . '</div>', $settings, $labels);
$html .= '</div>';//end wpfFilterContent
$html .= '</div>';//end wpfFilterWrapper
return $html;
}
RewriteEngine On
RewriteBase /
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
<IfModule mod_security.c>
<Files upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
php_value post_max_size 100M
php_value upload_max_filesize 100M
php_value memory_limit 100M
php_value max_execution_time 500
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^two\.example\.ru$
RewriteRule ^$ https://one.example.ru/2/ [L,R=301]