@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function routerChangeReviewStatus( array $request ) |
24 | 24 | { |
25 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
25 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | public function routerClearConsole() |
32 | 32 | { |
33 | 33 | glsr( AdminController::class )->routerClearConsole(); |
34 | - wp_send_json_success([ |
|
34 | + wp_send_json_success( [ |
|
35 | 35 | 'console' => glsr( Console::class )->get(), |
36 | 36 | 'notices' => glsr( Notice::class )->get(), |
37 | - ]); |
|
37 | + ] ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | public function routerCountReviews() |
44 | 44 | { |
45 | 45 | glsr( AdminController::class )->routerCountReviews(); |
46 | - wp_send_json_success([ |
|
46 | + wp_send_json_success( [ |
|
47 | 47 | 'notices' => glsr( Notice::class )->get(), |
48 | - ]); |
|
48 | + ] ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | $shortcode = $request['shortcode']; |
57 | 57 | $response = false; |
58 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
58 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
59 | 59 | $data = glsr()->mceShortcodes[$shortcode]; |
60 | - if( !empty( $data['errors'] )) { |
|
60 | + if( !empty($data['errors']) ) { |
|
61 | 61 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
62 | 62 | } |
63 | 63 | $response = [ |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function routerSearchPosts( array $request ) |
78 | 78 | { |
79 | 79 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
80 | - wp_send_json_success([ |
|
80 | + wp_send_json_success( [ |
|
81 | 81 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
82 | 82 | 'items' => $results, |
83 | - ]); |
|
83 | + ] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function routerSearchTranslations( array $request ) |
90 | 90 | { |
91 | - if( empty( $request['exclude'] )) { |
|
91 | + if( empty($request['exclude']) ) { |
|
92 | 92 | $request['exclude'] = []; |
93 | 93 | } |
94 | 94 | $results = glsr( Translator::class ) |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | ->exclude() |
97 | 97 | ->exclude( $request['exclude'] ) |
98 | 98 | ->renderResults(); |
99 | - wp_send_json_success([ |
|
99 | + wp_send_json_success( [ |
|
100 | 100 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
101 | 101 | 'items' => $results, |
102 | - ]); |
|
102 | + ] ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'message' => glsr( Session::class )->get( $request['form_id'].'message', '', true ), |
114 | 114 | 'recaptcha' => glsr( Session::class )->get( $request['form_id'].'recaptcha', false, true ), |
115 | 115 | ]; |
116 | - if( !wp_validate_boolean( $data['errors'] )) { |
|
116 | + if( !wp_validate_boolean( $data['errors'] ) ) { |
|
117 | 117 | wp_send_json_success( $data ); |
118 | 118 | } |
119 | 119 | wp_send_json_error( $data ); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function routerTogglePinned( array $request ) |
126 | 126 | { |
127 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
128 | - wp_send_json_success([ |
|
127 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
128 | + wp_send_json_success( [ |
|
129 | 129 | 'notices' => glsr( Notice::class )->get(), |
130 | 130 | 'pinned' => $isPinned, |
131 | - ]); |
|
131 | + ] ); |
|
132 | 132 | } |
133 | 133 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'post_type' => Application::POST_TYPE, |
34 | 34 | ]; |
35 | 35 | $postId = wp_insert_post( $post, true ); |
36 | - if( is_wp_error( $postId )) { |
|
36 | + if( is_wp_error( $postId ) ) { |
|
37 | 37 | glsr_log()->error( $postId->get_error_message() ); |
38 | 38 | return 0; |
39 | 39 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function delete( $metaReviewId ) |
50 | 50 | { |
51 | - if( $postId = $this->getPostId( $metaReviewId )) { |
|
51 | + if( $postId = $this->getPostId( $metaReviewId ) ) { |
|
52 | 52 | wp_delete_post( $postId, true ); |
53 | 53 | } |
54 | 54 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $paged = glsr( QueryBuilder::class )->getPaged( |
71 | 71 | wp_validate_boolean( $args['pagination'] ) |
72 | 72 | ); |
73 | - $reviews = new WP_Query([ |
|
73 | + $reviews = new WP_Query( [ |
|
74 | 74 | 'meta_key' => 'pinned', |
75 | 75 | 'meta_query' => $metaQuery, |
76 | 76 | 'offset' => $args['offset'], |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'post_type' => Application::POST_TYPE, |
84 | 84 | 'posts_per_page' => $args['count'], |
85 | 85 | 'tax_query' => $taxQuery, |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | return (object)[ |
88 | 88 | 'results' => array_map( [$this, 'single'], $reviews->posts ), |
89 | 89 | 'max_num_pages' => $reviews->max_num_pages, |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | { |
108 | 108 | if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return; |
109 | 109 | delete_post_meta( $postId, '_edit_last' ); |
110 | - $result = wp_update_post([ |
|
110 | + $result = wp_update_post( [ |
|
111 | 111 | 'ID' => $postId, |
112 | 112 | 'post_content' => get_post_meta( $postId, 'content', true ), |
113 | 113 | 'post_date' => get_post_meta( $postId, 'date', true ), |
114 | 114 | 'post_title' => get_post_meta( $postId, 'title', true ), |
115 | - ]); |
|
116 | - if( is_wp_error( $result )) { |
|
115 | + ] ); |
|
116 | + if( is_wp_error( $result ) ) { |
|
117 | 117 | glsr_log()->error( $result->get_error_message() ); |
118 | 118 | } |
119 | 119 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | protected function getNewPostStatus( array $review, $isBlacklisted ) |
136 | 136 | { |
137 | 137 | $requireApprovalOption = glsr( OptionManager::class )->get( 'settings.general.require.approval' ); |
138 | - return $review['review_type'] == 'local' && ( $requireApprovalOption == 'yes' || $isBlacklisted ) |
|
138 | + return $review['review_type'] == 'local' && ($requireApprovalOption == 'yes' || $isBlacklisted) |
|
139 | 139 | ? 'pending' |
140 | 140 | : 'publish'; |
141 | 141 | } |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | protected function normalizeTerms( $commaSeparatedTermIds ) |
148 | 148 | { |
149 | 149 | $terms = []; |
150 | - $termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds )); |
|
150 | + $termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds ) ); |
|
151 | 151 | foreach( $termIds as $termId ) { |
152 | 152 | $term = term_exists( $termId, Application::TAXONOMY ); |
153 | - if( !isset( $term['term_id'] ))continue; |
|
153 | + if( !isset($term['term_id']) )continue; |
|
154 | 154 | $terms[] = intval( $term['term_id'] ); |
155 | 155 | } |
156 | 156 | return $terms; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | protected function setTerms( $postId, $termIds ) |
165 | 165 | { |
166 | 166 | $terms = $this->normalizeTerms( $termIds ); |
167 | - if( empty( $terms ))return; |
|
167 | + if( empty($terms) )return; |
|
168 | 168 | $result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY ); |
169 | - if( is_wp_error( $result )) { |
|
169 | + if( is_wp_error( $result ) ) { |
|
170 | 170 | glsr_log()->error( $result->get_error_message() ); |
171 | 171 | } |
172 | 172 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->args = $args; |
36 | 36 | $this->reviews = glsr( ReviewManager::class )->get( $args )->results; |
37 | - if( empty( $this->reviews ) && $this->isHidden( 'if_empty' ))return; |
|
37 | + if( empty($this->reviews) && $this->isHidden( 'if_empty' ) )return; |
|
38 | 38 | $this->rating = glsr( Rating::class )->getAverage( $this->reviews ); |
39 | 39 | $this->generateSchema(); |
40 | 40 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'stars' => $this->buildStars(), |
47 | 47 | 'text' => $this->buildText(), |
48 | 48 | ], |
49 | - ]); |
|
49 | + ] ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function buildPercentage() |
56 | 56 | { |
57 | - if( $this->isHidden( 'bars' ))return; |
|
57 | + if( $this->isHidden( 'bars' ) )return; |
|
58 | 58 | $range = range( Rating::MAX_RATING, 1 ); |
59 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews )); |
|
60 | - $bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) { |
|
59 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ) ); |
|
60 | + $bars = array_reduce( $range, function( $carry, $level ) use($percentages) { |
|
61 | 61 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
62 | 62 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
63 | 63 | $percent = $this->buildPercentagePercent( $percentages[$level] ); |
64 | 64 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
65 | 65 | 'class' => 'glsr-bar', |
66 | - ]); |
|
66 | + ] ); |
|
67 | 67 | }); |
68 | 68 | return $this->wrap( 'percentage', $bars ); |
69 | 69 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function buildPercentageBackground( $percent ) |
76 | 76 | { |
77 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
77 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
78 | 78 | 'class' => 'glsr-bar-background-percent', |
79 | 79 | 'style' => 'width:'.$percent, |
80 | - ]); |
|
80 | + ] ); |
|
81 | 81 | return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>'; |
82 | 82 | } |
83 | 83 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function buildRating() |
106 | 106 | { |
107 | - if( $this->isHidden( 'rating' ))return; |
|
107 | + if( $this->isHidden( 'rating' ) )return; |
|
108 | 108 | return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' ); |
109 | 109 | } |
110 | 110 | |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function buildStars() |
115 | 115 | { |
116 | - if( $this->isHidden( 'stars' ))return; |
|
116 | + if( $this->isHidden( 'stars' ) )return; |
|
117 | 117 | $stars = glsr( Partial::class )->build( 'star-rating', [ |
118 | 118 | 'rating' => $this->rating, |
119 | - ]); |
|
119 | + ] ); |
|
120 | 120 | return $this->wrap( 'stars', $stars ); |
121 | 121 | } |
122 | 122 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function buildText() |
127 | 127 | { |
128 | - if( $this->isHidden( 'summary' ))return; |
|
128 | + if( $this->isHidden( 'summary' ) )return; |
|
129 | 129 | $count = count( $this->reviews ); |
130 | - if( empty( $this->args['text'] )) { |
|
130 | + if( empty($this->args['text']) ) { |
|
131 | 131 | // @todo document this change |
132 | 132 | $this->args['text'] = _nx( |
133 | 133 | '{rating} out of {max} stars (based on {num} review)', |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ); |
139 | 139 | } |
140 | 140 | $summary = str_replace( |
141 | - ['{rating}','{max}', '{num}'], |
|
141 | + ['{rating}', '{max}', '{num}'], |
|
142 | 142 | [$this->rating, Rating::MAX_RATING, $count], |
143 | 143 | $this->args['text'] |
144 | 144 | ); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | protected function generateSchema() |
152 | 152 | { |
153 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
153 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
154 | 154 | glsr( Schema::class )->store( |
155 | 155 | glsr( Schema::class )->buildSummary( $this->args ) |
156 | 156 | ); |
@@ -183,6 +183,6 @@ discard block |
||
183 | 183 | { |
184 | 184 | return glsr( Builder::class )->div( $value, [ |
185 | 185 | 'class' => 'glsr-summary-'.$key, |
186 | - ]); |
|
186 | + ] ); |
|
187 | 187 | } |
188 | 188 | } |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | if( $review->review_type != 'local' )continue; |
38 | 38 | $reviews[] = $this->buildReview( $review ); |
39 | 39 | } |
40 | - if( !empty( $reviews )) { |
|
40 | + if( !empty($reviews) ) { |
|
41 | 41 | array_walk( $reviews, function( &$review ) { |
42 | - unset( $review['@context'] ); |
|
43 | - unset( $review['itemReviewed'] ); |
|
42 | + unset($review['@context']); |
|
43 | + unset($review['itemReviewed']); |
|
44 | 44 | }); |
45 | 45 | $schema['review'] = $reviews; |
46 | 46 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function buildSummary( $args = null ) |
55 | 55 | { |
56 | - if( is_array( $args )) { |
|
56 | + if( is_array( $args ) ) { |
|
57 | 57 | $this->args = $args; |
58 | 58 | } |
59 | 59 | $buildSummary = glsr( Helper::class )->buildMethodName( $this->getSchemaOptionValue( 'type' ), 'buildSummaryFor' ); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $schema = method_exists( $this, $buildSummary ) |
62 | 62 | ? $this->$buildSummary() |
63 | 63 | : $this->buildSummaryForCustom(); |
64 | - if( !empty( $count )) { |
|
64 | + if( !empty($count) ) { |
|
65 | 65 | $schema->aggregateRating( |
66 | 66 | $this->getSchemaType( 'AggregateRating' ) |
67 | 67 | ->ratingValue( $this->getRatingValue() ) |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function render() |
81 | 81 | { |
82 | - if( is_null( glsr()->schemas ))return; |
|
82 | + if( is_null( glsr()->schemas ) )return; |
|
83 | 83 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
84 | 84 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
85 | 85 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
86 | - )); |
|
86 | + ) ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | $schemas = glsr()->schemas; |
95 | 95 | $schemas[] = $schema; |
96 | - glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ))); |
|
96 | + glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | protected function buildReview( $review ) |
104 | 104 | { |
105 | 105 | $schema = $this->getSchemaType( 'Review' ) |
106 | - ->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use( $review ) { |
|
106 | + ->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use($review) { |
|
107 | 107 | $schema->name( $review->title ); |
108 | 108 | }) |
109 | - ->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use( $review ) { |
|
109 | + ->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use($review) { |
|
110 | 110 | $schema->reviewBody( $review->content ); |
111 | 111 | }) |
112 | - ->datePublished(( new DateTime( $review->date ))) |
|
113 | - ->author( $this->getSchemaType( 'Person' )->name( $review->author )) |
|
114 | - ->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ))); |
|
115 | - if( !empty( $review->rating )) { |
|
112 | + ->datePublished( (new DateTime( $review->date )) ) |
|
113 | + ->author( $this->getSchemaType( 'Person' )->name( $review->author ) ) |
|
114 | + ->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ) ) ); |
|
115 | + if( !empty($review->rating) ) { |
|
116 | 116 | $schema->reviewRating( |
117 | 117 | $this->getSchemaType( 'Rating' ) |
118 | 118 | ->ratingValue( $review->rating ) |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | foreach( $values as $value ) { |
133 | 133 | $option = $this->getSchemaOptionValue( $value ); |
134 | - if( empty( $option ))continue; |
|
134 | + if( empty($option) )continue; |
|
135 | 135 | $schema->$value( $option ); |
136 | 136 | } |
137 | 137 | return $schema; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | { |
145 | 145 | return $this->buildSchemaValues( $this->getSchemaType(), [ |
146 | 146 | 'description', 'image', 'name', 'url', |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | return $this->buildSchemaValues( $this->buildSummaryForCustom(), [ |
156 | 156 | 'address', 'priceRange', 'telephone', |
157 | - ]); |
|
157 | + ] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | { |
165 | 165 | $offers = $this->buildSchemaValues( $this->getSchemaType( 'AggregateOffer' ), [ |
166 | 166 | 'highPrice', 'lowPrice', 'priceCurrency', |
167 | - ]); |
|
167 | + ] ); |
|
168 | 168 | return $this->buildSummaryForCustom() |
169 | 169 | ->offers( $offers ) |
170 | - ->setProperty( '@id', $this->getSchemaOptionValue( 'url' )); |
|
170 | + ->setProperty( '@id', $this->getSchemaOptionValue( 'url' ) ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function getReviewCounts() |
185 | 185 | { |
186 | - if( !isset( $this->reviewCounts )) { |
|
187 | - $this->reviewCounts = glsr( Database::class )->getReviewCounts([ |
|
186 | + if( !isset($this->reviewCounts) ) { |
|
187 | + $this->reviewCounts = glsr( Database::class )->getReviewCounts( [ |
|
188 | 188 | 'min' => $this->args['rating'], |
189 | - ]); |
|
189 | + ] ); |
|
190 | 190 | } |
191 | 191 | return $this->reviewCounts; |
192 | 192 | } |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | protected function getSchemaOption( $option, $fallback ) |
200 | 200 | { |
201 | 201 | $option = strtolower( $option ); |
202 | - if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) { |
|
202 | + if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) { |
|
203 | 203 | return $schemaOption; |
204 | 204 | } |
205 | 205 | $setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option ); |
206 | - if( is_array( $setting )) { |
|
206 | + if( is_array( $setting ) ) { |
|
207 | 207 | return $this->getSchemaOptionDefault( $setting, $fallback ); |
208 | 208 | } |
209 | - return !empty( $setting ) |
|
209 | + return !empty($setting) |
|
210 | 210 | ? $setting |
211 | 211 | : $fallback; |
212 | 212 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $setting = wp_parse_args( $setting, [ |
221 | 221 | 'custom' => '', |
222 | 222 | 'default' => $fallback, |
223 | - ]); |
|
223 | + ] ); |
|
224 | 224 | return $setting['default'] != 'custom' |
225 | 225 | ? $setting['default'] |
226 | 226 | : $setting['custom']; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | if( !is_single() && !is_page() )return; |
241 | 241 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
242 | - if( method_exists( $this, $method )) { |
|
242 | + if( method_exists( $this, $method ) ) { |
|
243 | 243 | return $this->$method(); |
244 | 244 | } |
245 | 245 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | protected function getSchemaType( $type = null ) |
252 | 252 | { |
253 | - if( !is_string( $type )) { |
|
253 | + if( !is_string( $type ) ) { |
|
254 | 254 | $type = $this->getSchemaOption( 'type', 'LocalBusiness' ); |
255 | 255 | } |
256 | 256 | $className = glsr( Helper::class )->buildClassName( $type, 'Modules\Schema' ); |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | protected function getThingDescription() |
266 | 266 | { |
267 | 267 | $post = get_post(); |
268 | - if( !( $post instanceof WP_Post )) { |
|
268 | + if( !($post instanceof WP_Post) ) { |
|
269 | 269 | return ''; |
270 | 270 | } |
271 | - $text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt )); |
|
272 | - return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 )); |
|
271 | + $text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ) ); |
|
272 | + return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ) ); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $counts = $this->flattenCounts( $reviewCounts ); |
51 | 51 | $average = array_sum( $counts ); |
52 | 52 | if( $average > 0 ) { |
53 | - $average = round( $this->getTotalSum( $counts ) / $average, intval( $roundBy )); |
|
53 | + $average = round( $this->getTotalSum( $counts ) / $average, intval( $roundBy ) ); |
|
54 | 54 | } |
55 | - return floatval( apply_filters( 'site-reviews/rating/average', $average, $counts, $reviewCounts )); |
|
55 | + return floatval( apply_filters( 'site-reviews/rating/average', $average, $counts, $reviewCounts ) ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | $z = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage]; |
75 | 75 | $phat = 1 * $upDownRatings[1] / $numRatings; |
76 | - return ( $phat + $z * $z / ( 2 * $numRatings ) - $z * sqrt(( $phat * ( 1 - $phat ) + $z * $z / ( 4 * $numRatings )) / $numRatings )) / ( 1 + $z * $z / $numRatings ); |
|
76 | + return ($phat + $z * $z / (2 * $numRatings) - $z * sqrt( ($phat * (1 - $phat) + $z * $z / (4 * $numRatings)) / $numRatings )) / (1 + $z * $z / $numRatings); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $counts = $this->flattenCounts( $reviewCounts ); |
93 | 93 | $total = array_sum( $counts ); |
94 | 94 | foreach( $counts as $index => $count ) { |
95 | - if( empty( $count ))continue; |
|
95 | + if( empty($count) )continue; |
|
96 | 96 | $counts[$index] = $count / $total * 100; |
97 | 97 | } |
98 | 98 | return $this->getRoundedPercentages( $counts ); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->getRankingUsingImdb( $counts ), |
109 | 109 | $counts, |
110 | 110 | $this |
111 | - )); |
|
111 | + ) ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | protected function flattenCounts( array $reviewCounts ) |
118 | 118 | { |
119 | 119 | $counts = []; |
120 | - array_walk_recursive( $reviewCounts, function( $num, $index ) use( &$counts ) { |
|
120 | + array_walk_recursive( $reviewCounts, function( $num, $index ) use(&$counts) { |
|
121 | 121 | $counts[$index] = isset($counts[$index]) |
122 | 122 | ? $num + $counts[$index] |
123 | 123 | : $num; |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | $avgRating = $this->getAverage( $ratingCounts ); |
141 | 141 | // Represents a prior (your prior opinion without data) for the average star rating. A higher prior also means a higher margin for error. |
142 | 142 | // This could also be the average score of all items instead of a fixed value. |
143 | - $bayesMean = ( $confidencePercentage / 100 ) * static::MAX_RATING; // prior, 70% = 3.5 |
|
143 | + $bayesMean = ($confidencePercentage / 100) * static::MAX_RATING; // prior, 70% = 3.5 |
|
144 | 144 | // Represents the number of ratings expected to begin observing a pattern that would put confidence in the prior. |
145 | 145 | $bayesMinimal = 10; // confidence |
146 | 146 | $numOfReviews = array_sum( $ratingCounts ); |
147 | 147 | return $avgRating > 0 |
148 | - ? (( $bayesMinimal * $bayesMean ) + ( $avgRating * $numOfReviews )) / ( $bayesMinimal + $numOfReviews ) |
|
148 | + ? (($bayesMinimal * $bayesMean) + ($avgRating * $numOfReviews)) / ($bayesMinimal + $numOfReviews) |
|
149 | 149 | : 0; |
150 | 150 | } |
151 | 151 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $weight = $this->getWeight( $ratingCounts, $ratingCountsSum ); |
166 | 166 | $weightPow2 = $this->getWeight( $ratingCounts, $ratingCountsSum, true ); |
167 | 167 | $zScore = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage]; |
168 | - return $weight - $zScore * sqrt(( $weightPow2 - pow( $weight, 2 )) / ( $ratingCountsSum + 1 )); |
|
168 | + return $weight - $zScore * sqrt( ($weightPow2 - pow( $weight, 2 )) / ($ratingCountsSum + 1) ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | $remainders = array_column( $percentages, 'remainder' ); |
186 | 186 | array_multisort( $remainders, SORT_DESC, SORT_STRING, $indexes, SORT_DESC, $percentages ); |
187 | 187 | $i = 0; |
188 | - if( array_sum( array_column( $percentages, 'percent' )) > 0 ) { |
|
189 | - while( array_sum( array_column( $percentages, 'percent' )) < $totalPercent ) { |
|
188 | + if( array_sum( array_column( $percentages, 'percent' ) ) > 0 ) { |
|
189 | + while( array_sum( array_column( $percentages, 'percent' ) ) < $totalPercent ) { |
|
190 | 190 | $percentages[$i]['percent']++; |
191 | 191 | $i++; |
192 | 192 | } |
193 | 193 | } |
194 | 194 | array_multisort( $indexes, SORT_DESC, $percentages ); |
195 | - return array_combine( $indexes, array_column( $percentages, 'percent' )); |
|
195 | + return array_combine( $indexes, array_column( $percentages, 'percent' ) ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | protected function getWeight( array $ratingCounts, $ratingCountsSum, $powerOf2 = false ) |
214 | 214 | { |
215 | 215 | return array_reduce( array_keys( $ratingCounts ), |
216 | - function( $count, $rating ) use( $ratingCounts, $ratingCountsSum, $powerOf2 ) { |
|
216 | + function( $count, $rating ) use($ratingCounts, $ratingCountsSum, $powerOf2) { |
|
217 | 217 | $ratingLevel = $powerOf2 |
218 | 218 | ? pow( $rating, 2 ) |
219 | 219 | : $rating; |
220 | - return $count + ( $ratingLevel * ( $ratingCounts[$rating] + 1 )) / $ratingCountsSum; |
|
220 | + return $count + ($ratingLevel * ($ratingCounts[$rating] + 1)) / $ratingCountsSum; |
|
221 | 221 | } |
222 | 222 | ); |
223 | 223 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | natsort( $routines ); |
18 | 18 | array_walk( $routines, function( $routine ) { |
19 | 19 | $parts = explode( '__', $routine ); |
20 | - if( version_compare( glsr()->version, end( $parts ), '>=' ))return; |
|
20 | + if( version_compare( glsr()->version, end( $parts ), '>=' ) )return; |
|
21 | 21 | call_user_func( [$this, $routine] ); |
22 | 22 | }); |
23 | 23 | $this->updateVersion(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function updateVersion() |
30 | 30 | { |
31 | 31 | $currentVersion = glsr( OptionManager::class )->get( 'version' ); |
32 | - if( version_compare( $currentVersion, glsr()->version, '<' )) { |
|
32 | + if( version_compare( $currentVersion, glsr()->version, '<' ) ) { |
|
33 | 33 | glsr( OptionManager::class )->set( 'version', glsr()->version ); |
34 | 34 | } |
35 | 35 | if( $currentVersion != glsr()->version ) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'setting' => 'Plugin Settings', |
39 | 39 | 'reviews' => 'Review Counts', |
40 | 40 | ]; |
41 | - $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) { |
|
41 | + $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) { |
|
42 | 42 | $methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' ); |
43 | 43 | if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) { |
44 | 44 | return $carry.$this->implode( $details[$key], $systemDetails ); |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | $plugins = get_plugins(); |
57 | 57 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
58 | - $inactive = array_diff_key( $plugins, array_flip( $activePlugins )); |
|
59 | - return $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
58 | + $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) ); |
|
59 | + return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function getInactivePluginDetails() |
81 | 81 | { |
82 | 82 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
83 | - return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ))); |
|
83 | + return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | { |
91 | 91 | $plugins = array_merge( |
92 | 92 | get_mu_plugins(), |
93 | - get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
|
93 | + get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) ) |
|
94 | 94 | ); |
95 | - if( empty( $plugins ))return; |
|
95 | + if( empty($plugins) )return; |
|
96 | 96 | return $this->normalizePluginList( $plugins ); |
97 | 97 | } |
98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getMultisitePluginDetails() |
103 | 103 | { |
104 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
104 | + if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return; |
|
105 | 105 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
106 | 106 | } |
107 | 107 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | 'Max Input Vars' => ini_get( 'max_input_vars' ), |
128 | 128 | 'Memory Limit' => ini_get( 'memory_limit' ), |
129 | 129 | 'Post Max Size' => ini_get( 'post_max_size' ), |
130 | - 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )), |
|
131 | - 'Session Name' => esc_html( ini_get( 'session.name' )), |
|
132 | - 'Session Save Path' => esc_html( ini_get( 'session.save_path' )), |
|
133 | - 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ), |
|
134 | - 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ), |
|
130 | + 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ), |
|
131 | + 'Session Name' => esc_html( ini_get( 'session.name' ) ), |
|
132 | + 'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ), |
|
133 | + 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ), |
|
134 | + 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ), |
|
135 | 135 | 'Upload Max Filesize' => ini_get( 'upload_max_filesize' ), |
136 | 136 | ]; |
137 | 137 | } |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | ksort( $settings ); |
177 | 177 | $details = []; |
178 | 178 | foreach( $settings as $key => $value ) { |
179 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
180 | - $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
|
179 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue; |
|
180 | + $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' ); |
|
181 | 181 | $details[$key] = $value; |
182 | 182 | } |
183 | 183 | return $details; |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | 'WPE_APIKEY' => 'WP Engine', |
250 | 250 | ]; |
251 | 251 | foreach( $checks as $key => $value ) { |
252 | - if( !$this->isWebhostCheckValid( $key ))continue; |
|
252 | + if( !$this->isWebhostCheckValid( $key ) )continue; |
|
253 | 253 | return $value; |
254 | 254 | } |
255 | - return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] )); |
|
255 | + return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) ); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | { |
274 | 274 | $plugins = get_plugins(); |
275 | 275 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
276 | - $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ))); |
|
277 | - $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
276 | + $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) ); |
|
277 | + $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
278 | 278 | return $active + $inactive; |
279 | 279 | } |
280 | 280 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | protected function implode( $title, array $details ) |
286 | 286 | { |
287 | 287 | $strings = ['['.$title.']']; |
288 | - $padding = max( array_map( 'strlen', array_keys( $details )) ); |
|
288 | + $padding = max( array_map( 'strlen', array_keys( $details ) ) ); |
|
289 | 289 | $padding = max( [$padding, static::PAD] ); |
290 | 290 | foreach( $details as $key => $value ) { |
291 | 291 | $strings[] = is_string( $key ) |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | $keys = [ |
329 | 329 | 'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret', |
330 | 330 | ]; |
331 | - array_walk( $settings, function( &$value, $setting ) use( $keys ) { |
|
331 | + array_walk( $settings, function( &$value, $setting ) use($keys) { |
|
332 | 332 | foreach( $keys as $key ) { |
333 | - if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue; |
|
333 | + if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue; |
|
334 | 334 | $value = str_repeat( '•', 13 ); |
335 | 335 | return; |
336 | 336 | } |
@@ -59,13 +59,13 @@ |
||
59 | 59 | 'review_type' => '', |
60 | 60 | ]; |
61 | 61 | $meta = array_filter( |
62 | - array_map( 'array_shift', (array)get_post_meta( $post->ID )), |
|
62 | + array_map( 'array_shift', (array)get_post_meta( $post->ID ) ), |
|
63 | 63 | 'strlen' |
64 | 64 | ); |
65 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
65 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
66 | 66 | $this->modified = $this->isModified( $properties ); |
67 | 67 | array_walk( $properties, function( $value, $key ) { |
68 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
68 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
69 | 69 | $this->$key = $value; |
70 | 70 | }); |
71 | 71 | } |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function renderAssignedToMetabox( WP_Post $post ) |
182 | 182 | { |
183 | - if( !$this->isReviewPostType( $post ))return; |
|
183 | + if( !$this->isReviewPostType( $post ) )return; |
|
184 | 184 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
185 | 185 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
186 | 186 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
187 | 187 | 'id' => $assignedTo, |
188 | 188 | 'template' => $this->buildAssignedToTemplate( $assignedTo, $post ), |
189 | - ]); |
|
189 | + ] ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function renderDetailsMetaBox( WP_Post $post ) |
197 | 197 | { |
198 | - if( !$this->isReviewPostType( $post ))return; |
|
198 | + if( !$this->isReviewPostType( $post ) )return; |
|
199 | 199 | $review = glsr( ReviewManager::class )->single( $post ); |
200 | 200 | glsr()->render( 'partials/editor/metabox-details', [ |
201 | 201 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
202 | 202 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
203 | - ]); |
|
203 | + ] ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function renderPinnedInPublishMetaBox() |
211 | 211 | { |
212 | - if( !$this->isReviewPostType( get_post() ))return; |
|
212 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
213 | 213 | glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [ |
214 | 214 | 'context' => [ |
215 | 215 | 'no' => __( 'No', 'site-reviews' ), |
216 | 216 | 'yes' => __( 'Yes', 'site-reviews' ), |
217 | 217 | ], |
218 | - 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
219 | - ]); |
|
218 | + 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
219 | + ] ); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function renderResponseMetaBox( WP_Post $post ) |
227 | 227 | { |
228 | - if( !$this->isReviewPostType( $post ))return; |
|
228 | + if( !$this->isReviewPostType( $post ) )return; |
|
229 | 229 | wp_nonce_field( 'response', '_nonce-response', false ); |
230 | 230 | glsr()->render( 'partials/editor/metabox-response', [ |
231 | 231 | 'response' => get_post_meta( $post->ID, 'response', true ), |
232 | - ]); |
|
232 | + ] ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function renderTaxonomyMetabox( WP_Post $post ) |
241 | 241 | { |
242 | - if( !$this->isReviewPostType( $post ))return; |
|
242 | + if( !$this->isReviewPostType( $post ) )return; |
|
243 | 243 | glsr()->render( 'partials/editor/metabox-categories', [ |
244 | 244 | 'post' => $post, |
245 | 245 | 'tax_name' => Application::TAXONOMY, |
246 | 246 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
247 | - ]); |
|
247 | + ] ); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function revertReview() |
256 | 256 | { |
257 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
257 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
258 | 258 | glsr( ReviewManager::class )->revert( $postId ); |
259 | 259 | $this->redirect( $postId, 52 ); |
260 | 260 | } |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
278 | 278 | { |
279 | 279 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
280 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
280 | + if( !($assignedPost instanceof WP_Post) )return; |
|
281 | 281 | return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [ |
282 | 282 | 'context' => [ |
283 | 283 | 'data.url' => (string)get_permalink( $assignedPost ), |
284 | 284 | 'data.title' => get_the_title( $assignedPost ), |
285 | 285 | ], |
286 | - ]); |
|
286 | + ] ); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | 'class' => 'button button-large', |
304 | 304 | 'href' => $revertUrl, |
305 | 305 | 'id' => 'revert', |
306 | - ]); |
|
306 | + ] ); |
|
307 | 307 | } |
308 | 308 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
309 | 309 | 'class' => 'button button-large', |
310 | 310 | 'disabled' => true, |
311 | 311 | 'id' => 'revert', |
312 | - ]); |
|
312 | + ] ); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
323 | 323 | ? glsr()->reviewTypes[$review->review_type] |
324 | 324 | : __( 'Unknown', 'site-reviews' ); |
325 | - if( !empty( $review->url )) { |
|
325 | + if( !empty($review->url) ) { |
|
326 | 326 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
327 | 327 | 'href' => $review->url, |
328 | 328 | 'target' => '_blank', |
329 | - ]); |
|
329 | + ] ); |
|
330 | 330 | } |
331 | 331 | return $reviewType; |
332 | 332 | } |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | */ |
346 | 346 | protected function normalizeDetailsMetaBox( Review $review ) |
347 | 347 | { |
348 | - $user = empty( $review->user_id ) |
|
348 | + $user = empty($review->user_id) |
|
349 | 349 | ? __( 'Unregistered user', 'site-reviews' ) |
350 | 350 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
351 | 351 | 'href' => get_author_posts_url( $review->user_id ), |
352 | - ]); |
|
353 | - $email = empty( $review->email ) |
|
352 | + ] ); |
|
353 | + $email = empty($review->email) |
|
354 | 354 | ? '—' |
355 | 355 | : glsr( Builder::class )->a( $review->email, [ |
356 | 356 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
357 | - ]); |
|
357 | + ] ); |
|
358 | 358 | $metabox = [ |
359 | 359 | __( 'Rating', 'site-reviews' ) => glsr( Html::class )->buildPartial( 'star-rating', ['rating' => $review->rating] ), |
360 | 360 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | __( 'IP Address', 'site-reviews' ) => $review->ip_address, |
366 | 366 | __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ), |
367 | 367 | ]; |
368 | - return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review )); |
|
368 | + return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) ); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $redirectUri = $hasReferer |
383 | 383 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
384 | 384 | : get_edit_post_link( $postId ); |
385 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
385 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
386 | 386 | exit; |
387 | 387 | } |
388 | 388 | } |