@@ -46,7 +46,10 @@ discard block |
||
46 | 46 | $font_span = '<span style="width: 100%; display: inline; '. |
47 | 47 | ($font?'font-family:'.$font.'; ':'').($font_size?'font-size:'.$font_size.'; ':''). |
48 | 48 | '">​</span>'; |
49 | - if (empty($font) && empty($font_size)) $font_span = ''; |
|
49 | + if (empty($font) && empty($font_size)) |
|
50 | + { |
|
51 | + $font_span = ''; |
|
52 | + } |
|
50 | 53 | if($font_span) |
51 | 54 | { |
52 | 55 | $config['preference_style'] = $font_span; |
@@ -78,7 +81,10 @@ discard block |
||
78 | 81 | $value = Api\Html\HtmLawed::purify($value, $this->attrs['validation_rules']); |
79 | 82 | } |
80 | 83 | $valid =& self::get_array($validated, $form_name, true); |
81 | - if (true) $valid = $value; |
|
84 | + if (true) |
|
85 | + { |
|
86 | + $valid = $value; |
|
87 | + } |
|
82 | 88 | } |
83 | 89 | } |
84 | 90 | } |
@@ -31,7 +31,8 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct($xml = '') |
33 | 33 | { |
34 | - if($xml) { |
|
34 | + if($xml) |
|
35 | + { |
|
35 | 36 | parent::__construct($xml); |
36 | 37 | } |
37 | 38 | } |
@@ -60,7 +60,10 @@ discard block |
||
60 | 60 | { |
61 | 61 | // need to use self::form_name($form_name, $key) as index into sel_options see comment in header |
62 | 62 | $options =& self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true); |
63 | - if (!is_array($options)) $options = array(); |
|
63 | + if (!is_array($options)) |
|
64 | + { |
|
65 | + $options = array(); |
|
66 | + } |
|
64 | 67 | $options += $type; |
65 | 68 | } |
66 | 69 | |
@@ -87,7 +90,10 @@ discard block |
||
87 | 90 | $form_name = self::form_name($cname, $this->id, $expand); |
88 | 91 | $value = self::get_array($content, $form_name); |
89 | 92 | $valid =& self::get_array($validated, $form_name, true); |
90 | - if (true) $valid = $value; |
|
93 | + if (true) |
|
94 | + { |
|
95 | + $valid = $value; |
|
96 | + } |
|
91 | 97 | return true; |
92 | 98 | } |
93 | 99 | } |
@@ -37,7 +37,10 @@ |
||
37 | 37 | { |
38 | 38 | $value = self::get_array($content, $form_name); |
39 | 39 | $valid =& self::get_array($validated, $form_name, true); |
40 | - if (true) $valid = $value; |
|
40 | + if (true) |
|
41 | + { |
|
42 | + $valid = $value; |
|
43 | + } |
|
41 | 44 | } |
42 | 45 | } |
43 | 46 | } |
@@ -41,7 +41,10 @@ discard block |
||
41 | 41 | // normalize types |
42 | 42 | if ($this->type !== 'textbox') |
43 | 43 | { |
44 | - if ($this->type == 'int') $this->type = 'integer'; |
|
44 | + if ($this->type == 'int') |
|
45 | + { |
|
46 | + $this->type = 'integer'; |
|
47 | + } |
|
45 | 48 | |
46 | 49 | $this->attrs['type'] = $this->type; |
47 | 50 | $this->type = 'textbox'; |
@@ -90,7 +93,10 @@ discard block |
||
90 | 93 | if (!empty($value)) |
91 | 94 | { |
92 | 95 | $preserv =& self::get_array(self::$request->preserv, $form_name, true); |
93 | - if (true) $preserv = (string)$value; |
|
96 | + if (true) |
|
97 | + { |
|
98 | + $preserv = (string)$value; |
|
99 | + } |
|
94 | 100 | $value = str_repeat('*', strlen($preserv)); |
95 | 101 | } |
96 | 102 | } |
@@ -171,11 +177,15 @@ discard block |
||
171 | 177 | break; |
172 | 178 | } |
173 | 179 | } |
174 | - elseif ($this->type == 'integer' || $this->type == 'float') // cast int and float and check range |
|
180 | + elseif ($this->type == 'integer' || $this->type == 'float') |
|
181 | + { |
|
182 | + // cast int and float and check range |
|
175 | 183 | { |
176 | 184 | if ((string)$value !== '' || $this->attrs['needed']) // empty values are Ok if needed is not set |
177 | 185 | { |
178 | - $value = $this->type == 'integer' ? (int) $value : (float) str_replace(',','.',$value); // allow for german (and maybe other) format |
|
186 | + $value = $this->type == 'integer' ? (int) $value : (float) str_replace(',','.',$value); |
|
187 | + } |
|
188 | + // allow for german (and maybe other) format |
|
179 | 189 | |
180 | 190 | if (!empty($this->attrs['min']) && $value < $this->attrs['min']) |
181 | 191 | { |
@@ -36,7 +36,10 @@ |
||
36 | 36 | |
37 | 37 | $image = $value != '' ? $value : $this->attrs['src']; |
38 | 38 | |
39 | - if (is_string($image)) list($app,$img) = explode('/',$image,2); |
|
39 | + if (is_string($image)) |
|
40 | + { |
|
41 | + list($app,$img) = explode('/',$image,2); |
|
42 | + } |
|
40 | 43 | if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false) |
41 | 44 | { |
42 | 45 | $img = $image; |
@@ -56,7 +56,11 @@ discard block |
||
56 | 56 | if (!$this->is_readonly($cname, $form_name)) |
57 | 57 | { |
58 | 58 | $value = self::get_array($content, $form_name); |
59 | - if (!isset($value)) return; // value not transmitted --> nothing to validate |
|
59 | + if (!isset($value)) |
|
60 | + { |
|
61 | + return; |
|
62 | + } |
|
63 | + // value not transmitted --> nothing to validate |
|
60 | 64 | $valid =& self::get_array($validated, $form_name, true); |
61 | 65 | |
62 | 66 | if (!$value && $this->attrs['needed']) |
@@ -101,7 +105,10 @@ discard block |
||
101 | 105 | { |
102 | 106 | if ($multiple) |
103 | 107 | { |
104 | - if (!isset($valid)) $valid = array(); |
|
108 | + if (!isset($valid)) |
|
109 | + { |
|
110 | + $valid = array(); |
|
111 | + } |
|
105 | 112 | $valid[] = $selected_value; |
106 | 113 | } |
107 | 114 | else |
@@ -113,7 +120,10 @@ discard block |
||
113 | 120 | { |
114 | 121 | if ($multiple) |
115 | 122 | { |
116 | - if (!isset($valid)) $valid = array(); |
|
123 | + if (!isset($valid)) |
|
124 | + { |
|
125 | + $valid = array(); |
|
126 | + } |
|
117 | 127 | } |
118 | 128 | elseif ($value === 'true') |
119 | 129 | { |
@@ -100,7 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | // Update content? |
102 | 102 | if(self::$cont == null) |
103 | - self::$cont = is_array(self::$request->content) ? self::$request->content : array(); |
|
103 | + { |
|
104 | + self::$cont = is_array(self::$request->content) ? self::$request->content : array(); |
|
105 | + } |
|
104 | 106 | if($this->id && is_array(self::$cont[$this->id])) |
105 | 107 | { |
106 | 108 | $old_cont = self::$cont; |
@@ -119,7 +121,8 @@ discard block |
||
119 | 121 | } |
120 | 122 | |
121 | 123 | // Reset content as we leave |
122 | - if($old_cont) { |
|
124 | + if($old_cont) |
|
125 | + { |
|
123 | 126 | self::$cont = $old_cont; |
124 | 127 | } |
125 | 128 | } |
@@ -200,7 +203,10 @@ discard block |
||
200 | 203 | $legacy_options = explode(',', $legacy_options); |
201 | 204 | foreach(self::csv_split($value, count($legacy_options)) as $n => $val) |
202 | 205 | { |
203 | - if ($legacy_options[$n] && (string)$val !== '') $template->attrs[$legacy_options[$n]] = $val; |
|
206 | + if ($legacy_options[$n] && (string)$val !== '') |
|
207 | + { |
|
208 | + $template->attrs[$legacy_options[$n]] = $val; |
|
209 | + } |
|
204 | 210 | } |
205 | 211 | } |
206 | 212 | } |
@@ -305,7 +311,9 @@ discard block |
||
305 | 311 | |
306 | 312 | $widget_registry = Api\Cache::getInstance('etemplate', 'widget_registry'); |
307 | 313 | |
308 | - if (!$widget_registry) // not in instance cache --> rescan from filesystem |
|
314 | + if (!$widget_registry) |
|
315 | + { |
|
316 | + // not in instance cache --> rescan from filesystem |
|
309 | 317 | { |
310 | 318 | foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__.'/Widget')) as $path) |
311 | 319 | { |
@@ -314,6 +322,7 @@ discard block |
||
314 | 322 | try |
315 | 323 | { |
316 | 324 | include_once($path); |
325 | + } |
|
317 | 326 | } |
318 | 327 | catch(Exception $e) |
319 | 328 | { |
@@ -410,7 +419,10 @@ discard block |
||
410 | 419 | |
411 | 420 | if(!$xml) |
412 | 421 | { |
413 | - if (empty($type)) $type = 'widget'; |
|
422 | + if (empty($type)) |
|
423 | + { |
|
424 | + $type = 'widget'; |
|
425 | + } |
|
414 | 426 | $xml = "<$type id='$id'/>"; |
415 | 427 | } |
416 | 428 | //error_log(__METHOD__."('$type', ..., '$id') using $class_name"); |
@@ -509,7 +521,10 @@ discard block |
||
509 | 521 | $params[$index] = (array)$params[$index]; |
510 | 522 | } |
511 | 523 | } |
512 | - if($call) call_user_func_array(array($this, $method_name), $params); |
|
524 | + if($call) |
|
525 | + { |
|
526 | + call_user_func_array(array($this, $method_name), $params); |
|
527 | + } |
|
513 | 528 | } |
514 | 529 | foreach($this->children as $child) |
515 | 530 | { |
@@ -565,7 +580,10 @@ discard block |
||
565 | 580 | $val = self::expand_name($value, $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']); |
566 | 581 | $check_val = self::expand_name($check, $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']); |
567 | 582 | $result = count($vals) == 1 ? $val != '' : ($check_val[0] == '/' ? preg_match($check_val,$val) : $val == $check_val); |
568 | - if ($not) $result = !$result; |
|
583 | + if ($not) |
|
584 | + { |
|
585 | + $result = !$result; |
|
586 | + } |
|
569 | 587 | |
570 | 588 | //error_log(__METHOD__."('".($not?'!':'')."$disabled' = '$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = ".($result?'True':'False')); |
571 | 589 | return $result; |
@@ -615,7 +633,10 @@ discard block |
||
615 | 633 | { |
616 | 634 | $cont = array(); |
617 | 635 | } |
618 | - if (!is_numeric($c)) $c = self::chrs2num($c); |
|
636 | + if (!is_numeric($c)) |
|
637 | + { |
|
638 | + $c = self::chrs2num($c); |
|
639 | + } |
|
619 | 640 | $col = self::num2chrs($c-1); // $c-1 to get: 0:'@', 1:'A', ... |
620 | 641 | $col_ = self::num2chrs($c_-1); |
621 | 642 | $row_cont = $cont[$row]; |
@@ -698,7 +719,8 @@ discard block |
||
698 | 719 | */ |
699 | 720 | public function __clone() |
700 | 721 | { |
701 | - foreach($this->children as $child_num => $child) { |
|
722 | + foreach($this->children as $child_num => $child) |
|
723 | + { |
|
702 | 724 | $this->children[$child_num] = clone $child; |
703 | 725 | } |
704 | 726 | } |
@@ -712,7 +734,10 @@ discard block |
||
712 | 734 | public function toXml($indent='') |
713 | 735 | { |
714 | 736 | echo "$indent<$this->type"; |
715 | - if ($this->id) echo ' id="'.htmlspecialchars($this->id).'"'; |
|
737 | + if ($this->id) |
|
738 | + { |
|
739 | + echo ' id="'.htmlspecialchars($this->id).'"'; |
|
740 | + } |
|
716 | 741 | foreach($this->attrs as $name => $value) |
717 | 742 | { |
718 | 743 | if ($name == 'options' && $this->legacy_options && (!is_array($this->legacy_options) || |
@@ -792,7 +817,11 @@ discard block |
||
792 | 817 | { |
793 | 818 | throw new Api\Exception\AssertionFailed(__METHOD__."(\$arr,'$_idx',$reference_into,$skip_empty) \$arr is no array!"); |
794 | 819 | } |
795 | - if (is_object($_idx)) return false; // given an error in php5.2 |
|
820 | + if (is_object($_idx)) |
|
821 | + { |
|
822 | + return false; |
|
823 | + } |
|
824 | + // given an error in php5.2 |
|
796 | 825 | |
797 | 826 | // Make sure none of these are left |
798 | 827 | $idx = str_replace(array('[',']'), array('[',']'), $_idx); |
@@ -815,7 +844,10 @@ discard block |
||
815 | 844 | //if ($reference_into) error_log(__METHOD__."(".(strlen($s=array2string($arr))>512?substr($s,0,512).'...':$s).", '$idx', ".array2string($reference_into).", ".array2string($skip_empty).") ".function_backtrace()); |
816 | 845 | return null; |
817 | 846 | } |
818 | - if($skip_empty && (!is_array($pos) || !isset($pos[$idx]))) return null; |
|
847 | + if($skip_empty && (!is_array($pos) || !isset($pos[$idx]))) |
|
848 | + { |
|
849 | + return null; |
|
850 | + } |
|
819 | 851 | $pos = &$pos[$idx]; |
820 | 852 | } |
821 | 853 | return $pos; |
@@ -834,7 +866,10 @@ discard block |
||
834 | 866 | static function set_array(&$_arr, $_idx, $_value) |
835 | 867 | { |
836 | 868 | $ref =& self::get_array($_arr, $_idx, true); |
837 | - if (true) $ref = $_value; |
|
869 | + if (true) |
|
870 | + { |
|
871 | + $ref = $_value; |
|
872 | + } |
|
838 | 873 | } |
839 | 874 | |
840 | 875 | /** |
@@ -886,7 +921,10 @@ discard block |
||
886 | 921 | // not yet used: if (is_null($cname)) $cname = self::$name_vars; |
887 | 922 | error_log(__METHOD__."('$name','$error','$cname') ".function_backtrace()); |
888 | 923 | |
889 | - if ($cname) $name = self::form_name($cname,$name); |
|
924 | + if ($cname) |
|
925 | + { |
|
926 | + $name = self::form_name($cname,$name); |
|
927 | + } |
|
890 | 928 | |
891 | 929 | if ($error === false) |
892 | 930 | { |
@@ -913,11 +951,17 @@ discard block |
||
913 | 951 | { |
914 | 952 | // not yet used: if (is_null($cname)) $cname = self::$name_vars; |
915 | 953 | //echo "<p>uietemplate::validation_errors('$ignore_validation','$cname') validation_error="; _debug_array(self::$validation_errors); |
916 | - if (!$ignore_validation) return count(self::$validation_errors) > 0; |
|
954 | + if (!$ignore_validation) |
|
955 | + { |
|
956 | + return count(self::$validation_errors) > 0; |
|
957 | + } |
|
917 | 958 | |
918 | 959 | foreach(array_values(self::$validation_errors) as $name) |
919 | 960 | { |
920 | - if ($cname) $name = preg_replace('/^'.$cname.'\[([^\]]+)\](.*)$/','\\1\\2',$name); |
|
961 | + if ($cname) |
|
962 | + { |
|
963 | + $name = preg_replace('/^'.$cname.'\[([^\]]+)\](.*)$/','\\1\\2',$name); |
|
964 | + } |
|
921 | 965 | |
922 | 966 | // treat $ignoare_validation only as regular expression, if it starts with a slash |
923 | 967 | if ($ignore_validation[0] == '/' && !preg_match($ignore_validation,$name) || |
@@ -974,8 +1018,14 @@ discard block |
||
974 | 1018 | self::$request->unset_to_process(''); |
975 | 1019 | //error_log(__METHOD__."('$name', '$attr', ...) ".function_backtrace()); |
976 | 1020 | } |
977 | - if (isset($this)) $this->attrs[$attr] = $val; |
|
978 | - if (!is_null($val)) $ref = $val; |
|
1021 | + if (isset($this)) |
|
1022 | + { |
|
1023 | + $this->attrs[$attr] = $val; |
|
1024 | + } |
|
1025 | + if (!is_null($val)) |
|
1026 | + { |
|
1027 | + $ref = $val; |
|
1028 | + } |
|
979 | 1029 | |
980 | 1030 | //error_log(__METHOD__."('$name', '$attr', ".array2string($val).')'); |
981 | 1031 | return $ref; |
@@ -101,7 +101,8 @@ |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // Special keys |
104 | - switch ($keyCode) { |
|
104 | + switch ($keyCode) |
|
105 | + { |
|
105 | 106 | case self::BACKSPACE: |
106 | 107 | return lang("Back"); |
107 | 108 | case self::TAB: |