@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | ]; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( midcom::get()->config->get('midcom_services_rcs_enable') |
|
| 150 | + if (midcom::get()->config->get('midcom_services_rcs_enable') |
|
| 151 | 151 | && $object->can_do('midgard:update') |
| 152 | 152 | && $object->_use_rcs) { |
| 153 | 153 | $buttons[] = [ |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | private function get_toolbar_update_items($object) : array |
| 209 | 209 | { |
| 210 | 210 | $buttons = []; |
| 211 | - if ( is_a($object, midcom_db_topic::class) |
|
| 211 | + if (is_a($object, midcom_db_topic::class) |
|
| 212 | 212 | && $object->component |
| 213 | 213 | && $object->can_do('midcom:component_config')) { |
| 214 | 214 | $buttons[] = [ |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | MIDCOM_TOOLBAR_ENABLED => $object->can_do('midgard:privileges'), |
| 247 | 247 | ]; |
| 248 | 248 | |
| 249 | - if ( midcom::get()->componentloader->is_installed('midcom.helper.replicator') |
|
| 249 | + if (midcom::get()->componentloader->is_installed('midcom.helper.replicator') |
|
| 250 | 250 | && midcom::get()->auth->admin) { |
| 251 | 251 | $buttons[] = [ |
| 252 | 252 | MIDCOM_TOOLBAR_URL => "__mfa/asgard_midcom.helper.replicator/object/{$object->guid}/", |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | private function _filter_schema_fields($key) : bool |
| 162 | 162 | { |
| 163 | - if ( $key == 'metadata' |
|
| 163 | + if ($key == 'metadata' |
|
| 164 | 164 | || in_array($key, $this->_config->get('object_skip_fields'))) { |
| 165 | 165 | return false; |
| 166 | 166 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | private function _add_string_field($key, $type) |
| 172 | 172 | { |
| 173 | - if ( $key == 'component' |
|
| 173 | + if ($key == 'component' |
|
| 174 | 174 | && $type == midcom_db_topic::class) { |
| 175 | 175 | $this->_add_component_dropdown($key); |
| 176 | 176 | return; |
@@ -248,8 +248,8 @@ discard block |
||
| 248 | 248 | $height = 30; |
| 249 | 249 | |
| 250 | 250 | // Check the user preference and configuration |
| 251 | - if ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
| 252 | - || ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
| 251 | + if (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
| 252 | + || (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
| 253 | 253 | && $this->_config->get('tinymce_enabled'))) { |
| 254 | 254 | $widget = 'tinymce'; |
| 255 | 255 | } |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | $height = 30; |
| 263 | 263 | |
| 264 | 264 | // Check the user preference and configuration |
| 265 | - if ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
| 266 | - || ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
| 265 | + if (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
| 266 | + || (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
| 267 | 267 | && $this->_config->get('codemirror_enabled'))) { |
| 268 | 268 | $widget = 'codemirror'; |
| 269 | 269 | } |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | if ($score1 > $score2) { |
| 501 | 501 | return 1; |
| 502 | 502 | } |
| 503 | - if ( $score1 < 3 |
|
| 503 | + if ($score1 < 3 |
|
| 504 | 504 | || $score1 > 6) { |
| 505 | 505 | return strnatcmp($first, $second); |
| 506 | 506 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $this->_object = $object; |
| 47 | 47 | $this->get_object_path(); |
| 48 | - $this->_request_data =& $request_data; |
|
| 48 | + $this->_request_data = & $request_data; |
|
| 49 | 49 | |
| 50 | 50 | $this->root_types = midcom_helper_reflector_tree::get_root_classes(); |
| 51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // we go through the path bottom up and show the first root type we find |
| 60 | 60 | foreach (array_reverse($this->_object_path) as $node) { |
| 61 | 61 | foreach ($this->root_types as $root_type) { |
| 62 | - if ( is_a($node, $root_type) |
|
| 62 | + if (is_a($node, $root_type) |
|
| 63 | 63 | || midcom_helper_reflector::is_same_class($root_type, $node->__midcom_class_name__)) { |
| 64 | 64 | $this->expanded_root_types[] = $root_type; |
| 65 | 65 | break; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function _is_collapsed($type, $total) : bool |
| 101 | 101 | { |
| 102 | - return ( $total > $this->_config->get('max_navigation_entries') |
|
| 102 | + return ($total > $this->_config->get('max_navigation_entries') |
|
| 103 | 103 | && empty($_GET['show_all_' . $type])); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | foreach ($ref->get_child_classes() as $class) { |
| 116 | 116 | $qb = $ref->_child_objects_type_qb($class, $object, false); |
| 117 | 117 | |
| 118 | - if ( !$qb |
|
| 118 | + if (!$qb |
|
| 119 | 119 | || !($count = $qb->count_unchecked())) { |
| 120 | 120 | continue; |
| 121 | 121 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $qb = $ref->_root_objects_qb(false); |
| 165 | 165 | |
| 166 | - if ( !$qb |
|
| 166 | + if (!$qb |
|
| 167 | 167 | || !($total = $qb->count_unchecked())) { |
| 168 | 168 | return; |
| 169 | 169 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $label = html_entity_decode($label); |
| 244 | 244 | |
| 245 | 245 | echo "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/{$mode}/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; |
| 246 | - if ( $selected |
|
| 246 | + if ($selected |
|
| 247 | 247 | || $autoexpand) { |
| 248 | 248 | $this->_list_child_elements($object, $level + 1); |
| 249 | 249 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | continue; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - if ( method_exists($class, 'navigation') |
|
| 266 | + if (method_exists($class, 'navigation') |
|
| 267 | 267 | && ($this->_request_data['plugin_name'] == "asgard_{$component}")) { |
| 268 | 268 | $this->_request_data['expanded'] = true; |
| 269 | 269 | midcom_show_style('midgard_admin_asgard_navigation_section_header'); |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | if ($this->_is_selected($object)) { |
| 298 | 298 | $css_class .= ' selected'; |
| 299 | 299 | } |
| 300 | - if ( is_object($this->_object) |
|
| 301 | - && ( $object->guid == $this->_object->guid |
|
| 302 | - || ( is_a($this->_object, midcom_db_parameter::class) |
|
| 300 | + if (is_object($this->_object) |
|
| 301 | + && ($object->guid == $this->_object->guid |
|
| 302 | + || (is_a($this->_object, midcom_db_parameter::class) |
|
| 303 | 303 | && $object->guid == $this->_object->parentguid))) { |
| 304 | 304 | $css_class .= ' current'; |
| 305 | 305 | } |
| 306 | - if ( !$object->can_do('midgard:update')) { |
|
| 306 | + if (!$object->can_do('midgard:update')) { |
|
| 307 | 307 | $css_class .= ' readonly'; |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $types = []; |
| 320 | 320 | |
| 321 | 321 | // Get the types that might have special display conditions |
| 322 | - if ( $this->_config->get('midgard_types') |
|
| 322 | + if ($this->_config->get('midgard_types') |
|
| 323 | 323 | && preg_match_all('/\|([a-z0-9\.\-_]+)/', $this->_config->get('midgard_types'), $regs)) { |
| 324 | 324 | $types = $regs[1]; |
| 325 | 325 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | // Override with user selected |
| 328 | 328 | // @TODO: Should this just include to the configuration selection, although it would break the consistency |
| 329 | 329 | // of other similar preference sets, which simply override the global settings? |
| 330 | - if ( midgard_admin_asgard_plugin::get_preference('midgard_types') |
|
| 330 | + if (midgard_admin_asgard_plugin::get_preference('midgard_types') |
|
| 331 | 331 | && preg_match_all('/\|([a-z0-9\.\-_]+)/', midgard_admin_asgard_plugin::get_preference('midgard_types'), $regs)) { |
| 332 | 332 | $types = $regs[1]; |
| 333 | 333 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $label_mapping = []; |
| 360 | 360 | foreach ($types as $root_type) { |
| 361 | 361 | // If the regular expression has been set, check which types should be shown |
| 362 | - if ( $regexp !== '//' |
|
| 362 | + if ($regexp !== '//' |
|
| 363 | 363 | && (boolean) preg_match($regexp, $root_type) == $exclude) { |
| 364 | 364 | continue; |
| 365 | 365 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | * click if nothing is expanded |
| 395 | 395 | */ |
| 396 | 396 | $types_shown = false; |
| 397 | - if ( !empty($expanded_types) |
|
| 397 | + if (!empty($expanded_types) |
|
| 398 | 398 | && midgard_admin_asgard_plugin::get_preference('navigation_type') === 'dropdown') { |
| 399 | 399 | $this->_draw_select_navigation(); |
| 400 | 400 | $types_shown = true; |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | echo " <li class=\"mgdschema-type\">"; |
| 434 | 434 | |
| 435 | 435 | $dbaclass = midcom::get()->dbclassloader->get_midcom_class_name_for_mgdschema_object($type); |
| 436 | - if ( $dbaclass |
|
| 436 | + if ($dbaclass |
|
| 437 | 437 | && class_exists($dbaclass)) { |
| 438 | 438 | $object = new $dbaclass; |
| 439 | 439 | } else { |