Passed
Branch master (ca90e6)
by Paul
07:04
created
plugin/Controllers/ListTableController/Columns.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -10,184 +10,184 @@
 block discarded – undo
10 10
 
11 11
 class Columns
12 12
 {
13
-    /**
14
-     * @param int $postId
15
-     * @return void|string
16
-     */
17
-    public function buildColumnAssignedTo($postId)
18
-    {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
-            return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
-                'href' => (string) get_the_permalink($assignedPost->ID),
23
-            ]);
24
-        }
25
-    }
13
+	/**
14
+	 * @param int $postId
15
+	 * @return void|string
16
+	 */
17
+	public function buildColumnAssignedTo($postId)
18
+	{
19
+		$assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
+		if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
+			return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
+				'href' => (string) get_the_permalink($assignedPost->ID),
23
+			]);
24
+		}
25
+	}
26 26
 
27
-    /**
28
-     * @param int $postId
29
-     * @return void|string
30
-     */
31
-    public function buildColumnEmail($postId)
32
-    {
33
-        if ($email = glsr(Database::class)->get($postId, 'email')) {
34
-            return $email;
35
-        }
36
-    }
27
+	/**
28
+	 * @param int $postId
29
+	 * @return void|string
30
+	 */
31
+	public function buildColumnEmail($postId)
32
+	{
33
+		if ($email = glsr(Database::class)->get($postId, 'email')) {
34
+			return $email;
35
+		}
36
+	}
37 37
 
38
-    /**
39
-     * @param int $postId
40
-     * @return void|string
41
-     */
42
-    public function buildColumnIpAddress($postId)
43
-    {
44
-        if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
45
-            return $ipAddress;
46
-        }
47
-    }
38
+	/**
39
+	 * @param int $postId
40
+	 * @return void|string
41
+	 */
42
+	public function buildColumnIpAddress($postId)
43
+	{
44
+		if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
45
+			return $ipAddress;
46
+		}
47
+	}
48 48
 
49
-    /**
50
-     * @param int $postId
51
-     * @return string
52
-     */
53
-    public function buildColumnPinned($postId)
54
-    {
55
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
56
-            ? 'pinned '
57
-            : '';
58
-        if (glsr()->can('edit_others_posts')) {
59
-            $pinned.= 'pin-review ';
60
-        }
61
-        return glsr(Builder::class)->i([
62
-            'class' => $pinned.'dashicons dashicons-sticky',
63
-            'data-id' => $postId,
64
-        ]);
65
-    }
49
+	/**
50
+	 * @param int $postId
51
+	 * @return string
52
+	 */
53
+	public function buildColumnPinned($postId)
54
+	{
55
+		$pinned = glsr(Database::class)->get($postId, 'pinned')
56
+			? 'pinned '
57
+			: '';
58
+		if (glsr()->can('edit_others_posts')) {
59
+			$pinned.= 'pin-review ';
60
+		}
61
+		return glsr(Builder::class)->i([
62
+			'class' => $pinned.'dashicons dashicons-sticky',
63
+			'data-id' => $postId,
64
+		]);
65
+	}
66 66
 
67
-    /**
68
-     * @param int $postId
69
-     * @return string
70
-     */
71
-    public function buildColumnResponse($postId)
72
-    {
73
-        return glsr(Database::class)->get($postId, 'response')
74
-            ? __('Yes', 'site-reviews')
75
-            : __('No', 'site-reviews');
76
-    }
67
+	/**
68
+	 * @param int $postId
69
+	 * @return string
70
+	 */
71
+	public function buildColumnResponse($postId)
72
+	{
73
+		return glsr(Database::class)->get($postId, 'response')
74
+			? __('Yes', 'site-reviews')
75
+			: __('No', 'site-reviews');
76
+	}
77 77
 
78
-    /**
79
-     * @param int $postId
80
-     * @return string
81
-     */
82
-    public function buildColumnReviewer($postId)
83
-    {
84
-        $author = strval(glsr(Database::class)->get($postId, 'author'));
85
-        $userId = Helper::castToInt(get_post($postId)->post_author);
86
-        return !empty($userId)
87
-            ? glsr(Builder::class)->a($author, ['href' => get_author_posts_url($userId)])
88
-            : $author;
89
-    }
78
+	/**
79
+	 * @param int $postId
80
+	 * @return string
81
+	 */
82
+	public function buildColumnReviewer($postId)
83
+	{
84
+		$author = strval(glsr(Database::class)->get($postId, 'author'));
85
+		$userId = Helper::castToInt(get_post($postId)->post_author);
86
+		return !empty($userId)
87
+			? glsr(Builder::class)->a($author, ['href' => get_author_posts_url($userId)])
88
+			: $author;
89
+	}
90 90
 
91
-    /**
92
-     * @param int $postId
93
-     * @param int|null $rating
94
-     * @return string
95
-     */
96
-    public function buildColumnRating($postId)
97
-    {
98
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
99
-    }
91
+	/**
92
+	 * @param int $postId
93
+	 * @param int|null $rating
94
+	 * @return string
95
+	 */
96
+	public function buildColumnRating($postId)
97
+	{
98
+		return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
99
+	}
100 100
 
101
-    /**
102
-     * @param int $postId
103
-     * @return string
104
-     */
105
-    public function buildColumnReviewType($postId)
106
-    {
107
-        $type = glsr(Database::class)->get($postId, 'review_type');
108
-        return array_key_exists($type, glsr()->reviewTypes)
109
-            ? glsr()->reviewTypes[$type]
110
-            : __('Unsupported Type', 'site-reviews');
111
-    }
101
+	/**
102
+	 * @param int $postId
103
+	 * @return string
104
+	 */
105
+	public function buildColumnReviewType($postId)
106
+	{
107
+		$type = glsr(Database::class)->get($postId, 'review_type');
108
+		return array_key_exists($type, glsr()->reviewTypes)
109
+			? glsr()->reviewTypes[$type]
110
+			: __('Unsupported Type', 'site-reviews');
111
+	}
112 112
 
113
-    /**
114
-     * @param string $postType
115
-     * @return void
116
-     */
117
-    public function renderFilters($postType)
118
-    {
119
-        if (Application::POST_TYPE !== $postType) {
120
-            return;
121
-        }
122
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
123
-            $status = 'publish';
124
-        }
125
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
126
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
127
-        $this->renderFilterRatings($ratings);
128
-        $this->renderFilterTypes($types);
129
-    }
113
+	/**
114
+	 * @param string $postType
115
+	 * @return void
116
+	 */
117
+	public function renderFilters($postType)
118
+	{
119
+		if (Application::POST_TYPE !== $postType) {
120
+			return;
121
+		}
122
+		if (!($status = filter_input(INPUT_GET, 'post_status'))) {
123
+			$status = 'publish';
124
+		}
125
+		$ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
126
+		$types = glsr(Database::class)->getReviewsMeta('review_type', $status);
127
+		$this->renderFilterRatings($ratings);
128
+		$this->renderFilterTypes($types);
129
+	}
130 130
 
131
-    /**
132
-     * @param string $column
133
-     * @param int $postId
134
-     * @return void
135
-     */
136
-    public function renderValues($column, $postId)
137
-    {
138
-        $method = Helper::buildMethodName($column, 'buildColumn');
139
-        $value = method_exists($this, $method)
140
-            ? call_user_func([$this, $method], $postId)
141
-            : '';
142
-        $value = apply_filters('site-reviews/columns/'.$column, $value, $postId);
143
-        if (0 !== $value && empty($value)) {
144
-            $value = '—';
145
-        }
146
-        echo $value;
147
-    }
131
+	/**
132
+	 * @param string $column
133
+	 * @param int $postId
134
+	 * @return void
135
+	 */
136
+	public function renderValues($column, $postId)
137
+	{
138
+		$method = Helper::buildMethodName($column, 'buildColumn');
139
+		$value = method_exists($this, $method)
140
+			? call_user_func([$this, $method], $postId)
141
+			: '';
142
+		$value = apply_filters('site-reviews/columns/'.$column, $value, $postId);
143
+		if (0 !== $value && empty($value)) {
144
+			$value = '—';
145
+		}
146
+		echo $value;
147
+	}
148 148
 
149
-    /**
150
-     * @param array $ratings
151
-     * @return void
152
-     */
153
-    protected function renderFilterRatings($ratings)
154
-    {
155
-        if (empty($ratings)) {
156
-            return;
157
-        }
158
-        $ratings = array_flip(array_reverse($ratings));
159
-        array_walk($ratings, function (&$value, $key) {
160
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
161
-            $value = sprintf($label, $key);
162
-        });
163
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
164
-            'class' => 'screen-reader-text',
165
-            'for' => 'rating',
166
-        ]);
167
-        echo glsr(Builder::class)->select([
168
-            'name' => 'rating',
169
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
170
-            'value' => filter_input(INPUT_GET, 'rating'),
171
-        ]);
172
-    }
149
+	/**
150
+	 * @param array $ratings
151
+	 * @return void
152
+	 */
153
+	protected function renderFilterRatings($ratings)
154
+	{
155
+		if (empty($ratings)) {
156
+			return;
157
+		}
158
+		$ratings = array_flip(array_reverse($ratings));
159
+		array_walk($ratings, function (&$value, $key) {
160
+			$label = _n('%s star', '%s stars', $key, 'site-reviews');
161
+			$value = sprintf($label, $key);
162
+		});
163
+		echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
164
+			'class' => 'screen-reader-text',
165
+			'for' => 'rating',
166
+		]);
167
+		echo glsr(Builder::class)->select([
168
+			'name' => 'rating',
169
+			'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
170
+			'value' => filter_input(INPUT_GET, 'rating'),
171
+		]);
172
+	}
173 173
 
174
-    /**
175
-     * @param array $types
176
-     * @return void
177
-     */
178
-    protected function renderFilterTypes($types)
179
-    {
180
-        if (count(glsr()->reviewTypes) < 2) {
181
-            return;
182
-        }
183
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
184
-            'class' => 'screen-reader-text',
185
-            'for' => 'review_type',
186
-        ]);
187
-        echo glsr(Builder::class)->select([
188
-            'name' => 'review_type',
189
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
190
-            'value' => filter_input(INPUT_GET, 'review_type'),
191
-        ]);
192
-    }
174
+	/**
175
+	 * @param array $types
176
+	 * @return void
177
+	 */
178
+	protected function renderFilterTypes($types)
179
+	{
180
+		if (count(glsr()->reviewTypes) < 2) {
181
+			return;
182
+		}
183
+		echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
184
+			'class' => 'screen-reader-text',
185
+			'for' => 'review_type',
186
+		]);
187
+		echo glsr(Builder::class)->select([
188
+			'name' => 'review_type',
189
+			'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
190
+			'value' => filter_input(INPUT_GET, 'review_type'),
191
+		]);
192
+	}
193 193
 }
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
      * @param int $postId
15 15
      * @return void|string
16 16
      */
17
-    public function buildColumnAssignedTo($postId)
17
+    public function buildColumnAssignedTo( $postId )
18 18
     {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
-            return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
-                'href' => (string) get_the_permalink($assignedPost->ID),
23
-            ]);
19
+        $assignedPost = glsr( Database::class )->getAssignedToPost( $postId );
20
+        if( $assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status ) {
21
+            return glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
22
+                'href' => (string)get_the_permalink( $assignedPost->ID ),
23
+            ] );
24 24
         }
25 25
     }
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
      * @param int $postId
29 29
      * @return void|string
30 30
      */
31
-    public function buildColumnEmail($postId)
31
+    public function buildColumnEmail( $postId )
32 32
     {
33
-        if ($email = glsr(Database::class)->get($postId, 'email')) {
33
+        if( $email = glsr( Database::class )->get( $postId, 'email' ) ) {
34 34
             return $email;
35 35
         }
36 36
     }
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
      * @param int $postId
40 40
      * @return void|string
41 41
      */
42
-    public function buildColumnIpAddress($postId)
42
+    public function buildColumnIpAddress( $postId )
43 43
     {
44
-        if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
44
+        if( $ipAddress = glsr( Database::class )->get( $postId, 'ip_address' ) ) {
45 45
             return $ipAddress;
46 46
         }
47 47
     }
@@ -50,41 +50,41 @@  discard block
 block discarded – undo
50 50
      * @param int $postId
51 51
      * @return string
52 52
      */
53
-    public function buildColumnPinned($postId)
53
+    public function buildColumnPinned( $postId )
54 54
     {
55
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
55
+        $pinned = glsr( Database::class )->get( $postId, 'pinned' )
56 56
             ? 'pinned '
57 57
             : '';
58
-        if (glsr()->can('edit_others_posts')) {
59
-            $pinned.= 'pin-review ';
58
+        if( glsr()->can( 'edit_others_posts' ) ) {
59
+            $pinned .= 'pin-review ';
60 60
         }
61
-        return glsr(Builder::class)->i([
61
+        return glsr( Builder::class )->i( [
62 62
             'class' => $pinned.'dashicons dashicons-sticky',
63 63
             'data-id' => $postId,
64
-        ]);
64
+        ] );
65 65
     }
66 66
 
67 67
     /**
68 68
      * @param int $postId
69 69
      * @return string
70 70
      */
71
-    public function buildColumnResponse($postId)
71
+    public function buildColumnResponse( $postId )
72 72
     {
73
-        return glsr(Database::class)->get($postId, 'response')
74
-            ? __('Yes', 'site-reviews')
75
-            : __('No', 'site-reviews');
73
+        return glsr( Database::class )->get( $postId, 'response' )
74
+            ? __( 'Yes', 'site-reviews' )
75
+            : __( 'No', 'site-reviews' );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @param int $postId
80 80
      * @return string
81 81
      */
82
-    public function buildColumnReviewer($postId)
82
+    public function buildColumnReviewer( $postId )
83 83
     {
84
-        $author = strval(glsr(Database::class)->get($postId, 'author'));
85
-        $userId = Helper::castToInt(get_post($postId)->post_author);
84
+        $author = strval( glsr( Database::class )->get( $postId, 'author' ) );
85
+        $userId = Helper::castToInt( get_post( $postId )->post_author );
86 86
         return !empty($userId)
87
-            ? glsr(Builder::class)->a($author, ['href' => get_author_posts_url($userId)])
87
+            ? glsr( Builder::class )->a( $author, ['href' => get_author_posts_url( $userId )] )
88 88
             : $author;
89 89
     }
90 90
 
@@ -93,39 +93,39 @@  discard block
 block discarded – undo
93 93
      * @param int|null $rating
94 94
      * @return string
95 95
      */
96
-    public function buildColumnRating($postId)
96
+    public function buildColumnRating( $postId )
97 97
     {
98
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
98
+        return glsr_star_rating( intval( glsr( Database::class )->get( $postId, 'rating' ) ) );
99 99
     }
100 100
 
101 101
     /**
102 102
      * @param int $postId
103 103
      * @return string
104 104
      */
105
-    public function buildColumnReviewType($postId)
105
+    public function buildColumnReviewType( $postId )
106 106
     {
107
-        $type = glsr(Database::class)->get($postId, 'review_type');
108
-        return array_key_exists($type, glsr()->reviewTypes)
107
+        $type = glsr( Database::class )->get( $postId, 'review_type' );
108
+        return array_key_exists( $type, glsr()->reviewTypes )
109 109
             ? glsr()->reviewTypes[$type]
110
-            : __('Unsupported Type', 'site-reviews');
110
+            : __( 'Unsupported Type', 'site-reviews' );
111 111
     }
112 112
 
113 113
     /**
114 114
      * @param string $postType
115 115
      * @return void
116 116
      */
117
-    public function renderFilters($postType)
117
+    public function renderFilters( $postType )
118 118
     {
119
-        if (Application::POST_TYPE !== $postType) {
119
+        if( Application::POST_TYPE !== $postType ) {
120 120
             return;
121 121
         }
122
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
122
+        if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
123 123
             $status = 'publish';
124 124
         }
125
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
126
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
127
-        $this->renderFilterRatings($ratings);
128
-        $this->renderFilterTypes($types);
125
+        $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
126
+        $types = glsr( Database::class )->getReviewsMeta( 'review_type', $status );
127
+        $this->renderFilterRatings( $ratings );
128
+        $this->renderFilterTypes( $types );
129 129
     }
130 130
 
131 131
     /**
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
      * @param int $postId
134 134
      * @return void
135 135
      */
136
-    public function renderValues($column, $postId)
136
+    public function renderValues( $column, $postId )
137 137
     {
138
-        $method = Helper::buildMethodName($column, 'buildColumn');
139
-        $value = method_exists($this, $method)
140
-            ? call_user_func([$this, $method], $postId)
138
+        $method = Helper::buildMethodName( $column, 'buildColumn' );
139
+        $value = method_exists( $this, $method )
140
+            ? call_user_func( [$this, $method], $postId )
141 141
             : '';
142
-        $value = apply_filters('site-reviews/columns/'.$column, $value, $postId);
143
-        if (0 !== $value && empty($value)) {
142
+        $value = apply_filters( 'site-reviews/columns/'.$column, $value, $postId );
143
+        if( 0 !== $value && empty($value) ) {
144 144
             $value = '&mdash;';
145 145
         }
146 146
         echo $value;
@@ -150,44 +150,44 @@  discard block
 block discarded – undo
150 150
      * @param array $ratings
151 151
      * @return void
152 152
      */
153
-    protected function renderFilterRatings($ratings)
153
+    protected function renderFilterRatings( $ratings )
154 154
     {
155
-        if (empty($ratings)) {
155
+        if( empty($ratings) ) {
156 156
             return;
157 157
         }
158
-        $ratings = array_flip(array_reverse($ratings));
159
-        array_walk($ratings, function (&$value, $key) {
160
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
161
-            $value = sprintf($label, $key);
158
+        $ratings = array_flip( array_reverse( $ratings ) );
159
+        array_walk( $ratings, function( &$value, $key ) {
160
+            $label = _n( '%s star', '%s stars', $key, 'site-reviews' );
161
+            $value = sprintf( $label, $key );
162 162
         });
163
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
163
+        echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
164 164
             'class' => 'screen-reader-text',
165 165
             'for' => 'rating',
166
-        ]);
167
-        echo glsr(Builder::class)->select([
166
+        ] );
167
+        echo glsr( Builder::class )->select( [
168 168
             'name' => 'rating',
169
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
170
-            'value' => filter_input(INPUT_GET, 'rating'),
171
-        ]);
169
+            'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
170
+            'value' => filter_input( INPUT_GET, 'rating' ),
171
+        ] );
172 172
     }
173 173
 
174 174
     /**
175 175
      * @param array $types
176 176
      * @return void
177 177
      */
178
-    protected function renderFilterTypes($types)
178
+    protected function renderFilterTypes( $types )
179 179
     {
180
-        if (count(glsr()->reviewTypes) < 2) {
180
+        if( count( glsr()->reviewTypes ) < 2 ) {
181 181
             return;
182 182
         }
183
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
183
+        echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
184 184
             'class' => 'screen-reader-text',
185 185
             'for' => 'review_type',
186
-        ]);
187
-        echo glsr(Builder::class)->select([
186
+        ] );
187
+        echo glsr( Builder::class )->select( [
188 188
             'name' => 'review_type',
189
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
190
-            'value' => filter_input(INPUT_GET, 'review_type'),
191
-        ]);
189
+            'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
190
+            'value' => filter_input( INPUT_GET, 'review_type' ),
191
+        ] );
192 192
     }
193 193
 }
Please login to merge, or discard this patch.
plugin/Database/SqlQueries.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -8,47 +8,47 @@  discard block
 block discarded – undo
8 8
 
9 9
 class SqlQueries
