@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->args = $args; |
36 | 36 | $this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args ); |
37 | - if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return; |
|
37 | + if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ) )return; |
|
38 | 38 | $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts ); |
39 | 39 | $this->generateSchema(); |
40 | 40 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'stars' => $this->buildStars(), |
48 | 48 | 'text' => $this->buildText(), |
49 | 49 | ], |
50 | - ]); |
|
50 | + ] ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function buildPercentage() |
57 | 57 | { |
58 | - if( $this->isHidden( 'bars' ))return; |
|
59 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts )); |
|
60 | - $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) { |
|
58 | + if( $this->isHidden( 'bars' ) )return; |
|
59 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ) ); |
|
60 | + $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use($percentages) { |
|
61 | 61 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
62 | 62 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
63 | 63 | $count = apply_filters( 'site-reviews/summary/counts', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $percent = $this->buildPercentageCount( $count ); |
68 | 68 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
69 | 69 | 'class' => 'glsr-bar', |
70 | - ]); |
|
70 | + ] ); |
|
71 | 71 | }); |
72 | 72 | return $this->wrap( 'percentage', $bars ); |
73 | 73 | } |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function buildPercentageBackground( $percent ) |
80 | 80 | { |
81 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
81 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
82 | 82 | 'class' => 'glsr-bar-background-percent', |
83 | 83 | 'style' => 'width:'.$percent, |
84 | - ]); |
|
84 | + ] ); |
|
85 | 85 | return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>'; |
86 | 86 | } |
87 | 87 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function buildRating() |
110 | 110 | { |
111 | - if( $this->isHidden( 'rating' ))return; |
|
111 | + if( $this->isHidden( 'rating' ) )return; |
|
112 | 112 | return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' ); |
113 | 113 | } |
114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function buildStars() |
119 | 119 | { |
120 | - if( $this->isHidden( 'stars' ))return; |
|
120 | + if( $this->isHidden( 'stars' ) )return; |
|
121 | 121 | $stars = glsr_star_rating( $this->averageRating ); |
122 | 122 | return $this->wrap( 'stars', $stars ); |
123 | 123 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function buildText() |
129 | 129 | { |
130 | - if( $this->isHidden( 'summary' ))return; |
|
131 | - $count = intval( array_sum( $this->ratingCounts )); |
|
132 | - if( empty( $this->args['text'] )) { |
|
130 | + if( $this->isHidden( 'summary' ) )return; |
|
131 | + $count = intval( array_sum( $this->ratingCounts ) ); |
|
132 | + if( empty($this->args['text']) ) { |
|
133 | 133 | // @todo document this change |
134 | 134 | $this->args['text'] = _nx( |
135 | 135 | '{rating} out of {max} stars (based on {num} review)', |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ); |
141 | 141 | } |
142 | 142 | $summary = str_replace( |
143 | - ['{rating}','{max}', '{num}'], |
|
143 | + ['{rating}', '{max}', '{num}'], |
|
144 | 144 | [$this->averageRating, Rating::MAX_RATING, $count], |
145 | 145 | $this->args['text'] |
146 | 146 | ); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function generateSchema() |
154 | 154 | { |
155 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
155 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
156 | 156 | glsr( Schema::class )->store( |
157 | 157 | glsr( Schema::class )->buildSummary( $this->args ) |
158 | 158 | ); |
@@ -184,6 +184,6 @@ discard block |
||
184 | 184 | { |
185 | 185 | return glsr( Builder::class )->div( $value, [ |
186 | 186 | 'class' => 'glsr-summary-'.$key, |
187 | - ]); |
|
187 | + ] ); |
|
188 | 188 | } |
189 | 189 | } |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->args = $args; |
36 | 36 | $this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args ); |
37 | - if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return; |
|
37 | + if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) { |
|
38 | + return; |
|
39 | + } |
|
38 | 40 | $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts ); |
39 | 41 | $this->generateSchema(); |
40 | 42 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -55,7 +57,9 @@ discard block |
||
55 | 57 | */ |
56 | 58 | protected function buildPercentage() |
57 | 59 | { |
58 | - if( $this->isHidden( 'bars' ))return; |
|
60 | + if( $this->isHidden( 'bars' )) { |
|
61 | + return; |
|
62 | + } |
|
59 | 63 | $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts )); |
60 | 64 | $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) { |
61 | 65 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
@@ -108,7 +112,9 @@ discard block |
||
108 | 112 | */ |
109 | 113 | protected function buildRating() |
110 | 114 | { |
111 | - if( $this->isHidden( 'rating' ))return; |
|
115 | + if( $this->isHidden( 'rating' )) { |
|
116 | + return; |
|
117 | + } |
|
112 | 118 | return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' ); |
113 | 119 | } |
114 | 120 | |
@@ -117,7 +123,9 @@ discard block |
||
117 | 123 | */ |
118 | 124 | protected function buildStars() |
119 | 125 | { |
120 | - if( $this->isHidden( 'stars' ))return; |
|
126 | + if( $this->isHidden( 'stars' )) { |
|
127 | + return; |
|
128 | + } |
|
121 | 129 | $stars = glsr_star_rating( $this->averageRating ); |
122 | 130 | return $this->wrap( 'stars', $stars ); |
123 | 131 | } |
@@ -127,7 +135,9 @@ discard block |
||
127 | 135 | */ |
128 | 136 | protected function buildText() |
129 | 137 | { |
130 | - if( $this->isHidden( 'summary' ))return; |
|
138 | + if( $this->isHidden( 'summary' )) { |
|
139 | + return; |
|
140 | + } |
|
131 | 141 | $count = intval( array_sum( $this->ratingCounts )); |
132 | 142 | if( empty( $this->args['text'] )) { |
133 | 143 | // @todo document this change |
@@ -152,7 +162,9 @@ discard block |
||
152 | 162 | */ |
153 | 163 | protected function generateSchema() |
154 | 164 | { |
155 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
165 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
166 | + return; |
|
167 | + } |
|
156 | 168 | glsr( Schema::class )->store( |
157 | 169 | glsr( Schema::class )->buildSummary( $this->args ) |
158 | 170 | ); |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function saveAssignedToMetabox( $postId ) |
14 | 14 | { |
15 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
16 | - $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
|
15 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return; |
|
16 | + $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) ); |
|
17 | 17 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
18 | 18 | } |
19 | 19 | |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function saveResponseMetabox( $postId ) |
25 | 25 | { |
26 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
27 | - $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
|
26 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return; |
|
27 | + $response = strval( glsr( Helper::class )->filterInput( 'response' ) ); |
|
28 | 28 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
29 | 29 | 'a' => ['href' => [], 'title' => []], |
30 | 30 | 'em' => [], |
31 | 31 | 'strong' => [], |
32 | - ]))); |
|
32 | + ] ) ) ); |
|
33 | 33 | } |
34 | 34 | } |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function saveAssignedToMetabox( $postId ) |
14 | 14 | { |
15 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
15 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) { |
|
16 | + return; |
|
17 | + } |
|
16 | 18 | $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
17 | 19 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
18 | 20 | } |
@@ -23,7 +25,9 @@ discard block |
||
23 | 25 | */ |
24 | 26 | public function saveResponseMetabox( $postId ) |
25 | 27 | { |
26 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
28 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) { |
|
29 | + return; |
|
30 | + } |
|
27 | 31 | $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
28 | 32 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
29 | 33 | 'a' => ['href' => [], 'title' => []], |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function deleteAllSessions( $sessionCookiePrefix ) |
23 | 23 | { |
24 | - return $this->db->query(" |
|
24 | + return $this->db->query( " |
|
25 | 25 | DELETE |
26 | 26 | FROM {$this->db->options} |
27 | 27 | WHERE option_name LIKE '{$sessionCookiePrefix}_%' |
28 | - "); |
|
28 | + " ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function deleteExpiredSessions( $expiredSessions ) |
36 | 36 | { |
37 | - return $this->db->query(" |
|
37 | + return $this->db->query( " |
|
38 | 38 | DELETE |
39 | 39 | FROM {$this->db->options} |
40 | 40 | WHERE option_name IN ('{$expiredSessions}') |
41 | - "); |
|
41 | + " ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getExpiredSessions( $sessionCookiePrefix, $limit ) |
50 | 50 | { |
51 | - return $this->db->get_results(" |
|
51 | + return $this->db->get_results( " |
|
52 | 52 | SELECT option_name AS name, option_value AS expiration |
53 | 53 | FROM {$this->db->options} |
54 | 54 | WHERE option_name LIKE '{$sessionCookiePrefix}_expires_%' |
55 | 55 | ORDER BY option_value ASC |
56 | 56 | LIMIT 0, {$limit} |
57 | - "); |
|
57 | + " ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getPostIdFromReviewId( $metaReviewId ) |
65 | 65 | { |
66 | - $postId = $this->db->get_var(" |
|
66 | + $postId = $this->db->get_var( " |
|
67 | 67 | SELECT p.ID |
68 | 68 | FROM {$this->db->posts} AS p |
69 | 69 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
70 | 70 | WHERE p.post_type = '{Application::POST_TYPE}' |
71 | 71 | AND m.meta_key = 'review_id' |
72 | 72 | AND m.meta_value = '{$metaReviewId}' |
73 | - "); |
|
73 | + " ); |
|
74 | 74 | return intval( $postId ); |
75 | 75 | } |
76 | 76 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function getReviewCounts( array $args, $lastPostId = 0, $limit = 500 ) |
83 | 83 | { |
84 | - return $this->db->get_results(" |
|
84 | + return $this->db->get_results( " |
|
85 | 85 | SELECT p.ID, m1.meta_value AS rating, m2.meta_value AS type |
86 | 86 | FROM {$this->db->posts} AS p |
87 | 87 | INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getReviewCountsFor( $metaKey ) |
106 | 106 | { |
107 | - return (array) $this->db->get_results(" |
|
107 | + return (array)$this->db->get_results( " |
|
108 | 108 | SELECT m.meta_value AS name, COUNT(*) num_posts |
109 | 109 | FROM {$this->db->posts} AS p |
110 | 110 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
111 | 111 | WHERE p.post_type = '{Application::POST_TYPE}' |
112 | 112 | AND m.meta_key = '{$metaKey}' |
113 | 113 | GROUP BY name |
114 | - "); |
|
114 | + " ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getReviewIdsByType( $reviewType ) |
122 | 122 | { |
123 | - $query = $this->db->get_col(" |
|
123 | + $query = $this->db->get_col( " |
|
124 | 124 | SELECT m1.meta_value AS review_id |
125 | 125 | FROM {$this->db->posts} AS p |
126 | 126 | INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | AND m1.meta_key = 'review_id' |
130 | 130 | AND m2.meta_key = 'review_type' |
131 | 131 | AND m2.meta_value = '{$reviewType}' |
132 | - "); |
|
133 | - return array_keys( array_flip( $query )); |
|
132 | + " ); |
|
133 | + return array_keys( array_flip( $query ) ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | public function getReviewRatingsFromIds( array $postIds, $greaterThanId = 0, $limit = 100 ) |
142 | 142 | { |
143 | 143 | sort( $postIds ); |
144 | - $postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds )), $limit ); |
|
144 | + $postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds ) ), $limit ); |
|
145 | 145 | $postIds = implode( ',', $postIds ); |
146 | - return $this->db->get_results(" |
|
146 | + return $this->db->get_results( " |
|
147 | 147 | SELECT p.ID, m.meta_value AS rating |
148 | 148 | FROM {$this->db->posts} AS p |
149 | 149 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $queryBuilder = glsr( QueryBuilder::class ); |
168 | 168 | $key = $queryBuilder->buildSqlOr( $key, "m.meta_key = '%s'" ); |
169 | 169 | $status = $queryBuilder->buildSqlOr( $status, "p.post_status = '%s'" ); |
170 | - return $this->db->get_col(" |
|
170 | + return $this->db->get_col( " |
|
171 | 171 | SELECT DISTINCT m.meta_value |
172 | 172 | FROM {$this->db->postmeta} m |
173 | 173 | LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | AND ({$key}) |
176 | 176 | AND ({$status}) |
177 | 177 | ORDER BY m.meta_value |
178 | - "); |
|
178 | + " ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getAndForCounts( array $args, $and = '' ) |
186 | 186 | { |
187 | - if( !empty( $args['post_id'] )) { |
|
188 | - $and.= "AND m3.meta_key = 'assigned_to' AND m3.meta_value = {$args['post_id']}"; |
|
187 | + if( !empty($args['post_id']) ) { |
|
188 | + $and .= "AND m3.meta_key = 'assigned_to' AND m3.meta_value = {$args['post_id']}"; |
|
189 | 189 | } |
190 | - if( !empty( $args['term_taxonomy_id'] )) { |
|
191 | - $and.= "AND tr.term_taxonomy_id = {$args['term_taxonomy_id']}"; |
|
190 | + if( !empty($args['term_taxonomy_id']) ) { |
|
191 | + $and .= "AND tr.term_taxonomy_id = {$args['term_taxonomy_id']}"; |
|
192 | 192 | } |
193 | 193 | return $and; |
194 | 194 | } |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function getInnerJoinForCounts( array $args, $innerJoin = '' ) |
201 | 201 | { |
202 | - if( !empty( $args['post_id'] )) { |
|
203 | - $innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id"; |
|
202 | + if( !empty($args['post_id']) ) { |
|
203 | + $innerJoin .= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id"; |
|
204 | 204 | } |
205 | - if( !empty( $args['term_taxonomy_id'] )) { |
|
206 | - $innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id"; |
|
205 | + if( !empty($args['term_taxonomy_id']) ) { |
|
206 | + $innerJoin .= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id"; |
|
207 | 207 | } |
208 | 208 | return $innerJoin; |
209 | 209 | } |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | { |
23 | 23 | global $menu, $typenow; |
24 | 24 | foreach( $menu as $key => $value ) { |
25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
28 | 28 | 'class' => 'pending-count', |
29 | - ]); |
|
29 | + ] ); |
|
30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
32 | - ]); |
|
32 | + ] ); |
|
33 | 33 | $menu[$key][0] .= ' '.$awaitingModeration; |
34 | 34 | if( $typenow === Application::POST_TYPE ) { |
35 | - $menu[$key][4].= ' current'; |
|
35 | + $menu[$key][4] .= ' current'; |
|
36 | 36 | } |
37 | 37 | break; |
38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
50 | 50 | 'addons' => __( 'Add-ons', 'site-reviews' ), |
51 | 51 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
52 | - ]); |
|
52 | + ] ); |
|
53 | 53 | foreach( $pages as $slug => $title ) { |
54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
56 | - if( !is_callable( $callback ))continue; |
|
56 | + if( !is_callable( $callback ) )continue; |
|
57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback ); |
58 | 58 | } |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $this->renderPage( 'addons', [ |
69 | 69 | 'template' => glsr( Template::class ), |
70 | - ]); |
|
70 | + ] ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
86 | 86 | 'addons' => __( 'Addons', 'site-reviews' ), |
87 | - ]); |
|
87 | + ] ); |
|
88 | 88 | $addons = apply_filters( 'site-reviews/addon/documentation', [] ); |
89 | 89 | ksort( $addons ); |
90 | - if( empty( $addons )) { |
|
91 | - unset( $tabs['addons'] ); |
|
90 | + if( empty($addons) ) { |
|
91 | + unset($tabs['addons']); |
|
92 | 92 | } |
93 | 93 | $this->renderPage( 'documentation', [ |
94 | 94 | 'addons' => $addons, |
95 | 95 | 'tabs' => $tabs, |
96 | - ]); |
|
96 | + ] ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | 'translations' => __( 'Translations', 'site-reviews' ), |
112 | 112 | 'addons' => __( 'Addons', 'site-reviews' ), |
113 | 113 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
114 | - ]); |
|
115 | - if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' ))) { |
|
116 | - unset( $tabs['addons'] ); |
|
114 | + ] ); |
|
115 | + if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' )) ) { |
|
116 | + unset($tabs['addons']); |
|
117 | 117 | } |
118 | - if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' ))) { |
|
119 | - unset( $tabs['licenses'] ); |
|
118 | + if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' )) ) { |
|
119 | + unset($tabs['licenses']); |
|
120 | 120 | } |
121 | 121 | $this->renderPage( 'settings', [ |
122 | 122 | 'notices' => $this->getNotices(), |
123 | 123 | 'settings' => glsr( Settings::class ), |
124 | 124 | 'tabs' => $tabs, |
125 | - ]); |
|
125 | + ] ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
138 | 138 | 'console' => __( 'Console', 'site-reviews' ), |
139 | 139 | 'system-info' => __( 'System Info', 'site-reviews' ), |
140 | - ]); |
|
141 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
142 | - unset( $tabs['sync'] ); |
|
140 | + ] ); |
|
141 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
142 | + unset($tabs['sync']); |
|
143 | 143 | } |
144 | 144 | $this->renderPage( 'tools', [ |
145 | 145 | 'data' => [ |
146 | 146 | 'context' => [ |
147 | 147 | 'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ), |
148 | - 'console' => strval( glsr( Console::class )), |
|
148 | + 'console' => strval( glsr( Console::class ) ), |
|
149 | 149 | 'id' => Application::ID, |
150 | - 'system' => strval( glsr( System::class )), |
|
150 | + 'system' => strval( glsr( System::class ) ), |
|
151 | 151 | ], |
152 | 152 | 'services' => apply_filters( 'site-reviews/addon/sync/services', [] ), |
153 | 153 | ], |
154 | 154 | 'notices' => $this->getNotices(), |
155 | 155 | 'tabs' => $tabs, |
156 | 156 | 'template' => glsr( Template::class ), |
157 | - ]); |
|
157 | + ] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
177 | 177 | 'id' => 'glsr-notices', |
178 | - ]); |
|
178 | + ] ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | { |
23 | 23 | global $menu, $typenow; |
24 | 24 | foreach( $menu as $key => $value ) { |
25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
26 | + continue; |
|
27 | + } |
|
26 | 28 | $postCount = wp_count_posts( Application::POST_TYPE ); |
27 | 29 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
28 | 30 | 'class' => 'pending-count', |
@@ -53,7 +55,9 @@ discard block |
||
53 | 55 | foreach( $pages as $slug => $title ) { |
54 | 56 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
55 | 57 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
56 | - if( !is_callable( $callback ))continue; |
|
58 | + if( !is_callable( $callback )) { |
|
59 | + continue; |
|
60 | + } |
|
57 | 61 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback ); |
58 | 62 | } |
59 | 63 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php defined( 'WPINC' ) || die; ?> |
2 | 2 | |
3 | -<?php if( glsr()->hasPermission( 'settings' )) : ?> |
|
3 | +<?php if( glsr()->hasPermission( 'settings' ) ) : ?> |
|
4 | 4 | <div class="glsr-card card"> |
5 | 5 | <h3>Export Settings</h3> |
6 | 6 | <p>Export the Site Reviews settings for this site to a <code>*.json</code> file. This allows you to easily import the plugin settings into another site.</p> |
@@ -55,7 +55,9 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function enqueuePolyfillService() |
57 | 57 | { |
58 | - if( !apply_filters( 'site-reviews/assets/polyfill', true ))return; |
|
58 | + if( !apply_filters( 'site-reviews/assets/polyfill', true )) { |
|
59 | + return; |
|
60 | + } |
|
59 | 61 | wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([ |
60 | 62 | 'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,XMLHttpRequest,MutationObserver', |
61 | 63 | 'flags' => 'gated', |
@@ -70,7 +72,9 @@ discard block |
||
70 | 72 | // wpforms-recaptcha |
71 | 73 | // google-recaptcha |
72 | 74 | // nf-google-recaptcha |
73 | - if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
|
75 | + if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) { |
|
76 | + return; |
|
77 | + } |
|
74 | 78 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
75 | 79 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
76 | 80 | 'hl' => $language, |
@@ -84,7 +88,9 @@ discard block |
||
84 | 88 | public function inlineStyles() |
85 | 89 | { |
86 | 90 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
87 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
91 | + if( !apply_filters( 'site-reviews/assets/css', true )) { |
|
92 | + return; |
|
93 | + } |
|
88 | 94 | if( !file_exists( $inlineStylesheetPath )) { |
89 | 95 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
90 | 96 | return; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function enqueueAssets() |
29 | 29 | { |
30 | - if( apply_filters( 'site-reviews/assets/css', true )) { |
|
30 | + if( apply_filters( 'site-reviews/assets/css', true ) ) { |
|
31 | 31 | wp_enqueue_style( |
32 | 32 | Application::ID, |
33 | 33 | $this->getStylesheet(), |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | glsr()->version |
36 | 36 | ); |
37 | 37 | } |
38 | - if( apply_filters( 'site-reviews/assets/js', true )) { |
|
38 | + if( apply_filters( 'site-reviews/assets/js', true ) ) { |
|
39 | 39 | $dependencies = apply_filters( 'site-reviews/assets/polyfill', true ) |
40 | 40 | ? [Application::ID.'/polyfill'] |
41 | 41 | : []; |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function enqueuePolyfillService() |
57 | 57 | { |
58 | - if( !apply_filters( 'site-reviews/assets/polyfill', true ))return; |
|
59 | - wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([ |
|
58 | + if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return; |
|
59 | + wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [ |
|
60 | 60 | 'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,XMLHttpRequest,MutationObserver', |
61 | 61 | 'flags' => 'gated', |
62 | - ], 'https://polyfill.io/v3/polyfill.min.js' )); |
|
62 | + ], 'https://polyfill.io/v3/polyfill.min.js' ) ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | // nf-google-recaptcha |
73 | 73 | if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
74 | 74 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
75 | - wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
|
75 | + wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [ |
|
76 | 76 | 'hl' => $language, |
77 | 77 | 'render' => 'explicit', |
78 | - ], 'https://www.google.com/recaptcha/api.js' )); |
|
78 | + ], 'https://www.google.com/recaptcha/api.js' ) ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | public function inlineStyles() |
102 | 102 | { |
103 | 103 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
104 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
105 | - if( !file_exists( $inlineStylesheetPath )) { |
|
104 | + if( !apply_filters( 'site-reviews/assets/css', true ) )return; |
|
105 | + if( !file_exists( $inlineStylesheetPath ) ) { |
|
106 | 106 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
107 | 107 | return; |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $script = 'window.hasOwnProperty("GLSR")||(window.GLSR={});'; |
124 | 124 | foreach( $variables as $key => $value ) { |
125 | - $script.= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE )); |
|
125 | + $script .= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); |
|
126 | 126 | } |
127 | 127 | $pattern = '/\"([^ \-\"]+)\"(:[{\[\"])/'; // removes unnecessary quotes surrounding object keys |
128 | 128 | $optimizedScript = preg_replace( $pattern, '$1$2', $script ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getFixedSelectorsForPagination() |
136 | 136 | { |
137 | - $selectors = ['#wpadminbar','.site-navigation-fixed']; |
|
137 | + $selectors = ['#wpadminbar', '.site-navigation-fixed']; |
|
138 | 138 | return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors ); |
139 | 139 | } |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | protected function getStylesheet() |
145 | 145 | { |
146 | 146 | $currentStyle = glsr( Style::class )->style; |
147 | - return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' )) |
|
147 | + return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) ) |
|
148 | 148 | ? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' ) |
149 | 149 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
150 | 150 | } |