@@ -62,7 +62,8 @@ |
||
62 | 62 | try { |
63 | 63 | $this->__object = call_user_func(array($this->__midcom_class_name__, 'get_cached'), $this->__identifier); |
64 | 64 | return true; |
65 | - } catch (midcom_error $e) { |
|
65 | + } |
|
66 | + catch (midcom_error $e) { |
|
66 | 67 | $e->log(); |
67 | 68 | } |
68 | 69 | return false; |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | // show_unapproved_objects). Disabled by default. Unsafe to Link Prefetching! |
439 | 439 | 'metadata_approval' => false, |
440 | 440 | 'metadata_scheduling' => false, |
441 | - 'metadata_lock_timeout' => 60, // Time in minutes |
|
441 | + 'metadata_lock_timeout' => 60, // Time in minutes |
|
442 | 442 | 'staging2live_staging' => false, |
443 | 443 | |
444 | 444 | // Set the DM2 schema used by the Metadata Service |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | // Check the midcom_config site prefix for absolute local urls |
566 | - if ( $key === 'midcom_site_url' |
|
566 | + if ($key === 'midcom_site_url' |
|
567 | 567 | && substr($this->_merged_config[$key], 0, 1) === '/') { |
568 | 568 | $this->_merged_config[$key] = midcom::get()->get_page_prefix() . substr($this->_merged_config[$key], 1); |
569 | 569 | } |
@@ -86,7 +86,7 @@ |
||
86 | 86 | return; |
87 | 87 | } |
88 | 88 | $initialized = true; |
89 | - if ( !midcom::get()->auth->user |
|
89 | + if (!midcom::get()->auth->user |
|
90 | 90 | || !midcom::get()->config->get('toolbars_enable_centralized') |
91 | 91 | || !midcom::get()->auth->can_user_do('midcom:centralized_toolbar', null, $this)) { |
92 | 92 | return; |
@@ -139,7 +139,7 @@ |
||
139 | 139 | { |
140 | 140 | foreach ($data as $component => $jobs) { |
141 | 141 | // First, verify the component is loaded |
142 | - if ( $component != 'midcom' |
|
142 | + if ($component != 'midcom' |
|
143 | 143 | && !midcom::get()->componentloader->load_graceful($component)) { |
144 | 144 | $msg = "Failed to load the component {$component}. See the debug level log for further information, skipping this component."; |
145 | 145 | debug_add($msg, MIDCOM_LOG_ERROR); |
@@ -153,7 +153,8 @@ |
||
153 | 153 | $job['component'] = $component; |
154 | 154 | $this->_jobs[] = $job; |
155 | 155 | } |
156 | - } catch (midcom_error $e) { |
|
156 | + } |
|
157 | + catch (midcom_error $e) { |
|
157 | 158 | $e->log(MIDCOM_LOG_ERROR); |
158 | 159 | debug_print_r('Got this job declaration:', $job); |
159 | 160 | echo "ERROR: Failed to register a job for {$component}: " . $e->getMessage() . "\n"; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function show($show_simple = false) |
148 | 148 | { |
149 | - if ( $show_simple |
|
149 | + if ($show_simple |
|
150 | 150 | || !midcom::get()->auth->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) { |
151 | 151 | $this->show_simple(); |
152 | 152 | return; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function show_simple($prefer_fancy = false) |
179 | 179 | { |
180 | - if ( $prefer_fancy |
|
180 | + if ($prefer_fancy |
|
181 | 181 | && midcom::get()->auth->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) { |
182 | 182 | return $this->show(); |
183 | 183 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Approval attributes |
155 | - if ( midcom::get()->config->get('metadata_approval') |
|
155 | + if (midcom::get()->config->get('metadata_approval') |
|
156 | 156 | && !$object->metadata->is_approved()) { |
157 | 157 | $css_classes[] = 'unapproved'; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Hiding and scheduling attributes |
161 | - if ( ( !midcom::get()->config->get('show_hidden_objects') |
|
161 | + if ((!midcom::get()->config->get('show_hidden_objects') |
|
162 | 162 | || midcom::get()->config->get('metadata_scheduling')) |
163 | 163 | && !$object->metadata->is_visible()) { |
164 | 164 | $css_classes[] = 'hidden'; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | private function _add_opengraph_metadata($view_metadata) |
282 | 282 | { |
283 | 283 | $opengraph_type = $view_metadata->object->get_parameter('midcom.helper.metadata', 'opengraph_type'); |
284 | - if ( $opengraph_type |
|
284 | + if ($opengraph_type |
|
285 | 285 | && $opengraph_type != 'none') { |
286 | 286 | $request_metadata = $this->get_request_metadata(); |
287 | 287 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } |
402 | 402 | |
403 | 403 | $component = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT); |
404 | - if ( !$component |
|
404 | + if (!$component |
|
405 | 405 | || !midcom::get()->componentloader->is_installed($component) |
406 | 406 | || !midcom::get()->componentloader->load_graceful($component)) { |
407 | 407 | return ''; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | public function set_request_metadata($lastmodified, $permalinkguid) |
427 | 427 | { |
428 | - if ( is_object($lastmodified) |
|
428 | + if (is_object($lastmodified) |
|
429 | 429 | && is_a($lastmodified, 'midgard_datetime')) { |
430 | 430 | // Midgard2 compatibility |
431 | 431 | $lastmodified = $lastmodified->format('U'); |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | 'permalink' => midcom::get()->permalinks->create_permalink($context->get_key(MIDCOM_CONTEXT_PERMALINKGUID)), |
457 | 457 | ); |
458 | 458 | |
459 | - if ( is_object($meta['lastmodified']) |
|
459 | + if (is_object($meta['lastmodified']) |
|
460 | 460 | && is_a($meta['lastmodified'], 'midgard_datetime')) { |
461 | 461 | // Midgard2 compatibility |
462 | 462 | $meta['lastmodified'] = $meta['lastmodified']->format('U'); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | { |
464 | 464 | // Complete fields |
465 | 465 | $this->indexed = time(); |
466 | - if ( $this->author == '' |
|
466 | + if ($this->author == '' |
|
467 | 467 | && isset($this->creator->name)) { |
468 | 468 | $this->author = $this->creator->name; |
469 | 469 | } |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | public function read_metadata_from_object($object) |
607 | 607 | { |
608 | 608 | // Published is set to non-empty value, use it as creation data |
609 | - if ( !empty($object->metadata->published) |
|
609 | + if (!empty($object->metadata->published) |
|
610 | 610 | && !preg_match('/0{1,4}-0{1,2}0{1,2}\s+0{1,2}:0{1,2}:0{1,2}/', $object->metadata->published)) { |
611 | 611 | $this->created = $this->read_unixtime($object->metadata->published); |
612 | 612 | } elseif (isset($object->metadata->created)) { |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | return @strtotime($stamp); |
646 | 646 | } |
647 | 647 | // Unix timestamp |
648 | - return (int)$stamp; |
|
648 | + return (int) $stamp; |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | /** |
@@ -680,7 +680,8 @@ |
||
680 | 680 | { |
681 | 681 | try { |
682 | 682 | return midcom_db_person::get_cached($id); |
683 | - } catch (midcom_error $e) { |
|
683 | + } |
|
684 | + catch (midcom_error $e) { |
|
684 | 685 | return false; |
685 | 686 | } |
686 | 687 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | private function process_attachment() |
95 | 95 | { |
96 | - if ( !isset($this->attachment->metadata) |
|
96 | + if (!isset($this->attachment->metadata) |
|
97 | 97 | || !is_object($this->attachment->metadata)) { |
98 | 98 | return; |
99 | 99 | } |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | if (strlen(trim($this->attachment->title)) > 0) { |
145 | - $this->title = "{$this->attachment->title} ({$this->attachment->name})"; |
|
145 | + $this->title = "{$this->attachment->title} ({$this->attachment->name})"; |
|
146 | 146 | $this->content .= "\n{$this->attachment->title}\n{$this->attachment->name}"; |
147 | 147 | } else { |
148 | - $this->title = $this->attachment->name; |
|
148 | + $this->title = $this->attachment->name; |
|
149 | 149 | $this->content .= "\n{$this->attachment->name}"; |
150 | 150 | } |
151 | 151 |
@@ -85,7 +85,8 @@ |
||
85 | 85 | |
86 | 86 | try { |
87 | 87 | $this->session->start(); |
88 | - } catch (RuntimeException $e) { |
|
88 | + } |
|
89 | + catch (RuntimeException $e) { |
|
89 | 90 | debug_add($e->getMessage(), MIDCOM_LOG_ERROR); |
90 | 91 | return false; |
91 | 92 | } |
@@ -67,15 +67,15 @@ |
||
67 | 67 | return true; |
68 | 68 | } |
69 | 69 | |
70 | - if ( !midcom::get()->config->get('sessioning_service_enable') |
|
71 | - && !( midcom::get()->config->get('sessioning_service_always_enable_for_users') |
|
70 | + if (!midcom::get()->config->get('sessioning_service_enable') |
|
71 | + && !(midcom::get()->config->get('sessioning_service_always_enable_for_users') |
|
72 | 72 | && midcom_connection::get_user())) { |
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | 76 | $this->session = new Session(null, new NamespacedAttributeBag('midcom_session_data', $this->ns_separator)); |
77 | 77 | // Try to start session only if the client sends the id OR we need to set data |
78 | - if ( !isset($_REQUEST[$this->session->getName()]) |
|
78 | + if (!isset($_REQUEST[$this->session->getName()]) |
|
79 | 79 | && !$unconditional_start) { |
80 | 80 | return false; |
81 | 81 | } |