Passed
Branch master (f83f0c)
by Andreas
17:25
created
lib/midgard/admin/asgard/stylehelper.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
                 'midcom' => [
95 95
                     'style-init' => '',
96 96
                     'style-finish' => '',
97
-                 ]
97
+                    ]
98 98
             ],
99 99
             'nodes' => [],
100 100
         ];
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function __construct(array &$data)
24 24
     {
25
-        $this->_data =& $data;
25
+        $this->_data = & $data;
26 26
         midcom::get()->head->enable_jquery_ui(['accordion']);
27 27
     }
28 28
 
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
             return;
34 34
         }
35 35
 
36
-        if (   midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_style')
37
-            && (   $this->_data['handler_id'] !== '____mfa-asgard-object_create'
36
+        if (midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_style')
37
+            && ($this->_data['handler_id'] !== '____mfa-asgard-object_create'
38 38
                 || $this->_data['current_type'] == 'midgard_element')) {
39 39
             $help_element = $this->_get_help_style_elementnames($this->_data['object']);
40
-        } elseif (   midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_element')
40
+        } elseif (midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_element')
41 41
                   && $this->_data['handler_id'] !== '____mfa-asgard-object_create') {
42 42
             $help_element = $this->_get_help_element();
43 43
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     private function _get_help_element()
51 51
     {
52
-        if (   empty($this->_data['object']->name)
52
+        if (empty($this->_data['object']->name)
53 53
             || empty($this->_data['object']->style)) {
54 54
             // We cannot help with empty elements
55 55
             return;
Please login to merge, or discard this patch.
lib/midcom/services/auth/acl.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -312,17 +312,17 @@
 block discarded – undo
312 312
     private static $_privileges_cache = [];
313 313
 
314 314
     /**
315
-    * Internal cache of the content privileges of users on content objects, this is
316
-    * an associative array using a combination of the user identifier and the object's
317
-    * guid as index. The privileges for the anonymous user use the magic
318
-    * EVERYONE as user identifier.
319
-    *
320
-    * This must not be merged with the class-wide privileges_cache, because otherwise
321
-    * class_default_privileges for child objects might be overridden by parent default
322
-    * privileges
323
-    *
324
-    * @var Array
325
-    */
315
+     * Internal cache of the content privileges of users on content objects, this is
316
+     * an associative array using a combination of the user identifier and the object's
317
+     * guid as index. The privileges for the anonymous user use the magic
318
+     * EVERYONE as user identifier.
319
+     *
320
+     * This must not be merged with the class-wide privileges_cache, because otherwise
321
+     * class_default_privileges for child objects might be overridden by parent default
322
+     * privileges
323
+     *
324
+     * @var Array
325
+     */
326 326
     private static $_content_privileges_cache = [];
327 327
 
328 328
     /**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         $cache_id = $user_id . '::' . $object_guid;
522 522
 
523 523
         if (!array_key_exists($cache_id, self::$_privileges_cache)) {
524
-            if (   empty($object_guid)
524
+            if (empty($object_guid)
525 525
                 || empty($object_class)) {
526 526
                 /* No idea if there should be some special log message written */
527 527
                 return [];
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
         // otherwise. (get_parent_data calling get_object_by_guid calling can_do ...)
622 622
         list ($parent_guid, $parent_class) = $this->get_parent_data($guid, $class);
623 623
 
624
-        if (   $parent_guid == $guid
624
+        if ($parent_guid == $guid
625 625
             || !mgd_is_guid($parent_guid)) {
626 626
             $base_privileges = [];
627 627
         } else {
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
         // Determine parent ownership
633 633
         $is_owner = false;
634 634
         $last_owner_scope = -1;
635
-        if (   array_key_exists('midgard:owner', $base_privileges)
635
+        if (array_key_exists('midgard:owner', $base_privileges)
636 636
             && $base_privileges['midgard:owner'] == MIDCOM_PRIVILEGE_ALLOW) {
637 637
             $is_owner = true;
638 638
         }
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 
673 673
             $valid_privileges[$scope][$privilege->privilegename] = $privilege->value;
674 674
 
675
-            if (   $privilege->privilegename == 'midgard:owner'
675
+            if ($privilege->privilegename == 'midgard:owner'
676 676
                 && $scope > $last_owner_scope) {
677 677
                 $is_owner = ($privilege->value == MIDCOM_PRIVILEGE_ALLOW);
678 678
                 $last_owner_scope = $scope;
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
         $content_privilege = null;
870 870
 
871 871
         foreach ($object_privileges as $privilege) {
872
-            if (   $privilege->privilegename != $privilegename
872
+            if ($privilege->privilegename != $privilegename
873 873
                 ||  $privilege->scope <= $last_scope
874 874
                 || !$privilege->does_privilege_apply($user_id)) {
875 875
                 continue;
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
         }
881 881
 
882 882
         //owner privileges override everything but person privileges, so we have to cross-check those here
883
-        if (   $privilegename != 'midgard:owner'
883
+        if ($privilegename != 'midgard:owner'
884 884
             && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) {
885 885
             $owner_privileges = $this->get_owner_default_privileges();
886
-            if (    array_key_exists($privilegename, $owner_privileges)
886
+            if (array_key_exists($privilegename, $owner_privileges)
887 887
                  && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id)
888 888
                  && self::$_content_privileges_cache[$cache_id]['midgard:owner']) {
889 889
                 self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW);
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
         //if nothing was found, we try to recurse to parent
900 900
         list ($parent_guid, $parent_class) = $this->get_parent_data($guid, $class);
901 901
 
902
-        if (   $parent_guid == $guid
902
+        if ($parent_guid == $guid
903 903
             || !mgd_is_guid($parent_guid)) {
904 904
             return false;
905 905
         }
Please login to merge, or discard this patch.
lib/midcom/cron/purgedeleted.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     {
31 31
         $classes = [];
32 32
         foreach (midcom_connection::get_schema_types() as $mgdschema) {
33
-            if (   substr($mgdschema, 0, 2) == '__'
33
+            if (substr($mgdschema, 0, 2) == '__'
34 34
                 || !midgard_reflector_object::has_metadata_class($mgdschema)) {
35 35
                 continue;
36 36
             }
Please login to merge, or discard this patch.
lib/midcom/core/dbaproxy.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,8 @@
 block discarded – undo
62 62
         try {
63 63
             $this->__object = call_user_func([$this->__midcom_class_name__, 'get_cached'], $this->__identifier);
64 64
             return true;
65
-        } catch (midcom_error $e) {
65
+        }
66
+        catch (midcom_error $e) {
66 67
             $e->log();
67 68
         }
68 69
         return false;
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/copy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         }
309 309
 
310 310
         // Override requested root object properties
311
-        if (   !empty($this->target->guid)
311
+        if (!empty($this->target->guid)
312 312
             && $target->guid === $this->target->guid) {
313 313
             foreach ($this->root_object_values as $name => $value) {
314 314
                 $target->$name = $value;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         // Store for later use - if ever needed
354 354
         $this->new_objects[] = $target;
355 355
 
356
-        if (   !$this->_copy_data('parameters', $source, $target)
356
+        if (!$this->_copy_data('parameters', $source, $target)
357 357
             || !$this->_copy_data('metadata', $source, $target)
358 358
             || !$this->_copy_data('attachments', $source, $target)
359 359
             || !$this->_copy_data('privileges', $source, $target)) {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     private function _copy_data($type, $source, &$target)
375 375
     {
376 376
         $method = 'copy_' . $type;
377
-        if (   !$this->$method($source, $target)
377
+        if (!$this->$method($source, $target)
378 378
             && $this->halt_on_errors) {
379 379
             $this->errors[] = $this->_l10n->get('failed to copy ' . $type);
380 380
             return false;
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
     public static function copy_object_tree($source, $parent, $exclude = [], $copy_parameters = true, $copy_metadata = true, $copy_attachments = true)
516 516
     {
517 517
         $copy = new midcom_helper_reflector_copy();
518
-        $copy->source =& $source;
519
-        $copy->target =& $parent;
518
+        $copy->source = & $source;
519
+        $copy->target = & $parent;
520 520
         $copy->copy_parameters = $copy_parameters;
521 521
         $copy->copy_metadata = $copy_metadata;
522 522
         $copy->copy_attachments = $copy_attachments;
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/tree.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     private static function _check_permissions($deleted)
159 159
     {
160 160
         // PONDER: Check for some generic user privilege instead  ??
161
-        if (   $deleted
161
+        if ($deleted
162 162
             && !midcom_connection::is_admin()
163 163
             && !midcom::get()->auth->is_component_sudo()) {
164 164
             debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                     'target' => $ref->get_link_target($field)
249 249
                 ];
250 250
                 $linked_class = $ref->get_link_name($field);
251
-                if (   empty($linked_class)
251
+                if (empty($linked_class)
252 252
                     && $info['type'] === MGD_TYPE_GUID) {
253 253
                     // Guid link without class specification, valid for all classes
254 254
                     if (empty($info['target'])) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $field_type = $field_data['type'];
299 299
             $field = $field_data['name'];
300 300
 
301
-            if (   !$field_target
301
+            if (!$field_target
302 302
                 || !isset($for_object->$field_target)) {
303 303
                 // Why return false ???
304 304
                 return false;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
             $parent_property = midgard_object_class::get_property_parent($schema_type);
415 415
             $up_property = midgard_object_class::get_property_up($schema_type);
416 416
 
417
-            if (   !$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class)
417
+            if (!$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class)
418 418
                 && !$this->_resolve_child_classes_links_back($up_property, $schema_type, $this->mgdschema_class)) {
419 419
                 continue;
420 420
             }
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
         $ref = new midgard_reflection_property($prospect_type);
441 441
         $link_class = $ref->get_link_name($property);
442
-        if (   empty($link_class)
442
+        if (empty($link_class)
443 443
             && $ref->get_midgard_type($property) === MGD_TYPE_GUID) {
444 444
             return true;
445 445
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -553,7 +553,8 @@
 block discarded – undo
553 553
         $tree = [];
554 554
         try {
555 555
             $children = self::get_child_objects($parent);
556
-        } catch (midcom_error $e) {
556
+        }
557
+        catch (midcom_error $e) {
557 558
             return $tree;
558 559
         }
559 560
 
Please login to merge, or discard this patch.
lib/midcom/helper/misc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             return $data;
253 253
         }
254 254
 
255
-        $preg='/s:([0-9]+):"(.*?)";/ms';
255
+        $preg = '/s:([0-9]+):"(.*?)";/ms';
256 256
         preg_match_all($preg, $data, $matches);
257 257
         $cache = [];
258 258
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
             $theme_path = implode('/', $path_array);
349 349
             $candidates = [];
350 350
             if ($substyle) {
351
-                $candidates[] =  $theme_root . $theme_path .  "/style/{$substyle}/{$element_name}.php";
351
+                $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php";
352 352
             }
353 353
             if ($page) {
354
-                $candidates[] =  $theme_root . $theme_path .  "/style{$page}/{$element_name}.php";
354
+                $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php";
355 355
             }
356 356
 
357
-            $candidates[] = $theme_root . $theme_path .  "/style/{$element_name}.php";
357
+            $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php";
358 358
 
359 359
             foreach (array_filter($candidates, 'file_exists') as $candidate) {
360 360
                 return file_get_contents($candidate);
Please login to merge, or discard this patch.
lib/midcom/helper/toolbar/view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             ]);
55 55
         }
56 56
 
57
-        if (   midcom::get()->config->get('midcom_services_rcs_enable')
57
+        if (midcom::get()->config->get('midcom_services_rcs_enable')
58 58
             && $object->can_do('midgard:update')
59 59
             && $object->_use_rcs) {
60 60
             $buttons[] = [
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             }
85 85
 
86 86
             $icon = 'stock-icons/16x16/page-' . $icontype . '.png';
87
-            if (   !midcom::get()->config->get('show_hidden_objects')
87
+            if (!midcom::get()->config->get('show_hidden_objects')
88 88
                 && !$object->metadata->is_visible()) {
89 89
                 // Take scheduling into account
90 90
                 $icon = 'stock-icons/16x16/page-' . $icontype . '-notpublished.png';
Please login to merge, or discard this patch.
lib/fi/protie/navigation/main.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
         $classes = [];
339 339
 
340 340
         if ($child[MIDCOM_NAV_TYPE] === 'node') {
341
-            if (   $item[MIDCOM_NAV_ID] === $this->_nap->get_current_node()
342
-                && (   !$this->_nap->get_current_leaf()
341
+            if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_node()
342
+                && (!$this->_nap->get_current_leaf()
343 343
                     || !$this->_nap->get_leaf($this->_nap->get_current_leaf()))) {
344 344
                 $classes[] = $this->css_active;
345 345
             }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         }
387 387
 
388 388
         // Add information about the object's status
389
-        if (   $this->object_status_to_class
389
+        if ($this->object_status_to_class
390 390
             && isset($item[MIDCOM_NAV_OBJECT])
391 391
             && $css_status_class = midcom::get()->metadata->get_object_classes($item[MIDCOM_NAV_OBJECT])) {
392 392
             $classes[] = $css_status_class;
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
         echo "<a href=\"{$item[MIDCOM_NAV_ABSOLUTEURL]}\"{$link_class}>{$item[MIDCOM_NAV_NAME]}</a>";
406 406
         // If either of the follow nodes switches is on, follow all the nodes
407 407
 
408
-        if (   $item[MIDCOM_NAV_TYPE] === 'node'
408
+        if ($item[MIDCOM_NAV_TYPE] === 'node'
409 409
             && !$this->show_only_current
410
-            && (   $this->list_levels === 0
410
+            && ($this->list_levels === 0
411 411
                 || $this->_level < $this->list_levels)) {
412
-            if (   $this->follow_all
413
-                || (   $this->follow_selected
412
+            if ($this->follow_all
413
+                || ($this->follow_selected
414 414
                     && in_array($item[MIDCOM_NAV_ID], $this->node_path, true))) {
415 415
                 $this->_level++;
416 416
                 $this->_list_child_elements($item[MIDCOM_NAV_ID]);
Please login to merge, or discard this patch.