@@ -194,7 +194,8 @@ |
||
194 | 194 | $dateFormat = $this->getOption('settings.reviews.date.format', 'default'); |
195 | 195 | if ('relative' == $dateFormat) { |
196 | 196 | $date = glsr(Date::class)->relative($value); |
197 | - } else { |
|
197 | + } |
|
198 | + else { |
|
198 | 199 | $format = 'custom' == $dateFormat |
199 | 200 | ? $this->getOption('settings.reviews.date.custom', 'M j, Y') |
200 | 201 | : glsr(OptionManager::class)->getWP('date_format', 'F j, Y'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @action set_object_terms |
23 | 23 | */ |
24 | 24 | public function onAfterChangeCategory($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds) |
25 | - { |
|
25 | + { |
|
26 | 26 | sort($newTTIds); |
27 | 27 | sort($oldTTIds); |
28 | 28 | if ($newTTIds === $oldTTIds || !$this->isReviewPostId($postId)) { |
@@ -48,14 +48,15 @@ discard block |
||
48 | 48 | * @action transition_post_status |
49 | 49 | */ |
50 | 50 | public function onAfterChangeStatus($newStatus, $oldStatus, $post) |
51 | - { |
|
51 | + { |
|
52 | 52 | if (Application::POST_TYPE != glsr_get($post, 'post_type') || in_array($oldStatus, ['new', $newStatus])) { |
53 | 53 | return; |
54 | 54 | } |
55 | 55 | $review = glsr_get_review($post); |
56 | 56 | if ('publish' == $post->post_status) { |
57 | 57 | glsr(CountsManager::class)->increase($review); |
58 | - } else { |
|
58 | + } |
|
59 | + else { |
|
59 | 60 | glsr(CountsManager::class)->decrease($review); |
60 | 61 | } |
61 | 62 | } |
@@ -65,7 +66,7 @@ discard block |
||
65 | 66 | * @action site-reviews/review/created |
66 | 67 | */ |
67 | 68 | public function onAfterCreate(Review $review) |
68 | - { |
|
69 | + { |
|
69 | 70 | if ('publish' !== $review->status) { |
70 | 71 | return; |
71 | 72 | } |
@@ -78,7 +79,7 @@ discard block |
||
78 | 79 | * @action before_delete_post |
79 | 80 | */ |
80 | 81 | public function onBeforeDelete($postId) |
81 | - { |
|
82 | + { |
|
82 | 83 | if (!$this->isReviewPostId($postId)) { |
83 | 84 | return; |
84 | 85 | } |
@@ -95,7 +96,7 @@ discard block |
||
95 | 96 | * @action update_postmeta |
96 | 97 | */ |
97 | 98 | public function onBeforeUpdate($metaId, $postId, $metaKey, $metaValue) |
98 | - { |
|
99 | + { |
|
99 | 100 | if (!$this->isReviewPostId($postId)) { |
100 | 101 | return; |
101 | 102 | } |
@@ -116,7 +117,7 @@ discard block |
||
116 | 117 | * @return void |
117 | 118 | */ |
118 | 119 | public function onBeforeChangeAssignedTo(Review $review, $assignedTo) |
119 | - { |
|
120 | + { |
|
120 | 121 | glsr(CountsManager::class)->decreasePostCounts($review); |
121 | 122 | $review->assigned_to = $assignedTo; |
122 | 123 | glsr(CountsManager::class)->increasePostCounts($review); |
@@ -127,7 +128,7 @@ discard block |
||
127 | 128 | * @return void |
128 | 129 | */ |
129 | 130 | public function onBeforeChangeRating(Review $review, $rating) |
130 | - { |
|
131 | + { |
|
131 | 132 | glsr(CountsManager::class)->decrease($review); |
132 | 133 | $review->rating = $rating; |
133 | 134 | glsr(CountsManager::class)->increase($review); |
@@ -138,7 +139,7 @@ discard block |
||
138 | 139 | * @return void |
139 | 140 | */ |
140 | 141 | public function onBeforeChangeReviewType(Review $review, $reviewType) |
141 | - { |
|
142 | + { |
|
142 | 143 | glsr(CountsManager::class)->decrease($review); |
143 | 144 | $review->review_type = $reviewType; |
144 | 145 | glsr(CountsManager::class)->increase($review); |
@@ -108,7 +108,8 @@ |
||
108 | 108 | constant($integrationClass.'::PLUGIN_NAME') |
109 | 109 | )); |
110 | 110 | return false; |
111 | - } elseif (!glsr($integrationClass)->isSupported()) { |
|
111 | + } |
|
112 | + elseif (!glsr($integrationClass)->isSupported()) { |
|
112 | 113 | glsr(Notice::class)->addError(sprintf( |
113 | 114 | __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
114 | 115 | constant($integrationClass.'::PLUGIN_NAME'), |
@@ -221,7 +221,8 @@ |
||
221 | 221 | if ($flattenValue) { |
222 | 222 | $value = '['.implode(', ', $value).']'; |
223 | 223 | } |
224 | - } elseif (is_array($value)) { |
|
224 | + } |
|
225 | + elseif (is_array($value)) { |
|
225 | 226 | $result = array_merge($result, $this->flattenArray($value, $flattenValue, $newKey)); |
226 | 227 | continue; |
227 | 228 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return int |
23 | 23 | */ |
24 | 24 | public function getPostIdFromReviewId($metaReviewId) |
25 | - { |
|
25 | + { |
|
26 | 26 | $postId = $this->db->get_var(" |
27 | 27 | SELECT p.ID |
28 | 28 | FROM {$this->db->posts} AS p |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return array |
41 | 41 | */ |
42 | 42 | public function getReviewCounts(array $args, $lastPostId = 0, $limit = 500) |
43 | - { |
|
43 | + { |
|
44 | 44 | return (array) $this->db->get_results(" |
45 | 45 | SELECT DISTINCT p.ID, m1.meta_value AS rating, m2.meta_value AS type |
46 | 46 | FROM {$this->db->posts} AS p |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | */ |
66 | 66 | public function getReviewCountsFor($metaKey) |
67 | - { |
|
67 | + { |
|
68 | 68 | $metaKey = glsr(Helper::class)->prefix('_', $metaKey); |
69 | 69 | return (array) $this->db->get_results(" |
70 | 70 | SELECT DISTINCT m.meta_value AS name, COUNT(*) num_posts |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return array |
83 | 83 | */ |
84 | 84 | public function getReviewIdsByType($reviewType) |
85 | - { |
|
85 | + { |
|
86 | 86 | $results = $this->db->get_col(" |
87 | 87 | SELECT DISTINCT m1.meta_value AS review_id |
88 | 88 | FROM {$this->db->posts} AS p |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return array |
103 | 103 | */ |
104 | 104 | public function getReviewRatingsFromIds(array $postIds, $greaterThanId = 0, $limit = 100) |
105 | - { |
|
105 | + { |
|
106 | 106 | sort($postIds); |
107 | 107 | $postIds = array_slice($postIds, intval(array_search($greaterThanId, $postIds)), $limit); |
108 | 108 | $postIds = implode(',', $postIds); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return array |
128 | 128 | */ |
129 | 129 | public function getReviewsMeta($key, $status = 'publish') |
130 | - { |
|
130 | + { |
|
131 | 131 | $key = glsr(Helper::class)->prefix('_', $key); |
132 | 132 | $values = $this->db->get_col(" |
133 | 133 | SELECT DISTINCT m.meta_value |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return string |
150 | 150 | */ |
151 | 151 | protected function getAndForCounts(array $args, $and = '') |
152 | - { |
|
152 | + { |
|
153 | 153 | $postIds = implode(',', array_filter(glsr_get($args, 'post_ids'))); |
154 | 154 | $termIds = implode(',', array_filter(glsr_get($args, 'term_ids'))); |
155 | 155 | if (!empty($args['type'])) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @return string |
170 | 170 | */ |
171 | 171 | protected function getInnerJoinForCounts(array $args, $innerJoin = '') |
172 | - { |
|
172 | + { |
|
173 | 173 | if (!empty(glsr_get($args, 'post_ids'))) { |
174 | 174 | $innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id "; |
175 | 175 | } |