Passed
Push — master ( 4321c5...7f1e4d )
by Paul
07:58 queued 04:14
created
plugin/Modules/Multilingual.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -7,68 +7,68 @@
 block discarded – undo
7 7
 
8 8
 class Multilingual implements Contract
9 9
 {
10
-    protected $integration;
11
-    protected $isEnabled = false;
10
+	protected $integration;
11
+	protected $isEnabled = false;
12 12
 
13
-    public function __construct()
14
-    {
15
-        $integration = ucfirst(glsr(OptionManager::class)->get('settings.general.multilingual'));
16
-        $integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.$integration;
17
-        if (!class_exists($integrationClass)) {
18
-            glsr_log()->error($integrationClass.' does not exist');
19
-            return;
20
-        }
21
-        $this->integration = glsr($integrationClass);
22
-        $this->isEnabled = true;
23
-    }
13
+	public function __construct()
14
+	{
15
+		$integration = ucfirst(glsr(OptionManager::class)->get('settings.general.multilingual'));
16
+		$integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.$integration;
17
+		if (!class_exists($integrationClass)) {
18
+			glsr_log()->error($integrationClass.' does not exist');
19
+			return;
20
+		}
21
+		$this->integration = glsr($integrationClass);
22
+		$this->isEnabled = true;
23
+	}
24 24
 
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    public function getPost($postId)
29
-    {
30
-        return $this->isEnabled
31
-            ? $this->integration->getPostIds($postId)
32
-            : $postId;
33
-    }
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	public function getPost($postId)
29
+	{
30
+		return $this->isEnabled
31
+			? $this->integration->getPostIds($postId)
32
+			: $postId;
33
+	}
34 34
 
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    public function getPostIds(array $postIds)
39
-    {
40
-        return $this->isEnabled
41
-            ? $this->integration->getPostIds($postIds)
42
-            : $postIds;
43
-    }
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	public function getPostIds(array $postIds)
39
+	{
40
+		return $this->isEnabled
41
+			? $this->integration->getPostIds($postIds)
42
+			: $postIds;
43
+	}
44 44
 
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function isActive()
49
-    {
50
-        return $this->isEnabled
51
-            ? $this->integration->isActive()
52
-            : false;
53
-    }
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function isActive()
49
+	{
50
+		return $this->isEnabled
51
+			? $this->integration->isActive()
52
+			: false;
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritdoc}
57
-     */
58
-    public function isEnabled()
59
-    {
60
-        return $this->isEnabled
61
-            ? $this->integration->isEnabled()
62
-            : false;
63
-    }
55
+	/**
56
+	 * {@inheritdoc}
57
+	 */
58
+	public function isEnabled()
59
+	{
60
+		return $this->isEnabled
61
+			? $this->integration->isEnabled()
62
+			: false;
63
+	}
64 64
 
65
-    /**
66
-     * {@inheritdoc}
67
-     */
68
-    public function isSupported()
69
-    {
70
-        return $this->isEnabled
71
-            ? $this->integration->isSupported()
72
-            : false;
73
-    }
65
+	/**
66
+	 * {@inheritdoc}
67
+	 */
68
+	public function isSupported()
69
+	{
70
+		return $this->isEnabled
71
+			? $this->integration->isSupported()
72
+			: false;
73
+	}
74 74
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,33 +12,33 @@
 block discarded – undo
12 12
 
13 13
     public function __construct()
14 14
     {
15
-        $integration = ucfirst(glsr(OptionManager::class)->get('settings.general.multilingual'));
15
+        $integration = ucfirst( glsr( OptionManager::class )->get( 'settings.general.multilingual' ) );
16 16
         $integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.$integration;
17
-        if (!class_exists($integrationClass)) {
18
-            glsr_log()->error($integrationClass.' does not exist');
17
+        if( !class_exists( $integrationClass ) ) {
18
+            glsr_log()->error( $integrationClass.' does not exist' );
19 19
             return;
20 20
         }
21
-        $this->integration = glsr($integrationClass);
21
+        $this->integration = glsr( $integrationClass );
22 22
         $this->isEnabled = true;
23 23
     }
24 24
 
25 25
     /**
26 26
      * {@inheritdoc}
27 27
      */
28
-    public function getPost($postId)
28
+    public function getPost( $postId )
29 29
     {
30 30
         return $this->isEnabled
31
-            ? $this->integration->getPostIds($postId)
31
+            ? $this->integration->getPostIds( $postId )
32 32
             : $postId;
33 33
     }
34 34
 
35 35
     /**
36 36
      * {@inheritdoc}
37 37
      */
38
-    public function getPostIds(array $postIds)
38
+    public function getPostIds( array $postIds )
39 39
     {
40 40
         return $this->isEnabled
41
-            ? $this->integration->getPostIds($postIds)
41
+            ? $this->integration->getPostIds( $postIds )
42 42
             : $postIds;
43 43
     }
44 44
 
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 2 patches
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -12,190 +12,190 @@
 block discarded – undo
12 12
 
13 13
 class QueryBuilder
14 14
 {
15
-    /**
16
-     * Build a WP_Query meta_query/tax_query.
17
-     * @return array
18
-     */
19
-    public function buildQuery(array $keys = [], array $values = [])
20
-    {
21
-        $queries = [];
22
-        foreach ($keys as $key) {
23
-            if (!array_key_exists($key, $values)) {
24
-                continue;
25
-            }
26
-            $methodName = Helper::buildMethodName($key, __FUNCTION__);
27
-            if (!method_exists($this, $methodName)) {
28
-                continue;
29
-            }
30
-            $query = call_user_func([$this, $methodName], $values[$key]);
31
-            if (is_array($query)) {
32
-                $queries[] = $query;
33
-            }
34
-        }
35
-        return $queries;
36
-    }
15
+	/**
16
+	 * Build a WP_Query meta_query/tax_query.
17
+	 * @return array
18
+	 */
19
+	public function buildQuery(array $keys = [], array $values = [])
20
+	{
21
+		$queries = [];
22
+		foreach ($keys as $key) {
23
+			if (!array_key_exists($key, $values)) {
24
+				continue;
25
+			}
26
+			$methodName = Helper::buildMethodName($key, __FUNCTION__);
27
+			if (!method_exists($this, $methodName)) {
28
+				continue;
29
+			}
30
+			$query = call_user_func([$this, $methodName], $values[$key]);
31
+			if (is_array($query)) {
32
+				$queries[] = $query;
33
+			}
34
+		}
35
+		return $queries;
36
+	}
37 37
 
38
-    /**
39
-     * @return string
40
-     */
41
-    public function buildSqlLines(array $values, array $conditions)
42
-    {
43
-        $string = '';
44
-        $values = array_filter($values);
45
-        foreach ($conditions as $key => $value) {
46
-            if (!isset($values[$key])) {
47
-                continue;
48
-            }
49
-            $values[$key] = implode(',', (array) $values[$key]);
50
-            $string.= Str::contains($value, '%s')
51
-                ? sprintf($value, strval($values[$key]))
52
-                : $value;
53
-        }
54
-        return $string;
55
-    }
38
+	/**
39
+	 * @return string
40
+	 */
41
+	public function buildSqlLines(array $values, array $conditions)
42
+	{
43
+		$string = '';
44
+		$values = array_filter($values);
45
+		foreach ($conditions as $key => $value) {
46
+			if (!isset($values[$key])) {
47
+				continue;
48
+			}
49
+			$values[$key] = implode(',', (array) $values[$key]);
50
+			$string.= Str::contains($value, '%s')
51
+				? sprintf($value, strval($values[$key]))
52
+				: $value;
53
+		}
54
+		return $string;
55
+	}
56 56
 
57
-    /**
58
-     * Build a SQL 'OR' string from an array.
59
-     * @param string|array $values
60
-     * @param string $sprintfFormat
61
-     * @return string
62
-     */
63
-    public function buildSqlOr($values, $sprintfFormat)
64
-    {
65
-        if (!is_array($values)) {
66
-            $values = explode(',', $values);
67
-        }
68
-        $values = array_filter(array_map('trim', (array) $values));
69
-        $values = array_map(function ($value) use ($sprintfFormat) {
70
-            return sprintf($sprintfFormat, $value);
71
-        }, $values);
72
-        return implode(' OR ', $values);
73
-    }
57
+	/**
58
+	 * Build a SQL 'OR' string from an array.
59
+	 * @param string|array $values
60
+	 * @param string $sprintfFormat
61
+	 * @return string
62
+	 */
63
+	public function buildSqlOr($values, $sprintfFormat)
64
+	{
65
+		if (!is_array($values)) {
66
+			$values = explode(',', $values);
67
+		}
68
+		$values = array_filter(array_map('trim', (array) $values));
69
+		$values = array_map(function ($value) use ($sprintfFormat) {
70
+			return sprintf($sprintfFormat, $value);
71
+		}, $values);
72
+		return implode(' OR ', $values);
73
+	}
74 74
 
75
-    /**
76
-     * Search SQL filter for matching against post title only.
77
-     * @see http://wordpress.stackexchange.com/a/11826/1685
78
-     * @param string $search
79
-     * @return string
80
-     * @filter posts_search
81
-     */
82
-    public function filterSearchByTitle($search, WP_Query $query)
83
-    {
84
-        if (empty($search) || empty($query->get('search_terms'))) {
85
-            return $search;
86
-        }
87
-        global $wpdb;
88
-        $n = empty($query->get('exact'))
89
-            ? '%'
90
-            : '';
91
-        $search = [];
92
-        foreach ((array) $query->get('search_terms') as $term) {
93
-            $search[] = $wpdb->prepare("{$wpdb->posts}.post_title LIKE %s", $n.$wpdb->esc_like($term).$n);
94
-        }
95
-        if (!is_user_logged_in()) {
96
-            $search[] = "{$wpdb->posts}.post_password = ''";
97
-        }
98
-        return ' AND '.implode(' AND ', $search);
99
-    }
75
+	/**
76
+	 * Search SQL filter for matching against post title only.
77
+	 * @see http://wordpress.stackexchange.com/a/11826/1685
78
+	 * @param string $search
79
+	 * @return string
80
+	 * @filter posts_search
81
+	 */
82
+	public function filterSearchByTitle($search, WP_Query $query)
83
+	{
84
+		if (empty($search) || empty($query->get('search_terms'))) {
85
+			return $search;
86
+		}
87
+		global $wpdb;
88
+		$n = empty($query->get('exact'))
89
+			? '%'
90
+			: '';
91
+		$search = [];
92
+		foreach ((array) $query->get('search_terms') as $term) {
93
+			$search[] = $wpdb->prepare("{$wpdb->posts}.post_title LIKE %s", $n.$wpdb->esc_like($term).$n);
94
+		}
95
+		if (!is_user_logged_in()) {
96
+			$search[] = "{$wpdb->posts}.post_password = ''";
97
+		}
98
+		return ' AND '.implode(' AND ', $search);
99
+	}
100 100
 
101
-    /**
102
-     * Get the current page number from the global query.
103
-     * @param bool $isEnabled
104
-     * @return int
105
-     */
106
-    public function getPaged($isEnabled = true)
107
-    {
108
-        return $isEnabled
109
-            ? max(1, intval(filter_input(INPUT_GET, glsr()->constant('PAGED_QUERY_VAR'))))
110
-            : 1;
111
-    }
101
+	/**
102
+	 * Get the current page number from the global query.
103
+	 * @param bool $isEnabled
104
+	 * @return int
105
+	 */
106
+	public function getPaged($isEnabled = true)
107
+	{
108
+		return $isEnabled
109
+			? max(1, intval(filter_input(INPUT_GET, glsr()->constant('PAGED_QUERY_VAR'))))
110
+			: 1;
111
+	}
112 112
 
113
-    /**
114
-     * @param string $value
115
-     * @return void|array
116
-     */
117
-    protected function buildQueryAssignedTo($value)
118
-    {
119
-        if (!empty($value)) {
120
-            $postIds = Arr::convertStringToArray($value, 'is_numeric');
121
-            return [
122
-                'compare' => 'IN',
123
-                'key' => '_assigned_to',
124
-                'value' => glsr(Multilingual::class)->getPostIds($postIds),
125
-            ];
126
-        }
127
-    }
113
+	/**
114
+	 * @param string $value
115
+	 * @return void|array
116
+	 */
117
+	protected function buildQueryAssignedTo($value)
118
+	{
119
+		if (!empty($value)) {
120
+			$postIds = Arr::convertStringToArray($value, 'is_numeric');
121
+			return [
122
+				'compare' => 'IN',
123
+				'key' => '_assigned_to',
124
+				'value' => glsr(Multilingual::class)->getPostIds($postIds),
125
+			];
126
+		}
127
+	}
128 128
 
129
-    /**
130
-     * @param array $value
131
-     * @return void|array
132
-     */
133
-    protected function buildQueryCategory($value)
134
-    {
135
-        if (!empty($value)) {
136
-            return [
137
-                'field' => 'term_id',
138
-                'taxonomy' => Application::TAXONOMY,
139
-                'terms' => $value,
140
-            ];
141
-        }
142
-    }
129
+	/**
130
+	 * @param array $value
131
+	 * @return void|array
132
+	 */
133
+	protected function buildQueryCategory($value)
134
+	{
135
+		if (!empty($value)) {
136
+			return [
137
+				'field' => 'term_id',
138
+				'taxonomy' => Application::TAXONOMY,
139
+				'terms' => $value,
140
+			];
141
+		}
142
+	}
143 143
 
144
-    /**
145
-     * @param string $value
146
-     * @return void|array
147
-     */
148
-    protected function buildQueryEmail($value)
149
-    {
150
-        if (!empty($value)) {
151
-            return [
152
-                'key' => '_email',
153
-                'value' => $value,
154
-            ];
155
-        }
156
-    }
144
+	/**
145
+	 * @param string $value
146
+	 * @return void|array
147
+	 */
148
+	protected function buildQueryEmail($value)
149
+	{
150
+		if (!empty($value)) {
151
+			return [
152
+				'key' => '_email',
153
+				'value' => $value,
154
+			];
155
+		}
156
+	}
157 157
 
158
-    /**
159
-     * @param string $value
160
-     * @return void|array
161
-     */
162
-    protected function buildQueryIpAddress($value)
163
-    {
164
-        if (!empty($value)) {
165
-            return [
166
-                'key' => '_ip_address',
167
-                'value' => $value,
168
-            ];
169
-        }
170
-    }
158
+	/**
159
+	 * @param string $value
160
+	 * @return void|array
161
+	 */
162
+	protected function buildQueryIpAddress($value)
163
+	{
164
+		if (!empty($value)) {
165
+			return [
166
+				'key' => '_ip_address',
167
+				'value' => $value,
168
+			];
169
+		}
170
+	}
171 171
 
172
-    /**
173
-     * @param string $value
174
-     * @return void|array
175
-     */
176
-    protected function buildQueryRating($value)
177
-    {
178
-        if (is_numeric($value)
179
-            && in_array(intval($value), range(1, glsr()->constant('MAX_RATING', Rating::class)))) {
180
-            return [
181
-                'compare' => '>=',
182
-                'key' => '_rating',
183
-                'value' => $value,
184
-            ];
185
-        }
186
-    }
172
+	/**
173
+	 * @param string $value
174
+	 * @return void|array
175
+	 */
176
+	protected function buildQueryRating($value)
177
+	{
178
+		if (is_numeric($value)
179
+			&& in_array(intval($value), range(1, glsr()->constant('MAX_RATING', Rating::class)))) {
180
+			return [
181
+				'compare' => '>=',
182
+				'key' => '_rating',
183
+				'value' => $value,
184
+			];
185
+		}
186
+	}
187 187
 
188
-    /**
189
-     * @param string $value
190
-     * @return void|array
191
-     */
192
-    protected function buildQueryType($value)
193
-    {
194
-        if (!in_array($value, ['', 'all'])) {
195
-            return [
196
-                'key' => '_review_type',
197
-                'value' => $value,
198
-            ];
199
-        }
200
-    }
188
+	/**
189
+	 * @param string $value
190
+	 * @return void|array
191
+	 */
192
+	protected function buildQueryType($value)
193
+	{
194
+		if (!in_array($value, ['', 'all'])) {
195
+			return [
196
+				'key' => '_review_type',
197
+				'value' => $value,
198
+			];
199
+		}
200
+	}
201 201
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
      * Build a WP_Query meta_query/tax_query.
17 17
      * @return array
18 18
      */
19
-    public function buildQuery(array $keys = [], array $values = [])
19
+    public function buildQuery( array $keys = [], array $values = [] )
20 20
     {
21 21
         $queries = [];
22
-        foreach ($keys as $key) {
23
-            if (!array_key_exists($key, $values)) {
22
+        foreach( $keys as $key ) {
23
+            if( !array_key_exists( $key, $values ) ) {
24 24
                 continue;
25 25
             }
26
-            $methodName = Helper::buildMethodName($key, __FUNCTION__);
27
-            if (!method_exists($this, $methodName)) {
26
+            $methodName = Helper::buildMethodName( $key, __FUNCTION__ );
27
+            if( !method_exists( $this, $methodName ) ) {
28 28
                 continue;
29 29
             }
30
-            $query = call_user_func([$this, $methodName], $values[$key]);
31
-            if (is_array($query)) {
30
+            $query = call_user_func( [$this, $methodName], $values[$key] );
31
+            if( is_array( $query ) ) {
32 32
                 $queries[] = $query;
33 33
             }
34 34
         }
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
     /**
39 39
      * @return string
40 40
      */
41
-    public function buildSqlLines(array $values, array $conditions)
41
+    public function buildSqlLines( array $values, array $conditions )
42 42
     {
43 43
         $string = '';
44
-        $values = array_filter($values);
45
-        foreach ($conditions as $key => $value) {
46
-            if (!isset($values[$key])) {
44
+        $values = array_filter( $values );
45
+        foreach( $conditions as $key => $value ) {
46
+            if( !isset($values[$key]) ) {
47 47
                 continue;
48 48
             }
49
-            $values[$key] = implode(',', (array) $values[$key]);
50
-            $string.= Str::contains($value, '%s')
51
-                ? sprintf($value, strval($values[$key]))
49
+            $values[$key] = implode( ',', (array)$values[$key] );
50
+            $string .= Str::contains( $value, '%s' )
51
+                ? sprintf( $value, strval( $values[$key] ) )
52 52
                 : $value;
53 53
         }
54 54
         return $string;
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
      * @param string $sprintfFormat
61 61
      * @return string
62 62
      */
63
-    public function buildSqlOr($values, $sprintfFormat)
63
+    public function buildSqlOr( $values, $sprintfFormat )
64 64
     {
65
-        if (!is_array($values)) {
66
-            $values = explode(',', $values);
65
+        if( !is_array( $values ) ) {
66
+            $values = explode( ',', $values );
67 67
         }
68
-        $values = array_filter(array_map('trim', (array) $values));
69
-        $values = array_map(function ($value) use ($sprintfFormat) {
70
-            return sprintf($sprintfFormat, $value);
71
-        }, $values);
72
-        return implode(' OR ', $values);
68
+        $values = array_filter( array_map( 'trim', (array)$values ) );
69
+        $values = array_map( function( $value ) use ($sprintfFormat) {
70
+            return sprintf( $sprintfFormat, $value );
71
+        }, $values );
72
+        return implode( ' OR ', $values );
73 73
     }
74 74
 
75 75
     /**
@@ -79,23 +79,23 @@  discard block
 block discarded – undo
79 79
      * @return string
80 80
      * @filter posts_search
81 81
      */
82
-    public function filterSearchByTitle($search, WP_Query $query)
82
+    public function filterSearchByTitle( $search, WP_Query $query )
83 83
     {
84
-        if (empty($search) || empty($query->get('search_terms'))) {
84
+        if( empty($search) || empty($query->get( 'search_terms' )) ) {
85 85
             return $search;
86 86
         }
87 87
         global $wpdb;
88
-        $n = empty($query->get('exact'))
88
+        $n = empty($query->get( 'exact' ))
89 89
             ? '%'
90 90
             : '';
91 91
         $search = [];
92
-        foreach ((array) $query->get('search_terms') as $term) {
93
-            $search[] = $wpdb->prepare("{$wpdb->posts}.post_title LIKE %s", $n.$wpdb->esc_like($term).$n);
92
+        foreach( (array)$query->get( 'search_terms' ) as $term ) {
93
+            $search[] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $n.$wpdb->esc_like( $term ).$n );
94 94
         }
95
-        if (!is_user_logged_in()) {
95
+        if( !is_user_logged_in() ) {
96 96
             $search[] = "{$wpdb->posts}.post_password = ''";
97 97
         }
98
-        return ' AND '.implode(' AND ', $search);
98
+        return ' AND '.implode( ' AND ', $search );
99 99
     }
100 100
 
101 101
     /**
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
      * @param bool $isEnabled
104 104
      * @return int
105 105
      */
106
-    public function getPaged($isEnabled = true)
106
+    public function getPaged( $isEnabled = true )
107 107
     {
108 108
         return $isEnabled
109
-            ? max(1, intval(filter_input(INPUT_GET, glsr()->constant('PAGED_QUERY_VAR'))))
109
+            ? max( 1, intval( filter_input( INPUT_GET, glsr()->constant( 'PAGED_QUERY_VAR' ) ) ) )
110 110
             : 1;
111 111
     }
112 112
 
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
      * @param string $value
115 115
      * @return void|array
116 116
      */
117
-    protected function buildQueryAssignedTo($value)
117
+    protected function buildQueryAssignedTo( $value )
118 118
     {
119
-        if (!empty($value)) {
120
-            $postIds = Arr::convertStringToArray($value, 'is_numeric');
119
+        if( !empty($value) ) {
120
+            $postIds = Arr::convertStringToArray( $value, 'is_numeric' );
121 121
             return [
122 122
                 'compare' => 'IN',
123 123
                 'key' => '_assigned_to',
124
-                'value' => glsr(Multilingual::class)->getPostIds($postIds),
124
+                'value' => glsr( Multilingual::class )->getPostIds( $postIds ),
125 125
             ];
126 126
         }
127 127
     }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
      * @param array $value
131 131
      * @return void|array
132 132
      */
133
-    protected function buildQueryCategory($value)
133
+    protected function buildQueryCategory( $value )
134 134
     {
135
-        if (!empty($value)) {
135
+        if( !empty($value) ) {
136 136
             return [
137 137
                 'field' => 'term_id',
138 138
                 'taxonomy' => Application::TAXONOMY,
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
      * @param string $value
146 146
      * @return void|array
147 147
      */
148
-    protected function buildQueryEmail($value)
148
+    protected function buildQueryEmail( $value )
149 149
     {
150
-        if (!empty($value)) {
150
+        if( !empty($value) ) {
151 151
             return [
152 152
                 'key' => '_email',
153 153
                 'value' => $value,
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
      * @param string $value
160 160
      * @return void|array
161 161
      */
162
-    protected function buildQueryIpAddress($value)
162
+    protected function buildQueryIpAddress( $value )
163 163
     {
164
-        if (!empty($value)) {
164
+        if( !empty($value) ) {
165 165
             return [
166 166
                 'key' => '_ip_address',
167 167
                 'value' => $value,
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
      * @param string $value
174 174
      * @return void|array
175 175
      */
176
-    protected function buildQueryRating($value)
176
+    protected function buildQueryRating( $value )
177 177
     {
178
-        if (is_numeric($value)
179
-            && in_array(intval($value), range(1, glsr()->constant('MAX_RATING', Rating::class)))) {
178
+        if( is_numeric( $value )
179
+            && in_array( intval( $value ), range( 1, glsr()->constant( 'MAX_RATING', Rating::class ) ) ) ) {
180 180
             return [
181 181
                 'compare' => '>=',
182 182
                 'key' => '_rating',
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
      * @param string $value
190 190
      * @return void|array
191 191
      */
192
-    protected function buildQueryType($value)
192
+    protected function buildQueryType( $value )
193 193
     {
194
-        if (!in_array($value, ['', 'all'])) {
194
+        if( !in_array( $value, ['', 'all'] ) ) {
195 195
             return [
196 196
                 'key' => '_review_type',
197 197
                 'value' => $value,
Please login to merge, or discard this patch.
plugin/Modules/Multilingual/Wpml.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -7,87 +7,87 @@
 block discarded – undo
7 7
 
8 8
 class Wpml implements Contract
9 9
 {
10
-    const PLUGIN_NAME = 'WPML';
11
-    const SUPPORTED_VERSION = '3.3.5';
10
+	const PLUGIN_NAME = 'WPML';
11
+	const SUPPORTED_VERSION = '3.3.5';
12 12
 
13
-    /**
14
-     * {@inheritdoc}
15
-     */
16
-    public function getPost($postId)
17
-    {
18
-        apply_filters('console', $postId);
19
-        $postId = trim($postId);
20
-        if (!is_numeric($postId)) {
21
-            return;
22
-        }
23
-        if ($this->isEnabled()) {
24
-            apply_filters('console', $postId);
25
-            $postId = apply_filters('wpml_object_id', $postId, 'any', true);
26
-            apply_filters('console', $postId);
27
-        }
28
-        return get_post(intval($postId));
29
-    }
13
+	/**
14
+	 * {@inheritdoc}
15
+	 */
16
+	public function getPost($postId)
17
+	{
18
+		apply_filters('console', $postId);
19
+		$postId = trim($postId);
20
+		if (!is_numeric($postId)) {
21
+			return;
22
+		}
23
+		if ($this->isEnabled()) {
24
+			apply_filters('console', $postId);
25
+			$postId = apply_filters('wpml_object_id', $postId, 'any', true);
26
+			apply_filters('console', $postId);
27
+		}
28
+		return get_post(intval($postId));
29
+	}
30 30
 
31
-    /**
32
-     * {@inheritdoc}
33
-     */
34
-    public function getPostIds(array $postIds)
35
-    {
36
-        apply_filters('console', $postIds);
37
-        if (!$this->isEnabled()) {
38
-            return $postIds;
39
-        }
40
-        $newPostIds = [];
41
-        foreach ($this->cleanIds($postIds) as $postId) {
42
-            $postType = get_post_type($postId);
43
-            if (!$postType) {
44
-                continue;
45
-            }
46
-            $elementType = 'post_'.$postType;
47
-            $trid = apply_filters('wpml_element_trid', null, $postId, $elementType);
48
-            $translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType);
49
-            if (!is_array($translations)) {
50
-                $translations = [];
51
-            }
52
-            $newPostIds = array_merge(
53
-                $newPostIds,
54
-                array_column($translations, 'element_id')
55
-            );
56
-        }
57
-        return $this->cleanIds($newPostIds);
58
-    }
31
+	/**
32
+	 * {@inheritdoc}
33
+	 */
34
+	public function getPostIds(array $postIds)
35
+	{
36
+		apply_filters('console', $postIds);
37
+		if (!$this->isEnabled()) {
38
+			return $postIds;
39
+		}
40
+		$newPostIds = [];
41
+		foreach ($this->cleanIds($postIds) as $postId) {
42
+			$postType = get_post_type($postId);
43
+			if (!$postType) {
44
+				continue;
45
+			}
46
+			$elementType = 'post_'.$postType;
47
+			$trid = apply_filters('wpml_element_trid', null, $postId, $elementType);
48
+			$translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType);
49
+			if (!is_array($translations)) {
50
+				$translations = [];
51
+			}
52
+			$newPostIds = array_merge(
53
+				$newPostIds,
54
+				array_column($translations, 'element_id')
55
+			);
56
+		}
57
+		return $this->cleanIds($newPostIds);
58
+	}
59 59
 
60
-    /**
61
-     * {@inheritdoc}
62
-     */
63
-    public function isActive()
64
-    {
65
-        return defined('ICL_SITEPRESS_VERSION');
66
-    }
60
+	/**
61
+	 * {@inheritdoc}
62
+	 */
63
+	public function isActive()
64
+	{
65
+		return defined('ICL_SITEPRESS_VERSION');
66
+	}
67 67
 
68
-    /**
69
-     * {@inheritdoc}
70
-     */
71
-    public function isEnabled()
72
-    {
73
-        return $this->isActive()
74
-            && 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual');
75
-    }
68
+	/**
69
+	 * {@inheritdoc}
70
+	 */
71
+	public function isEnabled()
72
+	{
73
+		return $this->isActive()
74
+			&& 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual');
75
+	}
76 76
 
77
-    /**
78
-     * {@inheritdoc}
79
-     */
80
-    public function isSupported()
81
-    {
82
-        return $this->isActive()
83
-            && version_compare(ICL_SITEPRESS_VERSION, self::SUPPORTED_VERSION, '>=');
84
-    }
77
+	/**
78
+	 * {@inheritdoc}
79
+	 */
80
+	public function isSupported()
81
+	{
82
+		return $this->isActive()
83
+			&& version_compare(ICL_SITEPRESS_VERSION, self::SUPPORTED_VERSION, '>=');
84
+	}
85 85
 
86
-    /**
87
-     * @return array
88
-     */
89
-    protected function cleanIds(array $postIds)
90
-    {
91
-        return array_filter(array_unique($postIds));
92
-    }
86
+	/**
87
+	 * @return array
88
+	 */
89
+	protected function cleanIds(array $postIds)
90
+	{
91
+		return array_filter(array_unique($postIds));
92
+	}
93 93
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,48 +13,48 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * {@inheritdoc}
15 15
      */
16
-    public function getPost($postId)
16
+    public function getPost( $postId )
17 17
     {
18
-        apply_filters('console', $postId);
19
-        $postId = trim($postId);
20
-        if (!is_numeric($postId)) {
18
+        apply_filters( 'console', $postId );
19
+        $postId = trim( $postId );
20
+        if( !is_numeric( $postId ) ) {
21 21
             return;
22 22
         }
23
-        if ($this->isEnabled()) {
24
-            apply_filters('console', $postId);
25
-            $postId = apply_filters('wpml_object_id', $postId, 'any', true);
26
-            apply_filters('console', $postId);
23
+        if( $this->isEnabled() ) {
24
+            apply_filters( 'console', $postId );
25
+            $postId = apply_filters( 'wpml_object_id', $postId, 'any', true );
26
+            apply_filters( 'console', $postId );
27 27
         }
28
-        return get_post(intval($postId));
28
+        return get_post( intval( $postId ) );
29 29
     }
30 30
 
31 31
     /**
32 32
      * {@inheritdoc}
33 33
      */
34
-    public function getPostIds(array $postIds)
34
+    public function getPostIds( array $postIds )
35 35
     {
36
-        apply_filters('console', $postIds);
37
-        if (!$this->isEnabled()) {
36
+        apply_filters( 'console', $postIds );
37
+        if( !$this->isEnabled() ) {
38 38
             return $postIds;
39 39
         }
40 40
         $newPostIds = [];
41
-        foreach ($this->cleanIds($postIds) as $postId) {
42
-            $postType = get_post_type($postId);
43
-            if (!$postType) {
41
+        foreach( $this->cleanIds( $postIds ) as $postId ) {
42
+            $postType = get_post_type( $postId );
43
+            if( !$postType ) {
44 44
                 continue;
45 45
             }
46 46
             $elementType = 'post_'.$postType;
47
-            $trid = apply_filters('wpml_element_trid', null, $postId, $elementType);
48
-            $translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType);
49
-            if (!is_array($translations)) {
47
+            $trid = apply_filters( 'wpml_element_trid', null, $postId, $elementType );
48
+            $translations = apply_filters( 'wpml_get_element_translations', null, $trid, $elementType );
49
+            if( !is_array( $translations ) ) {
50 50
                 $translations = [];
51 51
             }
52 52
             $newPostIds = array_merge(
53 53
                 $newPostIds,
54
-                array_column($translations, 'element_id')
54
+                array_column( $translations, 'element_id' )
55 55
             );
56 56
         }
57
-        return $this->cleanIds($newPostIds);
57
+        return $this->cleanIds( $newPostIds );
58 58
     }
59 59
 
60 60
     /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function isActive()
64 64
     {
65
-        return defined('ICL_SITEPRESS_VERSION');
65
+        return defined( 'ICL_SITEPRESS_VERSION' );
66 66
     }
67 67
 
68 68
     /**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public function isEnabled()
72 72
     {
73 73
         return $this->isActive()
74
-            && 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual');
74
+            && 'wpml' == glsr( OptionManager::class )->get( 'settings.general.multilingual' );
75 75
     }
76 76
 
77 77
     /**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
     public function isSupported()
81 81
     {
82 82
         return $this->isActive()
83
-            && version_compare(ICL_SITEPRESS_VERSION, self::SUPPORTED_VERSION, '>=');
83
+            && version_compare( ICL_SITEPRESS_VERSION, self::SUPPORTED_VERSION, '>=' );
84 84
     }
85 85
 
86 86
     /**
87 87
      * @return array
88 88
      */
89
-    protected function cleanIds(array $postIds)
89
+    protected function cleanIds( array $postIds )
90 90
     {
91
-        return array_filter(array_unique($postIds));
91
+        return array_filter( array_unique( $postIds ) );
92 92
     }
93 93
 }
Please login to merge, or discard this patch.
plugin/Modules/Multilingual/Polylang.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,79 +7,79 @@
 block discarded – undo
7 7
 
8 8
 class Polylang implements Contract
9 9
 {
10
-    const PLUGIN_NAME = 'Polylang';
11
-    const SUPPORTED_VERSION = '2.3';
10
+	const PLUGIN_NAME = 'Polylang';
11
+	const SUPPORTED_VERSION = '2.3';
12 12
 
13
-    /**
14
-     * {@inheritdoc}
15
-     */
16
-    public function getPost($postId)
17
-    {
18
-        $postId = trim($postId);
19
-        if (!is_numeric($postId)) {
20
-            return;
21
-        }
22
-        if ($this->isEnabled()) {
23
-            $polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID()));
24
-        }
25
-        if (!empty($polylangPostId)) {
26
-            $postId = $polylangPostId;
27
-        }
28
-        return get_post(intval($postId));
29
-    }
13
+	/**
14
+	 * {@inheritdoc}
15
+	 */
16
+	public function getPost($postId)
17
+	{
18
+		$postId = trim($postId);
19
+		if (!is_numeric($postId)) {
20
+			return;
21
+		}
22
+		if ($this->isEnabled()) {
23
+			$polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID()));
24
+		}
25
+		if (!empty($polylangPostId)) {
26
+			$postId = $polylangPostId;
27
+		}
28
+		return get_post(intval($postId));
29
+	}
30 30
 
31
-    /**
32
-     * {@inheritdoc}
33
-     */
34
-    public function getPostIds(array $postIds)
35
-    {
36
-        if (!$this->isEnabled()) {
37
-            return $postIds;
38
-        }
39
-        $newPostIds = [];
40
-        foreach ($this->cleanIds($postIds) as $postId) {
41
-            $newPostIds = array_merge(
42
-                $newPostIds,
43
-                array_values(pll_get_post_translations($postId))
44
-            );
45
-        }
46
-        return $this->cleanIds($newPostIds);
47
-    }
31
+	/**
32
+	 * {@inheritdoc}
33
+	 */
34
+	public function getPostIds(array $postIds)
35
+	{
36
+		if (!$this->isEnabled()) {
37
+			return $postIds;
38
+		}
39
+		$newPostIds = [];
40
+		foreach ($this->cleanIds($postIds) as $postId) {
41
+			$newPostIds = array_merge(
42
+				$newPostIds,
43
+				array_values(pll_get_post_translations($postId))
44
+			);
45
+		}
46
+		return $this->cleanIds($newPostIds);
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritdoc}
51
-     */
52
-    public function isActive()
53
-    {
54
-        return function_exists('PLL')
55
-            && function_exists('pll_get_post')
56
-            && function_exists('pll_get_post_language')
57
-            && function_exists('pll_get_post_translations');
58
-    }
49
+	/**
50
+	 * {@inheritdoc}
51
+	 */
52
+	public function isActive()
53
+	{
54
+		return function_exists('PLL')
55
+			&& function_exists('pll_get_post')
56
+			&& function_exists('pll_get_post_language')
57
+			&& function_exists('pll_get_post_translations');
58
+	}
59 59
 
60
-    /**
61
-     * {@inheritdoc}
62
-     */
63
-    public function isEnabled()
64
-    {
65
-        return $this->isActive()
66
-            && 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual');
67
-    }
60
+	/**
61
+	 * {@inheritdoc}
62
+	 */
63
+	public function isEnabled()
64
+	{
65
+		return $this->isActive()
66
+			&& 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual');
67
+	}
68 68
 
69
-    /**
70
-     * {@inheritdoc}
71
-     */
72
-    public function isSupported()
73
-    {
74
-        return defined('POLYLANG_VERSION')
75
-            && version_compare(POLYLANG_VERSION, self::SUPPORTED_VERSION, '>=');
76
-    }
69
+	/**
70
+	 * {@inheritdoc}
71
+	 */
72
+	public function isSupported()
73
+	{
74
+		return defined('POLYLANG_VERSION')
75
+			&& version_compare(POLYLANG_VERSION, self::SUPPORTED_VERSION, '>=');
76
+	}
77 77
 
78
-    /**
79
-     * @return array
80
-     */
81
-    protected function cleanIds(array $postIds)
82
-    {
83
-        return array_filter(array_unique($postIds));
84
-    }
78
+	/**
79
+	 * @return array
80
+	 */
81
+	protected function cleanIds(array $postIds)
82
+	{
83
+		return array_filter(array_unique($postIds));
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,37 +13,37 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * {@inheritdoc}
15 15
      */
16
-    public function getPost($postId)
16
+    public function getPost( $postId )
17 17
     {
18
-        $postId = trim($postId);
19
-        if (!is_numeric($postId)) {
18
+        $postId = trim( $postId );
19
+        if( !is_numeric( $postId ) ) {
20 20
             return;
21 21
         }
22
-        if ($this->isEnabled()) {
23
-            $polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID()));
22
+        if( $this->isEnabled() ) {
23
+            $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() ) );
24 24
         }
25
-        if (!empty($polylangPostId)) {
25
+        if( !empty($polylangPostId) ) {
26 26
             $postId = $polylangPostId;
27 27
         }
28
-        return get_post(intval($postId));
28
+        return get_post( intval( $postId ) );
29 29
     }
30 30
 
31 31
     /**
32 32
      * {@inheritdoc}
33 33
      */
34
-    public function getPostIds(array $postIds)
34
+    public function getPostIds( array $postIds )
35 35
     {
36
-        if (!$this->isEnabled()) {
36
+        if( !$this->isEnabled() ) {
37 37
             return $postIds;
38 38
         }
39 39
         $newPostIds = [];
40
-        foreach ($this->cleanIds($postIds) as $postId) {
40
+        foreach( $this->cleanIds( $postIds ) as $postId ) {
41 41
             $newPostIds = array_merge(
42 42
                 $newPostIds,
43
-                array_values(pll_get_post_translations($postId))
43
+                array_values( pll_get_post_translations( $postId ) )
44 44
             );
45 45
         }
46
-        return $this->cleanIds($newPostIds);
46
+        return $this->cleanIds( $newPostIds );
47 47
     }
48 48
 
49 49
     /**
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function isActive()
53 53
     {
54
-        return function_exists('PLL')
55
-            && function_exists('pll_get_post')
56
-            && function_exists('pll_get_post_language')
57
-            && function_exists('pll_get_post_translations');
54
+        return function_exists( 'PLL' )
55
+            && function_exists( 'pll_get_post' )
56
+            && function_exists( 'pll_get_post_language' )
57
+            && function_exists( 'pll_get_post_translations' );
58 58
     }
59 59
 
60 60
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function isEnabled()
64 64
     {
65 65
         return $this->isActive()
66
-            && 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual');
66
+            && 'polylang' == glsr( OptionManager::class )->get( 'settings.general.multilingual' );
67 67
     }
68 68
 
69 69
     /**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function isSupported()
73 73
     {
74
-        return defined('POLYLANG_VERSION')
75
-            && version_compare(POLYLANG_VERSION, self::SUPPORTED_VERSION, '>=');
74
+        return defined( 'POLYLANG_VERSION' )
75
+            && version_compare( POLYLANG_VERSION, self::SUPPORTED_VERSION, '>=' );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @return array
80 80
      */
81
-    protected function cleanIds(array $postIds)
81
+    protected function cleanIds( array $postIds )
82 82
     {
83
-        return array_filter(array_unique($postIds));
83
+        return array_filter( array_unique( $postIds ) );
84 84
     }
85 85
 }
Please login to merge, or discard this patch.