@@ -37,7 +37,7 @@ |
||
37 | 37 | $schemadb = midcom_helper_datamanager2_schema::load_database(midcom::get()->config->get('metadata_schema')); |
38 | 38 | |
39 | 39 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
40 | - $this->_controller->schemadb =& $schemadb; |
|
40 | + $this->_controller->schemadb = & $schemadb; |
|
41 | 41 | |
42 | 42 | $object_schema = midcom_helper_metadata::find_schemaname($schemadb, $this->_object); |
43 | 43 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->_object = midcom::get()->dbfactory->get_object_by_guid($args[0]); |
36 | 36 | |
37 | - if ( !is_a($this->_object, 'midcom_db_topic') |
|
37 | + if (!is_a($this->_object, 'midcom_db_topic') |
|
38 | 38 | && !is_a($this->_object, 'midcom_db_article')) { |
39 | 39 | throw new midcom_error_notfound("Moving only topics and articles is supported."); |
40 | 40 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $folder = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ROOTTOPIC); |
79 | 79 | } |
80 | 80 | |
81 | - if ( is_a($this->_object, 'midcom_db_topic') |
|
81 | + if (is_a($this->_object, 'midcom_db_topic') |
|
82 | 82 | && $folder->up == $this->_object->id) { |
83 | 83 | $tree_disabled = true; |
84 | 84 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $selected = ' checked="checked"'; |
92 | 92 | } |
93 | 93 | |
94 | - if ( !is_a($this->_object, 'midcom_db_topic') |
|
94 | + if (!is_a($this->_object, 'midcom_db_topic') |
|
95 | 95 | && $folder->component !== $this->_request_data['current_folder']->component) { |
96 | 96 | // Non-topic objects may only be moved under folders of same component |
97 | 97 | $class = 'wrong_component'; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $move_to_topic = new midcom_db_topic(); |
128 | 128 | |
129 | 129 | if (!$move_to_topic->get_by_id($target)) { |
130 | - throw new midcom_error( 'Failed to move the topic. Could not get the target topic'); |
|
130 | + throw new midcom_error('Failed to move the topic. Could not get the target topic'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | $move_to_topic->require_do('midgard:create'); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | $http_client = new org_openpsa_httplib(); |
57 | 57 | $http_client->set_param('timeout', 300); |
58 | -if ( !empty($_SERVER['PHP_AUTH_USER']) |
|
58 | +if (!empty($_SERVER['PHP_AUTH_USER']) |
|
59 | 59 | && !empty($_SERVER['PHP_AUTH_PW'])) { |
60 | 60 | $http_client->basicauth['user'] = $_SERVER['PHP_AUTH_USER']; |
61 | 61 | $http_client->basicauth['password'] = $_SERVER['PHP_AUTH_PW']; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | protected function _add_visibility_checks() |
137 | 137 | { |
138 | - if ( !$this->_visibility_checks_added |
|
138 | + if (!$this->_visibility_checks_added |
|
139 | 139 | && $this->hide_invisible |
140 | 140 | && !midcom::get()->config->get('show_hidden_objects')) { |
141 | 141 | $this->add_constraint('metadata.hidden', '=', false); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | // Deal with empty arrays, which would produce invalid queries |
182 | 182 | // This is done here to avoid repetitive code in callers, and because |
183 | 183 | // it's easy enough to generalize: IN empty set => always false, NOT IN empty set => always true |
184 | - if ( is_array($value) |
|
184 | + if (is_array($value) |
|
185 | 185 | && empty($value)) { |
186 | 186 | if ($operator == 'NOT IN') { |
187 | 187 | return true; |
@@ -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); |
@@ -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'); |