@@ -10,154 +10,154 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Layout { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Holds class instance |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * |
|
| 18 | - * @var object \lsx\search\classes\frontend\Layout() |
|
| 19 | - */ |
|
| 20 | - protected static $instance = null; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Contructor |
|
| 24 | - */ |
|
| 25 | - public function __construct() { |
|
| 26 | - add_action( 'wp', array( $this, 'load_functions' ), 24 ); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Return an instance of this class. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - * |
|
| 34 | - * @return object \lsx\search\classes\frontend\Layout() A single instance of this class. |
|
| 35 | - */ |
|
| 36 | - public static function get_instance() { |
|
| 37 | - // If the single instance hasn't been set, set it now. |
|
| 38 | - if ( null == self::$instance ) { |
|
| 39 | - self::$instance = new self(); |
|
| 40 | - } |
|
| 41 | - return self::$instance; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Check all settings. |
|
| 46 | - */ |
|
| 47 | - public function load_functions() { |
|
| 48 | - $lsx_search = LSX_Search::get_instance(); |
|
| 49 | - if ( $lsx_search->frontend->search_enabled ) { |
|
| 50 | - if ( isset( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_layout_switcher_enable' ] ) ) { |
|
| 51 | - add_filter( 'lsx_blog_customizer_show_switcher', array( $this, 'show_layout_switcher' ), 10, 1 ); |
|
| 52 | - add_filter( 'lsx_layout_switcher_options', array( $this, 'lsx_layout_switcher_options' ), 10, 1 ); |
|
| 53 | - add_filter( 'lsx_layout_switcher_page_key', array( $this, 'lsx_layout_switcher_page_key' ), 10, 1 ); |
|
| 54 | - add_filter( 'lsx_layout_switcher_options_default', array( $this, 'lsx_layout_switcher_options_default' ), 10, 1 ); |
|
| 55 | - |
|
| 56 | - // Layout Classes |
|
| 57 | - add_filter( 'woocommerce_product_loop_start', array( $this, 'woocommerce_layout_class' ), 10, 1 ); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Display the woocommerce archive swticher. |
|
| 64 | - */ |
|
| 65 | - public function show_layout_switcher( $show = false ) { |
|
| 66 | - if ( is_search() ) { |
|
| 67 | - $archive_layout_switcher = get_theme_mod( 'lsx_blog_customizer_archive_layout_switcher', false ); |
|
| 68 | - if ( true === $archive_layout_switcher ) { |
|
| 69 | - $show = true; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - return $show; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Remove the default and half-grid options from the results layouts. |
|
| 77 | - * |
|
| 78 | - * @param array $layout_options |
|
| 79 | - * @return array |
|
| 80 | - */ |
|
| 81 | - public function lsx_layout_switcher_options( $layout_options ) { |
|
| 82 | - unset( $layout_options['default'] ); |
|
| 83 | - unset( $layout_options['half-grid'] ); |
|
| 84 | - return $layout_options; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Replace the key for the layout switcher. |
|
| 89 | - * |
|
| 90 | - * @param string $page_key |
|
| 91 | - * @return string |
|
| 92 | - */ |
|
| 93 | - public function lsx_layout_switcher_page_key( $page_key ) { |
|
| 94 | - $lsx_search = LSX_Search::get_instance(); |
|
| 95 | - $page_key = str_replace( '_search', '', $lsx_search->frontend->search_prefix ); |
|
| 96 | - return $page_key; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * CHange the default layout to a grid layout. |
|
| 101 | - * |
|
| 102 | - * @param string $default |
|
| 103 | - * @return string |
|
| 104 | - */ |
|
| 105 | - public function lsx_layout_switcher_options_default( $default = 'grid' ) { |
|
| 106 | - $lsx_search = LSX_Search::get_instance(); |
|
| 107 | - $default = 'grid'; |
|
| 108 | - if ( isset( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ] ) && ! empty( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ] ) ) { |
|
| 109 | - $default = $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ]; |
|
| 110 | - } |
|
| 111 | - return $default; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Controls the layout for the woocommerce shop page. |
|
| 116 | - */ |
|
| 117 | - public function woocommerce_layout_class( $output = '' ) { |
|
| 118 | - $default_class = $this->lsx_layout_switcher_options_default(); |
|
| 119 | - $selected = $this->get_layout_value_from_cookie( 'product' ); |
|
| 120 | - if ( '' !== $selected ) { |
|
| 121 | - $default_class = $selected; |
|
| 122 | - } |
|
| 123 | - $output = str_replace( 'products', 'products ' . $default_class, $output ); |
|
| 124 | - return $output; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Get layout value from cookie |
|
| 129 | - * |
|
| 130 | - * @since 1.0.0 |
|
| 131 | - */ |
|
| 132 | - public function get_layout_value_from_cookie( $page_key = 'blog' ) { |
|
| 133 | - $archive_layout = 'grid'; |
|
| 134 | - |
|
| 135 | - if ( isset( $_COOKIE[ 'lsx-' . $page_key . '-layout' ] ) ) { |
|
| 136 | - $archive_layout_from_cookie = sanitize_key( $_COOKIE[ 'lsx-' . $page_key . '-layout' ] ); |
|
| 137 | - $archive_layout_from_cookie = $this->sanitize_select_layout_switcher( $archive_layout_from_cookie ); |
|
| 138 | - |
|
| 139 | - if ( ! empty( $archive_layout_from_cookie ) ) { |
|
| 140 | - $archive_layout = $archive_layout_from_cookie; |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - return $archive_layout; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Sanitize select (layout switcher). |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - */ |
|
| 151 | - public function sanitize_select_layout_switcher( $input ) { |
|
| 152 | - $valid = array( |
|
| 153 | - 'list' => esc_html__( 'List', 'lsx-search' ), |
|
| 154 | - 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
| 155 | - ); |
|
| 156 | - |
|
| 157 | - if ( array_key_exists( $input, $valid ) ) { |
|
| 158 | - return $input; |
|
| 159 | - } else { |
|
| 160 | - return ''; |
|
| 161 | - } |
|
| 162 | - } |
|
| 13 | + /** |
|
| 14 | + * Holds class instance |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * |
|
| 18 | + * @var object \lsx\search\classes\frontend\Layout() |
|
| 19 | + */ |
|
| 20 | + protected static $instance = null; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Contructor |
|
| 24 | + */ |
|
| 25 | + public function __construct() { |
|
| 26 | + add_action( 'wp', array( $this, 'load_functions' ), 24 ); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Return an instance of this class. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + * |
|
| 34 | + * @return object \lsx\search\classes\frontend\Layout() A single instance of this class. |
|
| 35 | + */ |
|
| 36 | + public static function get_instance() { |
|
| 37 | + // If the single instance hasn't been set, set it now. |
|
| 38 | + if ( null == self::$instance ) { |
|
| 39 | + self::$instance = new self(); |
|
| 40 | + } |
|
| 41 | + return self::$instance; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Check all settings. |
|
| 46 | + */ |
|
| 47 | + public function load_functions() { |
|
| 48 | + $lsx_search = LSX_Search::get_instance(); |
|
| 49 | + if ( $lsx_search->frontend->search_enabled ) { |
|
| 50 | + if ( isset( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_layout_switcher_enable' ] ) ) { |
|
| 51 | + add_filter( 'lsx_blog_customizer_show_switcher', array( $this, 'show_layout_switcher' ), 10, 1 ); |
|
| 52 | + add_filter( 'lsx_layout_switcher_options', array( $this, 'lsx_layout_switcher_options' ), 10, 1 ); |
|
| 53 | + add_filter( 'lsx_layout_switcher_page_key', array( $this, 'lsx_layout_switcher_page_key' ), 10, 1 ); |
|
| 54 | + add_filter( 'lsx_layout_switcher_options_default', array( $this, 'lsx_layout_switcher_options_default' ), 10, 1 ); |
|
| 55 | + |
|
| 56 | + // Layout Classes |
|
| 57 | + add_filter( 'woocommerce_product_loop_start', array( $this, 'woocommerce_layout_class' ), 10, 1 ); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Display the woocommerce archive swticher. |
|
| 64 | + */ |
|
| 65 | + public function show_layout_switcher( $show = false ) { |
|
| 66 | + if ( is_search() ) { |
|
| 67 | + $archive_layout_switcher = get_theme_mod( 'lsx_blog_customizer_archive_layout_switcher', false ); |
|
| 68 | + if ( true === $archive_layout_switcher ) { |
|
| 69 | + $show = true; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + return $show; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Remove the default and half-grid options from the results layouts. |
|
| 77 | + * |
|
| 78 | + * @param array $layout_options |
|
| 79 | + * @return array |
|
| 80 | + */ |
|
| 81 | + public function lsx_layout_switcher_options( $layout_options ) { |
|
| 82 | + unset( $layout_options['default'] ); |
|
| 83 | + unset( $layout_options['half-grid'] ); |
|
| 84 | + return $layout_options; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Replace the key for the layout switcher. |
|
| 89 | + * |
|
| 90 | + * @param string $page_key |
|
| 91 | + * @return string |
|
| 92 | + */ |
|
| 93 | + public function lsx_layout_switcher_page_key( $page_key ) { |
|
| 94 | + $lsx_search = LSX_Search::get_instance(); |
|
| 95 | + $page_key = str_replace( '_search', '', $lsx_search->frontend->search_prefix ); |
|
| 96 | + return $page_key; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * CHange the default layout to a grid layout. |
|
| 101 | + * |
|
| 102 | + * @param string $default |
|
| 103 | + * @return string |
|
| 104 | + */ |
|
| 105 | + public function lsx_layout_switcher_options_default( $default = 'grid' ) { |
|
| 106 | + $lsx_search = LSX_Search::get_instance(); |
|
| 107 | + $default = 'grid'; |
|
| 108 | + if ( isset( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ] ) && ! empty( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ] ) ) { |
|
| 109 | + $default = $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ]; |
|
| 110 | + } |
|
| 111 | + return $default; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Controls the layout for the woocommerce shop page. |
|
| 116 | + */ |
|
| 117 | + public function woocommerce_layout_class( $output = '' ) { |
|
| 118 | + $default_class = $this->lsx_layout_switcher_options_default(); |
|
| 119 | + $selected = $this->get_layout_value_from_cookie( 'product' ); |
|
| 120 | + if ( '' !== $selected ) { |
|
| 121 | + $default_class = $selected; |
|
| 122 | + } |
|
| 123 | + $output = str_replace( 'products', 'products ' . $default_class, $output ); |
|
| 124 | + return $output; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Get layout value from cookie |
|
| 129 | + * |
|
| 130 | + * @since 1.0.0 |
|
| 131 | + */ |
|
| 132 | + public function get_layout_value_from_cookie( $page_key = 'blog' ) { |
|
| 133 | + $archive_layout = 'grid'; |
|
| 134 | + |
|
| 135 | + if ( isset( $_COOKIE[ 'lsx-' . $page_key . '-layout' ] ) ) { |
|
| 136 | + $archive_layout_from_cookie = sanitize_key( $_COOKIE[ 'lsx-' . $page_key . '-layout' ] ); |
|
| 137 | + $archive_layout_from_cookie = $this->sanitize_select_layout_switcher( $archive_layout_from_cookie ); |
|
| 138 | + |
|
| 139 | + if ( ! empty( $archive_layout_from_cookie ) ) { |
|
| 140 | + $archive_layout = $archive_layout_from_cookie; |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + return $archive_layout; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Sanitize select (layout switcher). |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + */ |
|
| 151 | + public function sanitize_select_layout_switcher( $input ) { |
|
| 152 | + $valid = array( |
|
| 153 | + 'list' => esc_html__( 'List', 'lsx-search' ), |
|
| 154 | + 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
| 155 | + ); |
|
| 156 | + |
|
| 157 | + if ( array_key_exists( $input, $valid ) ) { |
|
| 158 | + return $input; |
|
| 159 | + } else { |
|
| 160 | + return ''; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | 163 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * Contructor |
| 24 | 24 | */ |
| 25 | 25 | public function __construct() { |
| 26 | - add_action( 'wp', array( $this, 'load_functions' ), 24 ); |
|
| 26 | + add_action('wp', array($this, 'load_functions'), 24); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public static function get_instance() { |
| 37 | 37 | // If the single instance hasn't been set, set it now. |
| 38 | - if ( null == self::$instance ) { |
|
| 38 | + if (null == self::$instance) { |
|
| 39 | 39 | self::$instance = new self(); |
| 40 | 40 | } |
| 41 | 41 | return self::$instance; |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function load_functions() { |
| 48 | 48 | $lsx_search = LSX_Search::get_instance(); |
| 49 | - if ( $lsx_search->frontend->search_enabled ) { |
|
| 50 | - if ( isset( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_layout_switcher_enable' ] ) ) { |
|
| 51 | - add_filter( 'lsx_blog_customizer_show_switcher', array( $this, 'show_layout_switcher' ), 10, 1 ); |
|
| 52 | - add_filter( 'lsx_layout_switcher_options', array( $this, 'lsx_layout_switcher_options' ), 10, 1 ); |
|
| 53 | - add_filter( 'lsx_layout_switcher_page_key', array( $this, 'lsx_layout_switcher_page_key' ), 10, 1 ); |
|
| 54 | - add_filter( 'lsx_layout_switcher_options_default', array( $this, 'lsx_layout_switcher_options_default' ), 10, 1 ); |
|
| 49 | + if ($lsx_search->frontend->search_enabled) { |
|
| 50 | + if (isset($lsx_search->frontend->options['display'][$lsx_search->frontend->search_prefix.'_layout_switcher_enable'])) { |
|
| 51 | + add_filter('lsx_blog_customizer_show_switcher', array($this, 'show_layout_switcher'), 10, 1); |
|
| 52 | + add_filter('lsx_layout_switcher_options', array($this, 'lsx_layout_switcher_options'), 10, 1); |
|
| 53 | + add_filter('lsx_layout_switcher_page_key', array($this, 'lsx_layout_switcher_page_key'), 10, 1); |
|
| 54 | + add_filter('lsx_layout_switcher_options_default', array($this, 'lsx_layout_switcher_options_default'), 10, 1); |
|
| 55 | 55 | |
| 56 | 56 | // Layout Classes |
| 57 | - add_filter( 'woocommerce_product_loop_start', array( $this, 'woocommerce_layout_class' ), 10, 1 ); |
|
| 57 | + add_filter('woocommerce_product_loop_start', array($this, 'woocommerce_layout_class'), 10, 1); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * Display the woocommerce archive swticher. |
| 64 | 64 | */ |
| 65 | - public function show_layout_switcher( $show = false ) { |
|
| 66 | - if ( is_search() ) { |
|
| 67 | - $archive_layout_switcher = get_theme_mod( 'lsx_blog_customizer_archive_layout_switcher', false ); |
|
| 68 | - if ( true === $archive_layout_switcher ) { |
|
| 65 | + public function show_layout_switcher($show = false) { |
|
| 66 | + if (is_search()) { |
|
| 67 | + $archive_layout_switcher = get_theme_mod('lsx_blog_customizer_archive_layout_switcher', false); |
|
| 68 | + if (true === $archive_layout_switcher) { |
|
| 69 | 69 | $show = true; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @param array $layout_options |
| 79 | 79 | * @return array |
| 80 | 80 | */ |
| 81 | - public function lsx_layout_switcher_options( $layout_options ) { |
|
| 82 | - unset( $layout_options['default'] ); |
|
| 83 | - unset( $layout_options['half-grid'] ); |
|
| 81 | + public function lsx_layout_switcher_options($layout_options) { |
|
| 82 | + unset($layout_options['default']); |
|
| 83 | + unset($layout_options['half-grid']); |
|
| 84 | 84 | return $layout_options; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @param string $page_key |
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | - public function lsx_layout_switcher_page_key( $page_key ) { |
|
| 93 | + public function lsx_layout_switcher_page_key($page_key) { |
|
| 94 | 94 | $lsx_search = LSX_Search::get_instance(); |
| 95 | - $page_key = str_replace( '_search', '', $lsx_search->frontend->search_prefix ); |
|
| 95 | + $page_key = str_replace('_search', '', $lsx_search->frontend->search_prefix); |
|
| 96 | 96 | return $page_key; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | * @param string $default |
| 103 | 103 | * @return string |
| 104 | 104 | */ |
| 105 | - public function lsx_layout_switcher_options_default( $default = 'grid' ) { |
|
| 105 | + public function lsx_layout_switcher_options_default($default = 'grid') { |
|
| 106 | 106 | $lsx_search = LSX_Search::get_instance(); |
| 107 | 107 | $default = 'grid'; |
| 108 | - if ( isset( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ] ) && ! empty( $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ] ) ) { |
|
| 109 | - $default = $lsx_search->frontend->options['display'][ $lsx_search->frontend->search_prefix . '_grid_list' ]; |
|
| 108 | + if (isset($lsx_search->frontend->options['display'][$lsx_search->frontend->search_prefix.'_grid_list']) && !empty($lsx_search->frontend->options['display'][$lsx_search->frontend->search_prefix.'_grid_list'])) { |
|
| 109 | + $default = $lsx_search->frontend->options['display'][$lsx_search->frontend->search_prefix.'_grid_list']; |
|
| 110 | 110 | } |
| 111 | 111 | return $default; |
| 112 | 112 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | /** |
| 115 | 115 | * Controls the layout for the woocommerce shop page. |
| 116 | 116 | */ |
| 117 | - public function woocommerce_layout_class( $output = '' ) { |
|
| 117 | + public function woocommerce_layout_class($output = '') { |
|
| 118 | 118 | $default_class = $this->lsx_layout_switcher_options_default(); |
| 119 | - $selected = $this->get_layout_value_from_cookie( 'product' ); |
|
| 120 | - if ( '' !== $selected ) { |
|
| 119 | + $selected = $this->get_layout_value_from_cookie('product'); |
|
| 120 | + if ('' !== $selected) { |
|
| 121 | 121 | $default_class = $selected; |
| 122 | 122 | } |
| 123 | - $output = str_replace( 'products', 'products ' . $default_class, $output ); |
|
| 123 | + $output = str_replace('products', 'products '.$default_class, $output); |
|
| 124 | 124 | return $output; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @since 1.0.0 |
| 131 | 131 | */ |
| 132 | - public function get_layout_value_from_cookie( $page_key = 'blog' ) { |
|
| 132 | + public function get_layout_value_from_cookie($page_key = 'blog') { |
|
| 133 | 133 | $archive_layout = 'grid'; |
| 134 | 134 | |
| 135 | - if ( isset( $_COOKIE[ 'lsx-' . $page_key . '-layout' ] ) ) { |
|
| 136 | - $archive_layout_from_cookie = sanitize_key( $_COOKIE[ 'lsx-' . $page_key . '-layout' ] ); |
|
| 137 | - $archive_layout_from_cookie = $this->sanitize_select_layout_switcher( $archive_layout_from_cookie ); |
|
| 135 | + if (isset($_COOKIE['lsx-'.$page_key.'-layout'])) { |
|
| 136 | + $archive_layout_from_cookie = sanitize_key($_COOKIE['lsx-'.$page_key.'-layout']); |
|
| 137 | + $archive_layout_from_cookie = $this->sanitize_select_layout_switcher($archive_layout_from_cookie); |
|
| 138 | 138 | |
| 139 | - if ( ! empty( $archive_layout_from_cookie ) ) { |
|
| 139 | + if (!empty($archive_layout_from_cookie)) { |
|
| 140 | 140 | $archive_layout = $archive_layout_from_cookie; |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.0.0 |
| 150 | 150 | */ |
| 151 | - public function sanitize_select_layout_switcher( $input ) { |
|
| 151 | + public function sanitize_select_layout_switcher($input) { |
|
| 152 | 152 | $valid = array( |
| 153 | - 'list' => esc_html__( 'List', 'lsx-search' ), |
|
| 154 | - 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
| 153 | + 'list' => esc_html__('List', 'lsx-search'), |
|
| 154 | + 'grid' => esc_html__('Grid', 'lsx-search'), |
|
| 155 | 155 | ); |
| 156 | 156 | |
| 157 | - if ( array_key_exists( $input, $valid ) ) { |
|
| 157 | + if (array_key_exists($input, $valid)) { |
|
| 158 | 158 | return $input; |
| 159 | 159 | } else { |
| 160 | 160 | return ''; |