Completed
Push — master ( df31dd...7668ba )
by Andreas
08:37
created
lib/midgard/admin/asgard/navigation.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             {
66 66
                 foreach ($this->root_types as $root_type)
67 67
                 {
68
-                    if (    is_a($object, $root_type)
68
+                    if (is_a($object, $root_type)
69 69
                         || midcom_helper_reflector::is_same_class($root_type, $object->__midcom_class_name__))
70 70
                     {
71 71
                         $this->expanded_root_types[] = $root_type;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     protected function _is_collapsed($type, $total)
114 114
     {
115
-        return (   $total > $this->_config->get('max_navigation_entries')
115
+        return ($total > $this->_config->get('max_navigation_entries')
116 116
                 && empty($_GET['show_all_' . $type]));
117 117
     }
118 118
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         {
131 131
             $qb = $ref->_child_objects_type_qb($class, $object, false);
132 132
 
133
-            if (   !$qb
133
+            if (!$qb
134 134
                 || !($count = $qb->count_unchecked()))
135 135
             {
136 136
                 continue;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $qb = $ref->_root_objects_qb(false);
188 188
 
189
-        if (   !$qb
189
+        if (!$qb
190 190
             || !($total = $qb->count_unchecked()))
191 191
         {
192 192
             return;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $ref = midcom_helper_reflector::get($type);
228 228
         if (!empty($this->_object_path[$level]))
229 229
         {
230
-            if (   $this->_object_path[$level]->__mgdschema_class_name__ == $type
230
+            if ($this->_object_path[$level]->__mgdschema_class_name__ == $type
231 231
                 && !array_key_exists($this->_object_path[$level]->guid, $this->shown_objects))
232 232
             {
233 233
                 $label = htmlspecialchars($ref->get_object_label($this->_object_path[$level]));
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         }
265 265
 
266 266
         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";
267
-        if (   $selected
267
+        if ($selected
268 268
             || $autoexpand)
269 269
         {
270 270
             $this->_list_child_elements($object, $level + 1);
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
                 continue;
288 288
             }
289 289
 
290
-            if (   method_exists($class, 'navigation')
290
+            if (method_exists($class, 'navigation')
291 291
                 && ($this->_request_data['plugin_name'] == "asgard_{$component}"))
292 292
             {
293 293
                 $this->_request_data['expanded'] = true;
294 294
                 midcom_show_style('midgard_admin_asgard_navigation_section_header');
295
-                call_user_func(array($class,'navigation'));
295
+                call_user_func(array($class, 'navigation'));
296 296
             }
297 297
             else
298 298
             {
@@ -327,14 +327,14 @@  discard block
 block discarded – undo
327 327
         {
328 328
             $css_class .= ' selected';
329 329
         }
330
-        if (   is_object($this->_object)
331
-            && (   $object->guid == $this->_object->guid
332
-                || (   is_a($this->_object, 'midcom_db_parameter')
330
+        if (is_object($this->_object)
331
+            && ($object->guid == $this->_object->guid
332
+                || (is_a($this->_object, 'midcom_db_parameter')
333 333
                     && $object->guid == $this->_object->parentguid)))
334 334
         {
335 335
             $css_class .= ' current';
336 336
         }
337
-        if ( !$object->can_do('midgard:update'))
337
+        if (!$object->can_do('midgard:update'))
338 338
         {
339 339
             $css_class .= ' readonly';
340 340
         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $types = array();
352 352
 
353 353
         // Get the types that might have special display conditions
354
-        if (   $this->_config->get('midgard_types')
354
+        if ($this->_config->get('midgard_types')
355 355
             && preg_match_all('/\|([a-z0-9\.\-_]+)/', $this->_config->get('midgard_types'), $regs))
356 356
         {
357 357
             $types = $regs[1];
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         // Override with user selected
361 361
         // @TODO: Should this just include to the configuration selection, although it would break the consistency
362 362
         // of other similar preference sets, which simply override the global settings?
363
-        if (   midgard_admin_asgard_plugin::get_preference('midgard_types')
363
+        if (midgard_admin_asgard_plugin::get_preference('midgard_types')
364 364
             && preg_match_all('/\|([a-z0-9\.\-_]+)/', midgard_admin_asgard_plugin::get_preference('midgard_types'), $regs))
365 365
         {
366 366
             $types = $regs[1];
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
         foreach ($types as $root_type)
401 401
         {
402 402
             // If the regular expression has been set, check which types should be shown
403
-            if (   $regexp !== '//'
403
+            if ($regexp !== '//'
404 404
                 && (boolean) preg_match($regexp, $root_type) == $exclude)
405 405
             {
406 406
                 continue;
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
          * click if nothing is expanded
438 438
          */
439 439
         $types_shown = false;
440
-        if (    sizeof($expanded_types) > 0
440
+        if (sizeof($expanded_types) > 0
441 441
              && midgard_admin_asgard_plugin::get_preference('navigation_type') === 'dropdown')
442 442
         {
443 443
             $this->_draw_select_navigation();
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
             echo "    <li class=\"mgdschema-type\">";
480 480
 
481 481
             $dbaclass = midcom::get()->dbclassloader->get_midcom_class_name_for_mgdschema_object($type);
482
-            if (   $dbaclass
482
+            if ($dbaclass
483 483
                 && class_exists($dbaclass))
484 484
             {
485 485
                 $object = new $dbaclass;
Please login to merge, or discard this patch.
lib/midcom/helper/_styleloader.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                         break;
163 163
                     }
164 164
 
165
-                    if (   midcom::get()->config->get('styleengine_relative_paths')
165
+                    if (midcom::get()->config->get('styleengine_relative_paths')
166 166
                         && $style->up == midcom_connection::get('style'))
167 167
                     {
168 168
                         // Relative path, stop before going to main Midgard style
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                     }
171 171
                 }
172 172
             }
173
-            catch (midcom_error $e){}
173
+            catch (midcom_error $e) {}
174 174
 
175 175
             $path_parts = array_reverse($path_parts);
176 176
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     {
196 196
         static $cached = array();
197 197
 
198
-        if (   midcom::get()->config->get('styleengine_relative_paths')
198
+        if (midcom::get()->config->get('styleengine_relative_paths')
199 199
             && $rootstyle == 0)
200 200
         {
201 201
             // Relative paths in use, start seeking from under the style used for the Midgard host
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             $element = $matches[2];
349 349
         }
350 350
 
351
-        if (   isset($stylepath)
351
+        if (isset($stylepath)
352 352
             && $styleid = $this->get_style_id_from_path($stylepath))
353 353
         {
354 354
             array_unshift($this->_scope, $styleid);
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
      */
397 397
     public function render($preparsed, $path, array $data = array())
398 398
     {
399
-        if (   empty($data)
399
+        if (empty($data)
400 400
             && midcom_core_context::get()->has_custom_key('request_data'))
401 401
         {
402
-            $data =& midcom_core_context::get()->get_custom_key('request_data');
402
+            $data = & midcom_core_context::get()->get_custom_key('request_data');
403 403
         }
404 404
 
405 405
         if (eval('?>' . $preparsed) === false)
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         try
437 437
         {
438 438
             $root_topic = $context->get_key(MIDCOM_CONTEXT_ROOTTOPIC);
439
-            if (   $root_topic->style
439
+            if ($root_topic->style
440 440
                 && $db_style = $this->get_style_id_from_path($root_topic->style))
441 441
             {
442 442
                 $_style = $this->_get_element_in_styletree($db_style, $_element);
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
             {
480 480
                 return $this->_styles[$src];
481 481
             }
482
-            if (   $this->_scope[0] != ''
482
+            if ($this->_scope[0] != ''
483 483
                 && $result = $this->_get_element_in_styletree($this->_scope[0], $_element))
484 484
             {
485 485
                 $this->_styles[$src] = $result;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         {
500 500
             return $this->_snippets[$src];
501 501
         }
502
-        if (   midcom::get()->config->get('theme')
502
+        if (midcom::get()->config->get('theme')
503 503
             && $content = midcom_helper_misc::get_element_content($_element))
504 504
         {
505 505
             $this->_snippets[$src] = $content;
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         $current_context = midcom_core_context::get()->id;
510 510
         foreach ($this->_styledirs[$current_context] as $path)
511 511
         {
512
-            $filename = $path .  "/{$_element}.php";
512
+            $filename = $path . "/{$_element}.php";
513 513
             if (file_exists($filename))
514 514
             {
515 515
                 $this->_snippets[$filename] = file_get_contents($filename);
@@ -576,12 +576,12 @@  discard block
 block discarded – undo
576 576
         else
577 577
         {
578 578
             $style = $topic->style;
579
-            if (   !$topic->style
579
+            if (!$topic->style
580 580
                 && !empty($GLOBALS['midcom_style_inherited']))
581 581
             {
582 582
                 $style = $GLOBALS['midcom_style_inherited'];
583 583
             }
584
-            if (   is_string($style)
584
+            if (is_string($style)
585 585
                 && strpos($style, 'theme:') === 0)
586 586
             {
587 587
                 $theme_dir = OPENPSA2_THEME_ROOT . midcom::get()->config->get('theme') . '/style';
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
     {
613 613
         // get component's snippetdir (for default styles)
614 614
         $loader = midcom::get()->componentloader;
615
-        if (   !$topic
615
+        if (!$topic
616 616
             || !$topic->guid)
617 617
         {
618 618
             return null;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      * @param dirname path of style directory within midcom.
633 633
      * @throws midcom exception if directory does not exist.
634 634
      */
635
-    function append_styledir ($dirname)
635
+    function append_styledir($dirname)
636 636
     {
637 637
         if (!file_exists($dirname))
638 638
         {
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
      * @return boolean true if directory appended
649 649
      * @throws midcom_error if directory does not exist.
650 650
      */
651
-    function prepend_styledir ($dirname)
651
+    function prepend_styledir($dirname)
652 652
     {
653 653
         if (!file_exists($dirname))
654 654
         {
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
      * @param string componentname
665 665
      * @throws midcom exception if directory does not exist.
666 666
      */
667
-    function append_component_styledir ($component)
667
+    function append_component_styledir($component)
668 668
     {
669 669
         $loader = midcom::get()->componentloader;
670 670
         $path = $loader->path_to_snippetpath($component) . "/style";
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
      *
750 750
      * @param string component style
751 751
      */
752
-    private function _merge_styledirs ($component_style)
752
+    private function _merge_styledirs($component_style)
753 753
     {
754 754
         $current_context = midcom_core_context::get()->id;
755 755
         /* first the prepend styles */
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
         /* then the contextstyle */
758 758
         $this->_styledirs[$current_context][count($this->_styledirs[$current_context])] = $component_style;
759 759
 
760
-        $this->_styledirs[$current_context] =  array_merge($this->_styledirs[$current_context], $this->_styledirs_append[$current_context]);
760
+        $this->_styledirs[$current_context] = array_merge($this->_styledirs[$current_context], $this->_styledirs_append[$current_context]);
761 761
     }
762 762
 
763 763
     /**
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
             $this->_styledirs_append[$context] = array();
790 790
         }
791 791
 
792
-        if (   $this->_topic
792
+        if ($this->_topic
793 793
             && $_st = $this->_get_component_style($this->_topic))
794 794
         {
795 795
             array_unshift($this->_scope, $_st);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
      */
811 811
     public function leave_context()
812 812
     {
813
-        if (   $this->_topic
813
+        if ($this->_topic
814 814
             && $this->_get_component_style($this->_topic))
815 815
         {
816 816
             array_shift($this->_scope);
Please login to merge, or discard this patch.