10 10
 {
11
-    protected $db;
12
-    protected $postType;
11
+	protected $db;
12
+	protected $postType;
13 13
 
14
-    public function __construct()
15
-    {
16
-        global $wpdb;
17
-        $this->db = $wpdb;
18
-        $this->postType = Application::POST_TYPE;
19
-    }
14
+	public function __construct()
15
+	{
16
+		global $wpdb;
17
+		$this->db = $wpdb;
18
+		$this->postType = Application::POST_TYPE;
19
+	}
20 20
 
21
-    /**
22
-     * @return bool
23
-     */
24
-    public function deletePostCountMetaKeys()
25
-    {
26
-        return $this->db->query("
21
+	/**
22
+	 * @return bool
23
+	 */
24
+	public function deletePostCountMetaKeys()
25
+	{
26
+		return $this->db->query("
27 27
             DELETE
28 28
             FROM {$this->db->postmeta}
29 29
             WHERE meta_key LIKE '_glsr_%'
30 30
         ");
31
-    }
31
+	}
32 32
 
33
-    /**
34
-     * @return bool
35
-     */
36
-    public function deleteTermCountMetaKeys()
37
-    {
38
-        return $this->db->query("
33
+	/**
34
+	 * @return bool
35
+	 */
36
+	public function deleteTermCountMetaKeys()
37
+	{
38
+		return $this->db->query("
39 39
             DELETE
40 40
             FROM {$this->db->termmeta}
41 41
             WHERE meta_key LIKE '_glsr_%'
42 42
         ");
43
-    }
43
+	}
44 44
 
45
-    /**
46
-     * @param string $metaReviewId
47
-     * @return int
48
-     */
49
-    public function getPostIdFromReviewId($metaReviewId)
50
-    {
51
-        $postId = $this->db->get_var("
45
+	/**
46
+	 * @param string $metaReviewId
47
+	 * @return int
48
+	 */
49
+	public function getPostIdFromReviewId($metaReviewId)
50
+	{
51
+		$postId = $this->db->get_var("
52 52
             SELECT p.ID
53 53
             FROM {$this->db->posts} AS p
54 54
             INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
             AND m.meta_key = '_review_id'
57 57
             AND m.meta_value = '{$metaReviewId}'
58 58
         ");
59
-        return intval($postId);
60
-    }
59
+		return intval($postId);
60
+	}
61 61
 
62
-    /**
63
-     * @param int $lastPostId
64
-     * @param int $limit
65
-     * @return array
66
-     */
67
-    public function getReviewCounts(array $args, $lastPostId = 0, $limit = 500)
68
-    {
69
-        return (array) $this->db->get_results("
62
+	/**
63
+	 * @param int $lastPostId
64
+	 * @param int $limit
65
+	 * @return array
66
+	 */
67
+	public function getReviewCounts(array $args, $lastPostId = 0, $limit = 500)
68
+	{
69
+		return (array) $this->db->get_results("
70 70
             SELECT DISTINCT p.ID, m1.meta_value AS rating, m2.meta_value AS type
71 71
             FROM {$this->db->posts} AS p
72 72
             INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
             ORDER By p.ID ASC
82 82
             LIMIT {$limit}
83 83
         ");
84
-    }
84
+	}
85 85
 
86
-    /**
87
-     * @todo remove this?
88
-     * @param string $metaKey
89
-     * @return array
90
-     */
91
-    public function getReviewCountsFor($metaKey)
92
-    {
93
-        $metaKey = Str::prefix('_', $metaKey);
94
-        return (array) $this->db->get_results("
86
+	/**
87
+	 * @todo remove this?
88
+	 * @param string $metaKey
89
+	 * @return array
90
+	 */
91
+	public function getReviewCountsFor($metaKey)
92
+	{
93
+		$metaKey = Str::prefix('_', $metaKey);
94
+		return (array) $this->db->get_results("
95 95
             SELECT DISTINCT m.meta_value AS name, COUNT(*) num_posts
96 96
             FROM {$this->db->posts} AS p
97 97
             INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
             AND m.meta_key = '{$metaKey}'
100 100
             GROUP BY name
101 101
         ");
102
-    }
102
+	}
103 103
 
104
-    /**
105
-     * @todo remove this?
106
-     * @param string $reviewType
107
-     * @return array
108
-     */
109
-    public function getReviewIdsByType($reviewType)
110
-    {
111
-        $results = $this->db->get_col("
104
+	/**
105
+	 * @todo remove this?
106
+	 * @param string $reviewType
107
+	 * @return array
108
+	 */
109
+	public function getReviewIdsByType($reviewType)
110
+	{
111
+		$results = $this->db->get_col("
112 112
             SELECT DISTINCT m1.meta_value AS review_id
113 113
             FROM {$this->db->posts} AS p
114 114
             INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
             AND m2.meta_key = '_review_type'
119 119
             AND m2.meta_value = '{$reviewType}'
120 120
         ");
121
-        return array_keys(array_flip($results));
122
-    }
121
+		return array_keys(array_flip($results));
122
+	}
123 123
 
124
-    /**
125
-     * @param int $greaterThanId
126
-     * @param int $limit
127
-     * @return array
128
-     */
129
-    public function getReviewRatingsFromIds(array $postIds, $greaterThanId = 0, $limit = 100)
130
-    {
131
-        sort($postIds);
132
-        $postIds = array_slice($postIds, intval(array_search($greaterThanId, $postIds)), $limit);
133
-        $postIds = implode(',', $postIds);
134
-        return (array) $this->db->get_results("
124
+	/**
125
+	 * @param int $greaterThanId
126
+	 * @param int $limit
127
+	 * @return array
128
+	 */
129
+	public function getReviewRatingsFromIds(array $postIds, $greaterThanId = 0, $limit = 100)
130
+	{
131
+		sort($postIds);
132
+		$postIds = array_slice($postIds, intval(array_search($greaterThanId, $postIds)), $limit);
133
+		$postIds = implode(',', $postIds);
134
+		return (array) $this->db->get_results("
135 135
             SELECT p.ID, m.meta_value AS rating
136 136
             FROM {$this->db->posts} AS p
137 137
             INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
             ORDER By p.ID ASC
145 145
             LIMIT {$limit}
146 146
         ");
147
-    }
147
+	}
148 148
 
149
-    /**
150
-     * @param string $key
151
-     * @param string $status
152
-     * @return array
153
-     */
154
-    public function getReviewsMeta($key, $status = 'publish')
155
-    {
156
-        $postStatusQuery = 'all' != $status && !empty($status)
157
-            ? "AND p.post_status = '{$status}'"
158
-            : '';
159
-        $key = Str::prefix('_', $key);
160
-        $values = $this->db->get_col("
149
+	/**
150
+	 * @param string $key
151
+	 * @param string $status
152
+	 * @return array
153
+	 */
154
+	public function getReviewsMeta($key, $status = 'publish')
155
+	{
156
+		$postStatusQuery = 'all' != $status && !empty($status)
157
+			? "AND p.post_status = '{$status}'"
158
+			: '';
159
+		$key = Str::prefix('_', $key);
160
+		$values = $this->db->get_col("
161 161
             SELECT DISTINCT m.meta_value
162 162
             FROM {$this->db->postmeta} m
163 163
             LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id
@@ -168,42 +168,42 @@  discard block
 block discarded – undo
168 168
             GROUP BY p.ID -- remove duplicate meta_value entries
169 169
             ORDER BY m.meta_id ASC -- sort by oldest meta_value
170 170
         ");
171
-        sort($values);
172
-        return $values;
173
-    }
171
+		sort($values);
172
+		return $values;
173
+	}
174 174
 
175
-    /**
176
-     * @param string $and
177
-     * @return string
178
-     */
179
-    protected function getAndForCounts(array $args, $and = '')
180
-    {
181
-        $postIds = implode(',', array_filter(Arr::get($args, 'post_ids', [])));
182
-        $termIds = implode(',', array_filter(Arr::get($args, 'term_ids', [])));
183
-        if (!empty($args['type'])) {
184
-            $and.= "AND m2.meta_value = '{$args['type']}' ";
185
-        }
186
-        if ($postIds) {
187
-            $and.= "AND m3.meta_key = '_assigned_to' AND m3.meta_value IN ({$postIds}) ";
188
-        }
189
-        if ($termIds) {
190
-            $and.= "AND tr.term_taxonomy_id IN ({$termIds}) ";
191
-        }
192
-        return apply_filters('site-reviews/query/and-for-counts', $and);
193
-    }
175
+	/**
176
+	 * @param string $and
177
+	 * @return string
178
+	 */
179
+	protected function getAndForCounts(array $args, $and = '')
180
+	{
181
+		$postIds = implode(',', array_filter(Arr::get($args, 'post_ids', [])));
182
+		$termIds = implode(',', array_filter(Arr::get($args, 'term_ids', [])));
183
+		if (!empty($args['type'])) {
184
+			$and.= "AND m2.meta_value = '{$args['type']}' ";
185
+		}
186
+		if ($postIds) {
187
+			$and.= "AND m3.meta_key = '_assigned_to' AND m3.meta_value IN ({$postIds}) ";
188
+		}
189
+		if ($termIds) {
190
+			$and.= "AND tr.term_taxonomy_id IN ({$termIds}) ";
191
+		}
192
+		return apply_filters('site-reviews/query/and-for-counts', $and);
193
+	}
194 194
 
195
-    /**
196
-     * @param string $innerJoin
197
-     * @return string
198
-     */
199
-    protected function getInnerJoinForCounts(array $args, $innerJoin = '')
200
-    {
201
-        if (!empty(Arr::get($args, 'post_ids'))) {
202
-            $innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
203
-        }
204
-        if (!empty(Arr::get($args, 'term_ids'))) {
205
-            $innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
206
-        }
207
-        return apply_filters('site-reviews/query/inner-join-for-counts', $innerJoin);
208
-    }
195
+	/**
196
+	 * @param string $innerJoin
197
+	 * @return string
198
+	 */
199
+	protected function getInnerJoinForCounts(array $args, $innerJoin = '')
200
+	{
201
+		if (!empty(Arr::get($args, 'post_ids'))) {
202
+			$innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
203
+		}
204
+		if (!empty(Arr::get($args, 'term_ids'))) {
205
+			$innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
206
+		}
207
+		return apply_filters('site-reviews/query/inner-join-for-counts', $innerJoin);
208
+	}
209 209
 }
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function deletePostCountMetaKeys()
25 25
     {
26
-        return $this->db->query("
26
+        return $this->db->query( "
27 27
             DELETE
28 28
             FROM {$this->db->postmeta}
29 29
             WHERE meta_key LIKE '_glsr_%'
30
-        ");
30
+        " );
31 31
     }
32 32
 
33 33
     /**
@@ -35,28 +35,28 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function deleteTermCountMetaKeys()
37 37
     {
38
-        return $this->db->query("
38
+        return $this->db->query( "
39 39
             DELETE
40 40
             FROM {$this->db->termmeta}
41 41
             WHERE meta_key LIKE '_glsr_%'
42
-        ");
42
+        " );
43 43
     }
44 44
 
45 45
     /**
46 46
      * @param string $metaReviewId
47 47
      * @return int
48 48
      */
49
-    public function getPostIdFromReviewId($metaReviewId)
49
+    public function getPostIdFromReviewId( $metaReviewId )
50 50
     {
51
-        $postId = $this->db->get_var("
51
+        $postId = $this->db->get_var( "
52 52
             SELECT p.ID
53 53
             FROM {$this->db->posts} AS p
54 54
             INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
55 55
             WHERE p.post_type = '{$this->postType}'
56 56
             AND m.meta_key = '_review_id'
57 57
             AND m.meta_value = '{$metaReviewId}'
58
-        ");
59
-        return intval($postId);
58
+        " );
59
+        return intval( $postId );
60 60
     }
61 61
 
62 62
     /**
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
      * @param int $limit
65 65
      * @return array
66 66
      */
67
-    public function getReviewCounts(array $args, $lastPostId = 0, $limit = 500)
67
+    public function getReviewCounts( array $args, $lastPostId = 0, $limit = 500 )
68 68
     {
69
-        return (array) $this->db->get_results("
69
+        return (array)$this->db->get_results( "
70 70
             SELECT DISTINCT p.ID, m1.meta_value AS rating, m2.meta_value AS type
71 71
             FROM {$this->db->posts} AS p
72 72
             INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
73 73
             INNER JOIN {$this->db->postmeta} AS m2 ON p.ID = m2.post_id
74
-            {$this->getInnerJoinForCounts($args)}
74
+            {$this->getInnerJoinForCounts( $args )}
75 75
             WHERE p.ID > {$lastPostId}
76 76
             AND p.post_status = 'publish'
77 77
             AND p.post_type = '{$this->postType}'
78 78
             AND m1.meta_key = '_rating'
79 79
             AND m2.meta_key = '_review_type'
80
-            {$this->getAndForCounts($args)}
80
+            {$this->getAndForCounts( $args )}
81 81
             ORDER By p.ID ASC
82 82
             LIMIT {$limit}
83
-        ");
83
+        " );
84 84
     }
85 85
 
86 86
     /**
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      * @param string $metaKey
89 89
      * @return array
90 90
      */
91
-    public function getReviewCountsFor($metaKey)
91
+    public function getReviewCountsFor( $metaKey )
92 92
     {
93
-        $metaKey = Str::prefix('_', $metaKey);
94
-        return (array) $this->db->get_results("
93
+        $metaKey = Str::prefix( '_', $metaKey );
94
+        return (array)$this->db->get_results( "
95 95
             SELECT DISTINCT m.meta_value AS name, COUNT(*) num_posts
96 96
             FROM {$this->db->posts} AS p
97 97
             INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
98 98
             WHERE p.post_type = '{$this->postType}'
99 99
             AND m.meta_key = '{$metaKey}'
100 100
             GROUP BY name
101
-        ");
101
+        " );
102 102
     }
103 103
 
104 104
     /**
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
      * @param string $reviewType
107 107
      * @return array
108 108
      */
109
-    public function getReviewIdsByType($reviewType)
109
+    public function getReviewIdsByType( $reviewType )
110 110
     {
111
-        $results = $this->db->get_col("
111
+        $results = $this->db->get_col( "
112 112
             SELECT DISTINCT m1.meta_value AS review_id
113 113
             FROM {$this->db->posts} AS p
114 114
             INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
             AND m1.meta_key = '_review_id'
118 118
             AND m2.meta_key = '_review_type'
119 119
             AND m2.meta_value = '{$reviewType}'
120
-        ");
121
-        return array_keys(array_flip($results));
120
+        " );
121
+        return array_keys( array_flip( $results ) );
122 122
     }
123 123
 
124 124
     /**
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
      * @param int $limit
127 127
      * @return array
128 128
      */
129
-    public function getReviewRatingsFromIds(array $postIds, $greaterThanId = 0, $limit = 100)
129
+    public function getReviewRatingsFromIds( array $postIds, $greaterThanId = 0, $limit = 100 )
130 130
     {
131
-        sort($postIds);
132
-        $postIds = array_slice($postIds, intval(array_search($greaterThanId, $postIds)), $limit);
133
-        $postIds = implode(',', $postIds);
134
-        return (array) $this->db->get_results("
131
+        sort( $postIds );
132
+        $postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds ) ), $limit );
133
+        $postIds = implode( ',', $postIds );
134
+        return (array)$this->db->get_results( "
135 135
             SELECT p.ID, m.meta_value AS rating
136 136
             FROM {$this->db->posts} AS p
137 137
             INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             GROUP BY p.ID
144 144
             ORDER By p.ID ASC
145 145
             LIMIT {$limit}
146
-        ");
146
+        " );
147 147
     }
148 148
 
149 149
     /**
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
      * @param string $status
152 152
      * @return array
153 153
      */
154
-    public function getReviewsMeta($key, $status = 'publish')
154
+    public function getReviewsMeta( $key, $status = 'publish' )
155 155
     {
156 156
         $postStatusQuery = 'all' != $status && !empty($status)
157 157
             ? "AND p.post_status = '{$status}'"
158 158
             : '';
159
-        $key = Str::prefix('_', $key);
160
-        $values = $this->db->get_col("
159
+        $key = Str::prefix( '_', $key );
160
+        $values = $this->db->get_col( "
161 161
             SELECT DISTINCT m.meta_value
162 162
             FROM {$this->db->postmeta} m
163 163
             LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
             $postStatusQuery
168 168
             GROUP BY p.ID -- remove duplicate meta_value entries
169 169
             ORDER BY m.meta_id ASC -- sort by oldest meta_value
170
-        ");
171
-        sort($values);
170
+        " );
171
+        sort( $values );
172 172
         return $values;
173 173
     }
174 174
 
@@ -176,34 +176,34 @@  discard block
 block discarded – undo
176 176
      * @param string $and
177 177
      * @return string
178 178
      */
179
-    protected function getAndForCounts(array $args, $and = '')
179
+    protected function getAndForCounts( array $args, $and = '' )
180 180
     {
181
-        $postIds = implode(',', array_filter(Arr::get($args, 'post_ids', [])));
182
-        $termIds = implode(',', array_filter(Arr::get($args, 'term_ids', [])));
183
-        if (!empty($args['type'])) {
184
-            $and.= "AND m2.meta_value = '{$args['type']}' ";
181
+        $postIds = implode( ',', array_filter( Arr::get( $args, 'post_ids', [] ) ) );
182
+        $termIds = implode( ',', array_filter( Arr::get( $args, 'term_ids', [] ) ) );
183
+        if( !empty($args['type']) ) {
184
+            $and .= "AND m2.meta_value = '{$args['type']}' ";
185 185
         }
186
-        if ($postIds) {
187
-            $and.= "AND m3.meta_key = '_assigned_to' AND m3.meta_value IN ({$postIds}) ";
186
+        if( $postIds ) {
187
+            $and .= "AND m3.meta_key = '_assigned_to' AND m3.meta_value IN ({$postIds}) ";
188 188
         }
189
-        if ($termIds) {
190
-            $and.= "AND tr.term_taxonomy_id IN ({$termIds}) ";
189
+        if( $termIds ) {
190
+            $and .= "AND tr.term_taxonomy_id IN ({$termIds}) ";
191 191
         }
192
-        return apply_filters('site-reviews/query/and-for-counts', $and);
192
+        return apply_filters( 'site-reviews/query/and-for-counts', $and );
193 193
     }
194 194
 
195 195
     /**
196 196
      * @param string $innerJoin
197 197
      * @return string
198 198
      */
199
-    protected function getInnerJoinForCounts(array $args, $innerJoin = '')
199
+    protected function getInnerJoinForCounts( array $args, $innerJoin = '' )
200 200
     {
201
-        if (!empty(Arr::get($args, 'post_ids'))) {
202
-            $innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
201
+        if( !empty(Arr::get( $args, 'post_ids' )) ) {
202
+            $innerJoin .= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
203 203
         }
204
-        if (!empty(Arr::get($args, 'term_ids'))) {
205
-            $innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
204
+        if( !empty(Arr::get( $args, 'term_ids' )) ) {
205
+            $innerJoin .= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
206 206
         }
207
-        return apply_filters('site-reviews/query/inner-join-for-counts', $innerJoin);
207
+        return apply_filters( 'site-reviews/query/inner-join-for-counts', $innerJoin );
208 208
     }
209 209
 }
Please login to merge, or discard this patch.
plugin/Database/TermCountsManager.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -9,91 +9,91 @@
 block discarded – undo
9 9
 
10 10
 class TermCountsManager
11 11
 {
12
-    /**
13
-     * @var CountsManager
14
-     */
15
-    protected $manager;
12
+	/**
13
+	 * @var CountsManager
14
+	 */
15
+	protected $manager;
16 16
 
17
-    public function __construct()
18
-    {
19
-        $this->manager = glsr(CountsManager::class);
20
-    }
17
+	public function __construct()
18
+	{
19
+		$this->manager = glsr(CountsManager::class);
20
+	}
21 21
 
22
-    /**
23
-     * @param int $termTaxonomyId
24
-     * @return array
25
-     */
26
-    public function build($termTaxonomyId)
27
-    {
28
-        return $this->manager->buildCounts([
29
-            'term_ids' => [$termTaxonomyId],
30
-        ]);
31
-    }
22
+	/**
23
+	 * @param int $termTaxonomyId
24
+	 * @return array
25
+	 */
26
+	public function build($termTaxonomyId)
27
+	{
28
+		return $this->manager->buildCounts([
29
+			'term_ids' => [$termTaxonomyId],
30
+		]);
31
+	}
32 32
 
33
-    /**
34
-     * @return void
35
-     */
36
-    public function decrease(Review $review)
37
-    {
38
-        foreach ($review->term_ids as $termId) {
39
-            if (empty($counts = $this->get($termId))) {
40
-                continue;
41
-            }
42
-            $this->update($termId,
43
-                $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
44
-            );
45
-        }
46
-    }
33
+	/**
34
+	 * @return void
35
+	 */
36
+	public function decrease(Review $review)
37
+	{
38
+		foreach ($review->term_ids as $termId) {
39
+			if (empty($counts = $this->get($termId))) {
40
+				continue;
41
+			}
42
+			$this->update($termId,
43
+				$this->manager->decreaseRating($counts, $review->review_type, $review->rating)
44
+			);
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @param int $termId
50
-     * @return array
51
-     */
52
-    public function get($termId)
53
-    {
54
-        return array_filter((array) get_term_meta($termId, CountsManager::META_COUNT, true));
55
-    }
48
+	/**
49
+	 * @param int $termId
50
+	 * @return array
51
+	 */
52
+	public function get($termId)
53
+	{
54
+		return array_filter((array) get_term_meta($termId, CountsManager::META_COUNT, true));
55
+	}
56 56
 
57
-    /**
58
-     * @return void
59
-     */
60
-    public function increase(Review $review)
61
-    {
62
-        $terms = glsr(ReviewManager::class)->normalizeTerms(implode(',', $review->term_ids));
63
-        foreach ($terms as $term) {
64
-            $counts = $this->get($term['term_id']);
65
-            $counts = empty($counts)
66
-                ? $this->build($term['term_taxonomy_id'])
67
-                : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
68
-            $this->update($term['term_id'], $counts);
69
-        }
70
-    }
57
+	/**
58
+	 * @return void
59
+	 */
60
+	public function increase(Review $review)
61
+	{
62
+		$terms = glsr(ReviewManager::class)->normalizeTerms(implode(',', $review->term_ids));
63
+		foreach ($terms as $term) {
64
+			$counts = $this->get($term['term_id']);
65
+			$counts = empty($counts)
66
+				? $this->build($term['term_taxonomy_id'])
67
+				: $this->manager->increaseRating($counts, $review->review_type, $review->rating);
68
+			$this->update($term['term_id'], $counts);
69
+		}
70
+	}
71 71
 
72
-    /**
73
-     * @param int $termId
74
-     * @return void
75
-     */
76
-    public function update($termId, array $reviewCounts)
77
-    {
78
-        $term = get_term($termId, Application::TAXONOMY);
79
-        if (isset($term->term_id)) {
80
-            $ratingCounts = $this->manager->flatten($reviewCounts);
81
-            update_term_meta($termId, CountsManager::META_COUNT, $reviewCounts);
82
-            update_term_meta($termId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
83
-            update_term_meta($termId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
84
-        }
85
-    }
72
+	/**
73
+	 * @param int $termId
74
+	 * @return void
75
+	 */
76
+	public function update($termId, array $reviewCounts)
77
+	{
78
+		$term = get_term($termId, Application::TAXONOMY);
79
+		if (isset($term->term_id)) {
80
+			$ratingCounts = $this->manager->flatten($reviewCounts);
81
+			update_term_meta($termId, CountsManager::META_COUNT, $reviewCounts);
82
+			update_term_meta($termId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
83
+			update_term_meta($termId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
84
+		}
85
+	}
86 86
 
87
-    /**
88
-     * @return void
89
-     */
90
-    public function updateAll()
91
-    {
92
-        $terms = glsr(Database::class)->getTerms([
93
-            'fields' => 'all',
94
-        ]);
95
-        foreach ($terms as $term) {
96
-            $this->update($term->term_id, $this->build($term->term_taxonomy_id));
97
-        }
98
-    }
87
+	/**
88
+	 * @return void
89
+	 */
90
+	public function updateAll()
91
+	{
92
+		$terms = glsr(Database::class)->getTerms([
93
+			'fields' => 'all',
94
+		]);
95
+		foreach ($terms as $term) {
96
+			$this->update($term->term_id, $this->build($term->term_taxonomy_id));
97
+		}
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function __construct()
18 18
     {
19
-        $this->manager = glsr(CountsManager::class);
19
+        $this->manager = glsr( CountsManager::class );
20 20
     }
21 21
 
22 22
     /**
23 23
      * @param int $termTaxonomyId
24 24
      * @return array
25 25
      */
26
-    public function build($termTaxonomyId)
26
+    public function build( $termTaxonomyId )
27 27
     {
28
-        return $this->manager->buildCounts([
28
+        return $this->manager->buildCounts( [
29 29
             'term_ids' => [$termTaxonomyId],
30
-        ]);
30
+        ] );
31 31
     }
32 32
 
33 33
     /**
34 34
      * @return void
35 35
      */
36
-    public function decrease(Review $review)
36
+    public function decrease( Review $review )
37 37
     {
38
-        foreach ($review->term_ids as $termId) {
39
-            if (empty($counts = $this->get($termId))) {
38
+        foreach( $review->term_ids as $termId ) {
39
+            if( empty($counts = $this->get( $termId )) ) {
40 40
                 continue;
41 41
             }
42
-            $this->update($termId,
43
-                $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
42
+            $this->update( $termId,
43
+                $this->manager->decreaseRating( $counts, $review->review_type, $review->rating )
44 44
             );
45 45
         }
46 46
     }
@@ -49,23 +49,23 @@  discard block
 block discarded – undo
49 49
      * @param int $termId
50 50
      * @return array
51 51
      */
52
-    public function get($termId)
52
+    public function get( $termId )
53 53
     {
54
-        return array_filter((array) get_term_meta($termId, CountsManager::META_COUNT, true));
54
+        return array_filter( (array)get_term_meta( $termId, CountsManager::META_COUNT, true ) );
55 55
     }
56 56
 
57 57
     /**
58 58
      * @return void
59 59
      */
60
-    public function increase(Review $review)
60
+    public function increase( Review $review )
61 61
     {
62
-        $terms = glsr(ReviewManager::class)->normalizeTerms(implode(',', $review->term_ids));
63
-        foreach ($terms as $term) {
64
-            $counts = $this->get($term['term_id']);
62
+        $terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ) );
63
+        foreach( $terms as $term ) {
64
+            $counts = $this->get( $term['term_id'] );
65 65
             $counts = empty($counts)
66
-                ? $this->build($term['term_taxonomy_id'])
67
-                : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
68
-            $this->update($term['term_id'], $counts);
66
+                ? $this->build( $term['term_taxonomy_id'] )
67
+                : $this->manager->increaseRating( $counts, $review->review_type, $review->rating );
68
+            $this->update( $term['term_id'], $counts );
69 69
         }
70 70
     }
71 71
 
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
      * @param int $termId
74 74
      * @return void
75 75
      */
76
-    public function update($termId, array $reviewCounts)
76
+    public function update( $termId, array $reviewCounts )
77 77
     {
78
-        $term = get_term($termId, Application::TAXONOMY);
79
-        if (isset($term->term_id)) {
80
-            $ratingCounts = $this->manager->flatten($reviewCounts);
81
-            update_term_meta($termId, CountsManager::META_COUNT, $reviewCounts);
82
-            update_term_meta($termId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
83
-            update_term_meta($termId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
78
+        $term = get_term( $termId, Application::TAXONOMY );
79
+        if( isset($term->term_id) ) {
80
+            $ratingCounts = $this->manager->flatten( $reviewCounts );
81
+            update_term_meta( $termId, CountsManager::META_COUNT, $reviewCounts );
82
+            update_term_meta( $termId, CountsManager::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
83
+            update_term_meta( $termId, CountsManager::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
84 84
         }
85 85
     }
86 86
 
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function updateAll()
91 91
     {
92
-        $terms = glsr(Database::class)->getTerms([
92
+        $terms = glsr( Database::class )->getTerms( [
93 93
             'fields' => 'all',
94
-        ]);
95
-        foreach ($terms as $term) {
96
-            $this->update($term->term_id, $this->build($term->term_taxonomy_id));
94
+        ] );
95
+        foreach( $terms as $term ) {
96
+            $this->update( $term->term_id, $this->build( $term->term_taxonomy_id ) );
97 97
         }
98 98
     }
99 99
 }
Please login to merge, or discard this patch.
plugin/Database/PostCountsManager.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,85 +7,85 @@
 block discarded – undo
7 7
 
8 8
 class PostCountsManager
9 9
 {
10
-    /**
11
-     * @var CountsManager
12
-     */
13
-    protected $manager;
10
+	/**
11
+	 * @var CountsManager
12
+	 */
13
+	protected $manager;
14 14
 
15
-    public function __construct()
16
-    {
17
-        $this->manager = glsr(CountsManager::class);
18
-    }
15
+	public function __construct()
16
+	{
17
+		$this->manager = glsr(CountsManager::class);
18
+	}
19 19
 
20
-    /**
21
-     * @param int $postId
22
-     * @return array
23
-     */
24
-    public function build($postId)
25
-    {
26
-        return $this->manager->buildCounts([
27
-            'post_ids' => [$postId],
28
-        ]);
29
-    }
20
+	/**
21
+	 * @param int $postId
22
+	 * @return array
23
+	 */
24
+	public function build($postId)
25
+	{
26
+		return $this->manager->buildCounts([
27
+			'post_ids' => [$postId],
28
+		]);
29
+	}
30 30
 
31
-    /**
32
-     * @return void
33
-     */
34
-    public function decrease(Review $review)
35
-    {
36
-        if (empty($counts = $this->get($review->assigned_to))) {
37
-            return;
38
-        }
39
-        $this->update($review->assigned_to,
40
-            $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
41
-        );
42
-    }
31
+	/**
32
+	 * @return void
33
+	 */
34
+	public function decrease(Review $review)
35
+	{
36
+		if (empty($counts = $this->get($review->assigned_to))) {
37
+			return;
38
+		}
39
+		$this->update($review->assigned_to,
40
+			$this->manager->decreaseRating($counts, $review->review_type, $review->rating)
41
+		);
42
+	}
43 43
 
44
-    /**
45
-     * @param int $postId
46
-     * @return array
47
-     */
48
-    public function get($postId)
49
-    {
50
-        return array_filter((array) get_post_meta($postId, CountsManager::META_COUNT, true));
51
-    }
44
+	/**
45
+	 * @param int $postId
46
+	 * @return array
47
+	 */
48
+	public function get($postId)
49
+	{
50
+		return array_filter((array) get_post_meta($postId, CountsManager::META_COUNT, true));
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     */
56
-    public function increase(Review $review)
57
-    {
58
-        if (!(get_post($review->assigned_to) instanceof \WP_Post)) {
59
-            return;
60
-        }
61
-        $counts = $this->get($review->assigned_to);
62
-        $counts = empty($counts)
63
-            ? $this->build($review->assigned_to)
64
-            : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
65
-        $this->update($review->assigned_to, $counts);
66
-    }
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function increase(Review $review)
57
+	{
58
+		if (!(get_post($review->assigned_to) instanceof \WP_Post)) {
59
+			return;
60
+		}
61
+		$counts = $this->get($review->assigned_to);
62
+		$counts = empty($counts)
63
+			? $this->build($review->assigned_to)
64
+			: $this->manager->increaseRating($counts, $review->review_type, $review->rating);
65
+		$this->update($review->assigned_to, $counts);
66
+	}
67 67
 
68
-    /**
69
-     * @param int $postId
70
-     * @return void
71
-     */
72
-    public function update($postId, array $reviewCounts)
73
-    {
74
-        $ratingCounts = $this->manager->flatten($reviewCounts);
75
-        update_post_meta($postId, CountsManager::META_COUNT, $reviewCounts);
76
-        update_post_meta($postId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
77
-        update_post_meta($postId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
78
-    }
68
+	/**
69
+	 * @param int $postId
70
+	 * @return void
71
+	 */
72
+	public function update($postId, array $reviewCounts)
73
+	{
74
+		$ratingCounts = $this->manager->flatten($reviewCounts);
75
+		update_post_meta($postId, CountsManager::META_COUNT, $reviewCounts);
76
+		update_post_meta($postId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
77
+		update_post_meta($postId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
78
+	}
79 79
 
80
-    /**
81
-     * @return void
82
-     */
83
-    public function updateAll()
84
-    {
85
-        glsr(SqlQueries::class)->deletePostCountMetaKeys(); // @todo test this with SiteGround for race conditions
86
-        $postIds = glsr(SqlQueries::class)->getReviewsMeta('assigned_to');
87
-        foreach ($postIds as $postId) {
88
-            $this->update($postId, $this->build($postId));
89
-        }
90
-    }
80
+	/**
81
+	 * @return void
82
+	 */
83
+	public function updateAll()
84
+	{
85
+		glsr(SqlQueries::class)->deletePostCountMetaKeys(); // @todo test this with SiteGround for race conditions
86
+		$postIds = glsr(SqlQueries::class)->getReviewsMeta('assigned_to');
87
+		foreach ($postIds as $postId) {
88
+			$this->update($postId, $this->build($postId));
89
+		}
90
+	}
91 91
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct()
16 16
     {
17
-        $this->manager = glsr(CountsManager::class);
17
+        $this->manager = glsr( CountsManager::class );
18 18
     }
19 19
 
20 20
     /**
21 21
      * @param int $postId
22 22
      * @return array
23 23
      */
24
-    public function build($postId)
24
+    public function build( $postId )
25 25
     {
26
-        return $this->manager->buildCounts([
26
+        return $this->manager->buildCounts( [
27 27
             'post_ids' => [$postId],
28
-        ]);
28
+        ] );
29 29
     }
30 30
 
31 31
     /**
32 32
      * @return void
33 33
      */
34
-    public function decrease(Review $review)
34
+    public function decrease( Review $review )
35 35
     {
36
-        if (empty($counts = $this->get($review->assigned_to))) {
36
+        if( empty($counts = $this->get( $review->assigned_to )) ) {
37 37
             return;
38 38
         }
39
-        $this->update($review->assigned_to,
40
-            $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
39
+        $this->update( $review->assigned_to,
40
+            $this->manager->decreaseRating( $counts, $review->review_type, $review->rating )
41 41
         );
42 42
     }
43 43
 
@@ -45,36 +45,36 @@  discard block
 block discarded – undo
45 45
      * @param int $postId
46 46
      * @return array
47 47
      */
48
-    public function get($postId)
48
+    public function get( $postId )
49 49
     {
50
-        return array_filter((array) get_post_meta($postId, CountsManager::META_COUNT, true));
50
+        return array_filter( (array)get_post_meta( $postId, CountsManager::META_COUNT, true ) );
51 51
     }
52 52
 
53 53
     /**
54 54
      * @return void
55 55
      */
56
-    public function increase(Review $review)
56
+    public function increase( Review $review )
57 57
     {
58
-        if (!(get_post($review->assigned_to) instanceof \WP_Post)) {
58
+        if( !(get_post( $review->assigned_to ) instanceof \WP_Post) ) {
59 59
             return;
60 60
         }
61
-        $counts = $this->get($review->assigned_to);
61
+        $counts = $this->get( $review->assigned_to );
62 62
         $counts = empty($counts)
63
-            ? $this->build($review->assigned_to)
64
-            : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
65
-        $this->update($review->assigned_to, $counts);
63
+            ? $this->build( $review->assigned_to )
64
+            : $this->manager->increaseRating( $counts, $review->review_type, $review->rating );
65
+        $this->update( $review->assigned_to, $counts );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @param int $postId
70 70
      * @return void
71 71
      */
72
-    public function update($postId, array $reviewCounts)
72
+    public function update( $postId, array $reviewCounts )
73 73
     {
74
-        $ratingCounts = $this->manager->flatten($reviewCounts);
75
-        update_post_meta($postId, CountsManager::META_COUNT, $reviewCounts);
76
-        update_post_meta($postId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
77
-        update_post_meta($postId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
74
+        $ratingCounts = $this->manager->flatten( $reviewCounts );
75
+        update_post_meta( $postId, CountsManager::META_COUNT, $reviewCounts );
76
+        update_post_meta( $postId, CountsManager::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
77
+        update_post_meta( $postId, CountsManager::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
78 78
     }
79 79
 
80 80
     /**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function updateAll()
84 84
     {
85
-        glsr(SqlQueries::class)->deletePostCountMetaKeys(); // @todo test this with SiteGround for race conditions
86
-        $postIds = glsr(SqlQueries::class)->getReviewsMeta('assigned_to');
87
-        foreach ($postIds as $postId) {
88
-            $this->update($postId, $this->build($postId));
85
+        glsr( SqlQueries::class )->deletePostCountMetaKeys(); // @todo test this with SiteGround for race conditions
86
+        $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
87
+        foreach( $postIds as $postId ) {
88
+            $this->update( $postId, $this->build( $postId ) );
89 89
         }
90 90
     }
91 91
 }
Please login to merge, or discard this patch.
views/pages/documentation/functions.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div id="functions-01" class="glsr-card postbox">
4 4
     <div class="glsr-card-header">
5 5
         <h3>READ ME FIRST!</h3>
6 6
         <button type="button" class="handlediv" aria-expanded="true">
7
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
7
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
8 8
             <span class="toggle-indicator" aria-hidden="true"></span>
9 9
         </button>
10 10
     </div>
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     <div class="glsr-card-header">
39 39
         <h3>Helper function to create a review</h3>
40 40
         <button type="button" class="handlediv" aria-expanded="true">
41
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
41
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
42 42
             <span class="toggle-indicator" aria-hidden="true"></span>
43 43
         </button>
44 44
     </div>
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 ]);
88 88
 </code></pre>
89 89
         <p><strong>Helpful Tip:</strong></p>
90
-        <p>You can use the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to view the review object that is returned.</p>
90
+        <p>You can use the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to view the review object that is returned.</p>
91 91
         <pre><code class="php">glsr_debug($review);</code></pre>
92 92
     </div>
93 93
 </div>
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     <div class="glsr-card-header">
97 97
         <h3>Helper function to debug variables</h3>
98 98
         <button type="button" class="handlediv" aria-expanded="true">
99
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
99
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
100 100
             <span class="toggle-indicator" aria-hidden="true"></span>
101 101
         </button>
102 102
     </div>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     <div class="glsr-card-header">
122 122
         <h3>Helper function to generate HTML stars for a rating</h3>
123 123
         <button type="button" class="handlediv" aria-expanded="true">
124
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
124
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
125 125
             <span class="toggle-indicator" aria-hidden="true"></span>
126 126
         </button>
127 127
     </div>
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     <div class="glsr-card-header">
146 146
         <h3>Helper function to get a plugin setting</h3>
147 147
         <button type="button" class="handlediv" aria-expanded="true">
148
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
148
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
149 149
             <span class="toggle-indicator" aria-hidden="true"></span>
150 150
         </button>
151 151
     </div>
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 $requireApproval = apply_filters('glsr_get_option', 'no', 'general.require.approval', 'no');</code></pre>
167 167
         <p><strong>Helpful Tip:</strong></p>
168
-        <p>You can use the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to view the whole plugin settings array, this will help you figure out which dot-notation path to use.</p>
168
+        <p>You can use the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to view the whole plugin settings array, this will help you figure out which dot-notation path to use.</p>
169 169
         <pre><code class="php">glsr_debug(glsr_get_options());</code></pre>
170 170
     </div>
171 171
 </div>
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     <div class="glsr-card-header">
175 175
         <h3>Helper function to get all plugin settings</h3>
176 176
         <button type="button" class="handlediv" aria-expanded="true">
177
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
177
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
178 178
             <span class="toggle-indicator" aria-hidden="true"></span>
179 179
         </button>
180 180
     </div>
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 $pluginSettings = apply_filters('glsr_get_options', []);</code></pre>
193 193
         <p><strong>Helpful Tip:</strong></p>
194
-        <p>You can use the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print the settings array to the screen:</p>
194
+        <p>You can use the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print the settings array to the screen:</p>
195 195
         <pre><code class="php">glsr_debug($pluginSettings);</code></pre>
196 196
     </div>
197 197
 </div>
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     <div class="glsr-card-header">
201 201
         <h3>Helper function to get a single review</h3>
202 202
         <button type="button" class="handlediv" aria-expanded="true">
203
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
203
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
204 204
             <span class="toggle-indicator" aria-hidden="true"></span>
205 205
         </button>
206 206
     </div>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 <pre><code class="php">echo $reviewHtml; // This is identical to: $review->render();</code></pre>
242 242
             </li>
243 243
             <li>
244
-                <p>You can also use the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print both arrayable objects to the screen:</p>
244
+                <p>You can also use the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print both arrayable objects to the screen:</p>
245 245
                 <pre><code class="php">glsr_debug($review, $reviewHtml);</code></pre>
246 246
             </li>
247 247
         </ol>
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     <div class="glsr-card-header">
253 253
         <h3>Helper function to get multiple reviews</h3>
254 254
         <button type="button" class="handlediv" aria-expanded="true">
255
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
255
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
256 256
             <span class="toggle-indicator" aria-hidden="true"></span>
257 257
         </button>
258 258
     </div>
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                 <pre><code class="php">echo $reviews; // This is identical to: $reviews->render();</code></pre>
297 297
             </li>
298 298
             <li>
299
-                <p>Loop through all reviews and handle each review as needed. Each <code>$review</code> is identical to what the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-07">glsr_get_review</a></code> helper function returns, so make sure to read the "Helpful Tips" from that section above for more information.</p>
299
+                <p>Loop through all reviews and handle each review as needed. Each <code>$review</code> is identical to what the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-07">glsr_get_review</a></code> helper function returns, so make sure to read the "Helpful Tips" from that section above for more information.</p>
300 300
                 <pre><code class="php">foreach ($reviews as $review) {
301 301
     echo $review;
302 302
 };</code></pre>
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 echo $reviewsHtml->navigation;</code></pre>
315 315
             </li>
316 316
             <li>
317
-                <p>You can also use the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print both arrayable objects to the screen:</p>
317
+                <p>You can also use the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print both arrayable objects to the screen:</p>
318 318
                 <pre><code class="php">glsr_debug($reviews, $reviewsHtml);</code></pre>
319 319
             </li>
320 320
         </ol>
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     <div class="glsr-card-header">
326 326
         <h3>Helper function to get the rating information</h3>
327 327
         <button type="button" class="handlediv" aria-expanded="true">
328
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
328
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
329 329
             <span class="toggle-indicator" aria-hidden="true"></span>
330 330
         </button>
331 331
     </div>
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         <p><strong>Helpful Tips:</strong></p>
357 357
         <ol>
358 358
             <li>
359
-                <p>You can use the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions'); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print the rating info to the screen:</p>
359
+                <p>You can use the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-functions' ); ?>" data-expand="#functions-03">glsr_debug</a></code> helper function to print the rating info to the screen:</p>
360 360
                 <pre><code class="php">glsr_debug($ratingInfo);</code></pre>
361 361
             </li>
362 362
         </ol>
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     <div class="glsr-card-header">
368 368
         <h3>Helper function to log variables to the plugin console</h3>
369 369
         <button type="button" class="handlediv" aria-expanded="true">
370
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
370
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
371 371
             <span class="toggle-indicator" aria-hidden="true"></span>
372 372
         </button>
373 373
     </div>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 // OR:
388 388
 
389 389
 apply_filters('glsr_log', null, $var1);</code></pre>
390
-    <p>Logged entries will be found in the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=tools#tab-console'); ?>">Tools &rarr; Console</a></code>.</p>
390
+    <p>Logged entries will be found in the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=tools#tab-console' ); ?>">Tools &rarr; Console</a></code>.</p>
391 391
     </div>
392 392
 </div>
393 393
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     <div class="glsr-card-header">
396 396
         <h3>Helper function to recalculate the rating counts</h3>
397 397
         <button type="button" class="handlediv" aria-expanded="true">
398
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
398
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
399 399
             <span class="toggle-indicator" aria-hidden="true"></span>
400 400
         </button>
401 401
     </div>
@@ -411,6 +411,6 @@  discard block
 block discarded – undo
411 411
 // OR:
412 412
 
413 413
 apply_filters('glsr_calculate_ratings', null);</code></pre>
414
-    <p>You can verify that it runs by checking the log entries in the <code><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=tools#tab-console'); ?>">Tools &rarr; Console</a></code>.</p>
414
+    <p>You can verify that it runs by checking the log entries in the <code><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=tools#tab-console' ); ?>">Tools &rarr; Console</a></code>.</p>
415 415
     </div>
416 416
 </div>
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 2 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -15,195 +15,195 @@
 block discarded – undo
15 15
 
16 16
 class AjaxController extends Controller
17 17
 {
18
-    /**
19
-     * @return void
20
-     */
21
-    public function routerChangeStatus(array $request)
22
-    {
23
-        wp_send_json_success($this->execute(new ChangeStatus($request)));
24
-    }
18
+	/**
19
+	 * @return void
20
+	 */
21
+	public function routerChangeStatus(array $request)
22
+	{
23
+		wp_send_json_success($this->execute(new ChangeStatus($request)));
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     */
29
-    public function routerClearConsole()
30
-    {
31
-        glsr(AdminController::class)->routerClearConsole();
32
-        wp_send_json_success([
33
-            'console' => glsr(Console::class)->get(),
34
-            'notices' => glsr(Notice::class)->get(),
35
-        ]);
36
-    }
26
+	/**
27
+	 * @return void
28
+	 */
29
+	public function routerClearConsole()
30
+	{
31
+		glsr(AdminController::class)->routerClearConsole();
32
+		wp_send_json_success([
33
+			'console' => glsr(Console::class)->get(),
34
+			'notices' => glsr(Notice::class)->get(),
35
+		]);
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function routerCountReviews()
42
-    {
43
-        glsr(AdminController::class)->routerCountReviews();
44
-        wp_send_json_success([
45
-            'notices' => glsr(Notice::class)->get(),
46
-        ]);
47
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function routerCountReviews()
42
+	{
43
+		glsr(AdminController::class)->routerCountReviews();
44
+		wp_send_json_success([
45
+			'notices' => glsr(Notice::class)->get(),
46
+		]);
47
+	}
48 48
 
49
-    /**
50
-     * @return void
51
-     */
52
-    public function routerMigrateReviews()
53
-    {
54
-        glsr(AdminController::class)->routerMigrateReviews();
55
-        wp_send_json_success([
56
-            'notices' => glsr(Notice::class)->get(),
57
-        ]);
58
-    }
49
+	/**
50
+	 * @return void
51
+	 */
52
+	public function routerMigrateReviews()
53
+	{
54
+		glsr(AdminController::class)->routerMigrateReviews();
55
+		wp_send_json_success([
56
+			'notices' => glsr(Notice::class)->get(),
57
+		]);
58
+	}
59 59
 
60
-    /**
61
-     * @return void
62
-     */
63
-    public function routerDismissNotice(array $request)
64
-    {
65
-        glsr(NoticeController::class)->routerDismissNotice($request);
66
-        wp_send_json_success();
67
-    }
60
+	/**
61
+	 * @return void
62
+	 */
63
+	public function routerDismissNotice(array $request)
64
+	{
65
+		glsr(NoticeController::class)->routerDismissNotice($request);
66
+		wp_send_json_success();
67
+	}
68 68
 
69
-    /**
70
-     * @return void
71
-     */
72
-    public function routerMceShortcode(array $request)
73
-    {
74
-        $shortcode = $request['shortcode'];
75
-        $response = false;
76
-        if (array_key_exists($shortcode, glsr()->mceShortcodes)) {
77
-            $data = glsr()->mceShortcodes[$shortcode];
78
-            if (!empty($data['errors'])) {
79
-                $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')];
80
-            }
81
-            $response = [
82
-                'body' => $data['fields'],
83
-                'close' => $data['btn_close'],
84
-                'ok' => $data['btn_okay'],
85
-                'shortcode' => $shortcode,
86
-                'title' => $data['title'],
87
-            ];
88
-        }
89
-        wp_send_json_success($response);
90
-    }
69
+	/**
70
+	 * @return void
71
+	 */
72
+	public function routerMceShortcode(array $request)
73
+	{
74
+		$shortcode = $request['shortcode'];
75
+		$response = false;
76
+		if (array_key_exists($shortcode, glsr()->mceShortcodes)) {
77
+			$data = glsr()->mceShortcodes[$shortcode];
78
+			if (!empty($data['errors'])) {
79
+				$data['btn_okay'] = [esc_html__('Okay', 'site-reviews')];
80
+			}
81
+			$response = [
82
+				'body' => $data['fields'],
83
+				'close' => $data['btn_close'],
84
+				'ok' => $data['btn_okay'],
85
+				'shortcode' => $shortcode,
86
+				'title' => $data['title'],
87
+			];
88
+		}
89
+		wp_send_json_success($response);
90
+	}
91 91
 
92
-    /**
93
-     * @return void
94
-     */
95
-    public function routerFetchConsole()
96
-    {
97
-        glsr(AdminController::class)->routerFetchConsole();
98
-        wp_send_json_success([
99
-            'console' => glsr(Console::class)->get(),
100
-            'notices' => glsr(Notice::class)->get(),
101
-        ]);
102
-    }
92
+	/**
93
+	 * @return void
94
+	 */
95
+	public function routerFetchConsole()
96
+	{
97
+		glsr(AdminController::class)->routerFetchConsole();
98
+		wp_send_json_success([
99
+			'console' => glsr(Console::class)->get(),
100
+			'notices' => glsr(Notice::class)->get(),
101
+		]);
102
+	}
103 103
 
104
-    /**
105
-     * @return void
106
-     */
107
-    public function routerResetPermissions()
108
-    {
109
-        glsr(Role::class)->resetAll();
110
-        glsr(Notice::class)->clear()->addSuccess(__('The permissions have been reset, please reload the page for them to take effect.', 'site-reviews'));
111
-        wp_send_json_success([
112
-            'notices' => glsr(Notice::class)->get(),
113
-        ]);
114
-    }
104
+	/**
105
+	 * @return void
106
+	 */
107
+	public function routerResetPermissions()
108
+	{
109
+		glsr(Role::class)->resetAll();
110
+		glsr(Notice::class)->clear()->addSuccess(__('The permissions have been reset, please reload the page for them to take effect.', 'site-reviews'));
111
+		wp_send_json_success([
112
+			'notices' => glsr(Notice::class)->get(),
113
+		]);
114
+	}
115 115
 
116
-    /**
117
-     * @return void
118
-     */
119
-    public function routerSearchPosts(array $request)
120
-    {
121
-        $results = glsr(Database::class)->searchPosts($request['search']);
122
-        wp_send_json_success([
123
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
124
-            'items' => $results,
125
-        ]);
126
-    }
116
+	/**
117
+	 * @return void
118
+	 */
119
+	public function routerSearchPosts(array $request)
120
+	{
121
+		$results = glsr(Database::class)->searchPosts($request['search']);
122
+		wp_send_json_success([
123
+			'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
124
+			'items' => $results,
125
+		]);
126
+	}
127 127
 
128
-    /**
129
-     * @return void
130
-     */
131
-    public function routerSearchTranslations(array $request)
132
-    {
133
-        if (empty($request['exclude'])) {
134
-            $request['exclude'] = [];
135
-        }
136
-        $results = glsr(Translation::class)
137
-            ->search($request['search'])
138
-            ->exclude()
139
-            ->exclude($request['exclude'])
140
-            ->renderResults();
141
-        wp_send_json_success([
142
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
143
-            'items' => $results,
144
-        ]);
145
-    }
128
+	/**
129
+	 * @return void
130
+	 */
131
+	public function routerSearchTranslations(array $request)
132
+	{
133
+		if (empty($request['exclude'])) {
134
+			$request['exclude'] = [];
135
+		}
136
+		$results = glsr(Translation::class)
137
+			->search($request['search'])
138
+			->exclude()
139
+			->exclude($request['exclude'])
140
+			->renderResults();
141
+		wp_send_json_success([
142
+			'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
143
+			'items' => $results,
144
+		]);
145
+	}
146 146
 
147
-    /**
148
-     * @return void
149
-     */
150
-    public function routerSubmitReview(array $request)
151
-    {
152
-        $command = glsr(PublicController::class)->routerSubmitReview($request);
153
-        $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
154
-        $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command);
155
-        $data = [
156
-            'errors' => glsr()->sessionGet($command->form_id.'errors', false),
157
-            'message' => glsr()->sessionGet($command->form_id.'message', ''),
158
-            'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false),
159
-            'redirect' => $redirect,
160
-        ];
161
-        if (false === $data['errors']) {
162
-            glsr()->sessionClear();
163
-            wp_send_json_success($data);
164
-        }
165
-        wp_send_json_error($data);
166
-    }
147
+	/**
148
+	 * @return void
149
+	 */
150
+	public function routerSubmitReview(array $request)
151
+	{
152
+		$command = glsr(PublicController::class)->routerSubmitReview($request);
153
+		$redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
154
+		$redirect = apply_filters('site-reviews/review/redirect', $redirect, $command);
155
+		$data = [
156
+			'errors' => glsr()->sessionGet($command->form_id.'errors', false),
157
+			'message' => glsr()->sessionGet($command->form_id.'message', ''),
158
+			'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false),
159
+			'redirect' => $redirect,
160
+		];
161
+		if (false === $data['errors']) {
162
+			glsr()->sessionClear();
163
+			wp_send_json_success($data);
164
+		}
165
+		wp_send_json_error($data);
166
+	}
167 167
 
168
-    /**
169
-     * @return void
170
-     */
171
-    public function routerFetchPagedReviews(array $request)
172
-    {
173
-        $args = [
174
-            'paged' => Arr::get($request, 'page', false),
175
-            'pagedUrl' => '',
176
-            'pagination' => 'ajax',
177
-            'schema' => false,
178
-        ];
179
-        if (!$args['paged']) {
180
-            $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH));
181
-            $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH));
182
-            $urlQuery = [];
183
-            parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery);
184
-            $args['paged'] = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
185
-            $args['pagedUrl'] = $homePath === $urlPath
186
-                ? trailingslashit(home_url())
187
-                : trailingslashit(home_url($urlPath));
188
-        }
189
-        $atts = (array) json_decode(Arr::get($request, 'atts'));
190
-        $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts);
191
-        $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts));
192
-        return wp_send_json_success([
193
-            'pagination' => $html->getPagination(),
194
-            'reviews' => $html->getReviews(),
195
-        ]);
196
-    }
168
+	/**
169
+	 * @return void
170
+	 */
171
+	public function routerFetchPagedReviews(array $request)
172
+	{
173
+		$args = [
174
+			'paged' => Arr::get($request, 'page', false),
175
+			'pagedUrl' => '',
176
+			'pagination' => 'ajax',
177
+			'schema' => false,
178
+		];
179
+		if (!$args['paged']) {
180
+			$homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH));
181
+			$urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH));
182
+			$urlQuery = [];
183
+			parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery);
184
+			$args['paged'] = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
185
+			$args['pagedUrl'] = $homePath === $urlPath
186
+				? trailingslashit(home_url())
187
+				: trailingslashit(home_url($urlPath));
188
+		}
189
+		$atts = (array) json_decode(Arr::get($request, 'atts'));
190
+		$atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts);
191
+		$html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts));
192
+		return wp_send_json_success([
193
+			'pagination' => $html->getPagination(),
194
+			'reviews' => $html->getReviews(),
195
+		]);
196
+	}
197 197
 
198
-    /**
199
-     * @return void
200
-     */
201
-    public function routerTogglePinned(array $request)
202
-    {
203
-        $isPinned = $this->execute(new TogglePinned($request));
204
-        wp_send_json_success([
205
-            'notices' => glsr(Notice::class)->get(),
206
-            'pinned' => $isPinned,
207
-        ]);
208
-    }
198
+	/**
199
+	 * @return void
200
+	 */
201
+	public function routerTogglePinned(array $request)
202
+	{
203
+		$isPinned = $this->execute(new TogglePinned($request));
204
+		wp_send_json_success([
205
+			'notices' => glsr(Notice::class)->get(),
206
+			'pinned' => $isPinned,
207
+		]);
208
+	}
209 209
 }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @return void
20 20
      */
21
-    public function routerChangeStatus(array $request)
21
+    public function routerChangeStatus( array $request )
22 22
     {
23
-        wp_send_json_success($this->execute(new ChangeStatus($request)));
23
+        wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
24 24
     }
25 25
 
26 26
     /**
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function routerClearConsole()
30 30
     {
31
-        glsr(AdminController::class)->routerClearConsole();
32
-        wp_send_json_success([
33
-            'console' => glsr(Console::class)->get(),
34
-            'notices' => glsr(Notice::class)->get(),
35
-        ]);
31
+        glsr( AdminController::class )->routerClearConsole();
32
+        wp_send_json_success( [
33
+            'console' => glsr( Console::class )->get(),
34
+            'notices' => glsr( Notice::class )->get(),
35
+        ] );
36 36
     }
37 37
 
38 38
     /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function routerCountReviews()
42 42
     {
43
-        glsr(AdminController::class)->routerCountReviews();
44
-        wp_send_json_success([
45
-            'notices' => glsr(Notice::class)->get(),
46
-        ]);
43
+        glsr( AdminController::class )->routerCountReviews();
44
+        wp_send_json_success( [
45
+            'notices' => glsr( Notice::class )->get(),
46
+        ] );
47 47
     }
48 48
 
49 49
     /**
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function routerMigrateReviews()
53 53
     {
54
-        glsr(AdminController::class)->routerMigrateReviews();
55
-        wp_send_json_success([
56
-            'notices' => glsr(Notice::class)->get(),
57
-        ]);
54
+        glsr( AdminController::class )->routerMigrateReviews();
55
+        wp_send_json_success( [
56
+            'notices' => glsr( Notice::class )->get(),
57
+        ] );
58 58
     }
59 59
 
60 60
     /**
61 61
      * @return void
62 62
      */
63
-    public function routerDismissNotice(array $request)
63
+    public function routerDismissNotice( array $request )
64 64
     {
65
-        glsr(NoticeController::class)->routerDismissNotice($request);
65
+        glsr( NoticeController::class )->routerDismissNotice( $request );
66 66
         wp_send_json_success();
67 67
     }
68 68
 
69 69
     /**
70 70
      * @return void
71 71
      */
72
-    public function routerMceShortcode(array $request)
72
+    public function routerMceShortcode( array $request )
73 73
     {
74 74
         $shortcode = $request['shortcode'];
75 75
         $response = false;
76
-        if (array_key_exists($shortcode, glsr()->mceShortcodes)) {
76
+        if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
77 77
             $data = glsr()->mceShortcodes[$shortcode];
78
-            if (!empty($data['errors'])) {
79
-                $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')];
78
+            if( !empty($data['errors']) ) {
79
+                $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
80 80
             }
81 81
             $response = [
82 82
                 'body' => $data['fields'],
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 'title' => $data['title'],
87 87
             ];
88 88
         }
89
-        wp_send_json_success($response);
89
+        wp_send_json_success( $response );
90 90
     }
91 91
 
92 92
     /**
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function routerFetchConsole()
96 96
     {
97
-        glsr(AdminController::class)->routerFetchConsole();
98
-        wp_send_json_success([
99
-            'console' => glsr(Console::class)->get(),
100
-            'notices' => glsr(Notice::class)->get(),
101
-        ]);
97
+        glsr( AdminController::class )->routerFetchConsole();
98
+        wp_send_json_success( [
99
+            'console' => glsr( Console::class )->get(),
100
+            'notices' => glsr( Notice::class )->get(),
101
+        ] );
102 102
     }
103 103
 
104 104
     /**
@@ -106,104 +106,104 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function routerResetPermissions()
108 108
     {
109
-        glsr(Role::class)->resetAll();
110
-        glsr(Notice::class)->clear()->addSuccess(__('The permissions have been reset, please reload the page for them to take effect.', 'site-reviews'));
111
-        wp_send_json_success([
112
-            'notices' => glsr(Notice::class)->get(),
113
-        ]);
109
+        glsr( Role::class )->resetAll();
110
+        glsr( Notice::class )->clear()->addSuccess( __( 'The permissions have been reset, please reload the page for them to take effect.', 'site-reviews' ) );
111
+        wp_send_json_success( [
112
+            'notices' => glsr( Notice::class )->get(),
113
+        ] );
114 114
     }
115 115
 
116 116
     /**
117 117
      * @return void
118 118
      */
119
-    public function routerSearchPosts(array $request)
119
+    public function routerSearchPosts( array $request )
120 120
     {
121
-        $results = glsr(Database::class)->searchPosts($request['search']);
122
-        wp_send_json_success([
123
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
121
+        $results = glsr( Database::class )->searchPosts( $request['search'] );
122
+        wp_send_json_success( [
123
+            'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
124 124
             'items' => $results,
125
-        ]);
125
+        ] );
126 126
     }
127 127
 
128 128
     /**
129 129
      * @return void
130 130
      */
131
-    public function routerSearchTranslations(array $request)
131
+    public function routerSearchTranslations( array $request )
132 132
     {
133
-        if (empty($request['exclude'])) {
133
+        if( empty($request['exclude']) ) {
134 134
             $request['exclude'] = [];
135 135
         }
136
-        $results = glsr(Translation::class)
137
-            ->search($request['search'])
136
+        $results = glsr( Translation::class )
137
+            ->search( $request['search'] )
138 138
             ->exclude()
139
-            ->exclude($request['exclude'])
139
+            ->exclude( $request['exclude'] )
140 140
             ->renderResults();
141
-        wp_send_json_success([
142
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
141
+        wp_send_json_success( [
142
+            'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
143 143
             'items' => $results,
144
-        ]);
144
+        ] );
145 145
     }
146 146
 
147 147
     /**
148 148
      * @return void
149 149
      */
150
-    public function routerSubmitReview(array $request)
150
+    public function routerSubmitReview( array $request )
151 151
     {
152
-        $command = glsr(PublicController::class)->routerSubmitReview($request);
153
-        $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
154
-        $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command);
152
+        $command = glsr( PublicController::class )->routerSubmitReview( $request );
153
+        $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
154
+        $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command );
155 155
         $data = [
156
-            'errors' => glsr()->sessionGet($command->form_id.'errors', false),
157
-            'message' => glsr()->sessionGet($command->form_id.'message', ''),
158
-            'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false),
156
+            'errors' => glsr()->sessionGet( $command->form_id.'errors', false ),
157
+            'message' => glsr()->sessionGet( $command->form_id.'message', '' ),
158
+            'recaptcha' => glsr()->sessionGet( $command->form_id.'recaptcha', false ),
159 159
             'redirect' => $redirect,
160 160
         ];
161
-        if (false === $data['errors']) {
161
+        if( false === $data['errors'] ) {
162 162
             glsr()->sessionClear();
163
-            wp_send_json_success($data);
163
+            wp_send_json_success( $data );
164 164
         }
165
-        wp_send_json_error($data);
165
+        wp_send_json_error( $data );
166 166
     }
167 167
 
168 168
     /**
169 169
      * @return void
170 170
      */
171
-    public function routerFetchPagedReviews(array $request)
171
+    public function routerFetchPagedReviews( array $request )
172 172
     {
173 173
         $args = [
174
-            'paged' => Arr::get($request, 'page', false),
174
+            'paged' => Arr::get( $request, 'page', false ),
175 175
             'pagedUrl' => '',
176 176
             'pagination' => 'ajax',
177 177
             'schema' => false,
178 178
         ];
179
-        if (!$args['paged']) {
180
-            $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH));
181
-            $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH));
179
+        if( !$args['paged'] ) {
180
+            $homePath = untrailingslashit( parse_url( home_url(), PHP_URL_PATH ) );
181
+            $urlPath = untrailingslashit( parse_url( Arr::get( $request, 'url' ), PHP_URL_PATH ) );
182 182
             $urlQuery = [];
183
-            parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery);
184
-            $args['paged'] = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
183
+            parse_str( parse_url( Arr::get( $request, 'url' ), PHP_URL_QUERY ), $urlQuery );
184
+            $args['paged'] = (int)Arr::get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 );
185 185
             $args['pagedUrl'] = $homePath === $urlPath
186
-                ? trailingslashit(home_url())
187
-                : trailingslashit(home_url($urlPath));
186
+                ? trailingslashit( home_url() )
187
+                : trailingslashit( home_url( $urlPath ) );
188 188
         }
189
-        $atts = (array) json_decode(Arr::get($request, 'atts'));
190
-        $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts);
191
-        $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts));
192
-        return wp_send_json_success([
189
+        $atts = (array)json_decode( Arr::get( $request, 'atts' ) );
190
+        $atts = glsr( SiteReviewsShortcode::class )->normalizeAtts( $atts );
191
+        $html = glsr( SiteReviewsPartial::class )->build( wp_parse_args( $args, $atts ) );
192
+        return wp_send_json_success( [
193 193
             'pagination' => $html->getPagination(),
194 194
             'reviews' => $html->getReviews(),
195
-        ]);
195
+        ] );
196 196
     }
197 197
 
198 198
     /**
199 199
      * @return void
200 200
      */
201
-    public function routerTogglePinned(array $request)
201
+    public function routerTogglePinned( array $request )
202 202
     {
203
-        $isPinned = $this->execute(new TogglePinned($request));
204
-        wp_send_json_success([
205
-            'notices' => glsr(Notice::class)->get(),
203
+        $isPinned = $this->execute( new TogglePinned( $request ) );
204
+        wp_send_json_success( [
205
+            'notices' => glsr( Notice::class )->get(),
206 206
             'pinned' => $isPinned,
207
-        ]);
207
+        ] );
208 208
     }
209 209
 }
Please login to merge, or discard this patch.
config/settings.php 2 patches
Indentation   +561 added lines, -561 removed lines patch added patch discarded remove patch
@@ -1,565 +1,565 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'settings.general.style' => [
5
-        'default' => 'default',
6
-        'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
-        'label' => __('Plugin Style', 'site-reviews'),
8
-        'options' => [
9
-            'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10
-            'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11
-            'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12
-            'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13
-            'wpforms' => 'Plugin: WPForms Lite (v1)',
14
-            'default' => __('Site Reviews (default)', 'site-reviews'),
15
-            'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
16
-            'divi' => 'Theme: Divi (v3)',
17
-            'materialize' => 'Theme: Materialize',
18
-            'twentyfifteen' => 'Theme: Twenty Fifteen',
19
-            'twentyseventeen' => 'Theme: Twenty Seventeen',
20
-            'twentynineteen' => 'Theme: Twenty Nineteen',
21
-        ],
22
-        'type' => 'select',
23
-    ],
24
-    'settings.general.require.approval' => [
25
-        'default' => 'no',
26
-        'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
-        'label' => __('Require Approval', 'site-reviews'),
28
-        'type' => 'yes_no',
29
-    ],
30
-    'settings.general.require.login' => [
31
-        'default' => 'no',
32
-        'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
-        'label' => __('Require Login', 'site-reviews'),
34
-        'type' => 'yes_no',
35
-    ],
36
-    'settings.general.require.login_register' => [
37
-        'default' => 'no',
38
-        'depends_on' => [
39
-            'settings.general.require.login' => 'yes',
40
-        ],
41
-        'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
-            '<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
43
-        ),
44
-        'label' => __('Show Registration Link', 'site-reviews'),
45
-        'type' => 'yes_no',
46
-    ],
47
-    'settings.general.multilingual' => [
48
-        'default' => '',
49
-        'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
-        'label' => __('Multilingual', 'site-reviews'),
51
-        'options' => [
52
-            '' => __('No Integration', 'site-reviews'),
53
-            'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
-            'wpml' => __('Integrate with WPML', 'site-reviews'),
55
-        ],
56
-        'type' => 'select',
57
-    ],
58
-    'settings.general.trustalyze' => [
59
-        'default' => 'no',
60
-        'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
61
-            '<a href="https://trustalyze.com/plans?ref=105" target="_blank">Trustalyze Confidence System</a>'
62
-        ),
63
-        'label' => __('Blockchain Validation', 'site-reviews'),
64
-        'type' => 'yes_no',
65
-    ],
66
-    'settings.general.trustalyze_email' => [
67
-        'default' => '',
68
-        'depends_on' => [
69
-            'settings.general.trustalyze' => ['yes'],
70
-        ],
71
-        'description' => __('Enter your Trustalyze account email here.', 'site-reviews'),
72
-        'label' => __('Trustalyze Email', 'site-reviews'),
73
-        'type' => 'text',
74
-    ],
75
-    'settings.general.trustalyze_serial' => [
76
-        'default' => '',
77
-        'depends_on' => [
78
-            'settings.general.trustalyze' => ['yes'],
79
-        ],
80
-        'description' => __('Enter your Trustalyze account serial key here.', 'site-reviews'),
81
-        'label' => __('Trustalyze Serial Key', 'site-reviews'),
82
-        'type' => 'password',
83
-    ],
84
-    'settings.general.notifications' => [
85
-        'default' => [],
86
-        'label' => __('Notifications', 'site-reviews'),
87
-        'options' => [
88
-            'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
-            'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
-            'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
-            'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
92
-        ],
93
-        'type' => 'checkbox',
94
-    ],
95
-    'settings.general.notification_email' => [
96
-        'default' => '',
97
-        'depends_on' => [
98
-            'settings.general.notifications' => ['custom'],
99
-        ],
100
-        'label' => __('Send Notification Emails To', 'site-reviews'),
101
-        'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
102
-        'type' => 'text',
103
-    ],
104
-    'settings.general.notification_slack' => [
105
-        'default' => '',
106
-        'depends_on' => [
107
-            'settings.general.notifications' => ['slack'],
108
-        ],
109
-        'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
-            '<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
111
-        ),
112
-        'label' => __('Slack Webhook URL', 'site-reviews'),
113
-        'type' => 'text',
114
-    ],
115
-    'settings.general.notification_message' => [
116
-        'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
117
-        'depends_on' => [
118
-            'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119
-        ],
120
-        'description' => __(
121
-            'To restore the default text, save an empty template. '.
122
-            'If you are sending notifications to Slack then this template will only be used as a fallback in the event that <a href="https://api.slack.com/docs/attachments">Message Attachments</a> have been disabled. Available template tags:'.
123
-            '<br><code>{review_rating}</code> The review rating number (1-5)'.
124
-            '<br><code>{review_title}</code> The review title'.
125
-            '<br><code>{review_content}</code> The review content'.
126
-            '<br><code>{review_author}</code> The review author'.
127
-            '<br><code>{review_email}</code> The email of the review author'.
128
-            '<br><code>{review_ip}</code> The IP address of the review author'.
129
-            '<br><code>{review_link}</code> The link to edit/view a review',
130
-            'site-reviews'
131
-        ),
132
-        'label' => __('Notification Template', 'site-reviews'),
133
-        'rows' => 10,
134
-        'type' => 'code',
135
-    ],
136
-    'settings.reviews.date.format' => [
137
-        'default' => '',
138
-        'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
-            '<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
140
-        ),
141
-        'label' => __('Date Format', 'site-reviews'),
142
-        'options' => [
143
-            '' => __('Use the default date format', 'site-reviews'),
144
-            'relative' => __('Use a relative date format', 'site-reviews'),
145
-            'custom' => __('Use a custom date format', 'site-reviews'),
146
-        ],
147
-        'type' => 'select',
148
-    ],
149
-    'settings.reviews.date.custom' => [
150
-        'default' => get_option('date_format'),
151
-        'depends_on' => [
152
-            'settings.reviews.date.format' => 'custom',
153
-        ],
154
-        'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
-        'label' => __('Custom Date Format', 'site-reviews'),
156
-        'type' => 'text',
157
-    ],
158
-    'settings.reviews.name.format' => [
159
-        'default' => '',
160
-        'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
-        'label' => __('Name Format', 'site-reviews'),
162
-        'options' => [
163
-            '' => __('Use the name as given', 'site-reviews'),
164
-            'first' => __('Use the first name only', 'site-reviews'),
165
-            'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
-            'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
-            'initials' => __('Convert to all initials', 'site-reviews'),
168
-        ],
169
-        'type' => 'select',
170
-    ],
171
-    'settings.reviews.name.initial' => [
172
-        'default' => '',
173
-        'depends_on' => [
174
-            'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175
-        ],
176
-        'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
-        'label' => __('Initial Format', 'site-reviews'),
178
-        'options' => [
179
-            '' => __('Initial with a space', 'site-reviews'),
180
-            'period' => __('Initial with a period', 'site-reviews'),
181
-            'period_space' => __('Initial with a period and a space', 'site-reviews'),
182
-        ],
183
-        'type' => 'select',
184
-    ],
185
-    'settings.reviews.assigned_links' => [
186
-        'default' => 'no',
187
-        'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
-        'label' => __('Enable Assigned Links', 'site-reviews'),
189
-        'type' => 'yes_no',
190
-    ],
191
-    'settings.reviews.avatars' => [
192
-        'default' => 'no',
193
-        'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
-        'label' => __('Enable Avatars', 'site-reviews'),
195
-        'type' => 'yes_no',
196
-    ],
197
-    'settings.reviews.avatars_regenerate' => [
198
-        'default' => 'no',
199
-        'depends_on' => [
200
-            'settings.reviews.avatars' => 'yes',
201
-        ],
202
-        'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
-        'label' => __('Regenerate Avatars', 'site-reviews'),
204
-        'type' => 'yes_no',
205
-    ],
206
-    'settings.reviews.avatars_size' => [
207
-        'default' => 40,
208
-        'depends_on' => [
209
-            'settings.reviews.avatars' => 'yes',
210
-        ],
211
-        'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
-        'label' => __('Avatar Size', 'site-reviews'),
213
-        'type' => 'number',
214
-    ],
215
-    'settings.reviews.excerpts' => [
216
-        'default' => 'yes',
217
-        'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
-        'label' => __('Enable Excerpts', 'site-reviews'),
219
-        'type' => 'yes_no',
220
-    ],
221
-    'settings.reviews.excerpts_length' => [
222
-        'default' => 55,
223
-        'depends_on' => [
224
-            'settings.reviews.excerpts' => 'yes',
225
-        ],
226
-        'description' => __('Set the excerpt word length.', 'site-reviews'),
227
-        'label' => __('Excerpt Length', 'site-reviews'),
228
-        'type' => 'number',
229
-    ],
230
-    'settings.reviews.fallback' => [
231
-        'default' => 'yes',
232
-        'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
-            '<a href="'.admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-translations').'">'.__('Translations', 'site-reviews').'</a>',
234
-            '<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
235
-        ),
236
-        'label' => __('Enable Fallback Text', 'site-reviews'),
237
-        'type' => 'yes_no',
238
-    ],
239
-    'settings.reviews.pagination.url_parameter' => [
240
-        'default' => 'yes',
241
-        'description' => sprintf(
242
-            _x('Paginated URLs include the %s URL parameter. If you would like to keep the pagination links but prevent search engines from indexing them, add the following lines to your %s file instead: %s', 'admin-text', 'site-reviews'),
243
-            '<code>?'.glsr()->constant('PAGED_QUERY_VAR').'={page_number}</code>',
244
-            '<a href="https://www.robotstxt.org/">robots.txt</a>',
245
-            '<br><code>user-agent: *</code>'.
246
-            '<br><code>Disallow: /*?'.glsr()->constant('PAGED_QUERY_VAR').'=*</code>'.
247
-            '<br><code>Disallow: /*?*'.glsr()->constant('PAGED_QUERY_VAR').'=*</code>'
248
-        ),
249
-        'label' => esc_html_x('Enable Paginated URLs', 'admin-text', 'site-reviews'),
250
-        'type' => 'yes_no',
251
-    ],
252
-    'settings.schema.type.default' => [
253
-        'default' => 'LocalBusiness',
254
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
255
-        'label' => __('Default Schema Type', 'site-reviews'),
256
-        'options' => [
257
-            'LocalBusiness' => __('Local Business', 'site-reviews'),
258
-            'Product' => __('Product', 'site-reviews'),
259
-            'custom' => __('Custom', 'site-reviews'),
260
-        ],
261
-        'type' => 'select',
262
-    ],
263
-    'settings.schema.type.custom' => [
264
-        'default' => '',
265
-        'depends_on' => [
266
-            'settings.schema.type.default' => 'custom',
267
-        ],
268
-        'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
269
-        'label' => __('Custom Schema Type', 'site-reviews'),
270
-        'type' => 'text',
271
-    ],
272
-    'settings.schema.name.default' => [
273
-        'default' => 'post',
274
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
275
-        'label' => __('Default Name', 'site-reviews'),
276
-        'options' => [
277
-            'post' => __('Use the assigned or current page title', 'site-reviews'),
278
-            'custom' => __('Enter a custom title', 'site-reviews'),
279
-        ],
280
-        'type' => 'select',
281
-    ],
282
-    'settings.schema.name.custom' => [
283
-        'default' => '',
284
-        'depends_on' => [
285
-            'settings.schema.name.default' => 'custom',
286
-        ],
287
-        'label' => __('Custom Name', 'site-reviews'),
288
-        'type' => 'text',
289
-    ],
290
-    'settings.schema.description.default' => [
291
-        'default' => 'post',
292
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
293
-        'label' => __('Default Description', 'site-reviews'),
294
-        'options' => [
295
-            'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
296
-            'custom' => __('Enter a custom description', 'site-reviews'),
297
-        ],
298
-        'type' => 'select',
299
-    ],
300
-    'settings.schema.description.custom' => [
301
-        'default' => '',
302
-        'depends_on' => [
303
-            'settings.schema.description.default' => 'custom',
304
-        ],
305
-        'label' => __('Custom Description', 'site-reviews'),
306
-        'type' => 'text',
307
-    ],
308
-    'settings.schema.url.default' => [
309
-        'default' => 'post',
310
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
311
-        'label' => __('Default URL', 'site-reviews'),
312
-        'options' => [
313
-            'post' => __('Use the assigned or current page URL', 'site-reviews'),
314
-            'custom' => __('Enter a custom URL', 'site-reviews'),
315
-        ],
316
-        'type' => 'select',
317
-    ],
318
-    'settings.schema.url.custom' => [
319
-        'default' => '',
320
-        'depends_on' => [
321
-            'settings.schema.url.default' => 'custom',
322
-        ],
323
-        'label' => __('Custom URL', 'site-reviews'),
324
-        'type' => 'text',
325
-    ],
326
-    'settings.schema.image.default' => [
327
-        'default' => 'post',
328
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
329
-        'label' => __('Default Image', 'site-reviews'),
330
-        'options' => [
331
-            'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
332
-            'custom' => __('Enter a custom image URL', 'site-reviews'),
333
-        ],
334
-        'type' => 'select',
335
-    ],
336
-    'settings.schema.image.custom' => [
337
-        'default' => '',
338
-        'depends_on' => [
339
-            'settings.schema.image.default' => 'custom',
340
-        ],
341
-        'label' => __('Custom Image URL', 'site-reviews'),
342
-        'type' => 'text',
343
-    ],
344
-    'settings.schema.address' => [
345
-        'default' => '',
346
-        'depends_on' => [
347
-            'settings.schema.type.default' => 'LocalBusiness',
348
-        ],
349
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
350
-        'label' => __('Address', 'site-reviews'),
351
-        'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
352
-        'type' => 'text',
353
-    ],
354
-    'settings.schema.telephone' => [
355
-        'default' => '',
356
-        'depends_on' => [
357
-            'settings.schema.type.default' => 'LocalBusiness',
358
-        ],
359
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
360
-        'label' => __('Telephone Number', 'site-reviews'),
361
-        'placeholder' => '+1 (877) 273-3049',
362
-        'type' => 'text',
363
-    ],
364
-    'settings.schema.pricerange' => [
365
-        'default' => '',
366
-        'depends_on' => [
367
-            'settings.schema.type.default' => 'LocalBusiness',
368
-        ],
369
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
370
-        'label' => __('Price Range', 'site-reviews'),
371
-        'placeholder' => '$$-$$$',
372
-        'type' => 'text',
373
-    ],
374
-    'settings.schema.offertype' => [
375
-        'default' => 'AggregateOffer',
376
-        'depends_on' => [
377
-            'settings.schema.type.default' => 'Product',
378
-        ],
379
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
380
-        'label' => __('Offer Type', 'site-reviews'),
381
-        'options' => [
382
-            'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
383
-            'Offer' => __('Offer', 'site-reviews'),
384
-        ],
385
-        'type' => 'select',
386
-    ],
387
-    'settings.schema.price' => [
388
-        'default' => '',
389
-        'depends_on' => [
390
-            'settings.schema.type.default' => 'Product',
391
-            'settings.schema.offertype' => 'Offer',
392
-        ],
393
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
394
-        'label' => __('Price', 'site-reviews'),
395
-        'placeholder' => '50.00',
396
-        'type' => 'text',
397
-    ],
398
-    'settings.schema.lowprice' => [
399
-        'default' => '',
400
-        'depends_on' => [
401
-            'settings.schema.type.default' => 'Product',
402
-            'settings.schema.offertype' => 'AggregateOffer',
403
-        ],
404
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
405
-        'label' => __('Low Price', 'site-reviews'),
406
-        'placeholder' => '10.00',
407
-        'type' => 'text',
408
-    ],
409
-    'settings.schema.highprice' => [
410
-        'default' => '',
411
-        'depends_on' => [
412
-            'settings.schema.type.default' => 'Product',
413
-            'settings.schema.offertype' => 'AggregateOffer',
414
-        ],
415
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
416
-        'label' => __('High Price', 'site-reviews'),
417
-        'placeholder' => '100.00',
418
-        'type' => 'text',
419
-    ],
420
-    'settings.schema.pricecurrency' => [
421
-        'default' => '',
422
-        'depends_on' => [
423
-            'settings.schema.type.default' => 'Product',
424
-        ],
425
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
426
-        'label' => __('Price Currency', 'site-reviews'),
427
-        'placeholder' => 'USD',
428
-        'type' => 'text',
429
-    ],
430
-    'settings.submissions.required' => [
431
-        'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
432
-        'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
433
-        'label' => __('Required Fields', 'site-reviews'),
434
-        'options' => [
435
-            'rating' => __('Rating', 'site-reviews'),
436
-            'title' => __('Title', 'site-reviews'),
437
-            'content' => __('Review', 'site-reviews'),
438
-            'name' => __('Name', 'site-reviews'),
439
-            'email' => __('Email', 'site-reviews'),
440
-            'terms' => __('Terms', 'site-reviews'),
441
-        ],
442
-        'type' => 'checkbox',
443
-    ],
444
-    'settings.submissions.limit' => [
445
-        'default' => '',
446
-        'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
447
-        'label' => __('Limit Reviews', 'site-reviews'),
448
-        'options' => [
449
-            '' => __('No Limit', 'site-reviews'),
450
-            'email' => __('By Email Address', 'site-reviews'),
451
-            'ip_address' => __('By IP Address', 'site-reviews'),
452
-            'username' => __('By Username (will only work for registered users)', 'site-reviews'),
453
-        ],
454
-        'type' => 'select',
455
-    ],
456
-    'settings.submissions.limit_whitelist.email' => [
457
-        'default' => '',
458
-        'depends_on' => [
459
-            'settings.submissions.limit' => ['email'],
460
-        ],
461
-        'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
462
-        'label' => __('Email Whitelist', 'site-reviews'),
463
-        'rows' => 5,
464
-        'type' => 'code',
465
-    ],
466
-    'settings.submissions.limit_whitelist.ip_address' => [
467
-        'default' => '',
468
-        'depends_on' => [
469
-            'settings.submissions.limit' => ['ip_address'],
470
-        ],
471
-        'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
472
-        'label' => __('IP Address Whitelist', 'site-reviews'),
473
-        'rows' => 5,
474
-        'type' => 'code',
475
-    ],
476
-    'settings.submissions.limit_whitelist.username' => [
477
-        'default' => '',
478
-        'depends_on' => [
479
-            'settings.submissions.limit' => ['username'],
480
-        ],
481
-        'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
482
-        'label' => __('Username Whitelist', 'site-reviews'),
483
-        'rows' => 5,
484
-        'type' => 'code',
485
-    ],
486
-    'settings.submissions.recaptcha.integration' => [
487
-        'default' => '',
488
-        'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
489
-        'label' => __('Invisible reCAPTCHA', 'site-reviews'),
490
-        'options' => [
491
-            '' => 'Do not use reCAPTCHA',
492
-            'all' => 'Use reCAPTCHA',
493
-            'guest' => 'Use reCAPTCHA only for guest users',
494
-        ],
495
-        'type' => 'select',
496
-    ],
497
-    'settings.submissions.recaptcha.key' => [
498
-        'default' => '',
499
-        'depends_on' => [
500
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
501
-        ],
502
-        'label' => __('Site Key', 'site-reviews'),
503
-        'type' => 'text',
504
-    ],
505
-    'settings.submissions.recaptcha.secret' => [
506
-        'default' => '',
507
-        'depends_on' => [
508
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
509
-        ],
510
-        'label' => __('Site Secret', 'site-reviews'),
511
-        'type' => 'text',
512
-    ],
513
-    'settings.submissions.recaptcha.position' => [
514
-        'default' => 'bottomleft',
515
-        'depends_on' => [
516
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
517
-        ],
518
-        'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
519
-        'label' => __('Badge Position', 'site-reviews'),
520
-        'options' => [
521
-            'bottomleft' => 'Bottom Left',
522
-            'bottomright' => 'Bottom Right',
523
-            'inline' => 'Inline',
524
-        ],
525
-        'type' => 'select',
526
-    ],
527
-    'settings.submissions.akismet' => [
528
-        'default' => 'no',
529
-        'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
530
-        'label' => __('Enable Akismet Integration', 'site-reviews'),
531
-        'type' => 'yes_no',
532
-    ],
533
-    'settings.submissions.blacklist.integration' => [
534
-        'default' => '',
535
-        'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
536
-            '<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
537
-        ),
538
-        'label' => __('Blacklist', 'site-reviews'),
539
-        'options' => [
540
-            '' => 'Use the Site Reviews Blacklist',
541
-            'comments' => 'Use the WordPress Comment Blacklist',
542
-        ],
543
-        'type' => 'select',
544
-    ],
545
-    'settings.submissions.blacklist.entries' => [
546
-        'default' => '',
547
-        'depends_on' => [
548
-            'settings.submissions.blacklist.integration' => [''],
549
-        ],
550
-        'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
551
-        'label' => __('Review Blacklist', 'site-reviews'),
552
-        'rows' => 10,
553
-        'type' => 'code',
554
-    ],
555
-    'settings.submissions.blacklist.action' => [
556
-        'default' => 'unapprove',
557
-        'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
558
-        'label' => __('Blacklist Action', 'site-reviews'),
559
-        'options' => [
560
-            'unapprove' => __('Require approval', 'site-reviews'),
561
-            'reject' => __('Reject submission', 'site-reviews'),
562
-        ],
563
-        'type' => 'select',
564
-    ],
4
+	'settings.general.style' => [
5
+		'default' => 'default',
6
+		'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
+		'label' => __('Plugin Style', 'site-reviews'),
8
+		'options' => [
9
+			'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10
+			'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11
+			'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12
+			'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13
+			'wpforms' => 'Plugin: WPForms Lite (v1)',
14
+			'default' => __('Site Reviews (default)', 'site-reviews'),
15
+			'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
16
+			'divi' => 'Theme: Divi (v3)',
17
+			'materialize' => 'Theme: Materialize',
18
+			'twentyfifteen' => 'Theme: Twenty Fifteen',
19
+			'twentyseventeen' => 'Theme: Twenty Seventeen',
20
+			'twentynineteen' => 'Theme: Twenty Nineteen',
21
+		],
22
+		'type' => 'select',
23
+	],
24
+	'settings.general.require.approval' => [
25
+		'default' => 'no',
26
+		'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
+		'label' => __('Require Approval', 'site-reviews'),
28
+		'type' => 'yes_no',
29
+	],
30
+	'settings.general.require.login' => [
31
+		'default' => 'no',
32
+		'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
+		'label' => __('Require Login', 'site-reviews'),
34
+		'type' => 'yes_no',
35
+	],
36
+	'settings.general.require.login_register' => [
37
+		'default' => 'no',
38
+		'depends_on' => [
39
+			'settings.general.require.login' => 'yes',
40
+		],
41
+		'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
+			'<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
43
+		),
44
+		'label' => __('Show Registration Link', 'site-reviews'),
45
+		'type' => 'yes_no',
46
+	],
47
+	'settings.general.multilingual' => [
48
+		'default' => '',
49
+		'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
+		'label' => __('Multilingual', 'site-reviews'),
51
+		'options' => [
52
+			'' => __('No Integration', 'site-reviews'),
53
+			'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
+			'wpml' => __('Integrate with WPML', 'site-reviews'),
55
+		],
56
+		'type' => 'select',
57
+	],
58
+	'settings.general.trustalyze' => [
59
+		'default' => 'no',
60
+		'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
61
+			'<a href="https://trustalyze.com/plans?ref=105" target="_blank">Trustalyze Confidence System</a>'
62
+		),
63
+		'label' => __('Blockchain Validation', 'site-reviews'),
64
+		'type' => 'yes_no',
65
+	],
66
+	'settings.general.trustalyze_email' => [
67
+		'default' => '',
68
+		'depends_on' => [
69
+			'settings.general.trustalyze' => ['yes'],
70
+		],
71
+		'description' => __('Enter your Trustalyze account email here.', 'site-reviews'),
72
+		'label' => __('Trustalyze Email', 'site-reviews'),
73
+		'type' => 'text',
74
+	],
75
+	'settings.general.trustalyze_serial' => [
76
+		'default' => '',
77
+		'depends_on' => [
78
+			'settings.general.trustalyze' => ['yes'],
79
+		],
80
+		'description' => __('Enter your Trustalyze account serial key here.', 'site-reviews'),
81
+		'label' => __('Trustalyze Serial Key', 'site-reviews'),
82
+		'type' => 'password',
83
+	],
84
+	'settings.general.notifications' => [
85
+		'default' => [],
86
+		'label' => __('Notifications', 'site-reviews'),
87
+		'options' => [
88
+			'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
+			'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
+			'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
+			'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
92
+		],
93
+		'type' => 'checkbox',
94
+	],
95
+	'settings.general.notification_email' => [
96
+		'default' => '',
97
+		'depends_on' => [
98
+			'settings.general.notifications' => ['custom'],
99
+		],
100
+		'label' => __('Send Notification Emails To', 'site-reviews'),
101
+		'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
102
+		'type' => 'text',
103
+	],
104
+	'settings.general.notification_slack' => [
105
+		'default' => '',
106
+		'depends_on' => [
107
+			'settings.general.notifications' => ['slack'],
108
+		],
109
+		'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
+			'<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
111
+		),
112
+		'label' => __('Slack Webhook URL', 'site-reviews'),
113
+		'type' => 'text',
114
+	],
115
+	'settings.general.notification_message' => [
116
+		'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
117
+		'depends_on' => [
118
+			'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119
+		],
120
+		'description' => __(
121
+			'To restore the default text, save an empty template. '.
122
+			'If you are sending notifications to Slack then this template will only be used as a fallback in the event that <a href="https://api.slack.com/docs/attachments">Message Attachments</a> have been disabled. Available template tags:'.
123
+			'<br><code>{review_rating}</code> The review rating number (1-5)'.
124
+			'<br><code>{review_title}</code> The review title'.
125
+			'<br><code>{review_content}</code> The review content'.
126
+			'<br><code>{review_author}</code> The review author'.
127
+			'<br><code>{review_email}</code> The email of the review author'.
128
+			'<br><code>{review_ip}</code> The IP address of the review author'.
129
+			'<br><code>{review_link}</code> The link to edit/view a review',
130
+			'site-reviews'
131
+		),
132
+		'label' => __('Notification Template', 'site-reviews'),
133
+		'rows' => 10,
134
+		'type' => 'code',
135
+	],
136
+	'settings.reviews.date.format' => [
137
+		'default' => '',
138
+		'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
+			'<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
140
+		),
141
+		'label' => __('Date Format', 'site-reviews'),
142
+		'options' => [
143
+			'' => __('Use the default date format', 'site-reviews'),
144
+			'relative' => __('Use a relative date format', 'site-reviews'),
145
+			'custom' => __('Use a custom date format', 'site-reviews'),
146
+		],
147
+		'type' => 'select',
148
+	],
149
+	'settings.reviews.date.custom' => [
150
+		'default' => get_option('date_format'),
151
+		'depends_on' => [
152
+			'settings.reviews.date.format' => 'custom',
153
+		],
154
+		'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
+		'label' => __('Custom Date Format', 'site-reviews'),
156
+		'type' => 'text',
157
+	],
158
+	'settings.reviews.name.format' => [
159
+		'default' => '',
160
+		'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
+		'label' => __('Name Format', 'site-reviews'),
162
+		'options' => [
163
+			'' => __('Use the name as given', 'site-reviews'),
164
+			'first' => __('Use the first name only', 'site-reviews'),
165
+			'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
+			'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
+			'initials' => __('Convert to all initials', 'site-reviews'),
168
+		],
169
+		'type' => 'select',
170
+	],
171
+	'settings.reviews.name.initial' => [
172
+		'default' => '',
173
+		'depends_on' => [
174
+			'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175
+		],
176
+		'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
+		'label' => __('Initial Format', 'site-reviews'),
178
+		'options' => [
179
+			'' => __('Initial with a space', 'site-reviews'),
180
+			'period' => __('Initial with a period', 'site-reviews'),
181
+			'period_space' => __('Initial with a period and a space', 'site-reviews'),
182
+		],
183
+		'type' => 'select',
184
+	],
185
+	'settings.reviews.assigned_links' => [
186
+		'default' => 'no',
187
+		'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
+		'label' => __('Enable Assigned Links', 'site-reviews'),
189
+		'type' => 'yes_no',
190
+	],
191
+	'settings.reviews.avatars' => [
192
+		'default' => 'no',
193
+		'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
+		'label' => __('Enable Avatars', 'site-reviews'),
195
+		'type' => 'yes_no',
196
+	],
197
+	'settings.reviews.avatars_regenerate' => [
198
+		'default' => 'no',
199
+		'depends_on' => [
200
+			'settings.reviews.avatars' => 'yes',
201
+		],
202
+		'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
+		'label' => __('Regenerate Avatars', 'site-reviews'),
204
+		'type' => 'yes_no',
205
+	],
206
+	'settings.reviews.avatars_size' => [
207
+		'default' => 40,
208
+		'depends_on' => [
209
+			'settings.reviews.avatars' => 'yes',
210
+		],
211
+		'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
+		'label' => __('Avatar Size', 'site-reviews'),
213
+		'type' => 'number',
214
+	],
215
+	'settings.reviews.excerpts' => [
216
+		'default' => 'yes',
217
+		'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
+		'label' => __('Enable Excerpts', 'site-reviews'),
219
+		'type' => 'yes_no',
220
+	],
221
+	'settings.reviews.excerpts_length' => [
222
+		'default' => 55,
223
+		'depends_on' => [
224
+			'settings.reviews.excerpts' => 'yes',
225
+		],
226
+		'description' => __('Set the excerpt word length.', 'site-reviews'),
227
+		'label' => __('Excerpt Length', 'site-reviews'),
228
+		'type' => 'number',
229
+	],
230
+	'settings.reviews.fallback' => [
231
+		'default' => 'yes',
232
+		'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
+			'<a href="'.admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-translations').'">'.__('Translations', 'site-reviews').'</a>',
234
+			'<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
235
+		),
236
+		'label' => __('Enable Fallback Text', 'site-reviews'),
237
+		'type' => 'yes_no',
238
+	],
239
+	'settings.reviews.pagination.url_parameter' => [
240
+		'default' => 'yes',
241
+		'description' => sprintf(
242
+			_x('Paginated URLs include the %s URL parameter. If you would like to keep the pagination links but prevent search engines from indexing them, add the following lines to your %s file instead: %s', 'admin-text', 'site-reviews'),
243
+			'<code>?'.glsr()->constant('PAGED_QUERY_VAR').'={page_number}</code>',
244
+			'<a href="https://www.robotstxt.org/">robots.txt</a>',
245
+			'<br><code>user-agent: *</code>'.
246
+			'<br><code>Disallow: /*?'.glsr()->constant('PAGED_QUERY_VAR').'=*</code>'.
247
+			'<br><code>Disallow: /*?*'.glsr()->constant('PAGED_QUERY_VAR').'=*</code>'
248
+		),
249
+		'label' => esc_html_x('Enable Paginated URLs', 'admin-text', 'site-reviews'),
250
+		'type' => 'yes_no',
251
+	],
252
+	'settings.schema.type.default' => [
253
+		'default' => 'LocalBusiness',
254
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
255
+		'label' => __('Default Schema Type', 'site-reviews'),
256
+		'options' => [
257
+			'LocalBusiness' => __('Local Business', 'site-reviews'),
258
+			'Product' => __('Product', 'site-reviews'),
259
+			'custom' => __('Custom', 'site-reviews'),
260
+		],
261
+		'type' => 'select',
262
+	],
263
+	'settings.schema.type.custom' => [
264
+		'default' => '',
265
+		'depends_on' => [
266
+			'settings.schema.type.default' => 'custom',
267
+		],
268
+		'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
269
+		'label' => __('Custom Schema Type', 'site-reviews'),
270
+		'type' => 'text',
271
+	],
272
+	'settings.schema.name.default' => [
273
+		'default' => 'post',
274
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
275
+		'label' => __('Default Name', 'site-reviews'),
276
+		'options' => [
277
+			'post' => __('Use the assigned or current page title', 'site-reviews'),
278
+			'custom' => __('Enter a custom title', 'site-reviews'),
279
+		],
280
+		'type' => 'select',
281
+	],
282
+	'settings.schema.name.custom' => [
283
+		'default' => '',
284
+		'depends_on' => [
285
+			'settings.schema.name.default' => 'custom',
286
+		],
287
+		'label' => __('Custom Name', 'site-reviews'),
288
+		'type' => 'text',
289
+	],
290
+	'settings.schema.description.default' => [
291
+		'default' => 'post',
292
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
293
+		'label' => __('Default Description', 'site-reviews'),
294
+		'options' => [
295
+			'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
296
+			'custom' => __('Enter a custom description', 'site-reviews'),
297
+		],
298
+		'type' => 'select',
299
+	],
300
+	'settings.schema.description.custom' => [
301
+		'default' => '',
302
+		'depends_on' => [
303
+			'settings.schema.description.default' => 'custom',
304
+		],
305
+		'label' => __('Custom Description', 'site-reviews'),
306
+		'type' => 'text',
307
+	],
308
+	'settings.schema.url.default' => [
309
+		'default' => 'post',
310
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
311
+		'label' => __('Default URL', 'site-reviews'),
312
+		'options' => [
313
+			'post' => __('Use the assigned or current page URL', 'site-reviews'),
314
+			'custom' => __('Enter a custom URL', 'site-reviews'),
315
+		],
316
+		'type' => 'select',
317
+	],
318
+	'settings.schema.url.custom' => [
319
+		'default' => '',
320
+		'depends_on' => [
321
+			'settings.schema.url.default' => 'custom',
322
+		],
323
+		'label' => __('Custom URL', 'site-reviews'),
324
+		'type' => 'text',
325
+	],
326
+	'settings.schema.image.default' => [
327
+		'default' => 'post',
328
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
329
+		'label' => __('Default Image', 'site-reviews'),
330
+		'options' => [
331
+			'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
332
+			'custom' => __('Enter a custom image URL', 'site-reviews'),
333
+		],
334
+		'type' => 'select',
335
+	],
336
+	'settings.schema.image.custom' => [
337
+		'default' => '',
338
+		'depends_on' => [
339
+			'settings.schema.image.default' => 'custom',
340
+		],
341
+		'label' => __('Custom Image URL', 'site-reviews'),
342
+		'type' => 'text',
343
+	],
344
+	'settings.schema.address' => [
345
+		'default' => '',
346
+		'depends_on' => [
347
+			'settings.schema.type.default' => 'LocalBusiness',
348
+		],
349
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
350
+		'label' => __('Address', 'site-reviews'),
351
+		'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
352
+		'type' => 'text',
353
+	],
354
+	'settings.schema.telephone' => [
355
+		'default' => '',
356
+		'depends_on' => [
357
+			'settings.schema.type.default' => 'LocalBusiness',
358
+		],
359
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
360
+		'label' => __('Telephone Number', 'site-reviews'),
361
+		'placeholder' => '+1 (877) 273-3049',
362
+		'type' => 'text',
363
+	],
364
+	'settings.schema.pricerange' => [
365
+		'default' => '',
366
+		'depends_on' => [
367
+			'settings.schema.type.default' => 'LocalBusiness',
368
+		],
369
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
370
+		'label' => __('Price Range', 'site-reviews'),
371
+		'placeholder' => '$$-$$$',
372
+		'type' => 'text',
373
+	],
374
+	'settings.schema.offertype' => [
375
+		'default' => 'AggregateOffer',
376
+		'depends_on' => [
377
+			'settings.schema.type.default' => 'Product',
378
+		],
379
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
380
+		'label' => __('Offer Type', 'site-reviews'),
381
+		'options' => [
382
+			'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
383
+			'Offer' => __('Offer', 'site-reviews'),
384
+		],
385
+		'type' => 'select',
386
+	],
387
+	'settings.schema.price' => [
388
+		'default' => '',
389
+		'depends_on' => [
390
+			'settings.schema.type.default' => 'Product',
391
+			'settings.schema.offertype' => 'Offer',
392
+		],
393
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
394
+		'label' => __('Price', 'site-reviews'),
395
+		'placeholder' => '50.00',
396
+		'type' => 'text',
397
+	],
398
+	'settings.schema.lowprice' => [
399
+		'default' => '',
400
+		'depends_on' => [
401
+			'settings.schema.type.default' => 'Product',
402
+			'settings.schema.offertype' => 'AggregateOffer',
403
+		],
404
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
405
+		'label' => __('Low Price', 'site-reviews'),
406
+		'placeholder' => '10.00',
407
+		'type' => 'text',
408
+	],
409
+	'settings.schema.highprice' => [
410
+		'default' => '',
411
+		'depends_on' => [
412
+			'settings.schema.type.default' => 'Product',
413
+			'settings.schema.offertype' => 'AggregateOffer',
414
+		],
415
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
416
+		'label' => __('High Price', 'site-reviews'),
417
+		'placeholder' => '100.00',
418
+		'type' => 'text',
419
+	],
420
+	'settings.schema.pricecurrency' => [
421
+		'default' => '',
422
+		'depends_on' => [
423
+			'settings.schema.type.default' => 'Product',
424
+		],
425
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
426
+		'label' => __('Price Currency', 'site-reviews'),
427
+		'placeholder' => 'USD',
428
+		'type' => 'text',
429
+	],
430
+	'settings.submissions.required' => [
431
+		'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
432
+		'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
433
+		'label' => __('Required Fields', 'site-reviews'),
434
+		'options' => [
435
+			'rating' => __('Rating', 'site-reviews'),
436
+			'title' => __('Title', 'site-reviews'),
437
+			'content' => __('Review', 'site-reviews'),
438
+			'name' => __('Name', 'site-reviews'),
439
+			'email' => __('Email', 'site-reviews'),
440
+			'terms' => __('Terms', 'site-reviews'),
441
+		],
442
+		'type' => 'checkbox',
443
+	],
444
+	'settings.submissions.limit' => [
445
+		'default' => '',
446
+		'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
447
+		'label' => __('Limit Reviews', 'site-reviews'),
448
+		'options' => [
449
+			'' => __('No Limit', 'site-reviews'),
450
+			'email' => __('By Email Address', 'site-reviews'),
451
+			'ip_address' => __('By IP Address', 'site-reviews'),
452
+			'username' => __('By Username (will only work for registered users)', 'site-reviews'),
453
+		],
454
+		'type' => 'select',
455
+	],
456
+	'settings.submissions.limit_whitelist.email' => [
457
+		'default' => '',
458
+		'depends_on' => [
459
+			'settings.submissions.limit' => ['email'],
460
+		],
461
+		'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
462
+		'label' => __('Email Whitelist', 'site-reviews'),
463
+		'rows' => 5,
464
+		'type' => 'code',
465
+	],
466
+	'settings.submissions.limit_whitelist.ip_address' => [
467
+		'default' => '',
468
+		'depends_on' => [
469
+			'settings.submissions.limit' => ['ip_address'],
470
+		],
471
+		'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
472
+		'label' => __('IP Address Whitelist', 'site-reviews'),
473
+		'rows' => 5,
474
+		'type' => 'code',
475
+	],
476
+	'settings.submissions.limit_whitelist.username' => [
477
+		'default' => '',
478
+		'depends_on' => [
479
+			'settings.submissions.limit' => ['username'],
480
+		],
481
+		'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
482
+		'label' => __('Username Whitelist', 'site-reviews'),
483
+		'rows' => 5,
484
+		'type' => 'code',
485
+	],
486
+	'settings.submissions.recaptcha.integration' => [
487
+		'default' => '',
488
+		'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
489
+		'label' => __('Invisible reCAPTCHA', 'site-reviews'),
490
+		'options' => [
491
+			'' => 'Do not use reCAPTCHA',
492
+			'all' => 'Use reCAPTCHA',
493
+			'guest' => 'Use reCAPTCHA only for guest users',
494
+		],
495
+		'type' => 'select',
496
+	],
497
+	'settings.submissions.recaptcha.key' => [
498
+		'default' => '',
499
+		'depends_on' => [
500
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
501
+		],
502
+		'label' => __('Site Key', 'site-reviews'),
503
+		'type' => 'text',
504
+	],
505
+	'settings.submissions.recaptcha.secret' => [
506
+		'default' => '',
507
+		'depends_on' => [
508
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
509
+		],
510
+		'label' => __('Site Secret', 'site-reviews'),
511
+		'type' => 'text',
512
+	],
513
+	'settings.submissions.recaptcha.position' => [
514
+		'default' => 'bottomleft',
515
+		'depends_on' => [
516
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
517
+		],
518
+		'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
519
+		'label' => __('Badge Position', 'site-reviews'),
520
+		'options' => [
521
+			'bottomleft' => 'Bottom Left',
522
+			'bottomright' => 'Bottom Right',
523
+			'inline' => 'Inline',
524
+		],
525
+		'type' => 'select',
526
+	],
527
+	'settings.submissions.akismet' => [
528
+		'default' => 'no',
529
+		'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
530
+		'label' => __('Enable Akismet Integration', 'site-reviews'),
531
+		'type' => 'yes_no',
532
+	],
533
+	'settings.submissions.blacklist.integration' => [
534
+		'default' => '',
535
+		'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
536
+			'<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
537
+		),
538
+		'label' => __('Blacklist', 'site-reviews'),
539
+		'options' => [
540
+			'' => 'Use the Site Reviews Blacklist',
541
+			'comments' => 'Use the WordPress Comment Blacklist',
542
+		],
543
+		'type' => 'select',
544
+	],
545
+	'settings.submissions.blacklist.entries' => [
546
+		'default' => '',
547
+		'depends_on' => [
548
+			'settings.submissions.blacklist.integration' => [''],
549
+		],
550
+		'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
551
+		'label' => __('Review Blacklist', 'site-reviews'),
552
+		'rows' => 10,
553
+		'type' => 'code',
554
+	],
555
+	'settings.submissions.blacklist.action' => [
556
+		'default' => 'unapprove',
557
+		'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
558
+		'label' => __('Blacklist Action', 'site-reviews'),
559
+		'options' => [
560
+			'unapprove' => __('Require approval', 'site-reviews'),
561
+			'reject' => __('Reject submission', 'site-reviews'),
562
+		],
563
+		'type' => 'select',
564
+	],
565 565
 ];
Please login to merge, or discard this patch.
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 return [
4 4
     'settings.general.style' => [
5 5
         'default' => 'default',
6
-        'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
-        'label' => __('Plugin Style', 'site-reviews'),
6
+        'description' => __( 'Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews' ),
7
+        'label' => __( 'Plugin Style', 'site-reviews' ),
8 8
         'options' => [
9 9
             'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10 10
             'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11 11
             'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12 12
             'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13 13
             'wpforms' => 'Plugin: WPForms Lite (v1)',
14
-            'default' => __('Site Reviews (default)', 'site-reviews'),
15
-            'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
14
+            'default' => __( 'Site Reviews (default)', 'site-reviews' ),
15
+            'minimal' => __( 'Site Reviews (minimal)', 'site-reviews' ),
16 16
             'divi' => 'Theme: Divi (v3)',
17 17
             'materialize' => 'Theme: Materialize',
18 18
             'twentyfifteen' => 'Theme: Twenty Fifteen',
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
     ],
24 24
     'settings.general.require.approval' => [
25 25
         'default' => 'no',
26
-        'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
-        'label' => __('Require Approval', 'site-reviews'),
26
+        'description' => __( 'Set the status of new review submissions to "unapproved".', 'site-reviews' ),
27
+        'label' => __( 'Require Approval', 'site-reviews' ),
28 28
         'type' => 'yes_no',
29 29
     ],
30 30
     'settings.general.require.login' => [
31 31
         'default' => 'no',
32
-        'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
-        'label' => __('Require Login', 'site-reviews'),
32
+        'description' => __( 'Only allow review submissions from registered users.', 'site-reviews' ),
33
+        'label' => __( 'Require Login', 'site-reviews' ),
34 34
         'type' => 'yes_no',
35 35
     ],
36 36
     'settings.general.require.login_register' => [
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
         'depends_on' => [
39 39
             'settings.general.require.login' => 'yes',
40 40
         ],
41
-        'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
-            '<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
41
+        'description' => sprintf( __( 'Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews' ),
42
+            '<a href="'.admin_url( 'options-general.php#users_can_register' ).'">'.__( 'Anyone can register', 'site-reviews' ).'</a>'
43 43
         ),
44
-        'label' => __('Show Registration Link', 'site-reviews'),
44
+        'label' => __( 'Show Registration Link', 'site-reviews' ),
45 45
         'type' => 'yes_no',
46 46
     ],
47 47
     'settings.general.multilingual' => [
48 48
         'default' => '',
49
-        'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
-        'label' => __('Multilingual', 'site-reviews'),
49
+        'description' => __( 'Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews' ),
50
+        'label' => __( 'Multilingual', 'site-reviews' ),
51 51
         'options' => [
52
-            '' => __('No Integration', 'site-reviews'),
53
-            'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
-            'wpml' => __('Integrate with WPML', 'site-reviews'),
52
+            '' => __( 'No Integration', 'site-reviews' ),
53
+            'polylang' => __( 'Integrate with Polylang', 'site-reviews' ),
54
+            'wpml' => __( 'Integrate with WPML', 'site-reviews' ),
55 55
         ],
56 56
         'type' => 'select',
57 57
     ],
58 58
     'settings.general.trustalyze' => [
59 59
         'default' => 'no',
60
-        'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
60
+        'description' => sprintf( __( 'Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews' ),
61 61
             '<a href="https://trustalyze.com/plans?ref=105" target="_blank">Trustalyze Confidence System</a>'
62 62
         ),
63
-        'label' => __('Blockchain Validation', 'site-reviews'),
63
+        'label' => __( 'Blockchain Validation', 'site-reviews' ),
64 64
         'type' => 'yes_no',
65 65
     ],
66 66
     'settings.general.trustalyze_email' => [
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
         'depends_on' => [
69 69
             'settings.general.trustalyze' => ['yes'],
70 70
         ],
71
-        'description' => __('Enter your Trustalyze account email here.', 'site-reviews'),
72
-        'label' => __('Trustalyze Email', 'site-reviews'),
71
+        'description' => __( 'Enter your Trustalyze account email here.', 'site-reviews' ),
72
+        'label' => __( 'Trustalyze Email', 'site-reviews' ),
73 73
         'type' => 'text',
74 74
     ],
75 75
     'settings.general.trustalyze_serial' => [
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
         'depends_on' => [
78 78
             'settings.general.trustalyze' => ['yes'],
79 79
         ],
80
-        'description' => __('Enter your Trustalyze account serial key here.', 'site-reviews'),
81
-        'label' => __('Trustalyze Serial Key', 'site-reviews'),
80
+        'description' => __( 'Enter your Trustalyze account serial key here.', 'site-reviews' ),
81
+        'label' => __( 'Trustalyze Serial Key', 'site-reviews' ),
82 82
         'type' => 'password',
83 83
     ],
84 84
     'settings.general.notifications' => [
85 85
         'default' => [],
86
-        'label' => __('Notifications', 'site-reviews'),
86
+        'label' => __( 'Notifications', 'site-reviews' ),
87 87
         'options' => [
88
-            'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
-            'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
-            'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
-            'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
88
+            'admin' => __( 'Send to administrator', 'site-reviews' ).' <code>'.(string)get_option( 'admin_email' ).'</code>',
89
+            'author' => __( 'Send to author of the page that the review is assigned to', 'site-reviews' ),
90
+            'custom' => __( 'Send to one or more email addresses', 'site-reviews' ),
91
+            'slack' => __( 'Send to <a href="https://slack.com/">Slack</a>', 'site-reviews' ),
92 92
         ],
93 93
         'type' => 'checkbox',
94 94
     ],
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
         'depends_on' => [
98 98
             'settings.general.notifications' => ['custom'],
99 99
         ],
100
-        'label' => __('Send Notification Emails To', 'site-reviews'),
101
-        'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
100
+        'label' => __( 'Send Notification Emails To', 'site-reviews' ),
101
+        'placeholder' => __( 'Separate multiple emails with a comma', 'site-reviews' ),
102 102
         'type' => 'text',
103 103
     ],
104 104
     'settings.general.notification_slack' => [
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
         'depends_on' => [
107 107
             'settings.general.notifications' => ['slack'],
108 108
         ],
109
-        'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
-            '<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
109
+        'description' => sprintf( __( 'To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews' ),
110
+            '<a href="https://api.slack.com/incoming-webhooks">'.__( 'Incoming WebHook', 'site-reviews' ).'</a>'
111 111
         ),
112
-        'label' => __('Slack Webhook URL', 'site-reviews'),
112
+        'label' => __( 'Slack Webhook URL', 'site-reviews' ),
113 113
         'type' => 'text',
114 114
     ],
115 115
     'settings.general.notification_message' => [
116
-        'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
116
+        'default' => glsr( 'Modules\Html\Template' )->build( 'templates/email-notification' ),
117 117
         'depends_on' => [
118 118
             'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119 119
         ],
@@ -129,42 +129,42 @@  discard block
 block discarded – undo
129 129
             '<br><code>{review_link}</code> The link to edit/view a review',
130 130
             'site-reviews'
131 131
         ),
132
-        'label' => __('Notification Template', 'site-reviews'),
132
+        'label' => __( 'Notification Template', 'site-reviews' ),
133 133
         'rows' => 10,
134 134
         'type' => 'code',
135 135
     ],
136 136
     'settings.reviews.date.format' => [
137 137
         'default' => '',
138
-        'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
-            '<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
138
+        'description' => sprintf( __( 'The default date format is the one set in your %s.', 'site-reviews' ),
139
+            '<a href="'.admin_url( 'options-general.php#date_format_custom' ).'">'.__( 'WordPress settings', 'site-reviews' ).'</a>'
140 140
         ),
141
-        'label' => __('Date Format', 'site-reviews'),
141
+        'label' => __( 'Date Format', 'site-reviews' ),
142 142
         'options' => [
143
-            '' => __('Use the default date format', 'site-reviews'),
144
-            'relative' => __('Use a relative date format', 'site-reviews'),
145
-            'custom' => __('Use a custom date format', 'site-reviews'),
143
+            '' => __( 'Use the default date format', 'site-reviews' ),
144
+            'relative' => __( 'Use a relative date format', 'site-reviews' ),
145
+            'custom' => __( 'Use a custom date format', 'site-reviews' ),
146 146
         ],
147 147
         'type' => 'select',
148 148
     ],
149 149
     'settings.reviews.date.custom' => [
150
-        'default' => get_option('date_format'),
150
+        'default' => get_option( 'date_format' ),
151 151
         'depends_on' => [
152 152
             'settings.reviews.date.format' => 'custom',
153 153
         ],
154
-        'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
-        'label' => __('Custom Date Format', 'site-reviews'),
154
+        'description' => __( 'Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews' ),
155
+        'label' => __( 'Custom Date Format', 'site-reviews' ),
156 156
         'type' => 'text',
157 157
     ],
158 158
     'settings.reviews.name.format' => [
159 159
         'default' => '',
160
-        'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
-        'label' => __('Name Format', 'site-reviews'),
160
+        'description' => __( 'Choose how names are shown in your reviews.', 'site-reviews' ),
161
+        'label' => __( 'Name Format', 'site-reviews' ),
162 162
         'options' => [
163
-            '' => __('Use the name as given', 'site-reviews'),
164
-            'first' => __('Use the first name only', 'site-reviews'),
165
-            'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
-            'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
-            'initials' => __('Convert to all initials', 'site-reviews'),
163
+            '' => __( 'Use the name as given', 'site-reviews' ),
164
+            'first' => __( 'Use the first name only', 'site-reviews' ),
165
+            'first_initial' => __( 'Convert first name to an initial', 'site-reviews' ),
166
+            'last_initial' => __( 'Convert last name to an initial', 'site-reviews' ),
167
+            'initials' => __( 'Convert to all initials', 'site-reviews' ),
168 168
         ],
169 169
         'type' => 'select',
170 170
     ],
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
         'depends_on' => [
174 174
             'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175 175
         ],
176
-        'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
-        'label' => __('Initial Format', 'site-reviews'),
176
+        'description' => __( 'Choose how the initial is displayed.', 'site-reviews' ),
177
+        'label' => __( 'Initial Format', 'site-reviews' ),
178 178
         'options' => [
179
-            '' => __('Initial with a space', 'site-reviews'),
180
-            'period' => __('Initial with a period', 'site-reviews'),
181
-            'period_space' => __('Initial with a period and a space', 'site-reviews'),
179
+            '' => __( 'Initial with a space', 'site-reviews' ),
180
+            'period' => __( 'Initial with a period', 'site-reviews' ),
181
+            'period_space' => __( 'Initial with a period and a space', 'site-reviews' ),
182 182
         ],
183 183
         'type' => 'select',
184 184
     ],
185 185
     'settings.reviews.assigned_links' => [
186 186
         'default' => 'no',
187
-        'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
-        'label' => __('Enable Assigned Links', 'site-reviews'),
187
+        'description' => __( 'Display a link to the assigned post of a review.', 'site-reviews' ),
188
+        'label' => __( 'Enable Assigned Links', 'site-reviews' ),
189 189
         'type' => 'yes_no',
190 190
     ],
191 191
     'settings.reviews.avatars' => [
192 192
         'default' => 'no',
193
-        'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
-        'label' => __('Enable Avatars', 'site-reviews'),
193
+        'description' => __( 'Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews' ),
194
+        'label' => __( 'Enable Avatars', 'site-reviews' ),
195 195
         'type' => 'yes_no',
196 196
     ],
197 197
     'settings.reviews.avatars_regenerate' => [
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
         'depends_on' => [
200 200
             'settings.reviews.avatars' => 'yes',
201 201
         ],
202
-        'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
-        'label' => __('Regenerate Avatars', 'site-reviews'),
202
+        'description' => __( 'Regenerate the avatar whenever a local review is shown?', 'site-reviews' ),
203
+        'label' => __( 'Regenerate Avatars', 'site-reviews' ),
204 204
         'type' => 'yes_no',
205 205
     ],
206 206
     'settings.reviews.avatars_size' => [
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
         'depends_on' => [
209 209
             'settings.reviews.avatars' => 'yes',
210 210
         ],
211
-        'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
-        'label' => __('Avatar Size', 'site-reviews'),
211
+        'description' => __( 'Set the avatar size in pixels.', 'site-reviews' ),
212
+        'label' => __( 'Avatar Size', 'site-reviews' ),
213 213
         'type' => 'number',
214 214
     ],
215 215
     'settings.reviews.excerpts' => [
216 216
         'default' => 'yes',
217
-        'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
-        'label' => __('Enable Excerpts', 'site-reviews'),
217
+        'description' => __( 'Display an excerpt instead of the full review.', 'site-reviews' ),
218
+        'label' => __( 'Enable Excerpts', 'site-reviews' ),
219 219
         'type' => 'yes_no',
220 220
     ],
221 221
     'settings.reviews.excerpts_length' => [
@@ -223,40 +223,40 @@  discard block
 block discarded – undo
223 223
         'depends_on' => [
224 224
             'settings.reviews.excerpts' => 'yes',
225 225
         ],
226
-        'description' => __('Set the excerpt word length.', 'site-reviews'),
227
-        'label' => __('Excerpt Length', 'site-reviews'),
226
+        'description' => __( 'Set the excerpt word length.', 'site-reviews' ),
227
+        'label' => __( 'Excerpt Length', 'site-reviews' ),
228 228
         'type' => 'number',
229 229
     ],
230 230
     'settings.reviews.fallback' => [
231 231
         'default' => 'yes',
232
-        'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
-            '<a href="'.admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-translations').'">'.__('Translations', 'site-reviews').'</a>',
234
-            '<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
232
+        'description' => sprintf( __( 'Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews' ),
233
+            '<a href="'.admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#tab-translations' ).'">'.__( 'Translations', 'site-reviews' ).'</a>',
234
+            '<code>'.__( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' ).'</code>'
235 235
         ),
236
-        'label' => __('Enable Fallback Text', 'site-reviews'),
236
+        'label' => __( 'Enable Fallback Text', 'site-reviews' ),
237 237
         'type' => 'yes_no',
238 238
     ],
239 239
     'settings.reviews.pagination.url_parameter' => [
240 240
         'default' => 'yes',
241 241
         'description' => sprintf(
242
-            _x('Paginated URLs include the %s URL parameter. If you would like to keep the pagination links but prevent search engines from indexing them, add the following lines to your %s file instead: %s', 'admin-text', 'site-reviews'),
243
-            '<code>?'.glsr()->constant('PAGED_QUERY_VAR').'={page_number}</code>',
242
+            _x( 'Paginated URLs include the %s URL parameter. If you would like to keep the pagination links but prevent search engines from indexing them, add the following lines to your %s file instead: %s', 'admin-text', 'site-reviews' ),
243
+            '<code>?'.glsr()->constant( 'PAGED_QUERY_VAR' ).'={page_number}</code>',
244 244
             '<a href="https://www.robotstxt.org/">robots.txt</a>',
245 245
             '<br><code>user-agent: *</code>'.
246
-            '<br><code>Disallow: /*?'.glsr()->constant('PAGED_QUERY_VAR').'=*</code>'.
247
-            '<br><code>Disallow: /*?*'.glsr()->constant('PAGED_QUERY_VAR').'=*</code>'
246
+            '<br><code>Disallow: /*?'.glsr()->constant( 'PAGED_QUERY_VAR' ).'=*</code>'.
247
+            '<br><code>Disallow: /*?*'.glsr()->constant( 'PAGED_QUERY_VAR' ).'=*</code>'
248 248
         ),
249
-        'label' => esc_html_x('Enable Paginated URLs', 'admin-text', 'site-reviews'),
249
+        'label' => esc_html_x( 'Enable Paginated URLs', 'admin-text', 'site-reviews' ),
250 250
         'type' => 'yes_no',
251 251
     ],
252 252
     'settings.schema.type.default' => [
253 253
         'default' => 'LocalBusiness',
254
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
255
-        'label' => __('Default Schema Type', 'site-reviews'),
254
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_type</code>',
255
+        'label' => __( 'Default Schema Type', 'site-reviews' ),
256 256
         'options' => [
257
-            'LocalBusiness' => __('Local Business', 'site-reviews'),
258
-            'Product' => __('Product', 'site-reviews'),
259
-            'custom' => __('Custom', 'site-reviews'),
257
+            'LocalBusiness' => __( 'Local Business', 'site-reviews' ),
258
+            'Product' => __( 'Product', 'site-reviews' ),
259
+            'custom' => __( 'Custom', 'site-reviews' ),
260 260
         ],
261 261
         'type' => 'select',
262 262
     ],
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
         'depends_on' => [
266 266
             'settings.schema.type.default' => 'custom',
267 267
         ],
268
-        'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
269
-        'label' => __('Custom Schema Type', 'site-reviews'),
268
+        'description' => '<a href="https://schema.org/docs/schemas.html">'.__( 'View more information on schema types here', 'site-reviews' ).'</a>',
269
+        'label' => __( 'Custom Schema Type', 'site-reviews' ),
270 270
         'type' => 'text',
271 271
     ],
272 272
     'settings.schema.name.default' => [
273 273
         'default' => 'post',
274
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
275
-        'label' => __('Default Name', 'site-reviews'),
274
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_name</code>',
275
+        'label' => __( 'Default Name', 'site-reviews' ),
276 276
         'options' => [
277
-            'post' => __('Use the assigned or current page title', 'site-reviews'),
278
-            'custom' => __('Enter a custom title', 'site-reviews'),
277
+            'post' => __( 'Use the assigned or current page title', 'site-reviews' ),
278
+            'custom' => __( 'Enter a custom title', 'site-reviews' ),
279 279
         ],
280 280
         'type' => 'select',
281 281
     ],
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
         'depends_on' => [
285 285
             'settings.schema.name.default' => 'custom',
286 286
         ],
287
-        'label' => __('Custom Name', 'site-reviews'),
287
+        'label' => __( 'Custom Name', 'site-reviews' ),
288 288
         'type' => 'text',
289 289
     ],
290 290
     'settings.schema.description.default' => [
291 291
         'default' => 'post',
292
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
293
-        'label' => __('Default Description', 'site-reviews'),
292
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_description</code>',
293
+        'label' => __( 'Default Description', 'site-reviews' ),
294 294
         'options' => [
295
-            'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
296
-            'custom' => __('Enter a custom description', 'site-reviews'),
295
+            'post' => __( 'Use the assigned or current page excerpt', 'site-reviews' ),
296
+            'custom' => __( 'Enter a custom description', 'site-reviews' ),
297 297
         ],
298 298
         'type' => 'select',
299 299
     ],
@@ -302,16 +302,16 @@  discard block
 block discarded – undo
302 302
         'depends_on' => [
303 303
             'settings.schema.description.default' => 'custom',
304 304
         ],
305
-        'label' => __('Custom Description', 'site-reviews'),
305
+        'label' => __( 'Custom Description', 'site-reviews' ),
306 306
         'type' => 'text',
307 307
     ],
308 308
     'settings.schema.url.default' => [
309 309
         'default' => 'post',
310
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
311
-        'label' => __('Default URL', 'site-reviews'),
310
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_url</code>',
311
+        'label' => __( 'Default URL', 'site-reviews' ),
312 312
         'options' => [
313
-            'post' => __('Use the assigned or current page URL', 'site-reviews'),
314
-            'custom' => __('Enter a custom URL', 'site-reviews'),
313
+            'post' => __( 'Use the assigned or current page URL', 'site-reviews' ),
314
+            'custom' => __( 'Enter a custom URL', 'site-reviews' ),
315 315
         ],
316 316
         'type' => 'select',
317 317
     ],
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
         'depends_on' => [
321 321
             'settings.schema.url.default' => 'custom',
322 322
         ],
323
-        'label' => __('Custom URL', 'site-reviews'),
323
+        'label' => __( 'Custom URL', 'site-reviews' ),
324 324
         'type' => 'text',
325 325
     ],
326 326
     'settings.schema.image.default' => [
327 327
         'default' => 'post',
328
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
329
-        'label' => __('Default Image', 'site-reviews'),
328
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_image</code>',
329
+        'label' => __( 'Default Image', 'site-reviews' ),
330 330
         'options' => [
331
-            'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
332
-            'custom' => __('Enter a custom image URL', 'site-reviews'),
331
+            'post' => __( 'Use the featured image of the assigned or current page', 'site-reviews' ),
332
+            'custom' => __( 'Enter a custom image URL', 'site-reviews' ),
333 333
         ],
334 334
         'type' => 'select',
335 335
     ],
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         'depends_on' => [
339 339
             'settings.schema.image.default' => 'custom',
340 340
         ],
341
-        'label' => __('Custom Image URL', 'site-reviews'),
341
+        'label' => __( 'Custom Image URL', 'site-reviews' ),
342 342
         'type' => 'text',
343 343
     ],
344 344
     'settings.schema.address' => [
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
         'depends_on' => [
347 347
             'settings.schema.type.default' => 'LocalBusiness',
348 348
         ],
349
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
350
-        'label' => __('Address', 'site-reviews'),
349
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_address</code>',
350
+        'label' => __( 'Address', 'site-reviews' ),
351 351
         'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
352 352
         'type' => 'text',
353 353
     ],
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
         'depends_on' => [
357 357
             'settings.schema.type.default' => 'LocalBusiness',
358 358
         ],
359
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
360
-        'label' => __('Telephone Number', 'site-reviews'),
359
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_telephone</code>',
360
+        'label' => __( 'Telephone Number', 'site-reviews' ),
361 361
         'placeholder' => '+1 (877) 273-3049',
362 362
         'type' => 'text',
363 363
     ],
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
         'depends_on' => [
367 367
             'settings.schema.type.default' => 'LocalBusiness',
368 368
         ],
369
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
370
-        'label' => __('Price Range', 'site-reviews'),
369
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_pricerange</code>',
370
+        'label' => __( 'Price Range', 'site-reviews' ),
371 371
         'placeholder' => '$$-$$$',
372 372
         'type' => 'text',
373 373
     ],
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
         'depends_on' => [
377 377
             'settings.schema.type.default' => 'Product',
378 378
         ],
379
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
380
-        'label' => __('Offer Type', 'site-reviews'),
379
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_offertype</code>',
380
+        'label' => __( 'Offer Type', 'site-reviews' ),
381 381
         'options' => [
382
-            'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
383
-            'Offer' => __('Offer', 'site-reviews'),
382
+            'AggregateOffer' => __( 'AggregateOffer', 'site-reviews' ),
383
+            'Offer' => __( 'Offer', 'site-reviews' ),
384 384
         ],
385 385
         'type' => 'select',
386 386
     ],
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
             'settings.schema.type.default' => 'Product',
391 391
             'settings.schema.offertype' => 'Offer',
392 392
         ],
393
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
394
-        'label' => __('Price', 'site-reviews'),
393
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_price</code>',
394
+        'label' => __( 'Price', 'site-reviews' ),
395 395
         'placeholder' => '50.00',
396 396
         'type' => 'text',
397 397
     ],
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
             'settings.schema.type.default' => 'Product',
402 402
             'settings.schema.offertype' => 'AggregateOffer',
403 403
         ],
404
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
405
-        'label' => __('Low Price', 'site-reviews'),
404
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_lowprice</code>',
405
+        'label' => __( 'Low Price', 'site-reviews' ),
406 406
         'placeholder' => '10.00',
407 407
         'type' => 'text',
408 408
     ],
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
             'settings.schema.type.default' => 'Product',
413 413
             'settings.schema.offertype' => 'AggregateOffer',
414 414
         ],
415
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
416
-        'label' => __('High Price', 'site-reviews'),
415
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_highprice</code>',
416
+        'label' => __( 'High Price', 'site-reviews' ),
417 417
         'placeholder' => '100.00',
418 418
         'type' => 'text',
419 419
     ],
@@ -422,34 +422,34 @@  discard block
 block discarded – undo
422 422
         'depends_on' => [
423 423
             'settings.schema.type.default' => 'Product',
424 424
         ],
425
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
426
-        'label' => __('Price Currency', 'site-reviews'),
425
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_pricecurrency</code>',
426
+        'label' => __( 'Price Currency', 'site-reviews' ),
427 427
         'placeholder' => 'USD',
428 428
         'type' => 'text',
429 429
     ],
430 430
     'settings.submissions.required' => [
431 431
         'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
432
-        'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
433
-        'label' => __('Required Fields', 'site-reviews'),
432
+        'description' => __( 'Choose which fields should be required in the submission form.', 'site-reviews' ),
433
+        'label' => __( 'Required Fields', 'site-reviews' ),
434 434
         'options' => [
435
-            'rating' => __('Rating', 'site-reviews'),
436
-            'title' => __('Title', 'site-reviews'),
437
-            'content' => __('Review', 'site-reviews'),
438
-            'name' => __('Name', 'site-reviews'),
439
-            'email' => __('Email', 'site-reviews'),
440
-            'terms' => __('Terms', 'site-reviews'),
435
+            'rating' => __( 'Rating', 'site-reviews' ),
436
+            'title' => __( 'Title', 'site-reviews' ),
437
+            'content' => __( 'Review', 'site-reviews' ),
438
+            'name' => __( 'Name', 'site-reviews' ),
439
+            'email' => __( 'Email', 'site-reviews' ),
440
+            'terms' => __( 'Terms', 'site-reviews' ),
441 441
         ],
442 442
         'type' => 'checkbox',
443 443
     ],
444 444
     'settings.submissions.limit' => [
445 445
         'default' => '',
446
-        'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
447
-        'label' => __('Limit Reviews', 'site-reviews'),
446
+        'description' => __( 'Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews' ),
447
+        'label' => __( 'Limit Reviews', 'site-reviews' ),
448 448
         'options' => [
449
-            '' => __('No Limit', 'site-reviews'),
450
-            'email' => __('By Email Address', 'site-reviews'),
451
-            'ip_address' => __('By IP Address', 'site-reviews'),
452
-            'username' => __('By Username (will only work for registered users)', 'site-reviews'),
449
+            '' => __( 'No Limit', 'site-reviews' ),
450
+            'email' => __( 'By Email Address', 'site-reviews' ),
451
+            'ip_address' => __( 'By IP Address', 'site-reviews' ),
452
+            'username' => __( 'By Username (will only work for registered users)', 'site-reviews' ),
453 453
         ],
454 454
         'type' => 'select',
455 455
     ],
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
         'depends_on' => [
459 459
             'settings.submissions.limit' => ['email'],
460 460
         ],
461
-        'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
462
-        'label' => __('Email Whitelist', 'site-reviews'),
461
+        'description' => __( 'One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews' ),
462
+        'label' => __( 'Email Whitelist', 'site-reviews' ),
463 463
         'rows' => 5,
464 464
         'type' => 'code',
465 465
     ],
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
         'depends_on' => [
469 469
             'settings.submissions.limit' => ['ip_address'],
470 470
         ],
471
-        'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
472
-        'label' => __('IP Address Whitelist', 'site-reviews'),
471
+        'description' => __( 'One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews' ),
472
+        'label' => __( 'IP Address Whitelist', 'site-reviews' ),
473 473
         'rows' => 5,
474 474
         'type' => 'code',
475 475
     ],
@@ -478,15 +478,15 @@  discard block
 block discarded – undo
478 478
         'depends_on' => [
479 479
             'settings.submissions.limit' => ['username'],
480 480
         ],
481
-        'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
482
-        'label' => __('Username Whitelist', 'site-reviews'),
481
+        'description' => __( 'One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews' ),
482
+        'label' => __( 'Username Whitelist', 'site-reviews' ),
483 483
         'rows' => 5,
484 484
         'type' => 'code',
485 485
     ],
486 486
     'settings.submissions.recaptcha.integration' => [
487 487
         'default' => '',
488
-        'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
489
-        'label' => __('Invisible reCAPTCHA', 'site-reviews'),
488
+        'description' => __( 'Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews' ),
489
+        'label' => __( 'Invisible reCAPTCHA', 'site-reviews' ),
490 490
         'options' => [
491 491
             '' => 'Do not use reCAPTCHA',
492 492
             'all' => 'Use reCAPTCHA',
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         'depends_on' => [
500 500
             'settings.submissions.recaptcha.integration' => ['all', 'guest'],
501 501
         ],
502
-        'label' => __('Site Key', 'site-reviews'),
502
+        'label' => __( 'Site Key', 'site-reviews' ),
503 503
         'type' => 'text',
504 504
     ],
505 505
     'settings.submissions.recaptcha.secret' => [
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         'depends_on' => [
508 508
             'settings.submissions.recaptcha.integration' => ['all', 'guest'],
509 509
         ],
510
-        'label' => __('Site Secret', 'site-reviews'),
510
+        'label' => __( 'Site Secret', 'site-reviews' ),
511 511
         'type' => 'text',
512 512
     ],
513 513
     'settings.submissions.recaptcha.position' => [
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
         'depends_on' => [
516 516
             'settings.submissions.recaptcha.integration' => ['all', 'guest'],
517 517
         ],
518
-        'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
519
-        'label' => __('Badge Position', 'site-reviews'),
518
+        'description' => __( 'This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews' ),
519
+        'label' => __( 'Badge Position', 'site-reviews' ),
520 520
         'options' => [
521 521
             'bottomleft' => 'Bottom Left',
522 522
             'bottomright' => 'Bottom Right',
@@ -526,16 +526,16 @@  discard block
 block discarded – undo
526 526
     ],
527 527
     'settings.submissions.akismet' => [
528 528
         'default' => 'no',
529
-        'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
530
-        'label' => __('Enable Akismet Integration', 'site-reviews'),
529
+        'description' => __( 'The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews' ),
530
+        'label' => __( 'Enable Akismet Integration', 'site-reviews' ),
531 531
         'type' => 'yes_no',
532 532
     ],
533 533
     'settings.submissions.blacklist.integration' => [
534 534
         'default' => '',
535
-        'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
536
-            '<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
535
+        'description' => sprintf( __( 'Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews' ),
536
+            '<a href="'.admin_url( 'options-discussion.php#users_can_register' ).'">'.__( 'Comment Blacklist', 'site-reviews' ).'</a>'
537 537
         ),
538
-        'label' => __('Blacklist', 'site-reviews'),
538
+        'label' => __( 'Blacklist', 'site-reviews' ),
539 539
         'options' => [
540 540
             '' => 'Use the Site Reviews Blacklist',
541 541
             'comments' => 'Use the WordPress Comment Blacklist',
@@ -547,18 +547,18 @@  discard block
 block discarded – undo
547 547
         'depends_on' => [
548 548
             'settings.submissions.blacklist.integration' => [''],
549 549
         ],
550
-        'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
551
-        'label' => __('Review Blacklist', 'site-reviews'),
550
+        'description' => __( 'One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews' ),
551
+        'label' => __( 'Review Blacklist', 'site-reviews' ),
552 552
         'rows' => 10,
553 553
         'type' => 'code',
554 554
     ],
555 555
     'settings.submissions.blacklist.action' => [
556 556
         'default' => 'unapprove',
557
-        'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
558
-        'label' => __('Blacklist Action', 'site-reviews'),
557
+        'description' => __( 'Choose the action that should be taken when a review is blacklisted.', 'site-reviews' ),
558
+        'label' => __( 'Blacklist Action', 'site-reviews' ),
559 559
         'options' => [
560
-            'unapprove' => __('Require approval', 'site-reviews'),
561
-            'reject' => __('Reject submission', 'site-reviews'),
560
+            'unapprove' => __( 'Require approval', 'site-reviews' ),
561
+            'reject' => __( 'Reject submission', 'site-reviews' ),
562 562
         ],
563 563
         'type' => 'select',
564 564
     ],
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -11,70 +11,70 @@
 block discarded – undo
11 11
 
12 12
 class Pagination implements PartialContract
13 13
 {
14
-    /**
15
-     * @var array
16
-     */
17
-    protected $args;
14
+	/**
15
+	 * @var array
16
+	 */
17
+	protected $args;
18 18
 
19
-    /**
20
-     * @return string
21
-     */
22
-    public function build(array $args = [])
23
-    {
24
-        $this->args = $this->normalize($args);
25
-        if ($this->args['total'] < 2) {
26
-            return '';
27
-        }
28
-        return glsr(Template::class)->build('templates/pagination', [
29
-            'context' => [
30
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
31
-                'loader' => '<div class="glsr-loader"></div>',
32
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
33
-            ],
34
-        ]);
35
-    }
19
+	/**
20
+	 * @return string
21
+	 */
22
+	public function build(array $args = [])
23
+	{
24
+		$this->args = $this->normalize($args);
25
+		if ($this->args['total'] < 2) {
26
+			return '';
27
+		}
28
+		return glsr(Template::class)->build('templates/pagination', [
29
+			'context' => [
30
+				'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
31
+				'loader' => '<div class="glsr-loader"></div>',
32
+				'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
33
+			],
34
+		]);
35
+	}
36 36
 
37
-    /**
38
-     * @return string
39
-     */
40
-    protected function buildFauxLinks()
41
-    {
42
-        $links = (array) paginate_links(wp_parse_args(['type' => 'array'], $this->args));
43
-        $pattern = '/(href=["\'])([^"\']*?)(["\'])/i';
44
-        foreach ($links as &$link) {
45
-            if (!preg_match($pattern, $link, $matches)) {
46
-                continue;
47
-            }
48
-            parse_str(parse_url(Arr::get($matches, 2), PHP_URL_QUERY), $urlQuery);
49
-            $page = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
50
-            $replacement = sprintf('data-page="%d" href="#"', $page);
51
-            $link = str_replace(Arr::get($matches, 0), $replacement, $link);
52
-        }
53
-        return implode("\n", $links);
54
-    }
37
+	/**
38
+	 * @return string
39
+	 */
40
+	protected function buildFauxLinks()
41
+	{
42
+		$links = (array) paginate_links(wp_parse_args(['type' => 'array'], $this->args));
43
+		$pattern = '/(href=["\'])([^"\']*?)(["\'])/i';
44
+		foreach ($links as &$link) {
45
+			if (!preg_match($pattern, $link, $matches)) {
46
+				continue;
47
+			}
48
+			parse_str(parse_url(Arr::get($matches, 2), PHP_URL_QUERY), $urlQuery);
49
+			$page = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
50
+			$replacement = sprintf('data-page="%d" href="#"', $page);
51
+			$link = str_replace(Arr::get($matches, 0), $replacement, $link);
52
+		}
53
+		return implode("\n", $links);
54
+	}
55 55
 
56
-    /**
57
-     * @return string
58
-     */
59
-    protected function buildLinks()
60
-    {
61
-        return glsr(OptionManager::class)->getBool('settings.reviews.pagination.url_parameter')
62
-            ? paginate_links(wp_parse_args(['type' => 'plain'], $this->args))
63
-            : $this->buildFauxLinks();
64
-    }
56
+	/**
57
+	 * @return string
58
+	 */
59
+	protected function buildLinks()
60
+	{
61
+		return glsr(OptionManager::class)->getBool('settings.reviews.pagination.url_parameter')
62
+			? paginate_links(wp_parse_args(['type' => 'plain'], $this->args))
63
+			: $this->buildFauxLinks();
64
+	}
65 65
 
66
-    /**
67
-     * @return array
68
-     */
69
-    protected function normalize(array $args)
70
-    {
71
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
72
-            $args['base'] = $baseUrl.'%_%';
73
-        }
74
-        $args = wp_parse_args(array_filter($args), [
75
-            'current' => glsr(QueryBuilder::class)->getPaged(),
76
-            'total' => 1,
77
-        ]);
78
-        return glsr(Style::class)->paginationArgs($args);
79
-    }
66
+	/**
67
+	 * @return array
68
+	 */
69
+	protected function normalize(array $args)
70
+	{
71
+		if ($baseUrl = Arr::get($args, 'baseUrl')) {
72
+			$args['base'] = $baseUrl.'%_%';
73
+		}
74
+		$args = wp_parse_args(array_filter($args), [
75
+			'current' => glsr(QueryBuilder::class)->getPaged(),
76
+			'total' => 1,
77
+		]);
78
+		return glsr(Style::class)->paginationArgs($args);
79
+	}
80 80
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @return string
21 21
      */
22
-    public function build(array $args = [])
22
+    public function build( array $args = [] )
23 23
     {
24
-        $this->args = $this->normalize($args);
25
-        if ($this->args['total'] < 2) {
24
+        $this->args = $this->normalize( $args );
25
+        if( $this->args['total'] < 2 ) {
26 26
             return '';
27 27
         }
28
-        return glsr(Template::class)->build('templates/pagination', [
28
+        return glsr( Template::class )->build( 'templates/pagination', [
29 29
             'context' => [
30
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
30
+                'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
31 31
                 'loader' => '<div class="glsr-loader"></div>',
32
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
32
+                'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
33 33
             ],
34
-        ]);
34
+        ] );
35 35
     }
36 36
 
37 37
     /**
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
      */
40 40
     protected function buildFauxLinks()
41 41
     {
42
-        $links = (array) paginate_links(wp_parse_args(['type' => 'array'], $this->args));
42
+        $links = (array)paginate_links( wp_parse_args( ['type' => 'array'], $this->args ) );
43 43
         $pattern = '/(href=["\'])([^"\']*?)(["\'])/i';
44
-        foreach ($links as &$link) {
45
-            if (!preg_match($pattern, $link, $matches)) {
44
+        foreach( $links as &$link ) {
45
+            if( !preg_match( $pattern, $link, $matches ) ) {
46 46
                 continue;
47 47
             }
48
-            parse_str(parse_url(Arr::get($matches, 2), PHP_URL_QUERY), $urlQuery);
49
-            $page = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
50
-            $replacement = sprintf('data-page="%d" href="#"', $page);
51
-            $link = str_replace(Arr::get($matches, 0), $replacement, $link);
48
+            parse_str( parse_url( Arr::get( $matches, 2 ), PHP_URL_QUERY ), $urlQuery );
49
+            $page = (int)Arr::get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 );
50
+            $replacement = sprintf( 'data-page="%d" href="#"', $page );
51
+            $link = str_replace( Arr::get( $matches, 0 ), $replacement, $link );
52 52
         }
53
-        return implode("\n", $links);
53
+        return implode( "\n", $links );
54 54
     }
55 55
 
56 56
     /**
@@ -58,23 +58,23 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function buildLinks()
60 60
     {
61
-        return glsr(OptionManager::class)->getBool('settings.reviews.pagination.url_parameter')
62
-            ? paginate_links(wp_parse_args(['type' => 'plain'], $this->args))
61
+        return glsr( OptionManager::class )->getBool( 'settings.reviews.pagination.url_parameter' )
62
+            ? paginate_links( wp_parse_args( ['type' => 'plain'], $this->args ) )
63 63
             : $this->buildFauxLinks();
64 64
     }
65 65
 
66 66
     /**
67 67
      * @return array
68 68
      */
69
-    protected function normalize(array $args)
69
+    protected function normalize( array $args )
70 70
     {
71
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
71
+        if( $baseUrl = Arr::get( $args, 'baseUrl' ) ) {
72 72
             $args['base'] = $baseUrl.'%_%';
73 73
         }
74
-        $args = wp_parse_args(array_filter($args), [
75
-            'current' => glsr(QueryBuilder::class)->getPaged(),
74
+        $args = wp_parse_args( array_filter( $args ), [
75
+            'current' => glsr( QueryBuilder::class )->getPaged(),
76 76
             'total' => 1,
77
-        ]);
78
-        return glsr(Style::class)->paginationArgs($args);
77
+        ] );
78
+        return glsr( Style::class )->paginationArgs( $args );
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
plugin/Helpers/Str.php 2 patches
Indentation   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -4,187 +4,187 @@
 block discarded – undo
4 4
 
5 5
 class Str
6 6
 {
7
-    /**
8
-     * @param string $subject
9
-     * @param string $search
10
-     * @return string
11
-     */
12
-    public static function afterLast($subject, $search)
13
-    {
14
-        return '' === $search
15
-            ? $subject
16
-            : array_reverse(explode($search, $subject))[0];
17
-    }
7
+	/**
8
+	 * @param string $subject
9
+	 * @param string $search
10
+	 * @return string
11
+	 */
12
+	public static function afterLast($subject, $search)
13
+	{
14
+		return '' === $search
15
+			? $subject
16
+			: array_reverse(explode($search, $subject))[0];
17
+	}
18 18
 
19
-    /**
20
-     * @param string $string
21
-     * @return string
22
-     */
23
-    public static function camelCase($string)
24
-    {
25
-        $string = ucwords(str_replace(['-', '_'], ' ', trim($string)));
26
-        return str_replace(' ', '', $string);
27
-    }
19
+	/**
20
+	 * @param string $string
21
+	 * @return string
22
+	 */
23
+	public static function camelCase($string)
24
+	{
25
+		$string = ucwords(str_replace(['-', '_'], ' ', trim($string)));
26
+		return str_replace(' ', '', $string);
27
+	}
28 28
 
29
-    /**
30
-     * @param string $haystack
31
-     * @param string $needle
32
-     * @return bool
33
-     */
34
-    public static function contains($haystack, $needle)
35
-    {
36
-        return false !== strpos($haystack, $needle);
37
-    }
29
+	/**
30
+	 * @param string $haystack
31
+	 * @param string $needle
32
+	 * @return bool
33
+	 */
34
+	public static function contains($haystack, $needle)
35
+	{
36
+		return false !== strpos($haystack, $needle);
37
+	}
38 38
 
39
-    /**
40
-     * @param string $name
41
-     * @param string $nameType first|first_initial|initials|last|last_initial
42
-     * @param string $initialType period|period_space|space
43
-     * @return string
44
-     */
45
-    public static function convertName($name, $nameType = '', $initialType = '')
46
-    {
47
-        $names = preg_split('/\W/u', $name, 0, PREG_SPLIT_NO_EMPTY);
48
-        $firstName = array_shift($names);
49
-        $lastName = array_pop($names);
50
-        $initialTypes = [
51
-            'period' => '.',
52
-            'period_space' => '. ',
53
-            'space' => ' ',
54
-        ];
55
-        $initialPunctuation = (string) Arr::get($initialTypes, $initialType, ' ');
56
-        if ('initials' == $nameType) {
57
-            return static::convertToInitials($name, $initialPunctuation);
58
-        }
59
-        $nameTypes = [
60
-            'first' => $firstName,
61
-            'first_initial' => static::convertToInitials($firstName).$initialPunctuation.$lastName,
62
-            'last' => $lastName,
63
-            'last_initial' => $firstName.' '.static::convertToInitials($lastName).$initialPunctuation,
64
-        ];
65
-        return trim((string) Arr::get($nameTypes, $nameType, $name));
66
-    }
39
+	/**
40
+	 * @param string $name
41
+	 * @param string $nameType first|first_initial|initials|last|last_initial
42
+	 * @param string $initialType period|period_space|space
43
+	 * @return string
44
+	 */
45
+	public static function convertName($name, $nameType = '', $initialType = '')
46
+	{
47
+		$names = preg_split('/\W/u', $name, 0, PREG_SPLIT_NO_EMPTY);
48
+		$firstName = array_shift($names);
49
+		$lastName = array_pop($names);
50
+		$initialTypes = [
51
+			'period' => '.',
52
+			'period_space' => '. ',
53
+			'space' => ' ',
54
+		];
55
+		$initialPunctuation = (string) Arr::get($initialTypes, $initialType, ' ');
56
+		if ('initials' == $nameType) {
57
+			return static::convertToInitials($name, $initialPunctuation);
58
+		}
59
+		$nameTypes = [
60
+			'first' => $firstName,
61
+			'first_initial' => static::convertToInitials($firstName).$initialPunctuation.$lastName,
62
+			'last' => $lastName,
63
+			'last_initial' => $firstName.' '.static::convertToInitials($lastName).$initialPunctuation,
64
+		];
65
+		return trim((string) Arr::get($nameTypes, $nameType, $name));
66
+	}
67 67
 
68
-    /**
69
-     * @param string $path
70
-     * @param string $prefix
71
-     * @return string
72
-     */
73
-    public static function convertPathToId($path, $prefix = '')
74
-    {
75
-        return str_replace(['[', ']'], ['-', ''], static::convertPathToName($path, $prefix));
76
-    }
68
+	/**
69
+	 * @param string $path
70
+	 * @param string $prefix
71
+	 * @return string
72
+	 */
73
+	public static function convertPathToId($path, $prefix = '')
74
+	{
75
+		return str_replace(['[', ']'], ['-', ''], static::convertPathToName($path, $prefix));
76
+	}
77 77
 
78
-    /**
79
-     * @param string $path
80
-     * @param string $prefix
81
-     * @return string
82
-     */
83
-    public static function convertPathToName($path, $prefix = '')
84
-    {
85
-        $levels = explode('.', $path);
86
-        return array_reduce($levels, function ($result, $value) {
87
-            return $result .= '['.$value.']';
88
-        }, $prefix);
89
-    }
78
+	/**
79
+	 * @param string $path
80
+	 * @param string $prefix
81
+	 * @return string
82
+	 */
83
+	public static function convertPathToName($path, $prefix = '')
84
+	{
85
+		$levels = explode('.', $path);
86
+		return array_reduce($levels, function ($result, $value) {
87
+			return $result .= '['.$value.']';
88
+		}, $prefix);
89
+	}
90 90
 
91
-    /**
92
-     * @param string $name
93
-     * @param string $initialPunctuation
94
-     * @return string
95
-     */
96
-    public static function convertToInitials($name, $initialPunctuation = '')
97
-    {
98
-        preg_match_all('/(?<=\s|\b)\pL/u', $name, $matches);
99
-        return array_reduce($matches[0], function ($carry, $word) use ($initialPunctuation) {
100
-            $string = extension_loaded('mbstring') ? mb_substr($word, 0, 1) : substr($word, 0, 1);
101
-            return $carry.strtoupper($string).$initialPunctuation;
102
-        });
103
-    }
91
+	/**
92
+	 * @param string $name
93
+	 * @param string $initialPunctuation
94
+	 * @return string
95
+	 */
96
+	public static function convertToInitials($name, $initialPunctuation = '')
97
+	{
98
+		preg_match_all('/(?<=\s|\b)\pL/u', $name, $matches);
99
+		return array_reduce($matches[0], function ($carry, $word) use ($initialPunctuation) {
100
+			$string = extension_loaded('mbstring') ? mb_substr($word, 0, 1) : substr($word, 0, 1);
101
+			return $carry.strtoupper($string).$initialPunctuation;
102
+		});
103
+	}
104 104
 
105
-    /**
106
-     * @param string $string
107
-     * @return string
108
-     */
109
-    public static function dashCase($string)
110
-    {
111
-        return str_replace('_', '-', static::snakeCase($string));
112
-    }
105
+	/**
106
+	 * @param string $string
107
+	 * @return string
108
+	 */
109
+	public static function dashCase($string)
110
+	{
111
+		return str_replace('_', '-', static::snakeCase($string));
112
+	}
113 113
 
114
-    /**
115
-     * @param string $needle
116
-     * @param string $haystack
117
-     * @return bool
118
-     */
119
-    public static function endsWith($needle, $haystack)
120
-    {
121
-        $length = strlen($needle);
122
-        return 0 != $length
123
-            ? substr($haystack, -$length) === $needle
124
-            : true;
125
-    }
114
+	/**
115
+	 * @param string $needle
116
+	 * @param string $haystack
117
+	 * @return bool
118
+	 */
119
+	public static function endsWith($needle, $haystack)
120
+	{
121
+		$length = strlen($needle);
122
+		return 0 != $length
123
+			? substr($haystack, -$length) === $needle
124
+			: true;
125
+	}
126 126
 
127
-    /**
128
-     * @param string $prefix
129
-     * @param string $string
130
-     * @param string|null $trim
131
-     * @return string
132
-     */
133
-    public static function prefix($prefix, $string, $trim = null)
134
-    {
135
-        if (null === $trim) {
136
-            $trim = $prefix;
137
-        }
138
-        return $prefix.trim(static::removePrefix($trim, $string));
139
-    }
127
+	/**
128
+	 * @param string $prefix
129
+	 * @param string $string
130
+	 * @param string|null $trim
131
+	 * @return string
132
+	 */
133
+	public static function prefix($prefix, $string, $trim = null)
134
+	{
135
+		if (null === $trim) {
136
+			$trim = $prefix;
137
+		}
138
+		return $prefix.trim(static::removePrefix($trim, $string));
139
+	}
140 140
 
141
-    /**
142
-     * @param string $prefix
143
-     * @param string $string
144
-     * @return string
145
-     */
146
-    public static function removePrefix($prefix, $string)
147
-    {
148
-        return static::startsWith($prefix, $string)
149
-            ? substr($string, strlen($prefix))
150
-            : $string;
151
-    }
141
+	/**
142
+	 * @param string $prefix
143
+	 * @param string $string
144
+	 * @return string
145
+	 */
146
+	public static function removePrefix($prefix, $string)
147
+	{
148
+		return static::startsWith($prefix, $string)
149
+			? substr($string, strlen($prefix))
150
+			: $string;
151
+	}
152 152
 
153
-    /**
154
-     * @param string $string
155
-     * @return string
156
-     */
157
-    public static function snakeCase($string)
158
-    {
159
-        if (!ctype_lower($string)) {
160
-            $string = preg_replace('/\s+/u', '', $string);
161
-            $string = preg_replace('/(.)(?=[A-Z])/u', '$1_', $string);
162
-            $string = function_exists('mb_strtolower')
163
-                ? mb_strtolower($string, 'UTF-8')
164
-                : strtolower($string);
165
-        }
166
-        return str_replace('-', '_', $string);
167
-    }
153
+	/**
154
+	 * @param string $string
155
+	 * @return string
156
+	 */
157
+	public static function snakeCase($string)
158
+	{
159
+		if (!ctype_lower($string)) {
160
+			$string = preg_replace('/\s+/u', '', $string);
161
+			$string = preg_replace('/(.)(?=[A-Z])/u', '$1_', $string);
162
+			$string = function_exists('mb_strtolower')
163
+				? mb_strtolower($string, 'UTF-8')
164
+				: strtolower($string);
165
+		}
166
+		return str_replace('-', '_', $string);
167
+	}
168 168
 
169
-    /**
170
-     * @param string $needle
171
-     * @param string $haystack
172
-     * @return bool
173
-     */
174
-    public static function startsWith($needle, $haystack)
175
-    {
176
-        return substr($haystack, 0, strlen($needle)) === $needle;
177
-    }
169
+	/**
170
+	 * @param string $needle
171
+	 * @param string $haystack
172
+	 * @return bool
173
+	 */
174
+	public static function startsWith($needle, $haystack)
175
+	{
176
+		return substr($haystack, 0, strlen($needle)) === $needle;
177
+	}
178 178
 
179
-    /**
180
-     * @param string $string
181
-     * @param int $length
182
-     * @return string
183
-     */
184
-    public static function truncate($string, $length)
185
-    {
186
-        return strlen($string) > $length
187
-            ? substr($string, 0, $length)
188
-            : $string;
189
-    }
179
+	/**
180
+	 * @param string $string
181
+	 * @param int $length
182
+	 * @return string
183
+	 */
184
+	public static function truncate($string, $length)
185
+	{
186
+		return strlen($string) > $length
187
+			? substr($string, 0, $length)
188
+			: $string;
189
+	}
190 190
 }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
      * @param string $search
10 10
      * @return string
11 11
      */
12
-    public static function afterLast($subject, $search)
12
+    public static function afterLast( $subject, $search )
13 13
     {
14 14
         return '' === $search
15 15
             ? $subject
16
-            : array_reverse(explode($search, $subject))[0];
16
+            : array_reverse( explode( $search, $subject ) )[0];
17 17
     }
18 18
 
19 19
     /**
20 20
      * @param string $string
21 21
      * @return string
22 22
      */
23
-    public static function camelCase($string)
23
+    public static function camelCase( $string )
24 24
     {
25
-        $string = ucwords(str_replace(['-', '_'], ' ', trim($string)));
26
-        return str_replace(' ', '', $string);
25
+        $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) );
26
+        return str_replace( ' ', '', $string );
27 27
     }
28 28
 
29 29
     /**
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
      * @param string $needle
32 32
      * @return bool
33 33
      */
34
-    public static function contains($haystack, $needle)
34
+    public static function contains( $haystack, $needle )
35 35
     {
36
-        return false !== strpos($haystack, $needle);
36
+        return false !== strpos( $haystack, $needle );
37 37
     }
38 38
 
39 39
     /**
@@ -42,27 +42,27 @@  discard block
 block discarded – undo
42 42
      * @param string $initialType period|period_space|space
43 43
      * @return string
44 44
      */
45
-    public static function convertName($name, $nameType = '', $initialType = '')
45
+    public static function convertName( $name, $nameType = '', $initialType = '' )
46 46
     {
47
-        $names = preg_split('/\W/u', $name, 0, PREG_SPLIT_NO_EMPTY);
48
-        $firstName = array_shift($names);
49
-        $lastName = array_pop($names);
47
+        $names = preg_split( '/\W/u', $name, 0, PREG_SPLIT_NO_EMPTY );
48
+        $firstName = array_shift( $names );
49
+        $lastName = array_pop( $names );
50 50
         $initialTypes = [
51 51
             'period' => '.',
52 52
             'period_space' => '. ',
53 53
             'space' => ' ',
54 54
         ];
55
-        $initialPunctuation = (string) Arr::get($initialTypes, $initialType, ' ');
56
-        if ('initials' == $nameType) {
57
-            return static::convertToInitials($name, $initialPunctuation);
55
+        $initialPunctuation = (string)Arr::get( $initialTypes, $initialType, ' ' );
56
+        if( 'initials' == $nameType ) {
57
+            return static::convertToInitials( $name, $initialPunctuation );
58 58
         }
59 59
         $nameTypes = [
60 60
             'first' => $firstName,
61
-            'first_initial' => static::convertToInitials($firstName).$initialPunctuation.$lastName,
61
+            'first_initial' => static::convertToInitials( $firstName ).$initialPunctuation.$lastName,
62 62
             'last' => $lastName,
63
-            'last_initial' => $firstName.' '.static::convertToInitials($lastName).$initialPunctuation,
63
+            'last_initial' => $firstName.' '.static::convertToInitials( $lastName ).$initialPunctuation,
64 64
         ];
65
-        return trim((string) Arr::get($nameTypes, $nameType, $name));
65
+        return trim( (string)Arr::get( $nameTypes, $nameType, $name ) );
66 66
     }
67 67
 
68 68
     /**
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      * @param string $prefix
71 71
      * @return string
72 72
      */
73
-    public static function convertPathToId($path, $prefix = '')
73
+    public static function convertPathToId( $path, $prefix = '' )
74 74
     {
75
-        return str_replace(['[', ']'], ['-', ''], static::convertPathToName($path, $prefix));
75
+        return str_replace( ['[', ']'], ['-', ''], static::convertPathToName( $path, $prefix ) );
76 76
     }
77 77
 
78 78
     /**
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
      * @param string $prefix
81 81
      * @return string
82 82
      */
83
-    public static function convertPathToName($path, $prefix = '')
83
+    public static function convertPathToName( $path, $prefix = '' )
84 84
     {
85
-        $levels = explode('.', $path);
86
-        return array_reduce($levels, function ($result, $value) {
85
+        $levels = explode( '.', $path );
86
+        return array_reduce( $levels, function( $result, $value ) {
87 87
             return $result .= '['.$value.']';
88
-        }, $prefix);
88
+        }, $prefix );
89 89
     }
90 90
 
91 91
     /**
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
      * @param string $initialPunctuation
94 94
      * @return string
95 95
      */
96
-    public static function convertToInitials($name, $initialPunctuation = '')
96
+    public static function convertToInitials( $name, $initialPunctuation = '' )
97 97
     {
98
-        preg_match_all('/(?<=\s|\b)\pL/u', $name, $matches);
99
-        return array_reduce($matches[0], function ($carry, $word) use ($initialPunctuation) {
100
-            $string = extension_loaded('mbstring') ? mb_substr($word, 0, 1) : substr($word, 0, 1);
101
-            return $carry.strtoupper($string).$initialPunctuation;
98
+        preg_match_all( '/(?<=\s|\b)\pL/u', $name, $matches );
99
+        return array_reduce( $matches[0], function( $carry, $word ) use ($initialPunctuation) {
100
+            $string = extension_loaded( 'mbstring' ) ? mb_substr( $word, 0, 1 ) : substr( $word, 0, 1 );
101
+            return $carry.strtoupper( $string ).$initialPunctuation;
102 102
         });
103 103
     }
104 104
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
      * @param string $string
107 107
      * @return string
108 108
      */
109
-    public static function dashCase($string)
109
+    public static function dashCase( $string )
110 110
     {
111
-        return str_replace('_', '-', static::snakeCase($string));
111
+        return str_replace( '_', '-', static::snakeCase( $string ) );
112 112
     }
113 113
 
114 114
     /**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
      * @param string $haystack
117 117
      * @return bool
118 118
      */
119
-    public static function endsWith($needle, $haystack)
119
+    public static function endsWith( $needle, $haystack )
120 120
     {
121
-        $length = strlen($needle);
121
+        $length = strlen( $needle );
122 122
         return 0 != $length
123
-            ? substr($haystack, -$length) === $needle
123
+            ? substr( $haystack, -$length ) === $needle
124 124
             : true;
125 125
     }
126 126
 
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
      * @param string|null $trim
131 131
      * @return string
132 132
      */
133
-    public static function prefix($prefix, $string, $trim = null)
133
+    public static function prefix( $prefix, $string, $trim = null )
134 134
     {
135
-        if (null === $trim) {
135
+        if( null === $trim ) {
136 136
             $trim = $prefix;
137 137
         }
138
-        return $prefix.trim(static::removePrefix($trim, $string));
138
+        return $prefix.trim( static::removePrefix( $trim, $string ) );
139 139
     }
140 140
 
141 141
     /**
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
      * @param string $string
144 144
      * @return string
145 145
      */
146
-    public static function removePrefix($prefix, $string)
146
+    public static function removePrefix( $prefix, $string )
147 147
     {
148
-        return static::startsWith($prefix, $string)
149
-            ? substr($string, strlen($prefix))
148
+        return static::startsWith( $prefix, $string )
149
+            ? substr( $string, strlen( $prefix ) )
150 150
             : $string;
151 151
     }
152 152
 
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
      * @param string $string
155 155
      * @return string
156 156
      */
157
-    public static function snakeCase($string)
157
+    public static function snakeCase( $string )
158 158
     {
159
-        if (!ctype_lower($string)) {
160
-            $string = preg_replace('/\s+/u', '', $string);
161
-            $string = preg_replace('/(.)(?=[A-Z])/u', '$1_', $string);
162
-            $string = function_exists('mb_strtolower')
163
-                ? mb_strtolower($string, 'UTF-8')
164
-                : strtolower($string);
159
+        if( !ctype_lower( $string ) ) {
160
+            $string = preg_replace( '/\s+/u', '', $string );
161
+            $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
162
+            $string = function_exists( 'mb_strtolower' )
163
+                ? mb_strtolower( $string, 'UTF-8' )
164
+                : strtolower( $string );
165 165
         }
166
-        return str_replace('-', '_', $string);
166
+        return str_replace( '-', '_', $string );
167 167
     }
168 168
 
169 169
     /**
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
      * @param string $haystack
172 172
      * @return bool
173 173
      */
174
-    public static function startsWith($needle, $haystack)
174
+    public static function startsWith( $needle, $haystack )
175 175
     {
176
-        return substr($haystack, 0, strlen($needle)) === $needle;
176
+        return substr( $haystack, 0, strlen( $needle ) ) === $needle;
177 177
     }
178 178
 
179 179
     /**
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
      * @param int $length
182 182
      * @return string
183 183
      */
184
-    public static function truncate($string, $length)
184
+    public static function truncate( $string, $length )
185 185
     {
186
-        return strlen($string) > $length
187
-            ? substr($string, 0, $length)
186
+        return strlen( $string ) > $length
187
+            ? substr( $string, 0, $length )
188 188
             : $string;
189 189
     }
190 190
 }
Please login to merge, or discard this patch.