Completed
Push — 16.1 ( 2b6741...abc73d )
by Nathan
50:22 queued 36:36
created
api/src/Etemplate/Widget/Date.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 	 * @param string $cname
61 61
 	 * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
62 62
 	 */
63
-	public function beforeSendToClient($cname, array $expand=null)
63
+	public function beforeSendToClient($cname, array $expand = null)
64 64
 	{
65
-		if($this->type == 'date-houronly')
65
+		if ($this->type == 'date-houronly')
66 66
 		{
67 67
 			return parent::beforeSendToClient($cname, $expand);
68 68
 		}
69 69
 
70 70
 		$form_name = self::form_name($cname, $this->id, $expand);
71
-		$value =& self::get_array(self::$request->content, $form_name, false, true);
71
+		$value = & self::get_array(self::$request->content, $form_name, false, true);
72 72
 
73
-		if($this->type != 'date-duration' && $value)
73
+		if ($this->type != 'date-duration' && $value)
74 74
 		{
75 75
 			$value = $this->format_date($value);
76 76
 		}
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function set_row_value($cname, Array $expand, Array &$data)
92 92
 	{
93
-		if($this->type == 'date-duration') return;
93
+		if ($this->type == 'date-duration') return;
94 94
 
95 95
 		$form_name = self::form_name($cname, $this->id, $expand);
96
-		$value =& $this->get_array($data, $form_name, true);
96
+		$value = & $this->get_array($data, $form_name, true);
97 97
 
98 98
 		if (true) $value = $this->format_date($value);
99 99
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function format_date($value)
107 107
 	{
108
-		if (!$value) return $value;	// otherwise we will get current date or 1970-01-01 instead of an empty value
108
+		if (!$value) return $value; // otherwise we will get current date or 1970-01-01 instead of an empty value
109 109
 
110 110
 		if ($this->attrs['dataformat'] && !is_numeric($value))
111 111
 		{
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 		{
116 116
 			$date = new Api\DateTime($value);
117 117
 		}
118
-		if($this->type == 'date-timeonly')
118
+		if ($this->type == 'date-timeonly')
119 119
 		{
120 120
 			$date->setDate(1970, 1, 1);
121 121
 		}
122
-		if($date)
122
+		if ($date)
123 123
 		{
124 124
 			// postfix date-string with "Z" so javascript doesn't add/subtract anything
125 125
 			$value = $date->format('Y-m-d\TH:i:s\Z');
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
 	 * @param array &$validated=array() validated content
142 142
 	 * @return boolean true if no validation error, false otherwise
143 143
 	 */
144
-	public function validate($cname, array $expand, array $content, &$validated=array())
144
+	public function validate($cname, array $expand, array $content, &$validated = array())
145 145
 	{
146 146
 		$form_name = self::form_name($cname, $this->id, $expand);
147 147
 
148 148
 		if (!$this->is_readonly($cname, $form_name) && $this->type != 'date-since')	// date-since is always readonly
149 149
 		{
150 150
 			$value = self::get_array($content, $form_name);
151
-			$valid =& self::get_array($validated, $form_name, true);
151
+			$valid = & self::get_array($validated, $form_name, true);
152 152
 
153 153
 			if ((string)$value === '' && $this->attrs['needed'])
154 154
 			{
155
-				self::set_validation_error($form_name,lang('Field must not be empty !!!'));
155
+				self::set_validation_error($form_name, lang('Field must not be empty !!!'));
156 156
 			}
157 157
 			elseif (is_null($value))
158 158
 			{
@@ -162,49 +162,49 @@  discard block
 block discarded – undo
162 162
 			{
163 163
 				$valid = (string)$value === '' ? '' : (int)$value;
164 164
 			}
165
-			if($value)
165
+			if ($value)
166 166
 			{
167 167
 				$date = new Api\DateTime($value);
168 168
 			}
169 169
 			if (!empty($this->attrs['min']))
170 170
 			{
171
-				if(is_numeric($this->attrs['min']))
171
+				if (is_numeric($this->attrs['min']))
172 172
 				{
173
-					$min = new Api\DateTime(strtotime( $this->attrs['min'] . 'days'));
173
+					$min = new Api\DateTime(strtotime($this->attrs['min'].'days'));
174 174
 				}
175 175
 				else
176 176
 				{
177 177
 					$min = new Api\DateTime(strtotime($this->attrs['min']));
178 178
 				}
179
-				if($value < $min)
179
+				if ($value < $min)
180 180
 				{
181
-					self::set_validation_error($form_name,lang(
181
+					self::set_validation_error($form_name, lang(
182 182
 						"Value has to be at least '%1' !!!",
183 183
 						$min->format($this->type != 'date')
184
-					),'');
184
+					), '');
185 185
 					$value = $min;
186 186
 				}
187 187
 			}
188 188
 			if (!empty($this->attrs['max']))
189 189
 			{
190
-				if(is_numeric($this->attrs['max']))
190
+				if (is_numeric($this->attrs['max']))
191 191
 				{
192
-					$max = new Api\DateTime(strtotime( $this->attrs['max'] . 'days'));
192
+					$max = new Api\DateTime(strtotime($this->attrs['max'].'days'));
193 193
 				}
194 194
 				else
195 195
 				{
196 196
 					$max = new Api\DateTime(strtotime($this->attrs['max']));
197 197
 				}
198
-				if($value < $max)
198
+				if ($value < $max)
199 199
 				{
200
-					self::set_validation_error($form_name,lang(
200
+					self::set_validation_error($form_name, lang(
201 201
 						"Value has to be at maximum '%1' !!!",
202 202
 						$max->format($this->type != 'date')
203
-					),'');
203
+					), '');
204 204
 					$value = $max;
205 205
 				}
206 206
 			}
207
-			if(!$value)
207
+			if (!$value)
208 208
 			{
209 209
 				// Not null, blank
210 210
 				$value = '';
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			else
222 222
 			{
223 223
 				// this is not really a user error, but one of the clientside engine
224
-				self::set_validation_error($form_name,lang("'%1' is not a valid date !!!", $value).' '.$this->dataformat);
224
+				self::set_validation_error($form_name, lang("'%1' is not a valid date !!!", $value).' '.$this->dataformat);
225 225
 			}
226 226
 			//error_log("$this : ($valid)" . Api\DateTime::to($valid));
227 227
 		}
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/File.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param string $xml
29 29
 	 */
30
-	public function __construct($xml='')
30
+	public function __construct($xml = '')
31 31
 	{
32
-		if($xml) parent::__construct($xml);
32
+		if ($xml) parent::__construct($xml);
33 33
 
34 34
 		// Legacy multiple - id ends in []
35
-		if(substr($this->id,-2) == '[]')
35
+		if (substr($this->id, -2) == '[]')
36 36
 		{
37 37
 			$this->setElementAttribute($this->id, 'multiple', true);
38 38
 		}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$response = Api\Json\Response::get();
53 53
 		$request_id = str_replace(' ', '+', rawurldecode($_REQUEST['request_id']));
54 54
 		$widget_id = $_REQUEST['widget_id'];
55
-		if(!self::$request = Etemplate\Request::read($request_id)) {
55
+		if (!self::$request = Etemplate\Request::read($request_id)) {
56 56
 			$response->error("Could not read session");
57 57
 			return;
58 58
 		}
@@ -70,20 +70,20 @@  discard block
 block discarded – undo
70 70
 		foreach ($_FILES as $field => &$files)
71 71
 		{
72 72
 			$widget = $template->getElementById($widget_id ? $widget_id : $field);
73
-			if($widget && $widget->attrs['mime']) {
73
+			if ($widget && $widget->attrs['mime']) {
74 74
 				$mime = $widget->attrs['mime'];
75 75
 			}
76 76
 
77 77
 			// Check for legacy [] in id to indicate multiple - it changes format
78
-			if(is_array($files['name'])) {
78
+			if (is_array($files['name'])) {
79 79
 				$file_list = array();
80
-				foreach($files as $f_field => $values)
80
+				foreach ($files as $f_field => $values)
81 81
 				{
82
-					foreach($values as $key => $f_value) {
82
+					foreach ($values as $key => $f_value) {
83 83
 						$file_list[$key][$f_field] = $f_value;
84 84
 					}
85 85
 				}
86
-				foreach($file_list as $file)
86
+				foreach ($file_list as $file)
87 87
 				{
88 88
 					self::process_uploaded_file($field, $file, $mime, $file_data);
89 89
 				}
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 		$response->data($file_data);
100 100
 
101 101
 		// Check for a callback, call it if there is one
102
-		foreach($_FILES as $field => $file)
102
+		foreach ($_FILES as $field => $file)
103 103
 		{
104
-			if(($element = $template->getElementById($field)))
104
+			if (($element = $template->getElementById($field)))
105 105
 			{
106 106
 				$callback = $element->attrs['callback'];
107
-				if(!$callback) $callback = $template->getElementAttribute($field, 'callback');
108
-				if($callback)
107
+				if (!$callback) $callback = $template->getElementAttribute($field, 'callback');
108
+				if ($callback)
109 109
 				{
110 110
 					ExecMethod($callback, $_FILES[$field]);
111 111
 				}
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected static function process_uploaded_file($field, Array &$file, $mime, Array &$file_data)
120 120
 	{
121
-		unset($field);	// not used
121
+		unset($field); // not used
122 122
 
123 123
 		// Chunks get mangled a little
124
-		if($file['name'] == 'blob')
124
+		if ($file['name'] == 'blob')
125 125
 		{
126 126
 			$file['name'] = $_POST['resumableFilename'];
127 127
 			$file['type'] = $_POST['resumableType'];
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 
130 130
 		if ($file['error'] == UPLOAD_ERR_OK && trim($file['name']) != '' && $file['size'] > 0 && is_uploaded_file($file['tmp_name'])) {
131 131
 			// Mime check
132
-			if($mime)
132
+			if ($mime)
133 133
 			{
134 134
 				$type = $file['type'];
135 135
 				$is_preg = $mime[0] == '/';
136
-				if (!$is_preg && strcasecmp($mime,$type) ||
137
-					$is_preg && !preg_match($mime,$type))
136
+				if (!$is_preg && strcasecmp($mime, $type) ||
137
+					$is_preg && !preg_match($mime, $type))
138 138
 				{
139
-					$file_data[$file['name']] = $file['name'].':'.lang('File is of wrong type (%1 != %2)!',$type,$mime);
139
+					$file_data[$file['name']] = $file['name'].':'.lang('File is of wrong type (%1 != %2)!', $type, $mime);
140 140
 					//error_log(__METHOD__.__LINE__.array2string($file_data[$file['name']]));
141 141
 					return false;
142 142
 				}
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 			// Resumable / chunked uploads
146 146
 			// init the destination file (format <filename.ext>.part<#chunk>
147 147
 			// the file is stored in a temporary directory
148
-			$temp_dir = $GLOBALS['egw_info']['server']['temp_dir'].'/'.str_replace('/','_',$_POST['resumableIdentifier']);
149
-			$dest_file = $temp_dir.'/'.str_replace('/','_',$_POST['resumableFilename']).'.part'.(int)$_POST['resumableChunkNumber'];
148
+			$temp_dir = $GLOBALS['egw_info']['server']['temp_dir'].'/'.str_replace('/', '_', $_POST['resumableIdentifier']);
149
+			$dest_file = $temp_dir.'/'.str_replace('/', '_', $_POST['resumableFilename']).'.part'.(int)$_POST['resumableChunkNumber'];
150 150
 
151 151
 			// create the temporary directory
152 152
 			if (!is_dir($temp_dir))
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 			else
163 163
 			{
164 164
 				// check if all the parts present, and create the final destination file
165
-				$new_file = self::createFileFromChunks($temp_dir, str_replace('/','_',$_POST['resumableFilename']),
165
+				$new_file = self::createFileFromChunks($temp_dir, str_replace('/', '_', $_POST['resumableFilename']),
166 166
 						$_POST['resumableChunkSize'], $_POST['resumableTotalSize']);
167 167
 			}
168
-			if( $new_file) {
168
+			if ($new_file) {
169 169
 				$file['tmp_name'] = $new_file;
170 170
 
171 171
 				// Data to send back to client
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 		// count all the parts of this file
196 196
 		$total_files = 0;
197
-		foreach(scandir($temp_dir) as $file) {
197
+		foreach (scandir($temp_dir) as $file) {
198 198
 			if (stripos($file, $fileName) !== false) {
199 199
 				$total_files++;
200 200
 			}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 
203 203
 		// check that all the parts are present
204 204
 		// the size of the last part is between chunkSize and 2*$chunkSize
205
-		if ($total_files * $chunkSize >=  ($totalSize - $chunkSize + 1)) {
205
+		if ($total_files * $chunkSize >= ($totalSize - $chunkSize + 1)) {
206 206
 			if (is_dir($GLOBALS['egw_info']['server']['temp_dir']) && is_writable($GLOBALS['egw_info']['server']['temp_dir']))
207 207
 			{
208
-				$new_file = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'egw_');
208
+				$new_file = tempnam($GLOBALS['egw_info']['server']['temp_dir'], 'egw_');
209 209
 			}
210 210
 			else
211 211
 			{
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 			// create the final destination file
216 216
 			if (($fp = fopen($new_file, 'w')) !== false) {
217
-				for ($i=1; $i<=$total_files; $i++) {
217
+				for ($i = 1; $i <= $total_files; $i++) {
218 218
 					fwrite($fp, file_get_contents($temp_dir.'/'.$fileName.'.part'.$i));
219 219
 				}
220 220
 				fclose($fp);
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 			{
251 251
 				if ($object != "." && $object != "..")
252 252
 				{
253
-					if (filetype($dir . "/" . $object) == "dir")
253
+					if (filetype($dir."/".$object) == "dir")
254 254
 					{
255
-						self::rrmdir($dir . "/" . $object);
255
+						self::rrmdir($dir."/".$object);
256 256
 					}
257 257
 					else
258 258
 					{
259
-						unlink($dir . "/" . $object);
259
+						unlink($dir."/".$object);
260 260
 					}
261 261
 				}
262 262
 			}
@@ -273,23 +273,23 @@  discard block
 block discarded – undo
273 273
 	 * @param array $content
274 274
 	 * @param array &$validated=array() validated content
275 275
 	 */
276
-	public function validate($cname, array $expand, array $content, &$validated=array())
276
+	public function validate($cname, array $expand, array $content, &$validated = array())
277 277
 	{
278 278
 		$form_name = self::form_name($cname, $this->id, $expand);
279 279
 
280 280
 		if (!$this->is_readonly($cname, $form_name))
281 281
 		{
282 282
 			$value = $value_in = self::get_array($content, $form_name);
283
-			$valid =& self::get_array($validated, $form_name, true);
283
+			$valid = & self::get_array($validated, $form_name, true);
284 284
 
285
-			if(!is_array($value)) $value = array();
285
+			if (!is_array($value)) $value = array();
286 286
 
287 287
 			// Incoming values indexed by temp name
288
-			if($value[0]) $value = $value[0];
288
+			if ($value[0]) $value = $value[0];
289 289
 
290
-			foreach($value as $tmp => $file)
290
+			foreach ($value as $tmp => $file)
291 291
 			{
292
-				if(!$file) continue;
292
+				if (!$file) continue;
293 293
 				if (is_dir($GLOBALS['egw_info']['server']['temp_dir']) && is_writable($GLOBALS['egw_info']['server']['temp_dir']))
294 294
 				{
295 295
 					$path = $GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmp;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				);
310 310
 			}
311 311
 
312
-			if($valid && !$this->attrs['multiple']) $valid = $valid[0];
312
+			if ($valid && !$this->attrs['multiple']) $valid = $valid[0];
313 313
 		}
314 314
 	}
315 315
 }
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Button.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
76 76
 		}
77 77
 	}
78 78
 }
79
-Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Button', array('button','buttononly'));
79
+Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Button', array('button', 'buttononly'));
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Grid.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/HtmlArea.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
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
 			'">&#8203;</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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/ItemPicker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/HistoryLog.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Toolbar.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Textbox.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param boolean $cloned =true true: object does NOT need to be cloned, false: to set attribute, set them in cloned object
58 58
 	 * @return Template current object or clone, if any attribute was set
59 59
 	 */
60
-	public function set_attrs($xml, $cloned=true)
60
+	public function set_attrs($xml, $cloned = true)
61 61
 	{
62 62
 		parent::set_attrs($xml, $cloned);
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			$this->setElementAttribute($this->id, 'size', abs($this->attrs['size']));
70 70
 			self::$request->readonlys[$this->id] = false;
71 71
 			$this->setElementAttribute($this->id, 'readonly', true);
72
-			trigger_error("Using a negative size to set textbox readonly. " .$this, E_USER_DEPRECATED);
72
+			trigger_error("Using a negative size to set textbox readonly. ".$this, E_USER_DEPRECATED);
73 73
 		}
74 74
 		return $this;
75 75
 	}
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	 * @param string $cname
81 81
 	 * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
82 82
 	 */
83
-	public function beforeSendToClient($cname, array $expand=null)
83
+	public function beforeSendToClient($cname, array $expand = null)
84 84
 	{
85 85
 		// to NOT transmit passwords back to client, we need to store (non-empty) value in preserv
86 86
 		if ($this->attrs['type'] == 'passwd' || $this->type == 'passwd')
87 87
 		{
88 88
 			$form_name = self::form_name($cname, $this->id, $expand);
89
-			$value =& self::get_array(self::$request->content, $form_name);
89
+			$value = & self::get_array(self::$request->content, $form_name);
90 90
 			if (!empty($value))
91 91
 			{
92
-				$preserv =& self::get_array(self::$request->preserv, $form_name, true);
92
+				$preserv = & self::get_array(self::$request->preserv, $form_name, true);
93 93
 				if (true) $preserv = (string)$value;
94 94
 				$value = str_repeat('*', strlen($preserv));
95 95
 			}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param array &$validated=array() validated content
113 113
 	 * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont'
114 114
 	 */
115
-	public function validate($cname, array $expand, array $content, &$validated=array())
115
+	public function validate($cname, array $expand, array $content, &$validated = array())
116 116
 	{
117 117
 		$form_name = self::form_name($cname, $this->id, $expand);
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		{
121 121
 			if (!isset($this->attrs['validator']))
122 122
 			{
123
-				switch($this->type)
123
+				switch ($this->type)
124 124
 				{
125 125
 					case 'int':
126 126
 					case 'integer':
@@ -150,24 +150,24 @@  discard block
 block discarded – undo
150 150
 
151 151
 			if ((string)$value === '' && $this->attrs['needed'])
152 152
 			{
153
-				self::set_validation_error($form_name,lang('Field must not be empty !!!'),'');
153
+				self::set_validation_error($form_name, lang('Field must not be empty !!!'), '');
154 154
 			}
155
-			if ((int) $this->attrs['maxlength'] > 0 && mb_strlen($value) > (int) $this->attrs['maxlength'])
155
+			if ((int)$this->attrs['maxlength'] > 0 && mb_strlen($value) > (int)$this->attrs['maxlength'])
156 156
 			{
157
-				$value = mb_substr($value,0,(int) $this->attrs['maxlength']);
157
+				$value = mb_substr($value, 0, (int)$this->attrs['maxlength']);
158 158
 			}
159
-			if ($this->attrs['validator'] && !preg_match($this->attrs['validator'],$value))
159
+			if ($this->attrs['validator'] && !preg_match($this->attrs['validator'], $value))
160 160
 			{
161
-				switch($this->type)
161
+				switch ($this->type)
162 162
 				{
163 163
 					case 'integer':
164
-						self::set_validation_error($form_name,lang("'%1' is not a valid integer !!!",$value),'');
164
+						self::set_validation_error($form_name, lang("'%1' is not a valid integer !!!", $value), '');
165 165
 						break;
166 166
 					case 'float':
167
-						self::set_validation_error($form_name,lang("'%1' is not a valid floatingpoint number !!!",$value),'');
167
+						self::set_validation_error($form_name, lang("'%1' is not a valid floatingpoint number !!!", $value), '');
168 168
 						break;
169 169
 					default:
170
-						self::set_validation_error($form_name,lang("'%1' has an invalid format !!!",$value)/*." !preg_match('$this->attrs[validator]', '$value')"*/,'');
170
+						self::set_validation_error($form_name, lang("'%1' has an invalid format !!!", $value)/*." !preg_match('$this->attrs[validator]', '$value')"*/, '');
171 171
 						break;
172 172
 				}
173 173
 			}
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 			{
176 176
 				if ((string)$value !== '' || $this->attrs['needed'])	// empty values are Ok if needed is not set
177 177
 				{
178
-					$value = $this->type == 'integer' ? (int) $value : (float) str_replace(',','.',$value);	// allow for german (and maybe other) format
178
+					$value = $this->type == 'integer' ? (int)$value : (float)str_replace(',', '.', $value); // allow for german (and maybe other) format
179 179
 
180 180
 					if (!empty($this->attrs['min']) && $value < $this->attrs['min'])
181 181
 					{
182
-						self::set_validation_error($form_name,lang("Value has to be at least '%1' !!!",$this->attrs['min']),'');
183
-						$value = $this->type == 'integer' ? (int) $this->attrs['min'] : (float) $this->attrs['min'];
182
+						self::set_validation_error($form_name, lang("Value has to be at least '%1' !!!", $this->attrs['min']), '');
183
+						$value = $this->type == 'integer' ? (int)$this->attrs['min'] : (float)$this->attrs['min'];
184 184
 					}
185 185
 					if (!empty($this->attrs['max']) && $value > $this->attrs['max'])
186 186
 					{
187
-						self::set_validation_error($form_name,lang("Value has to be at maximum '%1' !!!",$this->attrs['max']),'');
188
-						$value = $this->type == 'integer' ? (int) $this->attrs['max'] : (float) $this->attrs['max'];
187
+						self::set_validation_error($form_name, lang("Value has to be at maximum '%1' !!!", $this->attrs['max']), '');
188
+						$value = $this->type == 'integer' ? (int)$this->attrs['max'] : (float)$this->attrs['max'];
189 189
 					}
190 190
 				}
191 191
 			}
@@ -197,4 +197,4 @@  discard block
 block discarded – undo
197 197
 		}
198 198
 	}
199 199
 }
200
-Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Textbox', array('textbox','text','int','integer','float','passwd','hidden','colorpicker','hidden'));
200
+Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Textbox', array('textbox', 'text', 'int', 'integer', 'float', 'passwd', 'hidden', 'colorpicker', 'hidden'));
Please login to merge, or discard this patch.