@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array &$validated=array() validated content |
45 | 45 | * @return boolean true if no validation error, false otherwise |
46 | 46 | */ |
47 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
47 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
48 | 48 | { |
49 | 49 | $form_name = self::form_name($cname, $this->id, $expand); |
50 | 50 | //error_log(__METHOD__."('$cname', ".array2string($expand).", ...) $this: get_array(\$content, '$form_name')=".array2string(self::get_array($content, $form_name))); |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | { |
54 | 54 | $value = self::get_array($content, $form_name); |
55 | 55 | |
56 | - if( |
|
56 | + if ( |
|
57 | 57 | // Handle case of not existing $row_cont[id], eg: create[] |
58 | 58 | is_array($value) && count($value) == 1 || |
59 | 59 | // check === true, as get_array() ignores a "[]" postfix and returns array() eg. for a not existing $row_cont[id] in "delete[$row_cont[id]]" |
60 | 60 | $value == true |
61 | 61 | ) |
62 | 62 | { |
63 | - $valid =& self::get_array($validated, $form_name, true); |
|
63 | + $valid = & self::get_array($validated, $form_name, true); |
|
64 | 64 | if (true) $valid = is_array($value) ? $value : 'pressed'; |
65 | 65 | |
66 | 66 | // recorded pressed button globally, was in the template object before, put now as static on this object |
67 | - if ($this->type == 'cancel' || $form_name == 'cancel' || substr($form_name,-10) == '[cancel]') |
|
67 | + if ($this->type == 'cancel' || $form_name == 'cancel' || substr($form_name, -10) == '[cancel]') |
|
68 | 68 | { |
69 | 69 | self::$canceled = true; |
70 | 70 | } |
@@ -76,4 +76,4 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
79 | -Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Button', array('button','buttononly')); |
|
79 | +Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Button', array('button', 'buttononly')); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
43 | 43 | * @param array $content |
44 | 44 | * @param array &$validated=array() validated content |
45 | - * @return boolean true if no validation error, false otherwise |
|
45 | + * @return boolean|null true if no validation error, false otherwise |
|
46 | 46 | */ |
47 | 47 | public function validate($cname, array $expand, array $content, &$validated=array()) |
48 | 48 | { |
@@ -58,10 +58,12 @@ |
||
58 | 58 | is_array($value) && count($value) == 1 || |
59 | 59 | // check === true, as get_array() ignores a "[]" postfix and returns array() eg. for a not existing $row_cont[id] in "delete[$row_cont[id]]" |
60 | 60 | $value == true |
61 | - ) |
|
62 | - { |
|
61 | + ) { |
|
63 | 62 | $valid =& self::get_array($validated, $form_name, true); |
64 | - if (true) $valid = is_array($value) ? $value : 'pressed'; |
|
63 | + if (true) |
|
64 | + { |
|
65 | + $valid = is_array($value) ? $value : 'pressed'; |
|
66 | + } |
|
65 | 67 | |
66 | 68 | // recorded pressed button globally, was in the template object before, put now as static on this object |
67 | 69 | if ($this->type == 'cancel' || $form_name == 'cancel' || substr($form_name,-10) == '[cancel]') |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | * @param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children |
66 | 66 | * @param array $columns_disabled=array() disabled columns |
67 | 67 | */ |
68 | - public function run($method_name, $params=array(''), $respect_disabled=false, &$columns_disabled=array()) |
|
68 | + public function run($method_name, $params = array(''), $respect_disabled = false, &$columns_disabled = array()) |
|
69 | 69 | { |
70 | 70 | // maintain $expand array name-expansion |
71 | - $cname =& $params[0]; |
|
72 | - $expand =& $params[1]; |
|
71 | + $cname = & $params[0]; |
|
72 | + $expand = & $params[1]; |
|
73 | 73 | $old_cname = $params[0]; |
74 | 74 | $old_expand = $params[1]; |
75 | 75 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | //error_log(__METHOD__."('$method_name', ".array2string($params).', '.array2string($respect_disabled).") $this disabled='{$this->attrs['disabled']}'=".array2string($disabled).": NOT running"); |
86 | 86 | $params[0] = $old_cname; |
87 | 87 | $params[1] = $old_expand; |
88 | - return false; // return |
|
88 | + return false; // return |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | if ($this->id) $cname = self::form_name($cname, $this->id, $expand); |
92 | 92 | if ($expand['cname'] !== $cname && $cname) |
93 | 93 | { |
94 | - $expand['cont'] =& self::get_array(self::$request->content, $cname); |
|
94 | + $expand['cont'] = & self::get_array(self::$request->content, $cname); |
|
95 | 95 | $expand['cname'] = $cname; |
96 | 96 | } |
97 | 97 | |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | } |
102 | 102 | //foreach($this->children as $n => $child) |
103 | 103 | $repeat_child = null; |
104 | - for($n = 0; ; ++$n) |
|
104 | + for ($n = 0; ; ++$n) |
|
105 | 105 | { |
106 | 106 | // maintain $expand array name-expansion |
107 | - switch($this->type) |
|
107 | + switch ($this->type) |
|
108 | 108 | { |
109 | 109 | case 'rows': |
110 | 110 | $expand['row'] = $n; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if (isset($this->children[$n])) |
117 | 117 | { |
118 | 118 | $child = $this->children[$n]; |
119 | - if($this->type == 'rows' || $this->type == 'columns') |
|
119 | + if ($this->type == 'rows' || $this->type == 'columns') |
|
120 | 120 | { |
121 | 121 | /* |
122 | 122 | * We store a clone of the repeated child, because at the end |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | if (in_array($n, $columns_disabled)) |
144 | 144 | { |
145 | 145 | //error_log(__METHOD__."('$method_name', ".array2string($params).', '.array2string($respect_disabled).") $this column $n is disabled: NOT running"); |
146 | - continue; // do NOT run $method_name on disabled columns |
|
146 | + continue; // do NOT run $method_name on disabled columns |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | //error_log('Running ' . $method_name . ' on child ' . $n . '(' . $child . ') ['.$expand['row'] . ','.$expand['c'] . ']'); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | if ($this->type == 'columns' && $disabled) |
153 | 153 | { |
154 | - $columns_disabled[] = $n; // mark column as disabled |
|
154 | + $columns_disabled[] = $n; // mark column as disabled |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | if ($this->type == 'grid') |
@@ -175,34 +175,34 @@ discard block |
||
175 | 175 | private function need_autorepeat($cname, array $expand) |
176 | 176 | { |
177 | 177 | // check id's of children |
178 | - foreach($this->children as $n => $direct_child) |
|
178 | + foreach ($this->children as $n => $direct_child) |
|
179 | 179 | { |
180 | - foreach(array_merge(array($direct_child), $n ? array() : $direct_child->children) as $child) |
|
180 | + foreach (array_merge(array($direct_child), $n ? array() : $direct_child->children) as $child) |
|
181 | 181 | { |
182 | 182 | $pat = $child->id; |
183 | - while(($patstr = strstr($pat, '$'))) |
|
183 | + while (($patstr = strstr($pat, '$'))) |
|
184 | 184 | { |
185 | - $pat = substr($patstr,$patstr[1] == '{' ? 2 : 1); |
|
185 | + $pat = substr($patstr, $patstr[1] == '{' ? 2 : 1); |
|
186 | 186 | |
187 | 187 | switch ($this->type) |
188 | 188 | { |
189 | 189 | case 'column': |
190 | - $Ok = $pat[0] == 'c' && !(substr($pat,0,4) == 'cont' || substr($pat,0,2) == 'c_' || |
|
191 | - substr($pat,0,4) == 'col_'); |
|
190 | + $Ok = $pat[0] == 'c' && !(substr($pat, 0, 4) == 'cont' || substr($pat, 0, 2) == 'c_' || |
|
191 | + substr($pat, 0, 4) == 'col_'); |
|
192 | 192 | break; |
193 | 193 | case 'row': |
194 | - $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || |
|
195 | - substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont'); |
|
194 | + $Ok = $pat[0] == 'r' && !(substr($pat, 0, 2) == 'r_' || |
|
195 | + substr($pat, 0, 4) == 'row_' && substr($pat, 0, 8) != 'row_cont'); |
|
196 | 196 | //error_log(__METHOD__."() pat='$pat' --> Ok=".array2string($Ok)); |
197 | 197 | break; |
198 | 198 | default: |
199 | 199 | return false; |
200 | 200 | } |
201 | - if ($Ok && ($fname=self::form_name($cname, $child->id, $expand)) && |
|
201 | + if ($Ok && ($fname = self::form_name($cname, $child->id, $expand)) && |
|
202 | 202 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
203 | 203 | // for an id like "run[$row_cont[appname]]" |
204 | 204 | substr($fname, -2) != '[]' && |
205 | - ($value = self::get_array(self::$request->content,$fname)) !== null) // null = not found (can be false!) |
|
205 | + ($value = self::get_array(self::$request->content, $fname)) !== null) // null = not found (can be false!) |
|
206 | 206 | { |
207 | 207 | //error_log(__METHOD__."('$cname', ) $this autorepeating row $expand[row] because of $child->id = '$fname' is ".array2string($value)); |
208 | 208 | unset($value); |
@@ -88,7 +88,10 @@ discard block |
||
88 | 88 | return false; // return |
89 | 89 | } |
90 | 90 | |
91 | - if ($this->id) $cname = self::form_name($cname, $this->id, $expand); |
|
91 | + if ($this->id) |
|
92 | + { |
|
93 | + $cname = self::form_name($cname, $this->id, $expand); |
|
94 | + } |
|
92 | 95 | if ($expand['cname'] !== $cname && $cname) |
93 | 96 | { |
94 | 97 | $expand['cont'] =& self::get_array(self::$request->content, $cname); |
@@ -202,10 +205,13 @@ discard block |
||
202 | 205 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
203 | 206 | // for an id like "run[$row_cont[appname]]" |
204 | 207 | substr($fname, -2) != '[]' && |
205 | - ($value = self::get_array(self::$request->content,$fname)) !== null) // null = not found (can be false!) |
|
208 | + ($value = self::get_array(self::$request->content,$fname)) !== null) |
|
209 | + { |
|
210 | + // null = not found (can be false!) |
|
206 | 211 | { |
207 | 212 | //error_log(__METHOD__."('$cname', ) $this autorepeating row $expand[row] because of $child->id = '$fname' is ".array2string($value)); |
208 | 213 | unset($value); |
214 | + } |
|
209 | 215 | return true; |
210 | 216 | } |
211 | 217 | } |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | $form_name = self::form_name($cname, $this->id); |
39 | 39 | |
40 | 40 | $config = Api\Html\CkEditorConfig::get_ckeditor_config_array($this->attrs['mode'], $this->attrs['height'], |
41 | - $this->attrs['expand_toolbar'],$this->attrs['base_href'] |
|
41 | + $this->attrs['expand_toolbar'], $this->attrs['base_href'] |
|
42 | 42 | ); |
43 | 43 | // User preferences |
44 | 44 | $font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font']; |
45 | 45 | $font_size = Api\Html\CkEditorConfig::font_size_from_prefs(); |
46 | 46 | $font_span = '<span style="width: 100%; display: inline; '. |
47 | - ($font?'font-family:'.$font.'; ':'').($font_size?'font-size:'.$font_size.'; ':''). |
|
47 | + ($font ? 'font-family:'.$font.'; ' : '').($font_size ? 'font-size:'.$font_size.'; ' : ''). |
|
48 | 48 | '">​</span>'; |
49 | 49 | if (empty($font) && empty($font_size)) $font_span = ''; |
50 | - if($font_span) |
|
50 | + if ($font_span) |
|
51 | 51 | { |
52 | 52 | $config['preference_style'] = $font_span; |
53 | 53 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param array &$validated=array() validated content |
66 | 66 | * @return boolean true if no validation error, false otherwise |
67 | 67 | */ |
68 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
68 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
69 | 69 | { |
70 | 70 | $form_name = self::form_name($cname, $this->id, $expand); |
71 | 71 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $value = Api\Html\HtmLawed::purify($value, $this->attrs['validation_rules']); |
79 | 79 | } |
80 | - $valid =& self::get_array($validated, $form_name, true); |
|
80 | + $valid = & self::get_array($validated, $form_name, true); |
|
81 | 81 | if (true) $valid = $value; |
82 | 82 | } |
83 | 83 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
43 | 43 | * @param array $content |
44 | 44 | * @param array &$validated=array() validated content |
45 | - * @return boolean true if no validation error, false otherwise |
|
45 | + * @return boolean|null true if no validation error, false otherwise |
|
46 | 46 | */ |
47 | 47 | public function validate($cname, array $expand, array $content, &$validated=array()) |
48 | 48 | { |
@@ -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,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct($xml = '') |
33 | 33 | { |
34 | - if($xml) { |
|
34 | + if ($xml) { |
|
35 | 35 | parent::__construct($xml); |
36 | 36 | } |
37 | 37 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * Find items that match the given parameters |
41 | 41 | * using the egw_link class |
42 | 42 | */ |
43 | - public static function ajax_item_search($app, $type, $pattern, $options=array()) |
|
43 | + public static function ajax_item_search($app, $type, $pattern, $options = array()) |
|
44 | 44 | { |
45 | 45 | $options['type'] = $type ? $type : $options['type']; |
46 | 46 | $items = Api\Link::query($app, $pattern, $options); |
@@ -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 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * while it uses select-account for owner in historylog (containing all users). |
34 | 34 | * |
35 | 35 | * @param string $cname |
36 | - */ |
|
36 | + */ |
|
37 | 37 | public function beforeSendToClient($cname) |
38 | 38 | { |
39 | 39 | $form_name = self::form_name($cname, $this->id); |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | { |
39 | 39 | $form_name = self::form_name($cname, $this->id); |
40 | 40 | |
41 | - if(is_array(self::$request->content[$form_name]['status-widgets'])) |
|
41 | + if (is_array(self::$request->content[$form_name]['status-widgets'])) |
|
42 | 42 | { |
43 | - foreach(self::$request->content[$form_name]['status-widgets'] as $key => $type) |
|
43 | + foreach (self::$request->content[$form_name]['status-widgets'] as $key => $type) |
|
44 | 44 | { |
45 | - if(!is_array($type)) |
|
45 | + if (!is_array($type)) |
|
46 | 46 | { |
47 | - list($basetype) = explode('-',$type); |
|
47 | + list($basetype) = explode('-', $type); |
|
48 | 48 | $widget = @self::factory($basetype, '<?xml version="1.0"?><'.$type.' type="'.$type.'"/>', $key); |
49 | 49 | $widget->id = $key; |
50 | 50 | $widget->attrs['type'] = $type; |
51 | 51 | $widget->type = $type; |
52 | 52 | |
53 | - if(method_exists($widget, 'beforeSendToClient')) |
|
53 | + if (method_exists($widget, 'beforeSendToClient')) |
|
54 | 54 | { |
55 | 55 | // need to use $form_name as $cname see comment in header |
56 | 56 | $widget->beforeSendToClient($form_name, array()); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | else |
60 | 60 | { |
61 | 61 | // need to use self::form_name($form_name, $key) as index into sel_options see comment in header |
62 | - $options =& self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true); |
|
62 | + $options = & self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true); |
|
63 | 63 | if (!is_array($options)) $options = array(); |
64 | 64 | $options += $type; |
65 | 65 | } |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * @param array &$validated=array() validated content |
83 | 83 | * @return boolean true if no validation error, false otherwise |
84 | 84 | */ |
85 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
85 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
86 | 86 | { |
87 | 87 | $form_name = self::form_name($cname, $this->id, $expand); |
88 | 88 | $value = self::get_array($content, $form_name); |
89 | - $valid =& self::get_array($validated, $form_name, true); |
|
89 | + $valid = & self::get_array($validated, $form_name, true); |
|
90 | 90 | if (true) $valid = $value; |
91 | 91 | return true; |
92 | 92 | } |
@@ -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 | } |
@@ -29,14 +29,14 @@ |
||
29 | 29 | * @param array &$validated=array() validated content |
30 | 30 | * @return boolean true if no validation error, false otherwise |
31 | 31 | */ |
32 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
32 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
33 | 33 | { |
34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
35 | 35 | |
36 | 36 | if (!$this->is_readonly($cname, $form_name)) |
37 | 37 | { |
38 | 38 | $value = self::get_array($content, $form_name); |
39 | - $valid =& self::get_array($validated, $form_name, true); |
|
39 | + $valid = & self::get_array($validated, $form_name, true); |
|
40 | 40 | if (true) $valid = $value; |
41 | 41 | } |
42 | 42 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
43 | 43 | * @param array $content |
44 | 44 | * @param array &$validated=array() validated content |
45 | - * @return boolean true if no validation error, false otherwise |
|
45 | + * @return boolean|null true if no validation error, false otherwise |
|
46 | 46 | */ |
47 | 47 | public function validate($cname, array $expand, array $content, &$validated=array()) |
48 | 48 | { |
@@ -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 | } |
@@ -29,21 +29,21 @@ |
||
29 | 29 | * @param string $cname |
30 | 30 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
31 | 31 | */ |
32 | - public function beforeSendToClient($cname, array $expand=null) |
|
32 | + public function beforeSendToClient($cname, array $expand = null) |
|
33 | 33 | { |
34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
35 | - $value =& self::get_array(self::$request->content, $form_name); |
|
35 | + $value = & self::get_array(self::$request->content, $form_name); |
|
36 | 36 | |
37 | 37 | $image = $value != '' ? $value : $this->attrs['src']; |
38 | 38 | |
39 | - if (is_string($image)) list($app,$img) = explode('/',$image,2); |
|
40 | - if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false) |
|
39 | + if (is_string($image)) list($app, $img) = explode('/', $image, 2); |
|
40 | + if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img, '/') !== false) |
|
41 | 41 | { |
42 | 42 | $img = $image; |
43 | - list($app) = explode('.',$form_name); |
|
43 | + list($app) = explode('.', $form_name); |
|
44 | 44 | } |
45 | 45 | $src = Api\Image::find($app, $img); |
46 | - if(!$this->id) |
|
46 | + if (!$this->id) |
|
47 | 47 | { |
48 | 48 | // self::setElementAttribute($this->attrs['src'], 'id', $this->attrs['src']); |
49 | 49 | } |
@@ -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; |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $GLOBALS['egw_info']['flags']['currentapp'] = 'etemplate'; |
34 | 34 | $GLOBALS['egw_info']['flags']['app_header'] = 'et2 Widgets'; |
35 | - //'js_link_registry' => True, |
|
35 | + //'js_link_registry' => True, |
|
36 | 36 | |
37 | 37 | // Widget browser code |
38 | 38 | Api\Framework::includeJS('/api/js/etemplate/widget_browser.js'); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | Api\Framework::includeCSS('/api/templates/default/etemplate2.css'); |
48 | 48 | |
49 | - Api\Framework::includeCSS('api','widget_browser',false); |
|
49 | + Api\Framework::includeCSS('api', 'widget_browser', false); |
|
50 | 50 | |
51 | 51 | // load translations |
52 | 52 | Api\Translation::add_app('etemplate'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | return $mime; |
48 | 48 | } |
49 | - return lang('%1 file',strtoupper($ext)).' ('.$mime.')'; |
|
49 | + return lang('%1 file', strtoupper($ext)).' ('.$mime.')'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | if (empty($_ext)) |
65 | 65 | { |
66 | - return 'text/plain';//assume no extension is a text file |
|
66 | + return 'text/plain'; //assume no extension is a text file |
|
67 | 67 | } |
68 | 68 | $ext = strtolower($_ext); |
69 | 69 | if (!array_key_exists($ext, self::$mime_extension_map)) |
@@ -188,24 +188,24 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public static function analyze_data($data) |
190 | 190 | { |
191 | - if(!is_writeable(@$GLOBALS['egw_info']['server']['temp_dir'])) |
|
191 | + if (!is_writeable(@$GLOBALS['egw_info']['server']['temp_dir'])) |
|
192 | 192 | { |
193 | 193 | //nothing we can do but bail out |
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | 197 | mt_srand(time()); |
198 | - $filename = $GLOBALS['egw_info']['server']['temp_dir'] . '/' |
|
199 | - . md5( time() + mt_rand() ) . '.tmp'; |
|
198 | + $filename = $GLOBALS['egw_info']['server']['temp_dir'].'/' |
|
199 | + . md5(time() + mt_rand()).'.tmp'; |
|
200 | 200 | |
201 | 201 | $fp = @fopen($filename, 'ab'); |
202 | - if(!$fp || !$data) |
|
202 | + if (!$fp || !$data) |
|
203 | 203 | { |
204 | 204 | //houston we have a problem - bail out |
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | |
208 | - if(!fwrite($fp, $data)) |
|
208 | + if (!fwrite($fp, $data)) |
|
209 | 209 | { |
210 | 210 | //bail out again |
211 | 211 | return false; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $mime = self::analyze_file($filename); |
217 | 217 | |
218 | - unlink($filename);//remove the temp file |
|
218 | + unlink($filename); //remove the temp file |
|
219 | 219 | |
220 | 220 | return $mime; |
221 | 221 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @var array of extenstion to mime mappings |
234 | 234 | */ |
235 | 235 | static $mime_extension_map = array( |
236 | - 'txt' => 'text/plain', // should be first, so text/plain maps back to .txt |
|
236 | + 'txt' => 'text/plain', // should be first, so text/plain maps back to .txt |
|
237 | 237 | '3dml' => 'text/vnd.in3d.3dml', |
238 | 238 | '3ds' => 'image/x-3ds', |
239 | 239 | '3g2' => 'video/3gpp2', |
@@ -106,7 +106,10 @@ |
||
106 | 106 | public static function mime2ext($_type) |
107 | 107 | { |
108 | 108 | $type = strtolower($_type); |
109 | - if (isset(self::$mime_alias_map[$type])) $type = self::$mime_alias_map[$type]; |
|
109 | + if (isset(self::$mime_alias_map[$type])) |
|
110 | + { |
|
111 | + $type = self::$mime_alias_map[$type]; |
|
112 | + } |
|
110 | 113 | $key = array_search($type, self::$mime_extension_map); |
111 | 114 | if (empty($type) || $key === false) |
112 | 115 | { |