@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | { |
219 | 219 | $config = midcom_baseclasses_components_configuration::get('net.nehmer.comments', 'config'); |
220 | 220 | |
221 | - if ( $config->get('ratings_enable') |
|
222 | - && ( $config->get('ratings_cache_to_object') |
|
221 | + if ($config->get('ratings_enable') |
|
222 | + && ($config->get('ratings_cache_to_object') |
|
223 | 223 | || $config->get('comment_count_cache_to_object'))) { |
224 | 224 | // Handle ratings |
225 | 225 | $comments = self::list_by_objectguid($this->objectguid); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | private function _send_notifications() |
270 | 270 | { |
271 | - if ( empty($this->title) |
|
271 | + if (empty($this->title) |
|
272 | 272 | && empty($this->content)) { |
273 | 273 | // No need to send notifications about empty rating entries |
274 | 274 | return; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | if (!$this->_schemadb) { |
99 | 99 | $this->_schemadb = schemadb::from_path($this->_config->get('schemadb')); |
100 | 100 | |
101 | - if ( $this->_config->get('use_captcha') |
|
102 | - || ( !midcom::get()->auth->user |
|
101 | + if ($this->_config->get('use_captcha') |
|
102 | + || (!midcom::get()->auth->user |
|
103 | 103 | && $this->_config->get('use_captcha_if_anonymous'))) { |
104 | 104 | $fields = $this->_schemadb->get('comment')->get('fields'); |
105 | 105 | $fields['captcha'] = [ |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->_schemadb->get('comment')->set('fields', $fields); |
113 | 113 | } |
114 | 114 | |
115 | - if ( $this->_config->get('ratings_enable') |
|
115 | + if ($this->_config->get('ratings_enable') |
|
116 | 116 | && $this->_schemadb->get('comment')->has_field('rating')) { |
117 | 117 | $this->_schemadb->get('comment')->get_field('rating')['hidden'] = false; |
118 | 118 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $this->_comments = $this->_comments->execute(); |
192 | 192 | } |
193 | 193 | |
194 | - if ( midcom::get()->auth->user |
|
194 | + if (midcom::get()->auth->user |
|
195 | 195 | || $this->_config->get('allow_anonymous')) { |
196 | 196 | $this->_init_post_controller($request); |
197 | 197 | if ($response = $this->_process_post($request)) { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | private function _process_post(Request $request) |
224 | 224 | { |
225 | - if ( !midcom::get()->auth->user |
|
225 | + if (!midcom::get()->auth->user |
|
226 | 226 | && !midcom::get()->auth->request_sudo('net.nehmer.comments')) { |
227 | 227 | throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting'); |
228 | 228 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | $formdata = $this->_post_controller->get_form_values(); |
238 | - if ( $formdata['subscribe'] |
|
238 | + if ($formdata['subscribe'] |
|
239 | 239 | && midcom::get()->auth->user) { |
240 | 240 | // User wants to subscribe to receive notifications about this comments thread |
241 | 241 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | private function _get_last_modified() : int |
271 | 271 | { |
272 | - return array_reduce($this->_comments, function ($carry, net_nehmer_comments_comment $item) { |
|
272 | + return array_reduce($this->_comments, function($carry, net_nehmer_comments_comment $item) { |
|
273 | 273 | return max($item->metadata->revised, $carry); |
274 | 274 | }, 0); |
275 | 275 | } |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | $data['comment_toolbar'] = $this->populate_post_toolbar($comment); |
292 | 292 | midcom_show_style('comments-item'); |
293 | 293 | |
294 | - if ( midcom::get()->auth->admin |
|
295 | - || ( midcom::get()->auth->user |
|
294 | + if (midcom::get()->auth->admin |
|
295 | + || (midcom::get()->auth->user |
|
296 | 296 | && $comment->can_do('midgard:delete'))) { |
297 | 297 | midcom_show_style('comments-admintoolbar'); |
298 | 298 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | midcom_show_style('comments-nonefound'); |
303 | 303 | } |
304 | 304 | |
305 | - if ( midcom::get()->auth->user |
|
305 | + if (midcom::get()->auth->user |
|
306 | 306 | || $this->_config->get('allow_anonymous')) { |
307 | 307 | midcom_show_style('post-comment'); |
308 | 308 | } else { |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $message['content'] = ''; |
55 | 55 | $logs = $comment->get_logs(); |
56 | 56 | if (!empty($logs)) { |
57 | - $message['content'] .= $this->_l10n->get('moderation history').":\n\n"; |
|
57 | + $message['content'] .= $this->_l10n->get('moderation history') . ":\n\n"; |
|
58 | 58 | foreach ($logs as $time => $log) { |
59 | 59 | $reported = $this->_l10n->get_formatter()->datetime(strtotime("{$time}Z")); |
60 | 60 | $message['content'] .= $this->_l10n->get(sprintf('%s: %s by %s (from %s)', "$reported:\n", $this->_l10n->get($log['action']), $log['reporter'], $log['ip'])) . "\n\n"; |
@@ -568,10 +568,10 @@ |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | //owner privileges override everything but person privileges, so we have to cross-check those here |
571 | - if ( $privilegename != 'midgard:owner' |
|
571 | + if ($privilegename != 'midgard:owner' |
|
572 | 572 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
573 | 573 | $owner_privileges = $this->get_owner_default_privileges(); |
574 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
574 | + if (array_key_exists($privilegename, $owner_privileges) |
|
575 | 575 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
576 | 576 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
577 | 577 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -43,11 +43,11 @@ |
||
43 | 43 | public function buildForm(FormBuilderInterface $builder, array $options) |
44 | 44 | { |
45 | 45 | $session_key = md5($builder->getForm()->getName() . '_session_key'); |
46 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($session_key) { |
|
46 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($session_key) { |
|
47 | 47 | $value = $event->getForm()->getData(); |
48 | 48 | $session = new midcom_services_session('midcom_datamanager_captcha'); |
49 | 49 | |
50 | - if ( !$session->exists($session_key) |
|
50 | + if (!$session->exists($session_key) |
|
51 | 51 | || $value != $session->get($session_key)) { |
52 | 52 | $event->getForm()->addError(new FormError($this->l10n->get('captcha validation failed'))); |
53 | 53 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $view->vars['readonly'] = $options['readonly']; |
66 | 66 | |
67 | 67 | if ($options['write_privilege'] !== null) { |
68 | - if ( array_key_exists('group', $options['write_privilege']) |
|
68 | + if (array_key_exists('group', $options['write_privilege']) |
|
69 | 69 | && !$this->auth->is_group_member($options['write_privilege']['group'])) { |
70 | 70 | $view->vars['readonly'] = true; |
71 | 71 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | $revisions[$history['revision']] = $history; |
92 | 92 | |
93 | 93 | $i += 3; |
94 | - while ( $i < $total |
|
94 | + while ($i < $total |
|
95 | 95 | && !str_starts_with($lines[$i], '----') |
96 | 96 | && !str_starts_with($lines[$i], '=====')) { |
97 | 97 | $i++; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function setTargetUrl($url) |
29 | 29 | { |
30 | - if ( !str_starts_with($url, "/") |
|
30 | + if (!str_starts_with($url, "/") |
|
31 | 31 | && !preg_match('|^https?://|', $url)) { |
32 | 32 | $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); |
33 | 33 | if ($prefix == '') { |
@@ -82,7 +82,7 @@ |
||
82 | 82 | |
83 | 83 | // Handle automatic wildcards |
84 | 84 | $auto_wildcards = $this->_config->get('auto_wildcards'); |
85 | - if ( $auto_wildcards |
|
85 | + if ($auto_wildcards |
|
86 | 86 | && !str_contains($this->_query_string_processed, '%')) { |
87 | 87 | switch ($auto_wildcards) { |
88 | 88 | case 'both': |