@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | $lastgoodnode = null; |
258 | 258 | |
259 | - while ( $parent_id |
|
259 | + while ($parent_id |
|
260 | 260 | && !isset(self::$_nodes[$parent_id])) { |
261 | 261 | try { |
262 | 262 | self::$_nodes[$parent_id] = $this->_loadNodeData($parent_id); |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | |
274 | 274 | $parent_id = $this->_get_parent_id($topic_id); |
275 | 275 | |
276 | - if ( $up |
|
276 | + if ($up |
|
277 | 277 | && $up_id = array_pop($up_ids) |
278 | 278 | && $up_id != $parent_id) { |
279 | 279 | $parent_id = $up_id; |
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | - if ( !is_null($lastgoodnode) |
|
283 | + if (!is_null($lastgoodnode) |
|
284 | 284 | && (empty($this->_lastgoodnode) || $this->_lastgoodnode < 0)) { |
285 | 285 | $this->_lastgoodnode = $lastgoodnode; |
286 | 286 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | { |
317 | 317 | $node = new midcom_helper_nav_node($this, $topic_id, $up); |
318 | 318 | |
319 | - if ( !$node->is_object_visible() |
|
319 | + if (!$node->is_object_visible() |
|
320 | 320 | || !$node->is_readable_by($this->_user_id)) { |
321 | 321 | throw new midcom_error_forbidden('Node cannot be read or is invisible'); |
322 | 322 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | }); |
362 | 362 | foreach ($leaves as $id => $leaf) { |
363 | 363 | $this->_leaves[$id] = $leaf; |
364 | - $this->_loaded_leaves[$node->id][$id] =& $this->_leaves[$id]; |
|
364 | + $this->_loaded_leaves[$node->id][$id] = & $this->_leaves[$id]; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | } |
448 | 448 | $subnode_id = $this->_nodeid($id, $up); |
449 | 449 | |
450 | - if ( !$show_noentry |
|
450 | + if (!$show_noentry |
|
451 | 451 | && self::$_nodes[$subnode_id]->noentry) { |
452 | 452 | // Hide "noentry" items |
453 | 453 | continue; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function is_readable_by($user_id) |
32 | 32 | { |
33 | - return ( !$user_id |
|
33 | + return (!$user_id |
|
34 | 34 | || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, 'midcom_db_topic', $user_id)); |
35 | 35 | } |
36 | 36 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
68 | 68 | $this->_controller->schemadb = $schemadb; |
69 | 69 | $this->_controller->schemaname = 'default'; |
70 | - $this->_controller->callback_object =& $this; |
|
70 | + $this->_controller->callback_object = & $this; |
|
71 | 71 | |
72 | 72 | // Suggest to create the same type of a folder as the parent is |
73 | 73 | $component_suggestion = $this->_topic->component; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | if (!$this->_new_topic->create()) { |
103 | 103 | debug_print_r('We operated on this object:', $this->_new_topic); |
104 | - throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
104 | + throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $this->_new_topic; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | // No topics matching path, check for attachments |
124 | - $att_qb = midcom_db_attachment::new_query_builder(); |
|
124 | + $att_qb = midcom_db_attachment::new_query_builder(); |
|
125 | 125 | $att_qb->add_constraint('name', '=', $this->argv[0]); |
126 | 126 | $att_qb->add_constraint('parentguid', '=', $this->get_current_object()->guid); |
127 | 127 | if ($att_qb->count() == 0) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | $this->_load_schemadb(); |
169 | 169 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
170 | - $this->_controller->schemadb =& $this->_schemadb; |
|
170 | + $this->_controller->schemadb = & $this->_schemadb; |
|
171 | 171 | $this->_controller->set_storage($this->_object, 'object'); |
172 | 172 | if (!$this->_controller->initialize()) { |
173 | 173 | throw new midcom_error("Failed to initialize a DM2 controller instance for object {$this->_object->guid}."); |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | return $this->_prepare_relocate($this->_object); |
185 | 185 | |
186 | 186 | case 'edit': |
187 | - $qf =& $this->_controller->formmanager->form; |
|
188 | - if ( $qf->isSubmitted() |
|
187 | + $qf = & $this->_controller->formmanager->form; |
|
188 | + if ($qf->isSubmitted() |
|
189 | 189 | && !$qf->validate()) { |
190 | 190 | foreach ($qf->_errors as $field => $error) { |
191 | - $element =& $qf->getElement($field); |
|
191 | + $element = & $qf->getElement($field); |
|
192 | 192 | $message = sprintf($this->_l10n->get('validation error in field %s: %s'), $element->getLabel(), $error); |
193 | 193 | midcom::get()->uimessages->add( |
194 | 194 | $this->_l10n->get('midgard.admin.asgard'), |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | if (!$this->_new_object->create()) { |
233 | 233 | debug_print_r('We operated on this object:', $this->_new_object); |
234 | - throw new midcom_error('Failed to create a new object. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
234 | + throw new midcom_error('Failed to create a new object. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $this->_new_object; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | midcom::get()->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); |
261 | 261 | |
262 | 262 | $data['defaults'] = array(); |
263 | - if ( $handler_id == '____mfa-asgard-object_create_toplevel' |
|
263 | + if ($handler_id == '____mfa-asgard-object_create_toplevel' |
|
264 | 264 | || $handler_id == '____mfa-asgard-object_create_chooser') { |
265 | 265 | midcom::get()->auth->require_user_do('midgard:create', null, $this->_new_type); |
266 | 266 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
281 | - $this->_controller->schemadb =& $this->_schemadb; |
|
281 | + $this->_controller->schemadb = & $this->_schemadb; |
|
282 | 282 | $this->_controller->schema = 'object'; |
283 | - $this->_controller->callback_object =& $this; |
|
283 | + $this->_controller->callback_object = & $this; |
|
284 | 284 | $this->_controller->defaults = $this->_get_defaults(); |
285 | 285 | if (!$this->_controller->initialize()) { |
286 | 286 | throw new midcom_error("Failed to initialize a DM2 create controller."); |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | $parent_property = null; |
322 | 322 | $new_type_reflector = midcom_helper_reflector::get($this->_new_type); |
323 | 323 | $link_properties = $new_type_reflector->get_link_properties(); |
324 | - $type_to_link_to = midcom_helper_reflector::class_rewrite(get_class($this->_object)); |
|
324 | + $type_to_link_to = midcom_helper_reflector::class_rewrite(get_class($this->_object)); |
|
325 | 325 | foreach ($link_properties as $child_property => $link) { |
326 | 326 | $linked_type = midcom_helper_reflector::class_rewrite($link['class']); |
327 | 327 | if (midcom_helper_reflector::is_same_class($linked_type, $type_to_link_to) |
328 | - || ( $link['type'] == MGD_TYPE_GUID |
|
328 | + || ($link['type'] == MGD_TYPE_GUID |
|
329 | 329 | && is_null($link['class']))) { |
330 | 330 | $parent_property = $link['target']; |
331 | 331 | break; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | // Allow setting defaults from query string, useful for things like "create event for today" and chooser |
341 | - if ( isset($_GET['defaults']) |
|
341 | + if (isset($_GET['defaults']) |
|
342 | 342 | && is_array($_GET['defaults'])) { |
343 | 343 | $get_defaults = array_intersect_key($_GET['defaults'], $this->_schemadb['object']->fields); |
344 | 344 | $defaults = array_merge($defaults, array_map('trim', $get_defaults)); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | { |
357 | 357 | if ($handler_id == '____mfa-asgard-object_create_chooser') { |
358 | 358 | midcom_show_style('midgard_admin_asgard_popup_header'); |
359 | - if ( $this->_new_object |
|
359 | + if ($this->_new_object |
|
360 | 360 | || isset($data['cancelled'])) { |
361 | 361 | $data['jsdata'] = $this->_object_to_jsdata($this->_new_object); |
362 | 362 | midcom_show_style('midgard_admin_asgard_object_create_after'); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $url = $type; |
408 | 408 | |
409 | 409 | $class_extends = $this->_config->get('class_extends'); |
410 | - if ( is_array($class_extends) |
|
410 | + if (is_array($class_extends) |
|
411 | 411 | && array_key_exists($type, $class_extends)) { |
412 | 412 | $url = $class_extends[$type]; |
413 | 413 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | |
507 | 507 | // Load the nullstorage controller |
508 | 508 | $this->_controller = midcom_helper_datamanager2_controller::create('nullstorage'); |
509 | - $this->_controller->schemadb =& $this->_schemadb; |
|
509 | + $this->_controller->schemadb = & $this->_schemadb; |
|
510 | 510 | |
511 | 511 | if (!$this->_controller->initialize()) { |
512 | 512 | throw new midcom_error('Failed to initialize the controller'); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | private function _filter_schema_fields($key) |
164 | 164 | { |
165 | - if ( $key == 'metadata' |
|
165 | + if ($key == 'metadata' |
|
166 | 166 | || in_array($key, $this->_config->get('object_skip_fields'))) { |
167 | 167 | return false; |
168 | 168 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | private function _add_string_field($key, $type) |
174 | 174 | { |
175 | - if ( $key == 'component' |
|
175 | + if ($key == 'component' |
|
176 | 176 | && $type == 'midcom_db_topic') { |
177 | 177 | $this->_add_component_dropdown($key); |
178 | 178 | return; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | private function _add_int_field($key) |
223 | 223 | { |
224 | - if ( $key == 'start' |
|
224 | + if ($key == 'start' |
|
225 | 225 | || $key == 'end' |
226 | 226 | || $key == 'added' |
227 | 227 | || $key == 'date') { |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | $height = 30; |
266 | 266 | |
267 | 267 | // Check the user preference and configuration |
268 | - if ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
269 | - || ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
268 | + if (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
269 | + || (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
270 | 270 | && $this->_config->get('tinymce_enabled'))) { |
271 | 271 | $widget = 'tinymce'; |
272 | 272 | } |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | $height = 30; |
280 | 280 | |
281 | 281 | // Check the user preference and configuration |
282 | - if ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
283 | - || ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
282 | + if (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
283 | + || (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
284 | 284 | && $this->_config->get('codemirror_enabled'))) { |
285 | 285 | $widget = 'codemirror'; |
286 | 286 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | if ($score1 > $score2) { |
543 | 543 | return 1; |
544 | 544 | } |
545 | - if ( $score1 < 3 |
|
545 | + if ($score1 < 3 |
|
546 | 546 | || $score1 > 6) { |
547 | 547 | return strnatcmp($first, $second); |
548 | 548 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | private function _compute_welcome_posting_count($start, $end) |
121 | 121 | { |
122 | - $data =& $this->_request_data; |
|
122 | + $data = & $this->_request_data; |
|
123 | 123 | $qb = midcom_db_article::new_query_builder(); |
124 | 124 | |
125 | 125 | $qb->add_constraint('metadata.published', '>=', $start->format('Y-m-d H:i:s')); |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | $year_data = array(); |
144 | 144 | $first_post = $this->_compute_welcome_first_post(); |
145 | 145 | $this->_request_data['first_post'] = $first_post; |
146 | - $this->_request_data['total_count'] =& $total_count; |
|
147 | - $this->_request_data['year_data'] =& $year_data; |
|
146 | + $this->_request_data['total_count'] = & $total_count; |
|
147 | + $this->_request_data['year_data'] = & $year_data; |
|
148 | 148 | if (!$first_post) { |
149 | 149 | return; |
150 | 150 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | switch ($handler_id) { |
279 | 279 | case 'archive-year-category': |
280 | 280 | $data['category'] = trim(strip_tags($args[1])); |
281 | - if ( isset($data['schemadb']['default']->fields['categories']) |
|
281 | + if (isset($data['schemadb']['default']->fields['categories']) |
|
282 | 282 | && array_key_exists('allow_multiple', $data['schemadb']['default']->fields['categories']['type_config']) |
283 | 283 | && !$data['schemadb']['default']->fields['categories']['type_config']['allow_multiple']) { |
284 | 284 | $qb->add_constraint('extra1', '=', (string) $data['category']); |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | throw new midcom_error_notfound("The year '{$year}' is not a valid year identifier."); |
374 | 374 | } |
375 | 375 | |
376 | - if ( $month < 1 |
|
376 | + if ($month < 1 |
|
377 | 377 | || $month > 12) { |
378 | 378 | throw new midcom_error_notfound("The year {$month} is not a valid year identifier."); |
379 | 379 | } |
380 | 380 | |
381 | 381 | $now = new DateTime(); |
382 | - $this->_start = new DateTime("{$year}-" . sprintf('%02d', $month) . "-01 00:00:00"); |
|
382 | + $this->_start = new DateTime("{$year}-" . sprintf('%02d', $month) . "-01 00:00:00"); |
|
383 | 383 | if ($this->_start > $now) { |
384 | - throw new midcom_error_notfound("The month '{$year}-" . sprintf('%02d', $month) . "' is in the future, no archive available."); |
|
384 | + throw new midcom_error_notfound("The month '{$year}-" . sprintf('%02d', $month) . "' is in the future, no archive available."); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | if ($month == 12) { |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $endmonth = $month + 1; |
393 | 393 | } |
394 | 394 | |
395 | - $this->_end = new DateTime("{$endyear}-" . sprintf('%02d', $endmonth) . "-01 00:00:00"); |
|
395 | + $this->_end = new DateTime("{$endyear}-" . sprintf('%02d', $endmonth) . "-01 00:00:00"); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $config = $this->get_config_for_topic($topic); |
71 | - if ( $object->name == 'index' |
|
71 | + if ($object->name == 'index' |
|
72 | 72 | && !$config->get('autoindex')) { |
73 | 73 | return ''; |
74 | 74 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | )); |
45 | 45 | } |
46 | 46 | |
47 | - if ( $this->_article->topic === $this->_topic->id |
|
47 | + if ($this->_article->topic === $this->_topic->id |
|
48 | 48 | && $this->_article->can_do('midgard:delete')) { |
49 | 49 | $delete = $this->get_workflow('delete', array('object' => $this->_article)); |
50 | 50 | $buttons[] = $delete->get_button("delete/{$this->_article->guid}/"); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | if ($this->_config->get('enable_ajax_editing')) { |
99 | 99 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
100 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb']; |
|
100 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb']; |
|
101 | 101 | $this->_request_data['controller']->set_storage($this->_article); |
102 | 102 | $this->_request_data['controller']->process_ajax(); |
103 | 103 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ($this->_config->get('comments_enable')) { |
106 | 106 | if ($comments_node = $this->_seek_comments()) { |
107 | 107 | $this->_request_data['comments_url'] = $comments_node[MIDCOM_NAV_RELATIVEURL] . "comment/{$this->_article->guid}"; |
108 | - if ( $this->_topic->can_do('midgard:update') |
|
108 | + if ($this->_topic->can_do('midgard:update') |
|
109 | 109 | && $this->_topic->can_do('net.nehmer.comments:moderation')) { |
110 | 110 | net_nehmer_comments_viewer::add_head_elements(); |
111 | 111 | } |