@@ -152,7 +152,7 @@ |
||
| 152 | 152 | $preparsed = midcom_helper_formatter::compile($style); |
| 153 | 153 | |
| 154 | 154 | if (midcom_core_context::get()->has_custom_key('request_data')) { |
| 155 | - $data =& midcom_core_context::get()->get_custom_key('request_data'); |
|
| 155 | + $data = & midcom_core_context::get()->get_custom_key('request_data'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | try { |
@@ -196,7 +196,7 @@ |
||
| 196 | 196 | |
| 197 | 197 | private function resolve_includes(string $content) : string |
| 198 | 198 | { |
| 199 | - return preg_replace_callback("/<\\(([a-zA-Z0-9 _-]+)\\)>/", function (array $matches) { |
|
| 199 | + return preg_replace_callback("/<\\(([a-zA-Z0-9 _-]+)\\)>/", function(array $matches) { |
|
| 200 | 200 | $element = $matches[1]; |
| 201 | 201 | |
| 202 | 202 | switch ($element) { |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | { |
| 99 | 99 | if (!isset($this->_modules[$name])) { |
| 100 | 100 | $this->_modules[$name] = $module; |
| 101 | - $this->$name =& $this->_modules[$name]; |
|
| 101 | + $this->$name = & $this->_modules[$name]; |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -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"; |
@@ -55,11 +55,11 @@ |
||
| 55 | 55 | foreach (array_filter($csv_line) as $field => $value) { |
| 56 | 56 | // Process the row accordingly |
| 57 | 57 | $field_matching = $this->_settings['fields'][$field]; |
| 58 | - if ( $field_matching |
|
| 58 | + if ($field_matching |
|
| 59 | 59 | && strstr($field_matching, ':')) { |
| 60 | 60 | [$schemadb, $schema_field] = explode(':', $field_matching); |
| 61 | 61 | |
| 62 | - if ( !array_key_exists($schemadb, $this->_schemadbs) |
|
| 62 | + if (!array_key_exists($schemadb, $this->_schemadbs) |
|
| 63 | 63 | || !$this->_schemadbs[$schemadb]->get('default')->has_field($schema_field)) { |
| 64 | 64 | // Invalid matching, skip |
| 65 | 65 | continue; |
@@ -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); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | // Get parent from DB and compare to catch moves |
| 72 | 72 | if ($parent = $napobject[MIDCOM_NAV_OBJECT]->get_parent()) { |
| 73 | 73 | $parent_entry = $this->get_guid($parent->guid); |
| 74 | - if ( $parent_entry |
|
| 74 | + if ($parent_entry |
|
| 75 | 75 | && $parent_entry[MIDCOM_NAV_ID] != $cached_node_id) { |
| 76 | 76 | $this->backend->delete($parent_entry[MIDCOM_NAV_ID] . '-leaves'); |
| 77 | 77 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $parent_id = $napobject[MIDCOM_NAV_NODEID]; |
| 87 | 87 | $parent_entry = $this->get_node($parent_id); |
| 88 | 88 | |
| 89 | - if ( $parent_entry |
|
| 89 | + if ($parent_entry |
|
| 90 | 90 | && array_key_exists(MIDCOM_NAV_SUBNODES, $parent_entry)) { |
| 91 | 91 | unset($parent_entry[MIDCOM_NAV_SUBNODES]); |
| 92 | 92 | $this->put_node($parent_id, $parent_entry); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if ($parent = $napobject[MIDCOM_NAV_OBJECT]->get_parent()) { |
| 97 | 97 | $parent_entry_from_object = $this->get_guid($parent->guid); |
| 98 | 98 | |
| 99 | - if ( !empty($parent_entry_from_object[MIDCOM_NAV_ID]) |
|
| 99 | + if (!empty($parent_entry_from_object[MIDCOM_NAV_ID]) |
|
| 100 | 100 | && !empty($parent_entry[MIDCOM_NAV_ID]) |
| 101 | 101 | && $parent_entry_from_object[MIDCOM_NAV_ID] != $parent_entry[MIDCOM_NAV_ID]) { |
| 102 | 102 | unset($parent_entry_from_object[MIDCOM_NAV_SUBNODES]); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $nav = new midcom_helper_nav; |
| 123 | 123 | if ($object instanceof midcom_db_topic) { |
| 124 | 124 | $napobject = $nav->get_node($object->id); |
| 125 | - } elseif ( ($node = $nav->find_closest_topic($object)) |
|
| 125 | + } elseif (($node = $nav->find_closest_topic($object)) |
|
| 126 | 126 | && $nodeobject = $nav->get_node($node->id)) { |
| 127 | 127 | $napobject = $nav->get_leaf($nodeobject[MIDCOM_NAV_ID] . '-' . $object->id); |
| 128 | 128 | } |