@@ -50,7 +50,7 @@ |
||
50 | 50 | public function read_root($style_id) |
51 | 51 | { |
52 | 52 | if (is_numeric($style_id)) { |
53 | - $style_id = (int)$style_id; |
|
53 | + $style_id = (int) $style_id; |
|
54 | 54 | } |
55 | 55 | $style = new midcom_db_style($style_id); |
56 | 56 |
@@ -164,9 +164,9 @@ |
||
164 | 164 | */ |
165 | 165 | protected function _require_type_value() |
166 | 166 | { |
167 | - if ( !array_key_exists('value', $this->_type) |
|
167 | + if (!array_key_exists('value', $this->_type) |
|
168 | 168 | || is_array($this->_type->value) |
169 | - || ( is_object($this->_type->value) |
|
169 | + || (is_object($this->_type->value) |
|
170 | 170 | && !$this->_type->value instanceof DateTime)) { |
171 | 171 | throw new midcom_error("The type {$this->name} does not have a value member or it is an array or object, you cannot use it with " . get_class($this)); |
172 | 172 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $result = $this->formmanager->process_form(); |
97 | 97 | |
98 | 98 | // Handle successful save explicitly. |
99 | - if ( $result == 'save' |
|
99 | + if ($result == 'save' |
|
100 | 100 | || $result == 'next') { |
101 | 101 | if (!$this->datamanager->validate()) { |
102 | 102 | debug_add('Type validation failed. Reverting to edit mode transparently.'); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // Do the actual I/O |
257 | 257 | $result = $this->formmanager->process_form(); |
258 | 258 | |
259 | - if ( $result == 'save' |
|
259 | + if ($result == 'save' |
|
260 | 260 | || $result == 'next') { |
261 | 261 | // Ok, we can save now. At this point we already have a content object. |
262 | 262 | if (!$this->datamanager->validate()) { |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | $this->formmanager->form->setElementError($field, $error); |
266 | 266 | } |
267 | 267 | |
268 | - if ( $this->datamanager->storage->object |
|
268 | + if ($this->datamanager->storage->object |
|
269 | 269 | && $this->datamanager->storage->object->guid) { |
270 | 270 | $this->datamanager->storage->object->delete(); |
271 | 271 | } |
272 | 272 | return 'edit'; |
273 | 273 | } |
274 | 274 | |
275 | - if ( $result == 'save' |
|
275 | + if ($result == 'save' |
|
276 | 276 | && !$this->datamanager->save()) { |
277 | 277 | // Get the error message |
278 | 278 | $midgard_error = midcom_connection::get_error_string(); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | // While editing, we keep any temporary storage object known. |
289 | - if ( $result != 'save' |
|
289 | + if ($result != 'save' |
|
290 | 290 | && $result != 'cancel' |
291 | 291 | && $this->datamanager->storage->object) { |
292 | 292 | // Save temporary object ID. |
@@ -171,7 +171,7 @@ |
||
171 | 171 | } |
172 | 172 | } else { |
173 | 173 | $data = null; |
174 | - if ( isset($this->_defaults) |
|
174 | + if (isset($this->_defaults) |
|
175 | 175 | && array_key_exists($name, $this->_defaults)) { |
176 | 176 | $data = $this->_defaults[$name]; |
177 | 177 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | function validate($value, $options = null) |
15 | 15 | { |
16 | - if ( !is_array($value) |
|
16 | + if (!is_array($value) |
|
17 | 17 | || empty($value)) { |
18 | 18 | debug_print_r('got value', $value); |
19 | 19 | debug_add('value is not array or is empty'); |
@@ -170,11 +170,11 @@ |
||
170 | 170 | */ |
171 | 171 | public function validate_number($fields) |
172 | 172 | { |
173 | - if ( $this->minimum !== null |
|
173 | + if ($this->minimum !== null |
|
174 | 174 | && $fields[$this->name] < $this->minimum) { |
175 | 175 | return array($this->name => sprintf($this->_l10n->get('type number: value must not be smaller than %s'), $this->minimum)); |
176 | 176 | } |
177 | - if ( $this->maximum !== null |
|
177 | + if ($this->maximum !== null |
|
178 | 178 | && $fields[$this->name] > $this->maximum) { |
179 | 179 | return array($this->name => sprintf($this->_l10n->get('type number: value must not be larger than %s'), $this->maximum)); |
180 | 180 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | return true; |
77 | 77 | } |
78 | 78 | |
79 | - if ( !isset($this->_datamanager->types[$this->later_than]) |
|
79 | + if (!isset($this->_datamanager->types[$this->later_than]) |
|
80 | 80 | || !is_a($this->_datamanager->types[$this->later_than], 'midcom_helper_datamanager2_type_date') |
81 | 81 | || !$this->_datamanager->types[$this->later_than]->value) { |
82 | 82 | debug_add("Failed to validate date field {$this->name} with {$this->later_than}, as such date field wasn't found.", |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | { |
197 | 197 | // FIXME: This is not exactly an elegant way to do this |
198 | 198 | $widget_conf = $this->storage->_schema->fields[$this->name]['widget_config']; |
199 | - if ( $this->storage_type != 'ISO_DATE' |
|
200 | - && ( !array_key_exists('show_time', $widget_conf) |
|
199 | + if ($this->storage_type != 'ISO_DATE' |
|
200 | + && (!array_key_exists('show_time', $widget_conf) |
|
201 | 201 | || $widget_conf['show_time'])) { |
202 | - if ( array_key_exists('hide_seconds', $widget_conf) |
|
202 | + if (array_key_exists('hide_seconds', $widget_conf) |
|
203 | 203 | && !$widget_conf['hide_seconds']) { |
204 | 204 | return 'medium'; |
205 | 205 | } |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | //sometimes the date-compare function seems to corrupt the date, by changing timezone maybe |
233 | - if ( !empty($this->min_date) |
|
233 | + if (!empty($this->min_date) |
|
234 | 234 | && $this->value < new DateTime($this->min_date)) { |
235 | 235 | $min_date = new DateTime($this->min_date); |
236 | 236 | $this->validation_error = sprintf($this->_l10n->get('type date: this date must be %s or later'), htmlspecialchars($this->_l10n->get_formatter()->date($min_date))); |
237 | 237 | return false; |
238 | 238 | } |
239 | - if ( !empty($this->max_date) |
|
239 | + if (!empty($this->max_date) |
|
240 | 240 | && $this->value > new DateTime($this->max_date)) { |
241 | 241 | $max_date = new DateTime($this->max_date); |
242 | 242 | $this->validation_error = sprintf($this->_l10n->get('type date: this date must be %s or earlier'), htmlspecialchars($this->_l10n->get_formatter()->date($max_date))); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected function _prepare_recreate($force = true) |
27 | 27 | { |
28 | - if ( !empty($this->_original_tmpname) |
|
28 | + if (!empty($this->_original_tmpname) |
|
29 | 29 | && !$force) { |
30 | 30 | // We have prepared. |
31 | 31 | return true; |