@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | )); |
54 | 54 | } |
55 | 55 | |
56 | - if ( midcom::get()->config->get('midcom_services_rcs_enable') |
|
56 | + if (midcom::get()->config->get('midcom_services_rcs_enable') |
|
57 | 57 | && $object->can_do('midgard:update') |
58 | 58 | && $object->_use_rcs) { |
59 | 59 | $buttons[] = array( |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $icon = 'stock-icons/16x16/page-' . $icontype . '.png'; |
86 | - if ( !midcom::get()->config->get('show_hidden_objects') |
|
86 | + if (!midcom::get()->config->get('show_hidden_objects') |
|
87 | 87 | && !$object->metadata->is_visible()) { |
88 | 88 | // Take scheduling into account |
89 | 89 | $icon = 'stock-icons/16x16/page-' . $icontype . '-notpublished.png'; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | throw new midcom_error_midgard($e, $guid); |
51 | 51 | } |
52 | - $person_class = midcom::get()->config->get('person_class'); |
|
53 | - if ( get_class($tmp) == 'midgard_person' |
|
52 | + $person_class = midcom::get()->config->get('person_class'); |
|
53 | + if (get_class($tmp) == 'midgard_person' |
|
54 | 54 | && $person_class != 'midgard_person') { |
55 | 55 | $tmp = new $person_class($guid); |
56 | 56 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | $object = new $classname($src); |
83 | 83 | $cache[$classname][$object->guid] = $object; |
84 | - $cache[$classname][$object->id] =& $cache[$classname][$object->guid]; |
|
84 | + $cache[$classname][$object->id] = & $cache[$classname][$object->guid]; |
|
85 | 85 | return $cache[$classname][$object->guid]; |
86 | 86 | } |
87 | 87 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | throw new midcom_error("Cannot cast the object to an MgdSchema type, it is not a MidCOM DBA object"); |
175 | 175 | } |
176 | 176 | |
177 | - if ( !isset($object->__object) |
|
177 | + if (!isset($object->__object) |
|
178 | 178 | || !is_object($object->__object)) { |
179 | 179 | debug_print_r("Object dump:", $object); |
180 | 180 | throw new midcom_error("Cannot cast the object to an MgdSchema type, as it doesn't contain it"); |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | return true; |
199 | 199 | } |
200 | 200 | |
201 | - if ( isset($object->__object) |
|
201 | + if (isset($object->__object) |
|
202 | 202 | && is_object($object->__object) |
203 | 203 | && is_a($object->__object, $class)) { |
204 | 204 | // Decorator whose MgdSchema object matches |
205 | 205 | return true; |
206 | 206 | } |
207 | 207 | |
208 | - if ( isset($object->__mgdschema_class_name__) |
|
208 | + if (isset($object->__mgdschema_class_name__) |
|
209 | 209 | && $object->__mgdschema_class_name__ == $class) { |
210 | 210 | // Decorator without object instantiated, check class match |
211 | 211 | return true; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if (is_object($object)) { |
228 | 228 | $helper = new helper; |
229 | 229 | // We're dealing with either MgdSchema or MidCOM DBA object |
230 | - if ( isset($object->__object) |
|
230 | + if (isset($object->__object) |
|
231 | 231 | && is_object($object->__object)) { |
232 | 232 | // MidCOM DBA decorator |
233 | 233 | return $helper->property_exists($object->__object, $property); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | return $helper->property_exists($object, $property); |
237 | 237 | } |
238 | 238 | |
239 | - if ( !is_string($object) |
|
239 | + if (!is_string($object) |
|
240 | 240 | || !class_exists($object)) { |
241 | 241 | // TODO: Raise exception? |
242 | 242 | debug_add("\$object is not string or class_exists() returned false", MIDCOM_LOG_WARN); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $parent_data = $this->_get_parent_guid_cached($object->guid, $object); |
262 | 262 | |
263 | 263 | $parent_guid = current($parent_data); |
264 | - if ( empty($parent_guid) |
|
264 | + if (empty($parent_guid) |
|
265 | 265 | || $parent_guid === $object->guid) { |
266 | 266 | return null; |
267 | 267 | } |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | ); |
465 | 465 | } |
466 | 466 | |
467 | - if ( $parent_property |
|
467 | + if ($parent_property |
|
468 | 468 | && $reflector->get_link_target($parent_property)) { |
469 | 469 | $target_class = $reflector->get_link_name($parent_property); |
470 | 470 | if ($target_class == 'midgard_person') { |
471 | - $person_class = midcom::get()->config->get('person_class'); |
|
471 | + $person_class = midcom::get()->config->get('person_class'); |
|
472 | 472 | if ($person_class != 'midgard_person') { |
473 | 473 | $target_class = $person_class; |
474 | 474 | } |
@@ -44,7 +44,8 @@ discard block |
||
44 | 44 | { |
45 | 45 | try { |
46 | 46 | $tmp = midgard_object_class::get_object_by_guid($guid); |
47 | - } catch (midgard_error_exception $e) { |
|
47 | + } |
|
48 | + catch (midgard_error_exception $e) { |
|
48 | 49 | debug_add('Loading object by GUID ' . $guid . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_INFO); |
49 | 50 | |
50 | 51 | throw new midcom_error_midgard($e, $guid); |
@@ -274,7 +275,8 @@ discard block |
||
274 | 275 | $parent_data = array( |
275 | 276 | $parent->__midcom_class_name__ => $parent_guid |
276 | 277 | ); |
277 | - } catch (midcom_error $e) { |
|
278 | + } |
|
279 | + catch (midcom_error $e) { |
|
278 | 280 | $parent_data = array( |
279 | 281 | '' => null |
280 | 282 | ); |
@@ -288,7 +290,8 @@ discard block |
||
288 | 290 | |
289 | 291 | try { |
290 | 292 | return $this->get_cached($classname, $parent_guid); |
291 | - } catch (midcom_error $e) { |
|
293 | + } |
|
294 | + catch (midcom_error $e) { |
|
292 | 295 | return null; |
293 | 296 | } |
294 | 297 | } |
@@ -347,7 +350,8 @@ discard block |
||
347 | 350 | if ($the_object === null) { |
348 | 351 | try { |
349 | 352 | $the_object = $this->get_object_by_guid($object_guid); |
350 | - } catch (midcom_error $e) { |
|
353 | + } |
|
354 | + catch (midcom_error $e) { |
|
351 | 355 | return array('' => null); |
352 | 356 | } |
353 | 357 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | private static function _check_permissions($deleted) |
159 | 159 | { |
160 | 160 | // PONDER: Check for some generic user privilege instead ?? |
161 | - if ( $deleted |
|
161 | + if ($deleted |
|
162 | 162 | && !midcom_connection::is_admin() |
163 | 163 | && !midcom::get()->auth->is_component_sudo()) { |
164 | 164 | debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | 'target' => $ref->get_link_target($field) |
249 | 249 | ); |
250 | 250 | $linked_class = $ref->get_link_name($field); |
251 | - if ( empty($linked_class) |
|
251 | + if (empty($linked_class) |
|
252 | 252 | && $info['type'] === MGD_TYPE_GUID) { |
253 | 253 | // Guid link without class specification, valid for all classes |
254 | 254 | if (empty($info['target'])) { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $field_type = $field_data['type']; |
299 | 299 | $field = $field_data['name']; |
300 | 300 | |
301 | - if ( !$field_target |
|
301 | + if (!$field_target |
|
302 | 302 | || !isset($for_object->$field_target)) { |
303 | 303 | // Why return false ??? |
304 | 304 | return false; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $parent_property = midgard_object_class::get_property_parent($schema_type); |
415 | 415 | $up_property = midgard_object_class::get_property_up($schema_type); |
416 | 416 | |
417 | - if ( !$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class) |
|
417 | + if (!$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class) |
|
418 | 418 | && !$this->_resolve_child_classes_links_back($up_property, $schema_type, $this->mgdschema_class)) { |
419 | 419 | continue; |
420 | 420 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | $ref = new midgard_reflection_property($prospect_type); |
441 | 441 | $link_class = $ref->get_link_name($property); |
442 | - if ( empty($link_class) |
|
442 | + if (empty($link_class) |
|
443 | 443 | && $ref->get_midgard_type($property) === MGD_TYPE_GUID) { |
444 | 444 | return true; |
445 | 445 | } |
@@ -534,12 +534,12 @@ discard block |
||
534 | 534 | $ref = self::get($schema_type); |
535 | 535 | $dummy = new $schema_type(); |
536 | 536 | $title_property = $ref->get_title_property($dummy); |
537 | - if ( is_string($title_property) |
|
537 | + if (is_string($title_property) |
|
538 | 538 | && midcom::get()->dbfactory->property_exists($schema_type, $title_property)) { |
539 | 539 | $qb->add_order($title_property); |
540 | 540 | } |
541 | 541 | $name_property = $ref->get_name_property($dummy); |
542 | - if ( is_string($name_property) |
|
542 | + if (is_string($name_property) |
|
543 | 543 | && midcom::get()->dbfactory->property_exists($schema_type, $name_property)) { |
544 | 544 | $qb->add_order($name_property); |
545 | 545 | } |
@@ -557,7 +557,8 @@ |
||
557 | 557 | $tree = array(); |
558 | 558 | try { |
559 | 559 | $children = self::get_child_objects($parent); |
560 | - } catch (midcom_error $e) { |
|
560 | + } |
|
561 | + catch (midcom_error $e) { |
|
561 | 562 | return $tree; |
562 | 563 | } |
563 | 564 |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | // Override requested root object properties |
349 | - if ( !empty($this->target->guid) |
|
349 | + if (!empty($this->target->guid) |
|
350 | 350 | && $target->guid === $this->target->guid) { |
351 | 351 | foreach ($this->root_object_values as $name => $value) { |
352 | 352 | $target->$name = $value; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | // Store for later use - if ever needed |
392 | 392 | $this->new_objects[] = $target; |
393 | 393 | |
394 | - if ( !$this->_copy_data('parameters', $source, $target) |
|
394 | + if (!$this->_copy_data('parameters', $source, $target) |
|
395 | 395 | || !$this->_copy_data('metadata', $source, $target) |
396 | 396 | || !$this->_copy_data('attachments', $source, $target) |
397 | 397 | || !$this->_copy_data('privileges', $source, $target)) { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | private function _copy_data($type, $source, &$target) |
413 | 413 | { |
414 | 414 | $method = 'copy_' . $type; |
415 | - if ( !$this->$method($source, $target) |
|
415 | + if (!$this->$method($source, $target) |
|
416 | 416 | && $this->halt_on_errors) { |
417 | 417 | $this->errors[] = $this->_l10n->get('failed to copy ' . $type); |
418 | 418 | return false; |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | public static function copy_object_tree($source, $parent, $exclude = array(), $copy_parameters = true, $copy_metadata = true, $copy_attachments = true) |
565 | 565 | { |
566 | 566 | $copy = new midcom_helper_reflector_copy(); |
567 | - $copy->source =& $source; |
|
568 | - $copy->target =& $parent; |
|
567 | + $copy->source = & $source; |
|
568 | + $copy->target = & $parent; |
|
569 | 569 | $copy->copy_parameters = $copy_parameters; |
570 | 570 | $copy->copy_metadata = $copy_metadata; |
571 | 571 | $copy->copy_attachments = $copy_attachments; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $node = $nap->get_node($node_id); |
55 | 55 | |
56 | - if ( !array_key_exists($node[MIDCOM_NAV_COMPONENT], $this->_request_data['components']) |
|
56 | + if (!array_key_exists($node[MIDCOM_NAV_COMPONENT], $this->_request_data['components']) |
|
57 | 57 | && $node[MIDCOM_NAV_COMPONENT] != 'midcom.helper.search') { |
58 | 58 | $l10n = $this->_i18n->get_l10n($node[MIDCOM_NAV_COMPONENT]); |
59 | 59 | $this->_request_data['components'][$node[MIDCOM_NAV_COMPONENT]] = $l10n->get($node[MIDCOM_NAV_COMPONENT]); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->prepare_query_data(); |
113 | 113 | $this->prepare_formdata($_REQUEST['type']); |
114 | 114 | |
115 | - if ( count(explode(' ', $data['query'])) == 1 |
|
115 | + if (count(explode(' ', $data['query'])) == 1 |
|
116 | 116 | && strpos($data['query'], '*') === false |
117 | 117 | && $this->_config->get('single_term_auto_wilcard')) { |
118 | 118 | //If there is only one search term append * to the query if auto_wildcard is enabled |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | $this->_request_data['last_document_number'] = $last_document_id + 1; |
193 | 193 | $this->_request_data['shown_documents'] = $last_document_id - $first_document_id + 1; |
194 | 194 | $this->_request_data['results_per_page'] = $results_per_page; |
195 | - $this->_request_data['all_results'] =& $result; |
|
195 | + $this->_request_data['all_results'] = & $result; |
|
196 | 196 | $this->_request_data['result'] = array_slice($result, $first_document_id, $results_per_page); |
197 | 197 | |
198 | 198 | // Register GUIDs for cache engine |
199 | 199 | foreach ($this->_request_data['result'] as $doc) { |
200 | - if ( !isset($doc->source) |
|
200 | + if (!isset($doc->source) |
|
201 | 201 | || !mgd_is_guid($doc->source)) { |
202 | 202 | // Non-Midgard results don't need to go through cache registration |
203 | 203 | continue; |
@@ -143,7 +143,8 @@ |
||
143 | 143 | |
144 | 144 | try { |
145 | 145 | $data = file_get_contents($filename); |
146 | - } catch (Exception $e) { |
|
146 | + } |
|
147 | + catch (Exception $e) { |
|
147 | 148 | return false; |
148 | 149 | } |
149 | 150 |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $this->_request_switch[$key]['handler'] = array(&$this, $value['handler']); |
434 | 434 | } |
435 | 435 | |
436 | - if ( !array_key_exists('expires', $value) |
|
436 | + if (!array_key_exists('expires', $value) |
|
437 | 437 | || !is_integer($value['expires']) |
438 | 438 | || $value['expires'] < -1) { |
439 | 439 | $this->_request_switch[$key]['expires'] = -1; |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | // Check if we need to start up a plugin. |
468 | - if ( $argc > 1 |
|
468 | + if ($argc > 1 |
|
469 | 469 | && array_key_exists($argv[0], self::$_plugin_namespace_config) |
470 | 470 | && array_key_exists($argv[1], self::$_plugin_namespace_config[$argv[0]])) { |
471 | 471 | $namespace = $argv[0]; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | continue; |
482 | 482 | } |
483 | 483 | $fixed_args_count = count($request['fixed_args']); |
484 | - $this->_handler =& $this->_request_switch[$key]; |
|
484 | + $this->_handler = & $this->_request_switch[$key]; |
|
485 | 485 | |
486 | 486 | $this->_handler['id'] = $key; |
487 | 487 | $this->_handler['args'] = array_slice($argv, $fixed_args_count); |
@@ -490,10 +490,10 @@ discard block |
||
490 | 490 | $this->_prepare_handler(); |
491 | 491 | |
492 | 492 | // If applicable, run the _can_handle check for the handler in question. |
493 | - $handler =& $this->_handler['handler'][0]; |
|
493 | + $handler = & $this->_handler['handler'][0]; |
|
494 | 494 | $method = "_can_handle_{$this->_handler['handler'][1]}"; |
495 | 495 | |
496 | - if ( method_exists($handler, $method) |
|
496 | + if (method_exists($handler, $method) |
|
497 | 497 | && !$handler->$method($this->_handler['id'], $this->_handler['args'], $this->_request_data)) { |
498 | 498 | // This can_handle failed, allow next one to take over if there is one |
499 | 499 | continue; |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $variable_args_count = $request['variable_args']; |
511 | 511 | $total_args_count = $fixed_args_count + $variable_args_count; |
512 | 512 | |
513 | - if ( ($argc != $total_args_count && ($variable_args_count >= 0)) |
|
513 | + if (($argc != $total_args_count && ($variable_args_count >= 0)) |
|
514 | 514 | || $fixed_args_count > $argc) { |
515 | 515 | return false; |
516 | 516 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $success = false; |
531 | 531 | foreach ($request['validation'][$i] as $rule) { |
532 | 532 | // rule is a callable function, like mgd_is_guid or is_int |
533 | - if ( is_callable($rule) |
|
533 | + if (is_callable($rule) |
|
534 | 534 | && $success = call_user_func($rule, $param)) { |
535 | 535 | break; |
536 | 536 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | midcom::get()->head->set_pagetitle($this->_l10n_midcom->get('component configuration')); |
91 | 91 | |
92 | 92 | $workflow = $this->get_workflow('datamanager2', array('controller' => $this->_controller)); |
93 | - if ( method_exists($this, '_load_datamanagers') |
|
93 | + if (method_exists($this, '_load_datamanagers') |
|
94 | 94 | && method_exists($this, '_load_objects')) { |
95 | 95 | $workflow->add_post_button('config/recreate/', $this->_l10n_midcom->get('recreate images'), array( |
96 | 96 | 'midcom_baseclasses_components_handler_configuration_recreateok' => true, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | return; |
133 | 133 | $indexer = midcom::get()->indexer; |
134 | - $topic =& $this->_content_topic; |
|
134 | + $topic = & $this->_content_topic; |
|
135 | 135 | |
136 | 136 | $nav = new midcom_helper_nav(); |
137 | 137 | $node = $nav->get_node($topic->id); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $prefix = $this->_get_url_prefix(); |
229 | 229 | $buttons = array(); |
230 | - if ( $this->_mode !== 'update' |
|
230 | + if ($this->_mode !== 'update' |
|
231 | 231 | && $this->_object->can_do('midgard:update')) { |
232 | 232 | $workflow = $this->get_workflow('datamanager2'); |
233 | 233 | $buttons[] = $workflow->get_button($prefix . "edit/{$this->_object->guid}/", array( |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | )); |
236 | 236 | } |
237 | 237 | |
238 | - if ( $this->_mode !== 'delete' |
|
238 | + if ($this->_mode !== 'delete' |
|
239 | 239 | && $this->_object->can_do('midgard:delete')) { |
240 | 240 | $workflow = $this->get_workflow('delete', array('object' => $this->_object)); |
241 | 241 | $buttons[] = $workflow->get_button($prefix . "delete/{$this->_object->guid}/"); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function _on_initialize() |
263 | 263 | { |
264 | - $this->_content_topic =& $this->_request_data['content_topic']; |
|
264 | + $this->_content_topic = & $this->_request_data['content_topic']; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function _load_schemadb() |
273 | 273 | { |
274 | - $this->_schemadb =& $this->_request_data['schemadb']; |
|
274 | + $this->_schemadb = & $this->_request_data['schemadb']; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | public function _load_controller($type = 'simple') |
323 | 323 | { |
324 | 324 | $this->_controller = midcom_helper_datamanager2_controller::create($type); |
325 | - $this->_controller->schemadb =& $this->_schemadb; |
|
325 | + $this->_controller->schemadb = & $this->_schemadb; |
|
326 | 326 | |
327 | 327 | if ($type == 'create') { |
328 | 328 | // Creation controller, give additional parameters |
329 | 329 | $this->_controller->schemaname = $this->_schema; |
330 | 330 | $this->_controller->defaults = $this->_defaults; |
331 | - $this->_controller->callback_object =& $this; |
|
331 | + $this->_controller->callback_object = & $this; |
|
332 | 332 | } else { |
333 | 333 | if (!$this->_object) { |
334 | 334 | throw new midcom_error_notfound("No object defined for DM2."); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | // AJAX editing is possible |
427 | 427 | $this->_load_controller('ajax'); |
428 | 428 | $this->_controller->process_ajax(); |
429 | - $this->_datamanager =& $this->_controller->datamanager; |
|
429 | + $this->_datamanager = & $this->_controller->datamanager; |
|
430 | 430 | } else { |
431 | 431 | $this->_load_datamanager(); |
432 | 432 | } |