@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function array2data(array $array, $root_node = 'array', $prefix = '') |
82 | 82 | { |
83 | - $data = "{$prefix}<{$root_node}>\n"; |
|
83 | + $data = "{$prefix}<{$root_node}>\n"; |
|
84 | 84 | |
85 | 85 | foreach ($array as $key => $field) { |
86 | 86 | if (is_numeric($key)) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return $data; |
253 | 253 | } |
254 | 254 | |
255 | - $preg='/s:([0-9]+):"(.*?)";/ms'; |
|
255 | + $preg = '/s:([0-9]+):"(.*?)";/ms'; |
|
256 | 256 | preg_match_all($preg, $data, $matches); |
257 | 257 | $cache = array(); |
258 | 258 | |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | $theme_path = implode('/', $path_array); |
349 | 349 | $candidates = array(); |
350 | 350 | if ($substyle) { |
351 | - $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php"; |
|
351 | + $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php"; |
|
352 | 352 | } |
353 | 353 | if ($page) { |
354 | - $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php"; |
|
354 | + $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php"; |
|
355 | 355 | } |
356 | 356 | |
357 | - $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php"; |
|
357 | + $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php"; |
|
358 | 358 | |
359 | 359 | foreach (array_filter($candidates, 'file_exists') as $candidate) { |
360 | 360 | return file_get_contents($candidate); |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | if (is_null($name_property)) { |
37 | 37 | $name_property = midcom_helper_reflector::get_name_property($this->_object); |
38 | 38 | } |
39 | - if ( empty($name_property) |
|
39 | + if (empty($name_property) |
|
40 | 40 | || !midcom::get()->dbfactory->property_exists($this->_object, $name_property)) { |
41 | 41 | // Could not resolve valid property |
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | // Make copy via typecast, very important or we might accidentally manipulate the given object |
45 | - return (string)$this->_object->{$name_property}; |
|
45 | + return (string) $this->_object->{$name_property}; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function name_is_unique_or_empty() |
130 | 130 | { |
131 | 131 | $name_copy = $this->get_object_name(); |
132 | - if ( empty($name_copy) |
|
132 | + if (empty($name_copy) |
|
133 | 133 | && $name_copy !== false) { |
134 | 134 | // Allow empty string name |
135 | 135 | return true; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $qb->add_constraint($child_name_property, '=', $name_copy); |
212 | 212 | if ($qb->count()) { |
213 | - debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
213 | + debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | $qb->add_constraint($child_name_property, '=', $name_copy); |
243 | 243 | if ($qb->count()) { |
244 | - debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
244 | + debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $name_prop = midcom_helper_reflector::get_name_property($this->_object); |
275 | 275 | |
276 | 276 | if (!empty($original_name)) { |
277 | - $current_name = (string)$original_name; |
|
277 | + $current_name = (string) $original_name; |
|
278 | 278 | } else { |
279 | 279 | // Empty name, try to generate from title |
280 | 280 | $title_copy = midcom_helper_reflector::get_object_title($this->_object, $title_property); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | } while (!$this->name_is_unique()); |
320 | 320 | |
321 | 321 | // Get a copy of the current, usable name |
322 | - $ret = (string)$this->_object->{$name_prop}; |
|
322 | + $ret = (string) $this->_object->{$name_prop}; |
|
323 | 323 | // Restore the original name |
324 | 324 | $this->_object->{$name_prop} = $original_name; |
325 | 325 | return $ret; |
@@ -54,7 +54,7 @@ |
||
54 | 54 | public function read_root($id) |
55 | 55 | { |
56 | 56 | if (is_numeric($id)) { |
57 | - $id = (int)$id; |
|
57 | + $id = (int) $id; |
|
58 | 58 | } |
59 | 59 | $rootdir = new midcom_db_snippetdir($id); |
60 | 60 | if (!$rootdir->can_do('midgard:update')) { |
@@ -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 | } |