Passed
Push — dependabot/github_actions/styf... ( 532cde )
by
unknown
09:49
created
lsx-search.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@
 block discarded – undo
12 12
  */
13 13
 
14 14
 // If this file is called directly, abort.
15
-if ( ! defined( 'WPINC' ) ) {
15
+if (!defined('WPINC')) {
16 16
 	die;
17 17
 }
18 18
 
19
-define( 'LSX_SEARCH_PATH', plugin_dir_path( __FILE__ ) );
20
-define( 'LSX_SEARCH_CORE', __FILE__ );
21
-define( 'LSX_SEARCH_URL', plugin_dir_url( __FILE__ ) );
22
-define( 'LSX_SEARCH_VER', '1.5.2' );
19
+define('LSX_SEARCH_PATH', plugin_dir_path(__FILE__));
20
+define('LSX_SEARCH_CORE', __FILE__);
21
+define('LSX_SEARCH_URL', plugin_dir_url(__FILE__));
22
+define('LSX_SEARCH_VER', '1.5.2');
23 23
 
24 24
 /* ======================= Below is the Plugin Class init ========================= */
25 25
 
26
-require_once LSX_SEARCH_PATH . '/includes/template-tags.php';
27
-require_once LSX_SEARCH_PATH . '/includes/functions.php';
28
-require_once LSX_SEARCH_PATH . '/classes/class-lsx-search.php';
26
+require_once LSX_SEARCH_PATH.'/includes/template-tags.php';
27
+require_once LSX_SEARCH_PATH.'/includes/functions.php';
28
+require_once LSX_SEARCH_PATH.'/classes/class-lsx-search.php';
Please login to merge, or discard this patch.
classes/frontend/class-layout.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 '';
Please login to merge, or discard this patch.