| @@ -85,9 +85,10 @@ | ||
| 85 | 85 | public function container( $content, $settings, $class = '', $template = '', $fullwidth = false, $ajax = true ) { |
| 86 | 86 | $rand = wp_rand(); |
| 87 | 87 | $layout_id = 'rtsb-container-' . $rand; |
| 88 | 88 | $metas = RenderHelpers::meta_dataset( $settings, $template ); |
| 89 | - $layout = $metas['layout']; | |
| 89 | + $raw_layout = esc_html( $metas['layout'] ); | |
| 90 | + $layout = RenderHelpers::filter_layout( $raw_layout, $template ); | |
| 90 | 91 | $style_attr = '--rtsb-default-columns: ' . esc_attr( RenderHelpers::default_columns( $layout ) ); |
| 91 | 92 | $view_mode = $settings['view_mode'] ?? 'grid'; |
| 92 | 93 | $view_mode = isset( $_GET['displayview'] ) ? sanitize_text_field( wp_unslash( $_GET['displayview'] ) ) : $view_mode; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 93 | 94 | $tooltip_attr = 'list' == $view_mode && ! empty( $metas['tooltip_position_list'] ) ? esc_attr( $metas['tooltip_position_list'] ) : $metas['tooltip_position']; |
| @@ -163,13 +164,15 @@ | ||
| 163 | 164 | * |
| 164 | 165 | * @return string |
| 165 | 166 | */ |
| 166 | 167 | public function row( $content, $settings, $hook_html = '', $raw_settings = [] ) { |
| 167 | - $layout = $settings['layout']; | |
| 168 | + $raw_layout = esc_html( $settings['layout'] ); | |
| 169 | + $layout = RenderHelpers::filter_layout( $raw_layout ); | |
| 170 | + | |
| 168 | 171 | $rand = wp_rand(); |
| 169 | - $is_carousel = preg_match( '/slider/', $layout ); | |
| 172 | + $is_carousel = preg_match( '/slider/', $raw_layout ); | |
| 170 | 173 | |
| 171 | - if ( preg_match( '/category/', $layout ) && ( ! empty( $settings['active_cat_slider'] ) ) ) { | |
| 174 | + if ( preg_match( '/category/', $raw_layout ) && ( ! empty( $settings['active_cat_slider'] ) ) ) { | |
| 172 | 175 | $is_carousel = true; |
| 173 | 176 | } |
| 174 | 177 | |
| 175 | 178 | // Row classes. |
| @@ -240,8 +243,9 @@ | ||
| 240 | 243 | |
| 241 | 244 | foreach ( $products as $product ) { |
| 242 | 245 | $i++; |
| 243 | 246 | $GLOBALS['product'] = $product; |
| 247 | + $layout = RenderHelpers::filter_layout( esc_html( $settings['layout'] ), $template ); | |
| 244 | 248 | |
| 245 | 249 | /** |
| 246 | 250 | * Before product template render hook. |
| 247 | 251 | */ |
| @@ -250,9 +254,9 @@ | ||
| 250 | 254 | // Loop arg. |
| 251 | 255 | $arg = $this->arg_dataset( $settings, $product, $settings['lazy_load'], $i ); |
| 252 | 256 | |
| 253 | 257 | // Get template. |
| 254 | - $html .= Fns::load_template( $template . $settings['layout'], $arg, true ); | |
| 258 | + $html .= Fns::load_template( $template . $layout, $arg, true ); | |
| 255 | 259 | |
| 256 | 260 | /** |
| 257 | 261 | * After product template render hook. |
| 258 | 262 | */ |