@@ -42,30 +42,30 @@ discard block |
||
42 | 42 | * @param array $params =array('') parameter(s) first parameter has to be the cname, second $expand! |
43 | 43 | * @param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children |
44 | 44 | */ |
45 | - public function run($method_name, $params=array(''), $respect_disabled=false) |
|
45 | + public function run($method_name, $params = array(''), $respect_disabled = false) |
|
46 | 46 | { |
47 | 47 | $form_name = self::form_name($params[0], $this->id, $params[1]); |
48 | 48 | |
49 | 49 | // Make sure additional tabs are processed for any method |
50 | - if (!($tabs =& self::getElementAttribute($form_name, 'tabs'))) |
|
50 | + if (!($tabs = & self::getElementAttribute($form_name, 'tabs'))) |
|
51 | 51 | { |
52 | 52 | $tabs = $this->attrs['tabs']; |
53 | 53 | } |
54 | - if($tabs && !$this->tabs_attr_evaluated) |
|
54 | + if ($tabs && !$this->tabs_attr_evaluated) |
|
55 | 55 | { |
56 | - $this->tabs_attr_evaluated = true; // we must not evaluate tabs attribte more then once! |
|
56 | + $this->tabs_attr_evaluated = true; // we must not evaluate tabs attribte more then once! |
|
57 | 57 | |
58 | 58 | // add_tabs toggles replacing or adding to existing tabs |
59 | - if(!$this->attrs['add_tabs']) |
|
59 | + if (!$this->attrs['add_tabs']) |
|
60 | 60 | { |
61 | 61 | $this->children[1]->children = array(); |
62 | 62 | } |
63 | 63 | |
64 | 64 | //$this->tabs = array(); |
65 | - foreach($tabs as &$tab) |
|
65 | + foreach ($tabs as &$tab) |
|
66 | 66 | { |
67 | - $template= clone Template::instance($tab['template']); |
|
68 | - if($tab['id']) $template->attrs['content'] = $tab['id']; |
|
67 | + $template = clone Template::instance($tab['template']); |
|
68 | + if ($tab['id']) $template->attrs['content'] = $tab['id']; |
|
69 | 69 | $this->children[1]->children[] = $template; |
70 | 70 | $tab['url'] = Template::rel2url($template->rel_path); |
71 | 71 | //$this->tabs[] = $tab; |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | |
79 | 79 | // Check for disabled tabs set via readonly, and set them as disabled |
80 | 80 | $readonlys = self::get_array(self::$request->readonlys, $form_name); |
81 | - if($respect_disabled && $readonlys) |
|
81 | + if ($respect_disabled && $readonlys) |
|
82 | 82 | { |
83 | - foreach($this->children[1]->children as $tab) |
|
83 | + foreach ($this->children[1]->children as $tab) |
|
84 | 84 | { |
85 | - $parts = explode('.',$tab->template ? $tab->template : $tab->id); |
|
85 | + $parts = explode('.', $tab->template ? $tab->template : $tab->id); |
|
86 | 86 | $ro_id = array_pop($parts); |
87 | - if($readonlys[$ro_id]) |
|
87 | + if ($readonlys[$ro_id]) |
|
88 | 88 | { |
89 | 89 | $tab->attrs['disabled'] = $readonlys[$ro_id]; |
90 | 90 | } |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | * @param array &$validated=array() validated content |
105 | 105 | * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont' |
106 | 106 | */ |
107 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
107 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
108 | 108 | { |
109 | 109 | $form_name = self::form_name($cname, $this->id, $expand); |
110 | 110 | |
111 | 111 | if (!empty($form_name)) |
112 | 112 | { |
113 | 113 | $value = self::get_array($content, $form_name); |
114 | - $valid =& self::get_array($validated, $form_name, true); |
|
114 | + $valid = & self::get_array($validated, $form_name, true); |
|
115 | 115 | if (true) $valid = $value; |
116 | 116 | } |
117 | 117 | } |
@@ -52,7 +52,6 @@ |
||
52 | 52 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
53 | 53 | * @param array $content |
54 | 54 | * @param array &$validated=array() validated content |
55 | - * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont' |
|
56 | 55 | */ |
57 | 56 | public function validate($cname, array $expand, array $content, &$validated=array()) |
58 | 57 | { |
@@ -65,7 +65,10 @@ discard block |
||
65 | 65 | foreach($tabs as &$tab) |
66 | 66 | { |
67 | 67 | $template= clone Template::instance($tab['template']); |
68 | - if($tab['id']) $template->attrs['content'] = $tab['id']; |
|
68 | + if($tab['id']) |
|
69 | + { |
|
70 | + $template->attrs['content'] = $tab['id']; |
|
71 | + } |
|
69 | 72 | $this->children[1]->children[] = $template; |
70 | 73 | $tab['url'] = Template::rel2url($template->rel_path); |
71 | 74 | //$this->tabs[] = $tab; |
@@ -112,7 +115,10 @@ discard block |
||
112 | 115 | { |
113 | 116 | $value = self::get_array($content, $form_name); |
114 | 117 | $valid =& self::get_array($validated, $form_name, true); |
115 | - if (true) $valid = $value; |
|
118 | + if (true) |
|
119 | + { |
|
120 | + $valid = $value; |
|
121 | + } |
|
116 | 122 | } |
117 | 123 | } |
118 | 124 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param string $cname |
75 | 75 | */ |
76 | - public function beforeSendToClient($cname, array $expand=array()) |
|
76 | + public function beforeSendToClient($cname, array $expand = array()) |
|
77 | 77 | { |
78 | 78 | $attrs = $this->attrs; |
79 | 79 | $form_name = self::form_name($cname, $this->id); |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | error_log(__METHOD__."() $this has no id!"); |
83 | 83 | return; |
84 | 84 | } |
85 | - $attrs['value'] = $value =& self::get_array(self::$request->content, $form_name, false, true); |
|
85 | + $attrs['value'] = $value = & self::get_array(self::$request->content, $form_name, false, true); |
|
86 | 86 | $attrs['type'] = $this->type; |
87 | 87 | $attrs['id'] = $this->id; |
88 | 88 | |
89 | 89 | $unmodified = $attrs; |
90 | 90 | |
91 | 91 | // run the transformation |
92 | - foreach(static::$transformation as $filter => $data) |
|
92 | + foreach (static::$transformation as $filter => $data) |
|
93 | 93 | { |
94 | 94 | $this->action($filter, $data, $attrs); |
95 | 95 | } |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | //echo $this; _debug_array($unmodified); _debug_array($attrs); _debug_array(array_diff_assoc($attrs, $unmodified)); |
98 | 98 | // compute the difference and send it to the client as modifications |
99 | 99 | $type_changed = false; |
100 | - foreach(array_diff_assoc($attrs, $unmodified) as $attr => $val) |
|
100 | + foreach (array_diff_assoc($attrs, $unmodified) as $attr => $val) |
|
101 | 101 | { |
102 | - switch($attr) |
|
102 | + switch ($attr) |
|
103 | 103 | { |
104 | 104 | case 'value': |
105 | 105 | if ($val != $value) |
106 | 106 | { |
107 | - $value = $val; // $value is reference to self::$request->content |
|
107 | + $value = $val; // $value is reference to self::$request->content |
|
108 | 108 | } |
109 | 109 | break; |
110 | 110 | case 'sel_options': |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | break; |
113 | 113 | case 'type': // not an attribute in etemplate2 |
114 | 114 | $type_changed = true; |
115 | - if($val == 'template') |
|
115 | + if ($val == 'template') |
|
116 | 116 | { |
117 | 117 | // If the widget has been transformed into a template, we |
118 | 118 | // also need to try and instanciate & parse the template too |
119 | 119 | $transformed_template = Template::instance($attrs['template']); |
120 | - if($transformed_template) |
|
120 | + if ($transformed_template) |
|
121 | 121 | { |
122 | 122 | $this->expand_widget($transformed_template, $expand); |
123 | - $transformed_template->run('beforeSendToClient',array($cname,$expand)); |
|
123 | + $transformed_template->run('beforeSendToClient', array($cname, $expand)); |
|
124 | 124 | } |
125 | 125 | $type_changed = false; |
126 | 126 | } |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | break; |
130 | 130 | } |
131 | 131 | } |
132 | - if($type_changed) |
|
132 | + if ($type_changed) |
|
133 | 133 | { |
134 | 134 | // Run the new widget type's beforeSendToClient |
135 | - $expanded_child = self::factory($attrs['type'], false,$this->id); |
|
135 | + $expanded_child = self::factory($attrs['type'], false, $this->id); |
|
136 | 136 | $expanded_child->id = $this->id; |
137 | 137 | $expanded_child->type = $attrs['type']; |
138 | 138 | $expanded_child->attrs = $attrs; |
139 | - $expanded_child->run('beforeSendToClient',array($cname,$expand)); |
|
139 | + $expanded_child->run('beforeSendToClient', array($cname, $expand)); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (strpos($action, '@') !== false) |
159 | 159 | { |
160 | 160 | $replace = array(); |
161 | - foreach($attrs as $a => $v) |
|
161 | + foreach ($attrs as $a => $v) |
|
162 | 162 | { |
163 | 163 | if (is_scalar($v) || is_null($v)) $replace['@'.$a] = $v; |
164 | 164 | } |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | // now replace with non-scalar value, eg. if values is an array: "@value", "@value[key] or "@value[@key]" |
167 | 167 | if (($a = strstr($action, '@'))) |
168 | 168 | { |
169 | - $action = self::get_array($attrs, substr($a,1)); |
|
169 | + $action = self::get_array($attrs, substr($a, 1)); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | $attrs[$attr] = $action; |
173 | 173 | if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs)); |
174 | 174 | } |
175 | 175 | // action is a serverside callback |
176 | - elseif(is_array($action) && isset($action['__callback__'])) |
|
176 | + elseif (is_array($action) && isset($action['__callback__'])) |
|
177 | 177 | { |
178 | 178 | if (!is_string(($callback = $action['__callback__']))) |
179 | 179 | { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | $attrs[$attr] = $this->$callback($attrs[$attr], $attrs); |
185 | 185 | } |
186 | - elseif(count(explode('.', $callback)) == 3) |
|
186 | + elseif (count(explode('.', $callback)) == 3) |
|
187 | 187 | { |
188 | 188 | $attrs[$attr] = ExecMethod($callback, $attrs[$attr], $attrs); |
189 | 189 | } |
@@ -197,29 +197,29 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | // action is a clientside callback |
200 | - elseif(is_array($action) && isset($action['__js__'])) |
|
200 | + elseif (is_array($action) && isset($action['__js__'])) |
|
201 | 201 | { |
202 | 202 | // nothing to do here |
203 | 203 | } |
204 | 204 | // TODO: Might be a better way to handle when value to be set is an array |
205 | - elseif(is_array($action) && $attr == 'sel_options') |
|
205 | + elseif (is_array($action) && $attr == 'sel_options') |
|
206 | 206 | { |
207 | 207 | $attrs[$attr] = $action; |
208 | 208 | } |
209 | 209 | // action is a switch --> check cases |
210 | - elseif(is_array($action)) |
|
210 | + elseif (is_array($action)) |
|
211 | 211 | { |
212 | 212 | // case matches --> run all actions |
213 | 213 | if (isset($action[$attrs[$attr]]) || !isset($action[$attrs[$attr]]) && isset($action['__default__'])) |
214 | 214 | { |
215 | 215 | $actions = isset($action[$attrs[$attr]]) ? $action[$attrs[$attr]] : $action['__default__']; |
216 | - if(!is_array($actions)) |
|
216 | + if (!is_array($actions)) |
|
217 | 217 | { |
218 | 218 | $attrs[$attr] = $actions; |
219 | 219 | $actions = array($attr => $actions); |
220 | 220 | } |
221 | 221 | if (self::DEBUG) error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions"); |
222 | - foreach($actions as $attr => $action) |
|
222 | + foreach ($actions as $attr => $action) |
|
223 | 223 | { |
224 | 224 | $this->action($attr, $action, $attrs); |
225 | 225 | } |
@@ -150,7 +150,10 @@ discard block |
||
150 | 150 | */ |
151 | 151 | protected function action($attr, $action, array &$attrs) |
152 | 152 | { |
153 | - if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).')'); |
|
153 | + if (self::DEBUG) |
|
154 | + { |
|
155 | + error_log(__METHOD__."('$attr', ".array2string($action).')'); |
|
156 | + } |
|
154 | 157 | // action is an assignment |
155 | 158 | if (is_scalar($action) || is_null($action)) |
156 | 159 | { |
@@ -160,7 +163,10 @@ discard block |
||
160 | 163 | $replace = array(); |
161 | 164 | foreach($attrs as $a => $v) |
162 | 165 | { |
163 | - if (is_scalar($v) || is_null($v)) $replace['@'.$a] = $v; |
|
166 | + if (is_scalar($v) || is_null($v)) |
|
167 | + { |
|
168 | + $replace['@'.$a] = $v; |
|
169 | + } |
|
164 | 170 | } |
165 | 171 | $action = strtr($action, $replace); |
166 | 172 | // now replace with non-scalar value, eg. if values is an array: "@value", "@value[key] or "@value[@key]" |
@@ -170,7 +176,10 @@ discard block |
||
170 | 176 | } |
171 | 177 | } |
172 | 178 | $attrs[$attr] = $action; |
173 | - if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs)); |
|
179 | + if (self::DEBUG) |
|
180 | + { |
|
181 | + error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs)); |
|
182 | + } |
|
174 | 183 | } |
175 | 184 | // action is a serverside callback |
176 | 185 | elseif(is_array($action) && isset($action['__callback__'])) |
@@ -218,7 +227,10 @@ discard block |
||
218 | 227 | $attrs[$attr] = $actions; |
219 | 228 | $actions = array($attr => $actions); |
220 | 229 | } |
221 | - if (self::DEBUG) error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions"); |
|
230 | + if (self::DEBUG) |
|
231 | + { |
|
232 | + error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions"); |
|
233 | + } |
|
222 | 234 | foreach($actions as $attr => $action) |
223 | 235 | { |
224 | 236 | $this->action($attr, $action, $attrs); |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | 'date' => 'Date', |
43 | 43 | 'date-time'=> 'Date+Time', |
44 | 44 | 'select-account' => 'Select account', |
45 | - 'button' => 'Button', // button to execute javascript |
|
45 | + 'button' => 'Button', // button to execute javascript |
|
46 | 46 | 'url' => 'Url', |
47 | 47 | 'url-email'=> 'EMail', |
48 | 48 | 'url-phone'=> 'Phone number', |
49 | 49 | 'htmlarea' => 'Formatted Text (HTML)', |
50 | - 'link-entry' => 'Select entry', // should be last type, as the individual apps get added behind |
|
50 | + 'link-entry' => 'Select entry', // should be last type, as the individual apps get added behind |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | /** |
@@ -86,24 +86,24 @@ discard block |
||
86 | 86 | * @param string $cname |
87 | 87 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
88 | 88 | */ |
89 | - public function beforeSendToClient($cname, array $expand=null) |
|
89 | + public function beforeSendToClient($cname, array $expand = null) |
|
90 | 90 | { |
91 | 91 | // No name, no way to get parameters client-side. |
92 | - if(!$this->id) $this->id = self::GLOBAL_ID; |
|
92 | + if (!$this->id) $this->id = self::GLOBAL_ID; |
|
93 | 93 | |
94 | 94 | $form_name = self::form_name($cname, $this->id, $expand); |
95 | 95 | |
96 | 96 | // Store properties at top level, so all customfield widgets can share |
97 | - if($this->attrs['app']) |
|
97 | + if ($this->attrs['app']) |
|
98 | 98 | { |
99 | 99 | $app = $this->attrs['app']; |
100 | 100 | } |
101 | 101 | else |
102 | 102 | { |
103 | - $app =& $this->getElementAttribute(self::GLOBAL_VALS, 'app'); |
|
104 | - if($this->getElementAttribute($form_name, 'app')) |
|
103 | + $app = & $this->getElementAttribute(self::GLOBAL_VALS, 'app'); |
|
104 | + if ($this->getElementAttribute($form_name, 'app')) |
|
105 | 105 | { |
106 | - $app =& $this->getElementAttribute($form_name, 'app'); |
|
106 | + $app = & $this->getElementAttribute($form_name, 'app'); |
|
107 | 107 | } |
108 | 108 | else |
109 | 109 | { |
@@ -112,21 +112,21 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - if($this->getElementAttribute($form_name, 'customfields')) |
|
115 | + if ($this->getElementAttribute($form_name, 'customfields')) |
|
116 | 116 | { |
117 | - $customfields =& $this->getElementAttribute($form_name, 'customfields'); |
|
117 | + $customfields = & $this->getElementAttribute($form_name, 'customfields'); |
|
118 | 118 | } |
119 | - elseif($app) |
|
119 | + elseif ($app) |
|
120 | 120 | { |
121 | 121 | // Checking creates it even if it wasn't there |
122 | 122 | unset(self::$request->modifications[$form_name]['customfields']); |
123 | - $customfields =& $this->getElementAttribute(self::GLOBAL_VALS, 'customfields'); |
|
123 | + $customfields = & $this->getElementAttribute(self::GLOBAL_VALS, 'customfields'); |
|
124 | 124 | } |
125 | 125 | |
126 | - if(!$app) |
|
126 | + if (!$app) |
|
127 | 127 | { |
128 | - $app =& $this->setElementAttribute(self::GLOBAL_VALS, 'app', $GLOBALS['egw_info']['flags']['currentapp']); |
|
129 | - $customfields =& $this->setElementAttribute(self::GLOBAL_VALS, 'customfields', Api\Storage\Customfields::get($app)); |
|
128 | + $app = & $this->setElementAttribute(self::GLOBAL_VALS, 'app', $GLOBALS['egw_info']['flags']['currentapp']); |
|
129 | + $customfields = & $this->setElementAttribute(self::GLOBAL_VALS, 'customfields', Api\Storage\Customfields::get($app)); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // if we are in the etemplate editor or the app has no cf's, load the cf's from the app the tpl belongs too |
@@ -134,29 +134,29 @@ discard block |
||
134 | 134 | ($GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate' || !$this->attrs['customfields']) || !isset($customfields)) |
135 | 135 | { |
136 | 136 | // app changed |
137 | - $customfields =& Api\Storage\Customfields::get($app); |
|
137 | + $customfields = & Api\Storage\Customfields::get($app); |
|
138 | 138 | } |
139 | 139 | // Filter fields |
140 | - if($this->attrs['field-names']) |
|
140 | + if ($this->attrs['field-names']) |
|
141 | 141 | { |
142 | 142 | $fields_name = explode(',', $this->attrs['field-names']); |
143 | - foreach($fields_name as &$f) |
|
143 | + foreach ($fields_name as &$f) |
|
144 | 144 | { |
145 | 145 | if ($f[0] == "!") |
146 | 146 | { |
147 | - $f= substr($f,1); |
|
148 | - $negate_fields[]= $f; |
|
147 | + $f = substr($f, 1); |
|
148 | + $negate_fields[] = $f; |
|
149 | 149 | } |
150 | - $field_filters []= $f; |
|
150 | + $field_filters [] = $f; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | $fields = $customfields; |
155 | 155 | |
156 | - $use_private = self::expand_name($this->attrs['use-private'],0,0,'','',self::$cont); |
|
157 | - $this->attrs['sub-type'] = self::expand_name($this->attrs['sub-type'],0,0,'','',self::$cont); |
|
156 | + $use_private = self::expand_name($this->attrs['use-private'], 0, 0, '', '', self::$cont); |
|
157 | + $this->attrs['sub-type'] = self::expand_name($this->attrs['sub-type'], 0, 0, '', '', self::$cont); |
|
158 | 158 | |
159 | - foreach((array)$fields as $key => $field) |
|
159 | + foreach ((array)$fields as $key => $field) |
|
160 | 160 | { |
161 | 161 | // remove private or non-private cf's, if only one kind should be displayed |
162 | 162 | if ((string)$use_private !== '' && (boolean)$field['private'] != (boolean)$use_private) |
@@ -165,36 +165,36 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // Remove filtered fields |
168 | - if($field_filters && in_array($key, $negate_fields) && in_array($key, $field_filters)) |
|
168 | + if ($field_filters && in_array($key, $negate_fields) && in_array($key, $field_filters)) |
|
169 | 169 | { |
170 | 170 | unset($fields[$key]); |
171 | 171 | } |
172 | 172 | } |
173 | 173 | // check if name refers to a single custom field --> show only that |
174 | 174 | $matches = null; |
175 | - if (($pos=strpos($form_name,self::$prefix)) !== false && // allow the prefixed name to be an array index too |
|
176 | - preg_match($preg = '/'.self::$prefix.'([^\]]+)/',$form_name,$matches) && isset($fields[$name=$matches[1]])) |
|
175 | + if (($pos = strpos($form_name, self::$prefix)) !== false && // allow the prefixed name to be an array index too |
|
176 | + preg_match($preg = '/'.self::$prefix.'([^\]]+)/', $form_name, $matches) && isset($fields[$name = $matches[1]])) |
|
177 | 177 | { |
178 | 178 | $fields = array($name => $fields[$name]); |
179 | 179 | $value = array(self::$prefix.$name => $value); |
180 | 180 | $form_name = self::$prefix.$name; |
181 | 181 | } |
182 | 182 | |
183 | - if(!is_array($fields)) $fields = array(); |
|
184 | - switch($type = $this->type) |
|
183 | + if (!is_array($fields)) $fields = array(); |
|
184 | + switch ($type = $this->type) |
|
185 | 185 | { |
186 | 186 | case 'customfields-types': |
187 | - foreach(self::$cf_types as $lname => $label) |
|
187 | + foreach (self::$cf_types as $lname => $label) |
|
188 | 188 | { |
189 | 189 | $sel_options[$lname] = lang($label); |
190 | - $fields_with_vals[]=$lname; |
|
190 | + $fields_with_vals[] = $lname; |
|
191 | 191 | } |
192 | 192 | $link_types = array_intersect_key(Api\Link::app_list('query'), Api\Link::app_list('title')); |
193 | 193 | // Explicitly add in filemanager, which does not support query or title |
194 | 194 | $link_types['filemanager'] = lang('filemanager'); |
195 | 195 | |
196 | 196 | ksort($link_types); |
197 | - foreach($link_types as $lname => $label) |
|
197 | + foreach ($link_types as $lname => $label) |
|
198 | 198 | { |
199 | 199 | $sel_options[$lname] = '- '.$label; |
200 | 200 | } |
@@ -202,32 +202,32 @@ discard block |
||
202 | 202 | self::$transformation['type'][$type]['no_lang'] = true; |
203 | 203 | return parent::beforeSendToClient($cname, $expand); |
204 | 204 | case 'customfields-list': |
205 | - foreach(array_reverse($fields) as $lname => $field) |
|
205 | + foreach (array_reverse($fields) as $lname => $field) |
|
206 | 206 | { |
207 | 207 | if (!empty($this->attrs['sub-type']) && !empty($field['type2']) && |
208 | - strpos(','.$field['type2'].',',','.$field['type2'].',') === false) continue; // not for our content type// |
|
208 | + strpos(','.$field['type2'].',', ','.$field['type2'].',') === false) continue; // not for our content type// |
|
209 | 209 | if (isset($value[self::$prefix.$lname]) && $value[self::$prefix.$lname] !== '') //break; |
210 | 210 | { |
211 | - $fields_with_vals[]=$lname; |
|
211 | + $fields_with_vals[] = $lname; |
|
212 | 212 | } |
213 | 213 | //$stop_at_field = $name; |
214 | 214 | } |
215 | 215 | break; |
216 | 216 | default: |
217 | - foreach(array_reverse($fields) as $lname => $field) |
|
217 | + foreach (array_reverse($fields) as $lname => $field) |
|
218 | 218 | { |
219 | - $fields_with_vals[]=$lname; |
|
219 | + $fields_with_vals[] = $lname; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | // need to encode values/select-options to keep their order |
223 | - foreach($customfields as &$data) |
|
223 | + foreach ($customfields as &$data) |
|
224 | 224 | { |
225 | 225 | if (!empty($data['values'])) |
226 | 226 | { |
227 | 227 | Select::fix_encoded_options($data['values']); |
228 | 228 | } |
229 | 229 | } |
230 | - if($fields != $customfields) |
|
230 | + if ($fields != $customfields) |
|
231 | 231 | { |
232 | 232 | // This widget has different settings from global |
233 | 233 | $this->setElementAttribute($form_name, 'customfields', $fields); |
@@ -239,14 +239,14 @@ discard block |
||
239 | 239 | parent::beforeSendToClient($cname, $expand); |
240 | 240 | |
241 | 241 | // Re-format date custom fields from Y-m-d |
242 | - $field_settings =& self::get_array(self::$request->modifications, "{$this->id}[customfields]",true); |
|
242 | + $field_settings = & self::get_array(self::$request->modifications, "{$this->id}[customfields]", true); |
|
243 | 243 | if (true) $field_settings = array(); |
244 | 244 | $link_types = Api\Link::app_list(); |
245 | - foreach($fields as $fname => $field) |
|
245 | + foreach ($fields as $fname => $field) |
|
246 | 246 | { |
247 | 247 | // Run beforeSendToClient for each field |
248 | 248 | $widget = $this->_widget($fname, $field); |
249 | - if(method_exists($widget, 'beforeSendToClient')) |
|
249 | + if (method_exists($widget, 'beforeSendToClient')) |
|
250 | 250 | { |
251 | 251 | $widget->beforeSendToClient($this->id == self::GLOBAL_ID ? '' : $this->id, $expand); |
252 | 252 | } |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | protected function _widget($fname, array $field) |
264 | 264 | { |
265 | 265 | static $link_types = null; |
266 | - if (!isset($link_types)) $link_types = Api\Link::app_list (); |
|
266 | + if (!isset($link_types)) $link_types = Api\Link::app_list(); |
|
267 | 267 | |
268 | 268 | $type = $field['type']; |
269 | 269 | // Link-tos needs to change from appname to link-to |
270 | - if($link_types[$field['type']]) |
|
270 | + if ($link_types[$field['type']]) |
|
271 | 271 | { |
272 | - if($type == 'filemanager') |
|
272 | + if ($type == 'filemanager') |
|
273 | 273 | { |
274 | 274 | $type = 'vfs-upload'; |
275 | 275 | } |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | $widget->attrs['type'] = $type; |
284 | 284 | |
285 | 285 | // some type-specific (default) attributes |
286 | - switch($type) |
|
286 | + switch ($type) |
|
287 | 287 | { |
288 | 288 | case 'date': |
289 | 289 | case 'date-time': |
290 | 290 | $widget->attrs['dataformat'] = $type == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s'; |
291 | - if($field['values']['min']) $widget->attrs['min'] = $field['values']['min']; |
|
292 | - if($field['values']['max']) $widget->attrs['min'] = $field['values']['max']; |
|
291 | + if ($field['values']['min']) $widget->attrs['min'] = $field['values']['min']; |
|
292 | + if ($field['values']['max']) $widget->attrs['min'] = $field['values']['max']; |
|
293 | 293 | break; |
294 | 294 | |
295 | 295 | case 'vfs-upload': |
296 | - $widget->attrs['path'] = $field['app'] . ':' . |
|
297 | - self::expand_name('$cont['.Api\Link::get_registry($field['app'],'view_id').']',0,0,0,0,self::$request->content). |
|
296 | + $widget->attrs['path'] = $field['app'].':'. |
|
297 | + self::expand_name('$cont['.Api\Link::get_registry($field['app'], 'view_id').']', 0, 0, 0, 0, self::$request->content). |
|
298 | 298 | ':'.$field['label']; |
299 | 299 | break; |
300 | 300 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @param array $content |
354 | 354 | * @param array &$validated=array() validated content |
355 | 355 | */ |
356 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
356 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
357 | 357 | { |
358 | 358 | if ($this->id) |
359 | 359 | { |
@@ -369,14 +369,14 @@ discard block |
||
369 | 369 | // if we have no id / use self::GLOBAL_ID, we have to set $value_in in global namespace for regular widgets validation to find |
370 | 370 | if (!$this->id) $content = array_merge($content, $value_in); |
371 | 371 | //error_log(__METHOD__."($cname, ...) form_name=$form_name, use-private={$this->attrs['use-private']}, value_in=".array2string($value_in)); |
372 | - $customfields =& $this->getElementAttribute(self::GLOBAL_VALS, 'customfields'); |
|
373 | - if(is_array($value_in)) |
|
372 | + $customfields = & $this->getElementAttribute(self::GLOBAL_VALS, 'customfields'); |
|
373 | + if (is_array($value_in)) |
|
374 | 374 | { |
375 | - foreach($value_in as $field => $value) |
|
375 | + foreach ($value_in as $field => $value) |
|
376 | 376 | { |
377 | - $field_settings = $customfields[$fname=substr($field,1)]; |
|
377 | + $field_settings = $customfields[$fname = substr($field, 1)]; |
|
378 | 378 | |
379 | - if ((string)$this->attrs['use-private'] !== '' && // are only (non-)private fields requested |
|
379 | + if ((string)$this->attrs['use-private'] !== '' && // are only (non-)private fields requested |
|
380 | 380 | (boolean)$field_settings['private'] != ($this->attrs['use-private'] != '0')) |
381 | 381 | { |
382 | 382 | continue; |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | $widget->validate($form_name != self::GLOBAL_ID ? $form_name : $cname, $expand, $content, $validated); |
397 | 397 | if ($field_settings['needed'] && (is_array($value) ? !$value : (string)$value === '')) |
398 | 398 | { |
399 | - self::set_validation_error($field,lang('Field must not be empty !!!'),''); |
|
399 | + self::set_validation_error($field, lang('Field must not be empty !!!'), ''); |
|
400 | 400 | } |
401 | - $field_name = $this->id[0] == self::$prefix && $customfields[substr($this->id,1)] ? $this->id : self::form_name($form_name != self::GLOBAL_ID ? $form_name : $cname, $field); |
|
402 | - $valid =& self::get_array($validated, $field_name, true); |
|
401 | + $field_name = $this->id[0] == self::$prefix && $customfields[substr($this->id, 1)] ? $this->id : self::form_name($form_name != self::GLOBAL_ID ? $form_name : $cname, $field); |
|
402 | + $valid = & self::get_array($validated, $field_name, true); |
|
403 | 403 | |
404 | 404 | if (is_array($valid)) $valid = implode(',', $valid); |
405 | 405 | // NULL is valid for most fields, but not custom fields due to backend handling |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | elseif ($this->type == 'customfields-types') |
412 | 412 | { |
413 | 413 | // Transformation doesn't handle validation |
414 | - $valid =& self::get_array($validated, $this->id ? $form_name : $field, true); |
|
414 | + $valid = & self::get_array($validated, $this->id ? $form_name : $field, true); |
|
415 | 415 | if (true) $valid = $value_in; |
416 | 416 | //error_log(__METHOD__."() $form_name $field: ".array2string($value).' --> '.array2string($value)); |
417 | 417 | } |
@@ -89,7 +89,10 @@ discard block |
||
89 | 89 | public function beforeSendToClient($cname, array $expand=null) |
90 | 90 | { |
91 | 91 | // No name, no way to get parameters client-side. |
92 | - if(!$this->id) $this->id = self::GLOBAL_ID; |
|
92 | + if(!$this->id) |
|
93 | + { |
|
94 | + $this->id = self::GLOBAL_ID; |
|
95 | + } |
|
93 | 96 | |
94 | 97 | $form_name = self::form_name($cname, $this->id, $expand); |
95 | 98 | |
@@ -180,7 +183,10 @@ discard block |
||
180 | 183 | $form_name = self::$prefix.$name; |
181 | 184 | } |
182 | 185 | |
183 | - if(!is_array($fields)) $fields = array(); |
|
186 | + if(!is_array($fields)) |
|
187 | + { |
|
188 | + $fields = array(); |
|
189 | + } |
|
184 | 190 | switch($type = $this->type) |
185 | 191 | { |
186 | 192 | case 'customfields-types': |
@@ -205,11 +211,18 @@ discard block |
||
205 | 211 | foreach(array_reverse($fields) as $lname => $field) |
206 | 212 | { |
207 | 213 | if (!empty($this->attrs['sub-type']) && !empty($field['type2']) && |
208 | - strpos(','.$field['type2'].',',','.$field['type2'].',') === false) continue; // not for our content type// |
|
209 | - if (isset($value[self::$prefix.$lname]) && $value[self::$prefix.$lname] !== '') //break; |
|
214 | + strpos(','.$field['type2'].',',','.$field['type2'].',') === false) |
|
215 | + { |
|
216 | + continue; |
|
217 | + } |
|
218 | + // not for our content type// |
|
219 | + if (isset($value[self::$prefix.$lname]) && $value[self::$prefix.$lname] !== '') |
|
220 | + { |
|
221 | + //break; |
|
210 | 222 | { |
211 | 223 | $fields_with_vals[]=$lname; |
212 | 224 | } |
225 | + } |
|
213 | 226 | //$stop_at_field = $name; |
214 | 227 | } |
215 | 228 | break; |
@@ -240,7 +253,10 @@ discard block |
||
240 | 253 | |
241 | 254 | // Re-format date custom fields from Y-m-d |
242 | 255 | $field_settings =& self::get_array(self::$request->modifications, "{$this->id}[customfields]",true); |
243 | - if (true) $field_settings = array(); |
|
256 | + if (true) |
|
257 | + { |
|
258 | + $field_settings = array(); |
|
259 | + } |
|
244 | 260 | $link_types = Api\Link::app_list(); |
245 | 261 | foreach($fields as $fname => $field) |
246 | 262 | { |
@@ -263,7 +279,10 @@ discard block |
||
263 | 279 | protected function _widget($fname, array $field) |
264 | 280 | { |
265 | 281 | static $link_types = null; |
266 | - if (!isset($link_types)) $link_types = Api\Link::app_list (); |
|
282 | + if (!isset($link_types)) |
|
283 | + { |
|
284 | + $link_types = Api\Link::app_list (); |
|
285 | + } |
|
267 | 286 | |
268 | 287 | $type = $field['type']; |
269 | 288 | // Link-tos needs to change from appname to link-to |
@@ -288,8 +307,14 @@ discard block |
||
288 | 307 | case 'date': |
289 | 308 | case 'date-time': |
290 | 309 | $widget->attrs['dataformat'] = $type == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s'; |
291 | - if($field['values']['min']) $widget->attrs['min'] = $field['values']['min']; |
|
292 | - if($field['values']['max']) $widget->attrs['min'] = $field['values']['max']; |
|
310 | + if($field['values']['min']) |
|
311 | + { |
|
312 | + $widget->attrs['min'] = $field['values']['min']; |
|
313 | + } |
|
314 | + if($field['values']['max']) |
|
315 | + { |
|
316 | + $widget->attrs['min'] = $field['values']['max']; |
|
317 | + } |
|
293 | 318 | break; |
294 | 319 | |
295 | 320 | case 'vfs-upload': |
@@ -306,7 +331,10 @@ discard block |
||
306 | 331 | break; |
307 | 332 | |
308 | 333 | default: |
309 | - if (substr($type, 0, 7) !== 'select-' && $type != 'ajax_select') break; |
|
334 | + if (substr($type, 0, 7) !== 'select-' && $type != 'ajax_select') |
|
335 | + { |
|
336 | + break; |
|
337 | + } |
|
310 | 338 | // fall-through for all select-* widgets |
311 | 339 | case 'select': |
312 | 340 | $this->attrs['multiple'] = $field['rows'] > 1; |
@@ -367,7 +395,10 @@ discard block |
||
367 | 395 | $all_readonly = $this->is_readonly($cname, $form_name); |
368 | 396 | $value_in = self::get_array($content, $form_name); |
369 | 397 | // if we have no id / use self::GLOBAL_ID, we have to set $value_in in global namespace for regular widgets validation to find |
370 | - if (!$this->id) $content = array_merge($content, $value_in); |
|
398 | + if (!$this->id) |
|
399 | + { |
|
400 | + $content = array_merge($content, $value_in); |
|
401 | + } |
|
371 | 402 | //error_log(__METHOD__."($cname, ...) form_name=$form_name, use-private={$this->attrs['use-private']}, value_in=".array2string($value_in)); |
372 | 403 | $customfields =& $this->getElementAttribute(self::GLOBAL_VALS, 'customfields'); |
373 | 404 | if(is_array($value_in)) |
@@ -392,7 +423,10 @@ discard block |
||
392 | 423 | // run validation method of widget implementing this custom field |
393 | 424 | $widget = $this->_widget($fname, $field_settings); |
394 | 425 | // widget has no validate method, eg. is only displaying stuff --> nothing to validate |
395 | - if (!method_exists($widget, 'validate')) continue; |
|
426 | + if (!method_exists($widget, 'validate')) |
|
427 | + { |
|
428 | + continue; |
|
429 | + } |
|
396 | 430 | $widget->validate($form_name != self::GLOBAL_ID ? $form_name : $cname, $expand, $content, $validated); |
397 | 431 | if ($field_settings['needed'] && (is_array($value) ? !$value : (string)$value === '')) |
398 | 432 | { |
@@ -401,10 +435,16 @@ discard block |
||
401 | 435 | $field_name = $this->id[0] == self::$prefix && $customfields[substr($this->id,1)] ? $this->id : self::form_name($form_name != self::GLOBAL_ID ? $form_name : $cname, $field); |
402 | 436 | $valid =& self::get_array($validated, $field_name, true); |
403 | 437 | |
404 | - if (is_array($valid)) $valid = implode(',', $valid); |
|
438 | + if (is_array($valid)) |
|
439 | + { |
|
440 | + $valid = implode(',', $valid); |
|
441 | + } |
|
405 | 442 | // NULL is valid for most fields, but not custom fields due to backend handling |
406 | 443 | // See so_sql_cf->save() |
407 | - if (is_null($valid)) $valid = false; |
|
444 | + if (is_null($valid)) |
|
445 | + { |
|
446 | + $valid = false; |
|
447 | + } |
|
408 | 448 | //error_log(__METHOD__."() $field_name: ".array2string($value).' --> '.array2string($valid)); |
409 | 449 | } |
410 | 450 | } |
@@ -412,7 +452,10 @@ discard block |
||
412 | 452 | { |
413 | 453 | // Transformation doesn't handle validation |
414 | 454 | $valid =& self::get_array($validated, $this->id ? $form_name : $field, true); |
415 | - if (true) $valid = $value_in; |
|
455 | + if (true) |
|
456 | + { |
|
457 | + $valid = $value_in; |
|
458 | + } |
|
416 | 459 | //error_log(__METHOD__."() $form_name $field: ".array2string($value).' --> '.array2string($value)); |
417 | 460 | } |
418 | 461 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $this->contacts->__construct(); |
130 | 130 | $options = $this->contacts->contact_fields; |
131 | - foreach($this->contacts->customfields as $name => $data) |
|
131 | + foreach ($this->contacts->customfields as $name => $data) |
|
132 | 132 | { |
133 | 133 | $options['#'.$name] = $data['label']; |
134 | 134 | } |
@@ -148,28 +148,28 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function get_contact($value, array $attrs) |
150 | 150 | { |
151 | - if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) return $value; |
|
151 | + if (is_array($value) && !(array_key_exists('app', $value) && array_key_exists('id', $value))) return $value; |
|
152 | 152 | |
153 | - if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id']; |
|
154 | - switch($attrs['type']) |
|
153 | + if (is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id']; |
|
154 | + switch ($attrs['type']) |
|
155 | 155 | { |
156 | 156 | case 'contact-account': |
157 | 157 | case 'contact-template': |
158 | - if (substr($value,0,8) != 'account:') |
|
158 | + if (substr($value, 0, 8) != 'account:') |
|
159 | 159 | { |
160 | 160 | $value = 'account:'.($attrs['name'] != 'account:' ? $value : $GLOBALS['egw_info']['user']['account_id']); |
161 | 161 | } |
162 | 162 | // fall-through |
163 | 163 | case 'contact-value': |
164 | 164 | default: |
165 | - if (substr($value,0,12) == 'addressbook:') $value = substr($value,12); // link-entry syntax |
|
165 | + if (substr($value, 0, 12) == 'addressbook:') $value = substr($value, 12); // link-entry syntax |
|
166 | 166 | if (!($contact = $this->contacts->read($value))) |
167 | 167 | { |
168 | 168 | $contact = array(); |
169 | 169 | } |
170 | 170 | break; |
171 | 171 | } |
172 | - unset($contact['jpegphoto']); // makes no sense to return binary image |
|
172 | + unset($contact['jpegphoto']); // makes no sense to return binary image |
|
173 | 173 | |
174 | 174 | //error_log(__METHOD__."('$value') returning ".array2string($contact)); |
175 | 175 | return $contact; |
@@ -148,9 +148,15 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function get_contact($value, array $attrs) |
150 | 150 | { |
151 | - if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) return $value; |
|
151 | + if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) |
|
152 | + { |
|
153 | + return $value; |
|
154 | + } |
|
152 | 155 | |
153 | - if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id']; |
|
156 | + if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) |
|
157 | + { |
|
158 | + $value = $value['id']; |
|
159 | + } |
|
154 | 160 | switch($attrs['type']) |
155 | 161 | { |
156 | 162 | case 'contact-account': |
@@ -162,7 +168,11 @@ discard block |
||
162 | 168 | // fall-through |
163 | 169 | case 'contact-value': |
164 | 170 | default: |
165 | - if (substr($value,0,12) == 'addressbook:') $value = substr($value,12); // link-entry syntax |
|
171 | + if (substr($value,0,12) == 'addressbook:') |
|
172 | + { |
|
173 | + $value = substr($value,12); |
|
174 | + } |
|
175 | + // link-entry syntax |
|
166 | 176 | if (!($contact = $this->contacts->read($value))) |
167 | 177 | { |
168 | 178 | $contact = array(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function __construct($xml = '') |
83 | 83 | { |
84 | - if($xml) { |
|
84 | + if ($xml) { |
|
85 | 85 | parent::__construct($xml); |
86 | 86 | } |
87 | 87 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return Template current object or clone, if any attribute was set |
97 | 97 | * @todo Use legacy_attributes instead of leaving it to typeOptions method to parse them |
98 | 98 | */ |
99 | - public function set_attrs($xml, $cloned=true) |
|
99 | + public function set_attrs($xml, $cloned = true) |
|
100 | 100 | { |
101 | 101 | parent::set_attrs($xml, $cloned); |
102 | 102 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | unset($this->attrs['options']); |
110 | 110 | } |
111 | 111 | } |
112 | - elseif($this->attrs['rows'] > 1) |
|
112 | + elseif ($this->attrs['rows'] > 1) |
|
113 | 113 | { |
114 | 114 | $this->attrs['multiple'] = true; |
115 | 115 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param array $content |
126 | 126 | * @param array &$validated=array() validated content |
127 | 127 | */ |
128 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
128 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
129 | 129 | { |
130 | 130 | $form_name = self::form_name($cname, $this->id, $expand); |
131 | 131 | $widget_type = $this->attrs['type'] ? $this->attrs['type'] : $this->type; |
@@ -135,21 +135,21 @@ discard block |
||
135 | 135 | { |
136 | 136 | $value = $value_in = self::get_array($content, $form_name); |
137 | 137 | |
138 | - $allowed2 = self::selOptions($form_name, true); // true = return array of option-values |
|
138 | + $allowed2 = self::selOptions($form_name, true); // true = return array of option-values |
|
139 | 139 | $type_options = self::typeOptions($this, |
140 | 140 | // typeOptions thinks # of rows is the first thing in options |
141 | 141 | ($this->attrs['rows'] && strpos($this->attrs['options'], $this->attrs['rows']) !== 0 ? $this->attrs['rows'].','.$this->attrs['options'] : $this->attrs['options'])); |
142 | - $allowed = array_merge($allowed2,array_keys($type_options)); |
|
142 | + $allowed = array_merge($allowed2, array_keys($type_options)); |
|
143 | 143 | |
144 | 144 | // add option children's values too, "" is not read, therefore we cast to string |
145 | - foreach($this->children as $child) |
|
145 | + foreach ($this->children as $child) |
|
146 | 146 | { |
147 | 147 | if ($child->type == 'option') $allowed[] = (string)$child->attrs['value']; |
148 | 148 | } |
149 | 149 | |
150 | 150 | if (!$this->attrs['multiple'] || !($this->attrs['options'] > 1)) $allowed[] = ''; |
151 | 151 | |
152 | - foreach((array) $value as $val) |
|
152 | + foreach ((array)$value as $val) |
|
153 | 153 | { |
154 | 154 | // handle empty-label for all widget types |
155 | 155 | if ((string)$val === '' && in_array('', $allowed)) continue; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | case 'select-account': |
160 | 160 | // If in allowed options, skip account check to support app-specific options |
161 | - if(count($allowed) > 0 && in_array($val,$allowed)) continue; |
|
161 | + if (count($allowed) > 0 && in_array($val, $allowed)) continue; |
|
162 | 162 | |
163 | 163 | // validate accounts independent of options know to server |
164 | 164 | $account_type = $this->attrs['account_type'] ? $this->attrs['account_type'] : 'accounts'; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ) |
173 | 173 | { |
174 | 174 | self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, |
175 | - !$type?'not found' : ($type == 1 ? 'user' : 'group')),''); |
|
175 | + !$type ? 'not found' : ($type == 1 ? 'user' : 'group')), ''); |
|
176 | 176 | $value = ''; |
177 | 177 | break 2; |
178 | 178 | } |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | break; |
187 | 187 | |
188 | 188 | default: |
189 | - if(!in_array($val, $allowed)) |
|
189 | + if (!in_array($val, $allowed)) |
|
190 | 190 | { |
191 | - self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!", $val, implode("','",$allowed)),''); |
|
191 | + self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, implode("','", $allowed)), ''); |
|
192 | 192 | $value = ''; |
193 | 193 | break 2; |
194 | 194 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | if ($ok && $value === '' && $this->attrs['needed']) |
198 | 198 | { |
199 | - self::set_validation_error($form_name,lang('Field must not be empty !!!',$value),''); |
|
199 | + self::set_validation_error($form_name, lang('Field must not be empty !!!', $value), ''); |
|
200 | 200 | } |
201 | 201 | // some widgets sub-types need some post-processing |
202 | 202 | // ToDo: move it together with preprocessing to clientside |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | { |
205 | 205 | case 'select-dow': |
206 | 206 | $dow = 0; |
207 | - foreach((array)$value as $val) |
|
207 | + foreach ((array)$value as $val) |
|
208 | 208 | { |
209 | 209 | $dow |= $val; |
210 | 210 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | $value = array_merge($value, (array)self::$request->preserv[$unavailable_name]); |
232 | 232 | } |
233 | - elseif(!$value) // for single cat, we only restore unavailable one, if no other was selected |
|
233 | + elseif (!$value) // for single cat, we only restore unavailable one, if no other was selected |
|
234 | 234 | { |
235 | 235 | $value = self::$request->preserv[$unavailable_name]; |
236 | 236 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param string $cname |
255 | 255 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
256 | 256 | */ |
257 | - public function beforeSendToClient($cname, array $expand=null) |
|
257 | + public function beforeSendToClient($cname, array $expand = null) |
|
258 | 258 | { |
259 | 259 | //error_log(__METHOD__."('$cname') this->id=$this->id, this->type=$this->type, this->attrs=".array2string($this->attrs)); |
260 | 260 | $matches = null; |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | { |
288 | 288 | // Check selection preference, we may be able to skip reading some data |
289 | 289 | $select_pref = $GLOBALS['egw_info']['user']['preferences']['common']['account_selection']; |
290 | - if($this->attrs['type'] == 'select-account' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $select_pref == 'none') |
|
290 | + if ($this->attrs['type'] == 'select-account' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $select_pref == 'none') |
|
291 | 291 | { |
292 | 292 | // Preserve but do not send the value if preference is 'none' |
293 | 293 | self::$request->preserv[$this->id] = self::$request->content[$this->id]; |
294 | 294 | unset(self::$request->content[$this->id]); |
295 | 295 | $this->attrs['readonly'] = true; |
296 | 296 | } |
297 | - if(!in_array($type, self::$cached_types)) |
|
297 | + if (!in_array($type, self::$cached_types)) |
|
298 | 298 | { |
299 | 299 | // adding type specific options here, while keep further options set by app code |
300 | 300 | // we need to make sure to run only once for auto-repeated rows, because |
@@ -324,20 +324,20 @@ discard block |
||
324 | 324 | |
325 | 325 | // Make sure s, etc. are properly encoded when sent, and not double-encoded |
326 | 326 | $options = (isset(self::$request->sel_options[$form_name]) ? $form_name : $this->id); |
327 | - if(is_array(self::$request->sel_options[$options])) |
|
327 | + if (is_array(self::$request->sel_options[$options])) |
|
328 | 328 | { |
329 | - if(in_array($this->attrs['type'], self::$cached_types) && !isset($form_names_done[$options])) |
|
329 | + if (in_array($this->attrs['type'], self::$cached_types) && !isset($form_names_done[$options])) |
|
330 | 330 | { |
331 | 331 | // Fix any custom options from application |
332 | - self::fix_encoded_options(self::$request->sel_options[$options],true); |
|
332 | + self::fix_encoded_options(self::$request->sel_options[$options], true); |
|
333 | 333 | $form_names_done[$options] = true; |
334 | 334 | } |
335 | 335 | // Turn on search, if there's a lot of rows (unless explicitly set) |
336 | - if(!array_key_exists('search',$this->attrs) && count(self::$request->sel_options[$options]) >= self::SEARCH_ROW_LIMIT) |
|
336 | + if (!array_key_exists('search', $this->attrs) && count(self::$request->sel_options[$options]) >= self::SEARCH_ROW_LIMIT) |
|
337 | 337 | { |
338 | 338 | self::setElementAttribute($form_name, "search", true); |
339 | 339 | } |
340 | - if(!self::$request->sel_options[$options]) |
|
340 | + if (!self::$request->sel_options[$options]) |
|
341 | 341 | { |
342 | 342 | unset(self::$request->sel_options[$options]); |
343 | 343 | } |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param array $options |
353 | 353 | * @param boolean $use_array_of_objects Re-indexes options, making everything more complicated |
354 | 354 | */ |
355 | - public static function fix_encoded_options(array &$options, $use_array_of_objects=null) |
|
355 | + public static function fix_encoded_options(array &$options, $use_array_of_objects = null) |
|
356 | 356 | { |
357 | 357 | $backup_options = $options; |
358 | 358 | |
359 | 359 | $values = array(); |
360 | - foreach($options as $value => &$label) |
|
360 | + foreach ($options as $value => &$label) |
|
361 | 361 | { |
362 | 362 | // Of course once we re-index the options, we can't detect duplicates |
363 | 363 | // so check here, as we re-index |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | return self::fix_encoded_options($options, true); |
378 | 378 | } |
379 | 379 | // optgroup or values for keys "label" and "title" |
380 | - if(is_array($label)) |
|
380 | + if (is_array($label)) |
|
381 | 381 | { |
382 | 382 | self::fix_encoded_options($label, false); |
383 | 383 | if ($use_array_of_objects && !array_key_exists('value', $label)) $label['value'] = $value; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param boolean $return_values =false true: return array with option values, instead of value => label pairs |
409 | 409 | * @return array |
410 | 410 | */ |
411 | - public static function selOptions($name, $return_values=false) |
|
411 | + public static function selOptions($name, $return_values = false) |
|
412 | 412 | { |
413 | 413 | $options = array(); |
414 | 414 | |
@@ -419,12 +419,12 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | // Check for base of name in root of sel_options |
422 | - if(!$options) |
|
422 | + if (!$options) |
|
423 | 423 | { |
424 | - $name_parts = explode('[',str_replace(array('[',']',']'),array('['),$name)); |
|
424 | + $name_parts = explode('[', str_replace(array('[', ']', ']'), array('['), $name)); |
|
425 | 425 | if (count($name_parts)) |
426 | 426 | { |
427 | - $org_name = $name_parts[count($name_parts)-1]; |
|
427 | + $org_name = $name_parts[count($name_parts) - 1]; |
|
428 | 428 | if (isset(self::$request->sel_options[$org_name]) && is_array(self::$request->sel_options[$org_name])) |
429 | 429 | { |
430 | 430 | $options += self::$request->sel_options[$org_name]; |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | if ($return_values) |
445 | 445 | { |
446 | 446 | $values = array(); |
447 | - foreach($options as $key => $val) |
|
447 | + foreach ($options as $key => $val) |
|
448 | 448 | { |
449 | 449 | if (is_array($val)) |
450 | 450 | { |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | } |
461 | 461 | else // optgroup |
462 | 462 | { |
463 | - foreach($val as $k => $v) |
|
463 | + foreach ($val as $k => $v) |
|
464 | 464 | { |
465 | 465 | $values[] = is_array($v) && isset($v['value']) ? $v['value'] : $k; |
466 | 466 | } |
@@ -489,50 +489,50 @@ discard block |
||
489 | 489 | * @param string $form_name =null |
490 | 490 | * @return array with value => label pairs |
491 | 491 | */ |
492 | - public static function typeOptions($widget_type, $_legacy_options, &$no_lang=false, $readonly=false, &$value=null, $form_name=null) |
|
492 | + public static function typeOptions($widget_type, $_legacy_options, &$no_lang = false, $readonly = false, &$value = null, $form_name = null) |
|
493 | 493 | { |
494 | - if($widget_type && is_object($widget_type)) |
|
494 | + if ($widget_type && is_object($widget_type)) |
|
495 | 495 | { |
496 | 496 | $widget = $widget_type; |
497 | 497 | $widget_type = $widget->attrs['type'] ? $widget->attrs['type'] : $widget->type; |
498 | 498 | } |
499 | 499 | // Legacy / static support |
500 | 500 | // Have to do this explicitly, since legacy options is not defined on class level |
501 | - $legacy_options = explode(',',$_legacy_options); |
|
502 | - foreach($legacy_options as &$field) |
|
501 | + $legacy_options = explode(',', $_legacy_options); |
|
502 | + foreach ($legacy_options as &$field) |
|
503 | 503 | { |
504 | - $field = self::expand_name($field, 0, 0,'','',self::$cont); |
|
504 | + $field = self::expand_name($field, 0, 0, '', '', self::$cont); |
|
505 | 505 | } |
506 | 506 | |
507 | - list($rows,$type,$type2,$type3,$type4,$type5) = $legacy_options; |
|
507 | + list($rows, $type, $type2, $type3, $type4, $type5) = $legacy_options; |
|
508 | 508 | $no_lang = false; |
509 | 509 | $options = array(); |
510 | 510 | switch ($widget_type) |
511 | 511 | { |
512 | 512 | case 'select-percent': // options: #row,decrement(default=10) |
513 | 513 | $decr = $type > 0 ? $type : 10; |
514 | - for ($i=0; $i <= 100; $i += $decr) |
|
514 | + for ($i = 0; $i <= 100; $i += $decr) |
|
515 | 515 | { |
516 | 516 | $options[intval($i)] = intval($i).'%'; |
517 | 517 | } |
518 | 518 | $options[100] = '100%'; |
519 | 519 | if (!$rows || !empty($value)) |
520 | 520 | { |
521 | - $value = intval(($value+($decr/2)) / $decr) * $decr; |
|
521 | + $value = intval(($value + ($decr / 2)) / $decr) * $decr; |
|
522 | 522 | } |
523 | 523 | $no_lang = True; |
524 | 524 | break; |
525 | 525 | |
526 | 526 | case 'select-priority': |
527 | - $options = array('','low','normal','high'); |
|
527 | + $options = array('', 'low', 'normal', 'high'); |
|
528 | 528 | break; |
529 | 529 | |
530 | 530 | case 'select-bool': // equal to checkbox, can be used with nextmatch-customfilter to filter a boolean column |
531 | - $options = array(0 => 'no',1 => 'yes'); |
|
531 | + $options = array(0 => 'no', 1 => 'yes'); |
|
532 | 532 | break; |
533 | 533 | |
534 | 534 | case 'select-country': // #Row|Extralabel,1=use country name, 0=use 2 letter-code,custom country field name |
535 | - if($type == 0 && $type2) |
|
535 | + if ($type == 0 && $type2) |
|
536 | 536 | { |
537 | 537 | $custom_label = is_numeric($type2) ? 'Custom' : $type2; |
538 | 538 | $options = array('-custom-' => lang($custom_label)) + Api\Country::countries(); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $value = Api\Country::country_code($value); |
547 | 547 | if (!isset($options[$value])) |
548 | 548 | { |
549 | - if($type2) |
|
549 | + if ($type2) |
|
550 | 550 | { |
551 | 551 | $options[$value] = $value; |
552 | 552 | } |
@@ -562,20 +562,20 @@ discard block |
||
562 | 562 | |
563 | 563 | case 'select-cat': // !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app, $type4: parent-id, $type5=owner (-1=global),$type6=show missing |
564 | 564 | if ((!$type3 || $type3 === $GLOBALS['egw']->categories->app_name) && |
565 | - (!$type5 || $type5 == $GLOBALS['egw']->categories->account_id)) |
|
565 | + (!$type5 || $type5 == $GLOBALS['egw']->categories->account_id)) |
|
566 | 566 | { |
567 | 567 | $categories = $GLOBALS['egw']->categories; |
568 | 568 | } |
569 | 569 | else // we need to instanciate a new cat object for the correct application |
570 | 570 | { |
571 | - $categories = new Api\Categories($type5,$type3); |
|
571 | + $categories = new Api\Categories($type5, $type3); |
|
572 | 572 | } |
573 | 573 | // Allow text for global |
574 | 574 | $type = ($type && strlen($type) > 1 ? $type : !$type); |
575 | 575 | // we cast $type4 (parent) to int, to get default of 0 if omitted |
576 | - foreach((array)$categories->return_sorted_array(0,False,'','','',$type,(int)$type4,true) as $cat) |
|
576 | + foreach ((array)$categories->return_sorted_array(0, False, '', '', '', $type, (int)$type4, true) as $cat) |
|
577 | 577 | { |
578 | - $s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']); |
|
578 | + $s = str_repeat(' ', $cat['level']).stripslashes($cat['name']); |
|
579 | 579 | |
580 | 580 | if (Api\Categories::is_global($cat)) |
581 | 581 | { |
@@ -590,13 +590,13 @@ discard block |
||
590 | 590 | 'children' => $cat['children'] |
591 | 591 | ); |
592 | 592 | // Send data too |
593 | - if(is_array($cat['data'])) |
|
593 | + if (is_array($cat['data'])) |
|
594 | 594 | { |
595 | 595 | $options[$cat['id']] += $cat['data']; |
596 | 596 | } |
597 | 597 | } |
598 | 598 | // preserv unavailible cats (eg. private user-cats) |
599 | - if ($value && ($unavailible = array_diff(is_array($value) ? $value : explode(',',$value),array_keys((array)$options)))) |
|
599 | + if ($value && ($unavailible = array_diff(is_array($value) ? $value : explode(',', $value), array_keys((array)$options)))) |
|
600 | 600 | { |
601 | 601 | // unavailable cats need to be merged in again |
602 | 602 | $unavailable_name = $form_name.self::UNAVAILABLE_CAT_POSTFIX; |
@@ -609,11 +609,11 @@ discard block |
||
609 | 609 | $options[''] = ''; |
610 | 610 | if ($type <= 0) $type = 3; |
611 | 611 | if ($type2 <= 0) $type2 = 2; |
612 | - if ($type > 100 && $type2 > 100 && $type > $type) { $y = $type; $type=$type2; $type2=$y; } |
|
613 | - $y = date('Y')-$type; |
|
614 | - if ($value && $value-$type < $y || $type > 100) $y = $type > 100 ? $type : $value-$type; |
|
615 | - $to = date('Y')+$type2; |
|
616 | - if ($value && $value+$type2 > $to || $type2 > 100) $to = $type2 > 100 ? $type2 : $value+$type2; |
|
612 | + if ($type > 100 && $type2 > 100 && $type > $type) { $y = $type; $type = $type2; $type2 = $y; } |
|
613 | + $y = date('Y') - $type; |
|
614 | + if ($value && $value - $type < $y || $type > 100) $y = $type > 100 ? $type : $value - $type; |
|
615 | + $to = date('Y') + $type2; |
|
616 | + if ($value && $value + $type2 > $to || $type2 > 100) $to = $type2 > 100 ? $type2 : $value + $type2; |
|
617 | 617 | for ($n = 0; $y <= $to && $n < 200; ++$n) |
618 | 618 | { |
619 | 619 | $options[$y] = $y++; |
@@ -629,17 +629,17 @@ discard block |
||
629 | 629 | case 'select-dow': // options: rows[,0=summaries befor days, 1=summaries after days, 2=no summaries[,extraStyleMultiselect]] |
630 | 630 | if (!defined('MCAL_M_SUNDAY')) |
631 | 631 | { |
632 | - define('MCAL_M_SUNDAY',1); |
|
633 | - define('MCAL_M_MONDAY',2); |
|
634 | - define('MCAL_M_TUESDAY',4); |
|
635 | - define('MCAL_M_WEDNESDAY',8); |
|
636 | - define('MCAL_M_THURSDAY',16); |
|
637 | - define('MCAL_M_FRIDAY',32); |
|
638 | - define('MCAL_M_SATURDAY',64); |
|
639 | - |
|
640 | - define('MCAL_M_WEEKDAYS',62); |
|
641 | - define('MCAL_M_WEEKEND',65); |
|
642 | - define('MCAL_M_ALLDAYS',127); |
|
632 | + define('MCAL_M_SUNDAY', 1); |
|
633 | + define('MCAL_M_MONDAY', 2); |
|
634 | + define('MCAL_M_TUESDAY', 4); |
|
635 | + define('MCAL_M_WEDNESDAY', 8); |
|
636 | + define('MCAL_M_THURSDAY', 16); |
|
637 | + define('MCAL_M_FRIDAY', 32); |
|
638 | + define('MCAL_M_SATURDAY', 64); |
|
639 | + |
|
640 | + define('MCAL_M_WEEKDAYS', 62); |
|
641 | + define('MCAL_M_WEEKEND', 65); |
|
642 | + define('MCAL_M_ALLDAYS', 127); |
|
643 | 643 | } |
644 | 644 | $weekstart = $GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']; |
645 | 645 | $options = array(); |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | } |
673 | 673 | $value_in = $value; |
674 | 674 | $value = array(); |
675 | - foreach(array_keys($options) as $val) |
|
675 | + foreach (array_keys($options) as $val) |
|
676 | 676 | { |
677 | - if (($value_in & $val) == $val) |
|
677 | + if (($value_in&$val) == $val) |
|
678 | 678 | { |
679 | 679 | $value[] = $val; |
680 | 680 | |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $val == MCAL_M_WEEKDAYS && $value_in == MCAL_M_WEEKDAYS || |
683 | 683 | $val == MCAL_M_WEEKEND && $value_in == MCAL_M_WEEKEND) |
684 | 684 | { |
685 | - break; // dont set the others |
|
685 | + break; // dont set the others |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | } |
@@ -695,22 +695,22 @@ discard block |
||
695 | 695 | // fall-through |
696 | 696 | |
697 | 697 | case 'select-number': // options: rows,min,max,decrement,suffix |
698 | - $type = $type === '' ? 1 : intval($type); // min |
|
699 | - $type2 = $type2 === '' ? 10 : intval($type2); // max |
|
698 | + $type = $type === '' ? 1 : intval($type); // min |
|
699 | + $type2 = $type2 === '' ? 10 : intval($type2); // max |
|
700 | 700 | $format = '%d'; |
701 | 701 | if (!empty($type3) && $type3[0] == '0') // leading zero |
702 | 702 | { |
703 | 703 | $format = '%0'.strlen($type3).'d'; |
704 | 704 | } |
705 | - $type3 = !$type3 ? 1 : intval($type3); // decrement |
|
705 | + $type3 = !$type3 ? 1 : intval($type3); // decrement |
|
706 | 706 | if (($type <= $type2) != ($type3 > 0)) |
707 | 707 | { |
708 | - $type3 = -$type3; // void infinite loop |
|
708 | + $type3 = -$type3; // void infinite loop |
|
709 | 709 | } |
710 | 710 | if (!empty($type4)) $format .= lang($type4); |
711 | - for ($i=0,$n=$type; $n <= $type2 && $i <= 100; $n += $type3,++$i) |
|
711 | + for ($i = 0, $n = $type; $n <= $type2 && $i <= 100; $n += $type3, ++$i) |
|
712 | 712 | { |
713 | - $options[$n] = sprintf($format,$n); |
|
713 | + $options[$n] = sprintf($format, $n); |
|
714 | 714 | } |
715 | 715 | $no_lang = True; |
716 | 716 | break; |
@@ -720,15 +720,14 @@ discard block |
||
720 | 720 | for ($h = 0; $h <= 23; ++$h) |
721 | 721 | { |
722 | 722 | $options[$h] = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? |
723 | - (($h % 12 ? $h % 12 : 12).$minutes.' '.($h < 12 ? lang('am') : lang('pm'))) : |
|
724 | - sprintf('%02d',$h).$minutes; |
|
723 | + (($h % 12 ? $h % 12 : 12).$minutes.' '.($h < 12 ? lang('am') : lang('pm'))) : sprintf('%02d', $h).$minutes; |
|
725 | 724 | } |
726 | 725 | $no_lang = True; |
727 | 726 | break; |
728 | 727 | |
729 | 728 | case 'select-app': // type2: 'user'=apps of current user, 'enabled', 'installed' (default), 'all' = not installed ones too |
730 | 729 | $apps = self::app_options($type2); |
731 | - $options = is_array($options) ? $options+$apps : $apps; |
|
730 | + $options = is_array($options) ? $options + $apps : $apps; |
|
732 | 731 | break; |
733 | 732 | |
734 | 733 | case 'select-lang': |
@@ -743,7 +742,7 @@ discard block |
||
743 | 742 | } |
744 | 743 | if ($readonly) // for readonly we dont need to fetch all TZ's |
745 | 744 | { |
746 | - $options[$value] = calendar_timezones::tz2id($value,'name'); |
|
745 | + $options[$value] = calendar_timezones::tz2id($value, 'name'); |
|
747 | 746 | } |
748 | 747 | else |
749 | 748 | { |
@@ -773,7 +772,7 @@ discard block |
||
773 | 772 | { |
774 | 773 | if ($type2 == 'enabled' && (!$data['enabled'] || !$data['status'] || $data['status'] == 3)) |
775 | 774 | { |
776 | - continue; // app not enabled (user can not have run rights for these apps) |
|
775 | + continue; // app not enabled (user can not have run rights for these apps) |
|
777 | 776 | } |
778 | 777 | if ($type2 != 'user' || $GLOBALS['egw_info']['user']['apps'][$app]) |
779 | 778 | { |
@@ -788,7 +787,7 @@ discard block |
||
788 | 787 | if (@is_dir(EGW_SERVER_ROOT."/$file/setup") && $file[0] != '.' && |
789 | 788 | !isset($apps[$app = basename($file)])) |
790 | 789 | { |
791 | - $apps[$app] = $app . ' (*)'; |
|
790 | + $apps[$app] = $app.' (*)'; |
|
792 | 791 | } |
793 | 792 | } |
794 | 793 | closedir($dir); |
@@ -806,7 +805,7 @@ discard block |
||
806 | 805 | * @param boolean $show_type =false true: return array with values for keys label and icon, false: only label |
807 | 806 | * @return string|array |
808 | 807 | */ |
809 | - public static function accountInfo($id,$acc=null,$longnames=0,$show_type=false) |
|
808 | + public static function accountInfo($id, $acc = null, $longnames = 0, $show_type = false) |
|
810 | 809 | { |
811 | 810 | if (!$id) |
812 | 811 | { |
@@ -817,7 +816,7 @@ discard block |
||
817 | 816 | { |
818 | 817 | $data = $GLOBALS['egw']->accounts->get_account_data($id); |
819 | 818 | if (!isset($data[$id])) return '#'.$id; |
820 | - foreach(array('type','lid','firstname','lastname') as $name) |
|
819 | + foreach (array('type', 'lid', 'firstname', 'lastname') as $name) |
|
821 | 820 | { |
822 | 821 | $acc['account_'.$name] = $data[$id][$name]; |
823 | 822 | } |
@@ -833,18 +832,17 @@ discard block |
||
833 | 832 | $info .= '<'.$acc['account_lid'].'> '; |
834 | 833 | // fall-through |
835 | 834 | case 1: |
836 | - $info .= $acc['account_type'] == 'g' ? lang('group').' '.$acc['account_lid'] : |
|
837 | - $acc['account_firstname'].' '.$acc['account_lastname']; |
|
835 | + $info .= $acc['account_type'] == 'g' ? lang('group').' '.$acc['account_lid'] : $acc['account_firstname'].' '.$acc['account_lastname']; |
|
838 | 836 | break; |
839 | 837 | case '0': |
840 | 838 | $info .= $acc['account_lid']; |
841 | 839 | break; |
842 | 840 | default: // use the phpgw default |
843 | 841 | $info = Api\Accounts::format_username($acc['account_lid'], |
844 | - $acc['account_firstname'],$acc['account_lastname']); |
|
842 | + $acc['account_firstname'], $acc['account_lastname']); |
|
845 | 843 | break; |
846 | 844 | } |
847 | - if($show_type) { |
|
845 | + if ($show_type) { |
|
848 | 846 | $info = array( |
849 | 847 | 'label' => $info, |
850 | 848 | 'icon' => $acc['account_type'] == 'g' ? 'addressbook/group' : 'user' |
@@ -864,8 +862,8 @@ discard block |
||
864 | 862 | public static function ajax_get_options($type, $attributes, $value = null) |
865 | 863 | { |
866 | 864 | $no_lang = false; |
867 | - $options = self::typeOptions($type, $attributes,$no_lang,false,$value); |
|
868 | - self::fix_encoded_options($options,true); |
|
865 | + $options = self::typeOptions($type, $attributes, $no_lang, false, $value); |
|
866 | + self::fix_encoded_options($options, true); |
|
869 | 867 | $response = Api\Json\Response::get(); |
870 | 868 | $response->data($options); |
871 | 869 | } |
@@ -81,7 +81,8 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function __construct($xml = '') |
83 | 83 | { |
84 | - if($xml) { |
|
84 | + if($xml) |
|
85 | + { |
|
85 | 86 | parent::__construct($xml); |
86 | 87 | } |
87 | 88 | } |
@@ -144,21 +145,33 @@ discard block |
||
144 | 145 | // add option children's values too, "" is not read, therefore we cast to string |
145 | 146 | foreach($this->children as $child) |
146 | 147 | { |
147 | - if ($child->type == 'option') $allowed[] = (string)$child->attrs['value']; |
|
148 | + if ($child->type == 'option') |
|
149 | + { |
|
150 | + $allowed[] = (string)$child->attrs['value']; |
|
151 | + } |
|
148 | 152 | } |
149 | 153 | |
150 | - if (!$this->attrs['multiple'] || !($this->attrs['options'] > 1)) $allowed[] = ''; |
|
154 | + if (!$this->attrs['multiple'] || !($this->attrs['options'] > 1)) |
|
155 | + { |
|
156 | + $allowed[] = ''; |
|
157 | + } |
|
151 | 158 | |
152 | 159 | foreach((array) $value as $val) |
153 | 160 | { |
154 | 161 | // handle empty-label for all widget types |
155 | - if ((string)$val === '' && in_array('', $allowed)) continue; |
|
162 | + if ((string)$val === '' && in_array('', $allowed)) |
|
163 | + { |
|
164 | + continue; |
|
165 | + } |
|
156 | 166 | |
157 | 167 | switch ($widget_type) |
158 | 168 | { |
159 | 169 | case 'select-account': |
160 | 170 | // If in allowed options, skip account check to support app-specific options |
161 | - if(count($allowed) > 0 && in_array($val,$allowed)) continue; |
|
171 | + if(count($allowed) > 0 && in_array($val,$allowed)) |
|
172 | + { |
|
173 | + continue; |
|
174 | + } |
|
162 | 175 | |
163 | 176 | // validate accounts independent of options know to server |
164 | 177 | $account_type = $this->attrs['account_type'] ? $this->attrs['account_type'] : 'accounts'; |
@@ -169,8 +182,7 @@ discard block |
||
169 | 182 | in_array($account_type, array('owngroups', 'memberships')) && |
170 | 183 | !in_array($val, $GLOBALS['egw']->accounts->memberships( |
171 | 184 | $GLOBALS['egw_info']['user']['account_id'], true)) |
172 | - ) |
|
173 | - { |
|
185 | + ) { |
|
174 | 186 | self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, |
175 | 187 | !$type?'not found' : ($type == 1 ? 'user' : 'group')),''); |
176 | 188 | $value = ''; |
@@ -230,10 +242,13 @@ discard block |
||
230 | 242 | { |
231 | 243 | $value = array_merge($value, (array)self::$request->preserv[$unavailable_name]); |
232 | 244 | } |
233 | - elseif(!$value) // for single cat, we only restore unavailable one, if no other was selected |
|
245 | + elseif(!$value) |
|
246 | + { |
|
247 | + // for single cat, we only restore unavailable one, if no other was selected |
|
234 | 248 | { |
235 | 249 | $value = self::$request->preserv[$unavailable_name]; |
236 | 250 | } |
251 | + } |
|
237 | 252 | } |
238 | 253 | } |
239 | 254 | if (isset($value)) |
@@ -258,10 +273,13 @@ discard block |
||
258 | 273 | { |
259 | 274 | //error_log(__METHOD__."('$cname') this->id=$this->id, this->type=$this->type, this->attrs=".array2string($this->attrs)); |
260 | 275 | $matches = null; |
261 | - if ($cname == '$row') // happens eg. with custom-fields: $cname='$row', this->id='#something' |
|
276 | + if ($cname == '$row') |
|
277 | + { |
|
278 | + // happens eg. with custom-fields: $cname='$row', this->id='#something' |
|
262 | 279 | { |
263 | 280 | $form_name = $this->id; |
264 | 281 | } |
282 | + } |
|
265 | 283 | // happens with fields in nm-header: $cname='nm', this->id='${row}[something]' or '{$row}[something]' |
266 | 284 | elseif (preg_match('/(\${row}|{\$row})\[([^]]+)\]$/', $this->id, $matches)) |
267 | 285 | { |
@@ -281,7 +299,10 @@ discard block |
||
281 | 299 | { |
282 | 300 | $form_name = self::form_name($cname, $this->id, $expand); |
283 | 301 | } |
284 | - if (!is_array(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = array(); |
|
302 | + if (!is_array(self::$request->sel_options[$form_name])) |
|
303 | + { |
|
304 | + self::$request->sel_options[$form_name] = array(); |
|
305 | + } |
|
285 | 306 | $type = $this->attrs['type'] ? $this->attrs['type'] : $this->type; |
286 | 307 | if ($type != 'select' && $type != 'menupopup') |
287 | 308 | { |
@@ -380,7 +401,10 @@ discard block |
||
380 | 401 | if(is_array($label)) |
381 | 402 | { |
382 | 403 | self::fix_encoded_options($label, false); |
383 | - if ($use_array_of_objects && !array_key_exists('value', $label)) $label['value'] = $value; |
|
404 | + if ($use_array_of_objects && !array_key_exists('value', $label)) |
|
405 | + { |
|
406 | + $label['value'] = $value; |
|
407 | + } |
|
384 | 408 | } |
385 | 409 | else |
386 | 410 | { |
@@ -607,13 +631,27 @@ discard block |
||
607 | 631 | |
608 | 632 | case 'select-year': // options: #rows,#before(default=3),#after(default=2) |
609 | 633 | $options[''] = ''; |
610 | - if ($type <= 0) $type = 3; |
|
611 | - if ($type2 <= 0) $type2 = 2; |
|
612 | - if ($type > 100 && $type2 > 100 && $type > $type) { $y = $type; $type=$type2; $type2=$y; } |
|
634 | + if ($type <= 0) |
|
635 | + { |
|
636 | + $type = 3; |
|
637 | + } |
|
638 | + if ($type2 <= 0) |
|
639 | + { |
|
640 | + $type2 = 2; |
|
641 | + } |
|
642 | + if ($type > 100 && $type2 > 100 && $type > $type) |
|
643 | + { |
|
644 | +$y = $type; $type=$type2; $type2=$y; } |
|
613 | 645 | $y = date('Y')-$type; |
614 | - if ($value && $value-$type < $y || $type > 100) $y = $type > 100 ? $type : $value-$type; |
|
646 | + if ($value && $value-$type < $y || $type > 100) |
|
647 | + { |
|
648 | + $y = $type > 100 ? $type : $value-$type; |
|
649 | + } |
|
615 | 650 | $to = date('Y')+$type2; |
616 | - if ($value && $value+$type2 > $to || $type2 > 100) $to = $type2 > 100 ? $type2 : $value+$type2; |
|
651 | + if ($value && $value+$type2 > $to || $type2 > 100) |
|
652 | + { |
|
653 | + $to = $type2 > 100 ? $type2 : $value+$type2; |
|
654 | + } |
|
617 | 655 | for ($n = 0; $y <= $to && $n < 200; ++$n) |
618 | 656 | { |
619 | 657 | $options[$y] = $y++; |
@@ -651,8 +689,14 @@ discard block |
||
651 | 689 | MCAL_M_WEEKEND => 'weekend', |
652 | 690 | ); |
653 | 691 | } |
654 | - if ($weekstart == 'Saturday') $options[MCAL_M_SATURDAY] = 'saturday'; |
|
655 | - if ($weekstart != 'Monday') $options[MCAL_M_SUNDAY] = 'sunday'; |
|
692 | + if ($weekstart == 'Saturday') |
|
693 | + { |
|
694 | + $options[MCAL_M_SATURDAY] = 'saturday'; |
|
695 | + } |
|
696 | + if ($weekstart != 'Monday') |
|
697 | + { |
|
698 | + $options[MCAL_M_SUNDAY] = 'sunday'; |
|
699 | + } |
|
656 | 700 | $options += array( |
657 | 701 | MCAL_M_MONDAY => 'monday', |
658 | 702 | MCAL_M_TUESDAY => 'tuesday', |
@@ -660,8 +704,14 @@ discard block |
||
660 | 704 | MCAL_M_THURSDAY => 'thursday', |
661 | 705 | MCAL_M_FRIDAY => 'friday', |
662 | 706 | ); |
663 | - if ($weekstart != 'Saturday') $options[MCAL_M_SATURDAY] = 'saturday'; |
|
664 | - if ($weekstart == 'Monday') $options[MCAL_M_SUNDAY] = 'sunday'; |
|
707 | + if ($weekstart != 'Saturday') |
|
708 | + { |
|
709 | + $options[MCAL_M_SATURDAY] = 'saturday'; |
|
710 | + } |
|
711 | + if ($weekstart == 'Monday') |
|
712 | + { |
|
713 | + $options[MCAL_M_SUNDAY] = 'sunday'; |
|
714 | + } |
|
665 | 715 | if ($rows >= 2 && $type == 1) |
666 | 716 | { |
667 | 717 | $options += array( |
@@ -698,16 +748,22 @@ discard block |
||
698 | 748 | $type = $type === '' ? 1 : intval($type); // min |
699 | 749 | $type2 = $type2 === '' ? 10 : intval($type2); // max |
700 | 750 | $format = '%d'; |
701 | - if (!empty($type3) && $type3[0] == '0') // leading zero |
|
751 | + if (!empty($type3) && $type3[0] == '0') |
|
752 | + { |
|
753 | + // leading zero |
|
702 | 754 | { |
703 | 755 | $format = '%0'.strlen($type3).'d'; |
704 | 756 | } |
757 | + } |
|
705 | 758 | $type3 = !$type3 ? 1 : intval($type3); // decrement |
706 | 759 | if (($type <= $type2) != ($type3 > 0)) |
707 | 760 | { |
708 | 761 | $type3 = -$type3; // void infinite loop |
709 | 762 | } |
710 | - if (!empty($type4)) $format .= lang($type4); |
|
763 | + if (!empty($type4)) |
|
764 | + { |
|
765 | + $format .= lang($type4); |
|
766 | + } |
|
711 | 767 | for ($i=0,$n=$type; $n <= $type2 && $i <= 100; $n += $type3,++$i) |
712 | 768 | { |
713 | 769 | $options[$n] = sprintf($format,$n); |
@@ -741,10 +797,13 @@ discard block |
||
741 | 797 | { |
742 | 798 | $value = calendar_timezones::id2tz($value); |
743 | 799 | } |
744 | - if ($readonly) // for readonly we dont need to fetch all TZ's |
|
800 | + if ($readonly) |
|
801 | + { |
|
802 | + // for readonly we dont need to fetch all TZ's |
|
745 | 803 | { |
746 | 804 | $options[$value] = calendar_timezones::tz2id($value,'name'); |
747 | 805 | } |
806 | + } |
|
748 | 807 | else |
749 | 808 | { |
750 | 809 | $options = $type ? Api\DateTime::getTimezones() : Api\DateTime::getUserTimezones($value); |
@@ -816,7 +875,10 @@ discard block |
||
816 | 875 | if (!is_array($acc)) |
817 | 876 | { |
818 | 877 | $data = $GLOBALS['egw']->accounts->get_account_data($id); |
819 | - if (!isset($data[$id])) return '#'.$id; |
|
878 | + if (!isset($data[$id])) |
|
879 | + { |
|
880 | + return '#'.$id; |
|
881 | + } |
|
820 | 882 | foreach(array('type','lid','firstname','lastname') as $name) |
821 | 883 | { |
822 | 884 | $acc['account_'.$name] = $data[$id][$name]; |
@@ -844,7 +906,8 @@ discard block |
||
844 | 906 | $acc['account_firstname'],$acc['account_lastname']); |
845 | 907 | break; |
846 | 908 | } |
847 | - if($show_type) { |
|
909 | + if($show_type) |
|
910 | + { |
|
848 | 911 | $info = array( |
849 | 912 | 'label' => $info, |
850 | 913 | 'icon' => $acc['account_type'] == 'g' ? 'addressbook/group' : 'user' |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | * @param array $params =array('') parameter(s) first parameter has to be cname! |
43 | 43 | * @param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children |
44 | 44 | */ |
45 | - public function run($method_name, $params=array(''), $respect_disabled=false) |
|
45 | + public function run($method_name, $params = array(''), $respect_disabled = false) |
|
46 | 46 | { |
47 | - $cname =& $params[0]; |
|
48 | - $expand =& $params[1]; |
|
47 | + $cname = & $params[0]; |
|
48 | + $expand = & $params[1]; |
|
49 | 49 | $old_cname = $params[0]; |
50 | 50 | $old_expand = $params[1]; |
51 | 51 | |
52 | 52 | if ($this->id && $this->type != 'groupbox') $cname = self::form_name($cname, $this->id, $params[1]); |
53 | 53 | if ($expand['cname'] !== $cname && $cname) |
54 | 54 | { |
55 | - $expand['cont'] =& self::get_array(self::$request->content, $cname); |
|
55 | + $expand['cont'] = & self::get_array(self::$request->content, $cname); |
|
56 | 56 | $expand['cname'] = $cname; |
57 | 57 | } |
58 | 58 | if ($respect_disabled && ($disabled = $this->attrs['disabled'] && self::check_disabled($this->attrs['disabled'], $expand))) |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | |
68 | 68 | // Expand children |
69 | 69 | $columns_disabled = null; |
70 | - for($n = 0; ; ++$n) |
|
70 | + for ($n = 0; ; ++$n) |
|
71 | 71 | { |
72 | 72 | if (isset($this->children[$n])) |
73 | 73 | { |
74 | - $child =& $this->children[$n]; |
|
74 | + $child = & $this->children[$n]; |
|
75 | 75 | // If type has something that can be expanded, we need to expand it so the correct method is run |
76 | 76 | $this->expand_widget($child, $expand); |
77 | 77 | } |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | */ |
108 | 108 | private function need_autorepeat(Etemplate\Widget $widget, $cname, array $expand) |
109 | 109 | { |
110 | - foreach(array($widget) + $widget->children as $check_widget) |
|
110 | + foreach (array($widget) + $widget->children as $check_widget) |
|
111 | 111 | { |
112 | 112 | $pat = $check_widget->id; |
113 | - while(($pattern = strstr($pat, '$'))) |
|
113 | + while (($pattern = strstr($pat, '$'))) |
|
114 | 114 | { |
115 | - $pat = substr($pattern,$pattern[1] == '{' ? 2 : 1); |
|
115 | + $pat = substr($pattern, $pattern[1] == '{' ? 2 : 1); |
|
116 | 116 | |
117 | - $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || |
|
118 | - substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont'); |
|
117 | + $Ok = $pat[0] == 'r' && !(substr($pat, 0, 2) == 'r_' || |
|
118 | + substr($pat, 0, 4) == 'row_' && substr($pat, 0, 8) != 'row_cont'); |
|
119 | 119 | |
120 | - if ($Ok && ($fname=self::form_name($cname, $check_widget->id, $expand)) && |
|
120 | + if ($Ok && ($fname = self::form_name($cname, $check_widget->id, $expand)) && |
|
121 | 121 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
122 | 122 | // for an id like "run[$row_cont[appname]]" |
123 | 123 | substr($fname, -2) != '[]' && |
@@ -49,7 +49,10 @@ discard block |
||
49 | 49 | $old_cname = $params[0]; |
50 | 50 | $old_expand = $params[1]; |
51 | 51 | |
52 | - if ($this->id && $this->type != 'groupbox') $cname = self::form_name($cname, $this->id, $params[1]); |
|
52 | + if ($this->id && $this->type != 'groupbox') |
|
53 | + { |
|
54 | + $cname = self::form_name($cname, $this->id, $params[1]); |
|
55 | + } |
|
53 | 56 | if ($expand['cname'] !== $cname && $cname) |
54 | 57 | { |
55 | 58 | $expand['cont'] =& self::get_array(self::$request->content, $cname); |
@@ -121,10 +124,13 @@ discard block |
||
121 | 124 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
122 | 125 | // for an id like "run[$row_cont[appname]]" |
123 | 126 | substr($fname, -2) != '[]' && |
124 | - ($value = self::get_array(self::$request->content, $fname)) !== null) // null = not found (can be false!) |
|
127 | + ($value = self::get_array(self::$request->content, $fname)) !== null) |
|
128 | + { |
|
129 | + // null = not found (can be false!) |
|
125 | 130 | { |
126 | 131 | //error_log(__METHOD__."($widget,$cname) $this autorepeating row $expand[row] because of $check_widget->id = '$fname' is ".array2string($value)); |
127 | 132 | unset($value); |
133 | + } |
|
128 | 134 | return true; |
129 | 135 | } |
130 | 136 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $cname |
27 | 27 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
28 | 28 | */ |
29 | - public function beforeSendToClient($cname, array $expand=null) |
|
29 | + public function beforeSendToClient($cname, array $expand = null) |
|
30 | 30 | { |
31 | 31 | $matches = null; |
32 | 32 | if ($cname == '$row') // happens eg. with custom-fields: $cname='$row', this->id='#something' |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | |
56 | 56 | // Make sure s, etc. are properly encoded when sent, and not double-encoded |
57 | 57 | $options = (isset(self::$request->sel_options[$form_name]) ? $form_name : $this->id); |
58 | - if(is_array(self::$request->sel_options[$options])) |
|
58 | + if (is_array(self::$request->sel_options[$options])) |
|
59 | 59 | { |
60 | 60 | |
61 | 61 | // Fix any custom options from application |
62 | - self::fix_encoded_options(self::$request->sel_options[$options],true); |
|
62 | + self::fix_encoded_options(self::$request->sel_options[$options], true); |
|
63 | 63 | |
64 | - if(!self::$request->sel_options[$options]) |
|
64 | + if (!self::$request->sel_options[$options]) |
|
65 | 65 | { |
66 | 66 | unset(self::$request->sel_options[$options]); |
67 | 67 | } |
@@ -29,10 +29,13 @@ |
||
29 | 29 | public function beforeSendToClient($cname, array $expand=null) |
30 | 30 | { |
31 | 31 | $matches = null; |
32 | - if ($cname == '$row') // happens eg. with custom-fields: $cname='$row', this->id='#something' |
|
32 | + if ($cname == '$row') |
|
33 | + { |
|
34 | + // happens eg. with custom-fields: $cname='$row', this->id='#something' |
|
33 | 35 | { |
34 | 36 | $form_name = $this->id; |
35 | 37 | } |
38 | + } |
|
36 | 39 | // happens with fields in nm-header: $cname='nm', this->id='${row}[something]' or '{$row}[something]' |
37 | 40 | elseif (preg_match('/(\${row}|{\$row})\[([^]]+)\]$/', $this->id, $matches)) |
38 | 41 | { |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @param string|XMLReader $xml |
27 | 27 | * @param boolean $cloned =true true: object does NOT need to be cloned, false: to set attribute, set them in cloned object |
28 | 28 | */ |
29 | - public function set_attrs($xml, $cloned=true) |
|
29 | + public function set_attrs($xml, $cloned = true) |
|
30 | 30 | { |
31 | 31 | parent::set_attrs($xml, $cloned); |
32 | 32 |
@@ -29,18 +29,18 @@ discard block |
||
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 | - switch($this->attrs['type']) |
|
34 | + switch ($this->attrs['type']) |
|
35 | 35 | { |
36 | 36 | case "link-entry": |
37 | 37 | self::$transformation['type'] = $this->attrs['type'] = 'nextmatch-entryheader'; |
38 | 38 | break; |
39 | 39 | default: |
40 | - list($type) = explode('-',$this->attrs['type']); |
|
41 | - if($type == 'select') |
|
40 | + list($type) = explode('-', $this->attrs['type']); |
|
41 | + if ($type == 'select') |
|
42 | 42 | { |
43 | - if(in_array($this->attrs['type'], Widget\Select::$cached_types)) |
|
43 | + if (in_array($this->attrs['type'], Widget\Select::$cached_types)) |
|
44 | 44 | { |
45 | 45 | $widget_type = $this->attrs['type']; |
46 | 46 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->setElementAttribute($form_name, 'options', trim($this->attrs['widget_options']) != '' ? $this->attrs['widget_options'] : ''); |
54 | 54 | |
55 | 55 | $this->setElementAttribute($form_name, 'type', $this->attrs['type']); |
56 | - if($widget_type) |
|
56 | + if ($widget_type) |
|
57 | 57 | { |
58 | 58 | $this->setElementAttribute($form_name, 'widget_type', $widget_type); |
59 | 59 | } |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | * @param array $content |
70 | 70 | * @param array &$validated=array() validated content |
71 | 71 | */ |
72 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
72 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
73 | 73 | { |
74 | 74 | $value = $value_in = self::get_array($content, $form_name); |
75 | 75 | |
76 | - $valid =& self::get_array($validated, $form_name, true); |
|
76 | + $valid = & self::get_array($validated, $form_name, true); |
|
77 | 77 | // returning null instead of array(), as array() will be overwritten by etemplate_new::complete_array_merge() |
78 | 78 | // with preserved old content and therefore user can not empty a taglist |
79 | 79 | $valid = $value ? $value : null; |