Test Failed
Branch master (8d1702)
by Andreas
11:03
created
lib/midcom/helper/datamanager2/storage/midgard.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             default:
74 74
                 $fieldname = $this->_schema->fields[$name]['storage']['location'];
75 75
                 $helper = new helper;
76
-                if (   !$helper->property_exists($this->object, $fieldname)
76
+                if (!$helper->property_exists($this->object, $fieldname)
77 77
                     && !$helper->property_exists($this->object->__object, $fieldname)) {
78 78
                     throw new midcom_error("Missing {$fieldname} field in object: " . get_class($this->object));
79 79
                 }
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 
113 113
             case 'metadata':
114 114
                 $helper = new helper;
115
-                if (   !isset($this->object->metadata)
116
-                    || (   !$helper->property_exists($this->object->metadata, $name)
115
+                if (!isset($this->object->metadata)
116
+                    || (!$helper->property_exists($this->object->metadata, $name)
117 117
                         && !$helper->property_exists($this->object->__object->metadata, $name))) {
118 118
                     throw new midcom_error("Missing {$name} metadata field in object: " . get_class($this->object));
119 119
                 }
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/jsdate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function _on_configuring()
76 76
     {
77
-        if (   is_a($this->_type, 'midcom_helper_datamanager2_type_date')
77
+        if (is_a($this->_type, 'midcom_helper_datamanager2_type_date')
78 78
             && $this->_type->storage_type == 'UNIXTIME') {
79 79
             $this->minyear = 1970;
80 80
             $this->maxyear = 2030;
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         }
396 396
 
397 397
         // Both date and time found, convert the input to hopefully full-fletched ISO datetime
398
-        if (   $date
398
+        if ($date
399 399
             && $time) {
400 400
             $input = "{$date} {$time}";
401 401
         }
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/downloads.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $this->_require_type_class('midcom_helper_datamanager2_type_blobs');
111 111
 
112 112
         // Reflect the type config setting for maximum count
113
-        if (   isset($this->_type->max_count)
113
+        if (isset($this->_type->max_count)
114 114
             && !$this->max_count) {
115 115
             $this->max_count = $this->_type->max_count;
116 116
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             ");
138 138
         }
139 139
         // controls if required apc-settings for the progressbar are set
140
-        if (   ini_get("apc.rfc1867") == 1
140
+        if (ini_get("apc.rfc1867") == 1
141 141
             && ini_get("apc.enabled") == 1) {
142 142
             $this->show_progressbar = true;
143 143
             $this->progress_id = uniqid("");
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function _add_new_upload_row($frozen)
207 207
     {
208 208
         // Show only a configured amount of new image rows
209
-        if (   $this->max_count
209
+        if ($this->max_count
210 210
             && count($this->_type->attachments_info) >= $this->max_count) {
211 211
             return;
212 212
         }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         if ($this->_type->sortable) {
288 288
             $sortable  = "            <td class=\"midcom_helper_datamanager2_helper_sortable\">\n";
289 289
             $sortable .= "               <input type=\"text\" class=\"downloads_sortable\" name=\"midcom_helper_datamanager2_sortable[{$this->name}][{$identifier}]\" value=\"{$this->_sort_index}\" />\n";
290
-            $sortable .="             </td>\n";
290
+            $sortable .= "             </td>\n";
291 291
 
292 292
             $this->_sort_index++;
293 293
         }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
     public function add_elements_to_form($attributes)
369 369
     {
370 370
         $frozen = false;
371
-        if (   $this->_type->storage->object
372
-            && (   !$this->_type->storage->object->can_do('midgard:attachments')
371
+        if ($this->_type->storage->object
372
+            && (!$this->_type->storage->object->can_do('midgard:attachments')
373 373
                 || !$this->_type->storage->object->can_do('midgard:update')
374 374
                 || !$this->_type->storage->object->can_do('midgard:parameters'))) {
375 375
             $frozen = true;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
             if (!$this->_type->delete_attachment($identifier)) {
477 477
                 debug_add("Failed to delete the attachment {$identifier} on the field '{$this->name}'. Ignoring silently.", MIDCOM_LOG_WARN);
478 478
             }
479
-        } elseif (   array_key_exists("e_exist_{$identifier}_file", $this->_elements)
479
+        } elseif (array_key_exists("e_exist_{$identifier}_file", $this->_elements)
480 480
                  && $this->_elements["e_exist_{$identifier}_file"]->isUploadedFile()) {
481 481
             $file = $this->_elements["e_exist_{$identifier}_file"]->getValue();
482 482
             $title = $values["e_exist_{$identifier}_title"];
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             if (!$this->_type->update_attachment($identifier, $file['name'], $title, $file['type'], $file['tmp_name'])) {
491 491
                 debug_add("Failed to update the attachment {$identifier} on the field '{$this->name}'. Ignoring silently.", MIDCOM_LOG_WARN);
492 492
             }
493
-        } elseif (   array_key_exists("e_exist_{$identifier}_title", $values)
493
+        } elseif (array_key_exists("e_exist_{$identifier}_title", $values)
494 494
                  && $values["e_exist_{$identifier}_title"] != $this->_type->attachments_info[$identifier]['description']) {
495 495
             $this->_type->update_attachment_title($identifier, $values["e_exist_{$identifier}_title"]);
496 496
         }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     public function sync_type_with_widget($results)
548 548
     {
549 549
         // NOTE: Updating titles etc is done already on _on_submit
550
-        if (   $this->_type->sortable
550
+        if ($this->_type->sortable
551 551
             && isset($_REQUEST['midcom_helper_datamanager2_sortable'])
552 552
             && isset($_REQUEST['midcom_helper_datamanager2_sortable'][$this->name])) {
553 553
             $this->_type->_sorted_list = $_REQUEST['midcom_helper_datamanager2_sortable'][$this->name];
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/tinymce.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -352,7 +352,7 @@
 block discarded – undo
352 352
         $original_element = $this->_form->getElement($this->name);
353 353
 
354 354
         foreach ($this->_form->_elements as $key => $element) {
355
-            if (   isset($element->_attributes['name'])
355
+            if (isset($element->_attributes['name'])
356 356
                 && $element->_attributes['name'] == $this->name
357 357
                 && isset($this->_form->_elements[$key + 1]->_attributes['name'])) {
358 358
                 $name_after = $this->_form->_elements[$key + 1]->_attributes['name'];
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,8 +127,8 @@
 block discarded – undo
127 127
      */
128 128
     public function get_default()
129 129
     {
130
-        if (   empty($this->_type->selection)
131
-            && (    !$this->_type->allow_other
130
+        if (empty($this->_type->selection)
131
+            && (!$this->_type->allow_other
132 132
                  || empty($this->_type->others))) {
133 133
             return null;
134 134
         }
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/image.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 
69 69
         $this->_form->addGroup($elements, $this->name, $this->_translate($this->_field['title']), ' ', false);
70 70
 
71
-        if (   $this->_type->storage->object
72
-            && (   !$this->_type->storage->object->can_do('midgard:attachments')
71
+        if ($this->_type->storage->object
72
+            && (!$this->_type->storage->object->can_do('midgard:attachments')
73 73
                 || !$this->_type->storage->object->can_do('midgard:update')
74 74
                 || !$this->_type->storage->object->can_do('midgard:parameters'))) {
75 75
             $this->freeze();
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $static_html .= $this->_l10n->get('type image: available sizes') . ":\n" .
201 201
                 "<ul class='midcom_helper_datamanager2_widget_image_sizelist'>";
202 202
         foreach ($this->_type->attachments_info as $info) {
203
-            if (   $info['size_x']
203
+            if ($info['size_x']
204 204
                 && $info['size_y']) {
205 205
                 $size = "{$info['size_x']}x{$info['size_y']}";
206 206
             } else {
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
             $y = $main_info['size_y'];
270 270
 
271 271
             // Downscale Preview image to max 75px, protect against broken images:
272
-            if (   $x != 0
272
+            if ($x != 0
273 273
                 && $y != 0) {
274
-                $aspect = $x/$y;
274
+                $aspect = $x / $y;
275 275
                 if ($x > 75) {
276 276
                     $x = 75;
277 277
                     $y = round($x / $aspect);
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
                 $y = $this->_type->attachments_info['main']['size_y'];
316 316
 
317 317
                 // Downscale Preview image to max 75px, protect against broken images:
318
-                if (   $x != 0
318
+                if ($x != 0
319 319
                     && $y != 0) {
320
-                    $aspect = $x/$y;
320
+                    $aspect = $x / $y;
321 321
                     if ($x > 75) {
322 322
                         $x = 75;
323 323
                         $y = round($x / $aspect);
@@ -456,10 +456,10 @@  discard block
 block discarded – undo
456 456
         $static_html .= "    <span class='field_text'>" . $this->_l10n->get('type image: actions') . ":</span>\n";
457 457
         $static_html .= "    <ul class='midcom_helper_datamanager2_widget_image_actions' id='{$this->_namespace}{$this->name}_image_actions'>\n";
458 458
         $static_html .= "        <li title='" . $this->_l10n->get('rotate left') . "'>\n";
459
-        $static_html .= "            <input type='image' name='{$this->name}_rotate[left]' src='".MIDCOM_STATIC_URL."/stock-icons/16x16/rotate_ccw.png' />\n";
459
+        $static_html .= "            <input type='image' name='{$this->name}_rotate[left]' src='" . MIDCOM_STATIC_URL . "/stock-icons/16x16/rotate_ccw.png' />\n";
460 460
         $static_html .= "         </li>\n";
461 461
         $static_html .= "         <li title='" . $this->_l10n->get('rotate right') . "'>\n";
462
-        $static_html .= "             <input type='image' name='{$this->name}_rotate[right]' src='".MIDCOM_STATIC_URL."/stock-icons/16x16/rotate_cw.png' />\n";
462
+        $static_html .= "             <input type='image' name='{$this->name}_rotate[right]' src='" . MIDCOM_STATIC_URL . "/stock-icons/16x16/rotate_cw.png' />\n";
463 463
         $static_html .= "         </li>\n";
464 464
         $static_html .= "    </ul>\n";
465 465
         $static_html .= "</div>\n";
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/images.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $this->_require_type_class('midcom_helper_datamanager2_type_images');
102 102
 
103 103
         // Reflect the type config setting for maximum count
104
-        if (   isset($this->_type->max_count)
104
+        if (isset($this->_type->max_count)
105 105
             && !$this->max_count) {
106 106
             $this->max_count = $this->_type->max_count;
107 107
         }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     private function _add_new_upload_row_old($frozen)
192 192
     {
193 193
         // Show only a configured amount of new image rows
194
-        if (   $this->max_count
194
+        if ($this->max_count
195 195
             && count($this->_type->images) >= $this->max_count) {
196 196
             return;
197 197
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     private function _add_new_upload_row($frozen)
254 254
     {
255 255
         // Show only a configured amount of new image rows
256
-        if (   $this->max_count
256
+        if ($this->max_count
257 257
             && count($this->_type->images) >= $this->max_count) {
258 258
             return;
259 259
         }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         }
306 306
         if (empty($info['object']->guid)) {
307 307
             //Panic, broken identifier
308
-            debug_add("Identifier '{$identifier}' does not have a valid object behind it",  MIDCOM_LOG_ERROR);
308
+            debug_add("Identifier '{$identifier}' does not have a valid object behind it", MIDCOM_LOG_ERROR);
309 309
             return;
310 310
         }
311 311
 
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
             $y = $info['size_y'];
371 371
 
372 372
             // Downscale Preview image to max 75px, protect against broken images:
373
-            if (   $x != 0
373
+            if ($x != 0
374 374
                 && $y != 0) {
375
-                $aspect = $x/$y;
375
+                $aspect = $x / $y;
376 376
                 if ($x > 75) {
377 377
                     $x = 75;
378 378
                     $y = round($x / $aspect);
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
     public function add_elements_to_form($attributes)
444 444
     {
445 445
         $frozen = false;
446
-        if (   $this->_type->storage->object
447
-            && (   !$this->_type->storage->object->can_do('midgard:attachments')
446
+        if ($this->_type->storage->object
447
+            && (!$this->_type->storage->object->can_do('midgard:attachments')
448 448
                 || !$this->_type->storage->object->can_do('midgard:update')
449 449
                 || !$this->_type->storage->object->can_do('midgard:parameters'))) {
450 450
             $frozen = true;
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 
501 501
         $file = $this->_elements['e_new_file']->getValue();
502 502
 
503
-        if ( preg_match('/\.(zip|tar(\.gz|\.bz2)?|tgz)$/', strtolower($file['name']), $extension_matches)) {
503
+        if (preg_match('/\.(zip|tar(\.gz|\.bz2)?|tgz)$/', strtolower($file['name']), $extension_matches)) {
504 504
             if (!$this->_type->_batch_handler($extension_matches[1], $file)) {
505 505
                 debug_add("Failed to add attachments from compressed files to the field '{$this->name}'. Ignoring silently.", MIDCOM_LOG_WARN);
506 506
             }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             }
552 552
         }
553 553
         // Image to be updated
554
-        elseif (   array_key_exists("e_exist_{$identifier}_file", $this->_elements)
554
+        elseif (array_key_exists("e_exist_{$identifier}_file", $this->_elements)
555 555
                   && $this->_elements["e_exist_{$identifier}_file"]->isUploadedFile()) {
556 556
             $file = $this->_elements["e_exist_{$identifier}_file"]->getValue();
557 557
             $title = $values["e_exist_{$identifier}_title"];
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     public function sync_type_with_widget($results)
619 619
     {
620 620
         $values = $results[$this->name];
621
-        if (   $this->_type->sortable
621
+        if ($this->_type->sortable
622 622
             && isset($_REQUEST['midcom_helper_datamanager2_sortable'])
623 623
             && isset($_REQUEST['midcom_helper_datamanager2_sortable'][$this->name])) {
624 624
             /**
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/autocomplete.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     private function _get_form_selection($data)
365 365
     {
366 366
         $selection = array();
367
-        if (   !isset($data[$this->name])
367
+        if (!isset($data[$this->name])
368 368
             || !is_array($data[$this->name])
369 369
             || !array_key_exists("selection", $data[$this->name])) {
370 370
             return $selection;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
         if (is_array($real_results)) {
376 376
             foreach ($real_results as $value) {
377
-                if (   $value != "0"
377
+                if ($value != "0"
378 378
                     || $value != 0) {
379 379
                     $selection[] = $value;
380 380
                 }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
     public function is_frozen()
415 415
     {
416 416
         foreach ($this->_widget_elements as $element) {
417
-            if (   method_exists($element, 'isFrozen')
417
+            if (method_exists($element, 'isFrozen')
418 418
                 && !$element->isFrozen()) {
419 419
                 return false;
420 420
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -455,7 +455,8 @@
 block discarded – undo
455 455
             }
456 456
             try {
457 457
                 $object = new $this->class($key);
458
-            } catch (midcom_error $e) {
458
+            }
459
+            catch (midcom_error $e) {
459 460
                 $e->log();
460 461
                 continue;
461 462
             }
Please login to merge, or discard this patch.
lib/midcom/helper/datamanager2/widget/photo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         $static_html .= $this->_l10n->get('type image: available sizes') . ":\n
66 66
                 <ul class='midcom_helper_datamanager2_widget_image_sizelist'>";
67 67
         foreach ($this->_type->attachments_info as $info) {
68
-            if (   $info['size_x']
68
+            if ($info['size_x']
69 69
                 && $info['size_y']) {
70 70
                 $size = "{$info['size_x']}x{$info['size_y']}";
71 71
             } else {
Please login to merge, or discard this patch.