@@ -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 |
@@ -196,7 +196,8 @@ |
||
196 | 196 | |
197 | 197 | try { |
198 | 198 | $diff_fields = $rcs_handler->get_diff($prev_version, $this_version, 'unified'); |
199 | - } catch (midcom_error $e) { |
|
199 | + } |
|
200 | + catch (midcom_error $e) { |
|
200 | 201 | $e->log(); |
201 | 202 | return ''; |
202 | 203 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | public function _on_creating() |
31 | 31 | { |
32 | - if ( $this->title == '' |
|
32 | + if ($this->title == '' |
|
33 | 33 | || !$this->topic) { |
34 | 34 | // We must have wikiword and topic at this stage |
35 | 35 | return false; |
@@ -63,7 +63,8 @@ |
||
63 | 63 | |
64 | 64 | try { |
65 | 65 | $attachment = new midcom_db_attachment($guid); |
66 | - } catch (midcom_error $e) { |
|
66 | + } |
|
67 | + catch (midcom_error $e) { |
|
67 | 68 | $e->log(); |
68 | 69 | return "<span class=\"missing_photo\" title=\"{$guid}\">{$fulltag}</span>{$after}"; |
69 | 70 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | return $this->render_link($parts[1], $parts[2]) . $after; |
225 | 225 | |
226 | 226 | // Macro [something: <data>] (for example [abbr: BOFH - Bastard Operator From Hell] or [photo: <GUID>]) |
227 | - case ( preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
227 | + case (preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
228 | 228 | && method_exists($this, "_run_macro_{$macro_parts[1]}")): |
229 | 229 | $method = "_run_macro_{$macro_parts[1]}"; |
230 | 230 | return $this->$method($macro_parts[2], $match[0], $after); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $folder = $wikipage_match['latest_parent']; |
258 | 258 | } |
259 | 259 | |
260 | - if ( isset($folder[MIDCOM_NAV_OBJECT]) |
|
260 | + if (isset($folder[MIDCOM_NAV_OBJECT]) |
|
261 | 261 | && $folder[MIDCOM_NAV_OBJECT]->can_do('midgard:create')) { |
262 | 262 | $workflow = $this->get_workflow('datamanager'); |
263 | 263 | return "<a href=\"{$folder[MIDCOM_NAV_ABSOLUTEURL]}create/?wikiword={$wikipage_match['remaining_path']}\" " . $workflow->render_attributes() . " class=\"wiki_missing\" title=\"" . $this->_l10n->get('click to create') . "\">{$text}</a>"; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $links[$parts[1]] = $parts[2]; |
301 | 301 | break; |
302 | 302 | // Ignore macros [something: <data>] (for example [abbr: BOFH - Bastard Operator From Hell] or [photo: <GUID>]) |
303 | - case ( preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
303 | + case (preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
304 | 304 | && method_exists($this, "_run_macro_{$macro_parts[1]}")): |
305 | 305 | continue 2; |
306 | 306 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $etag = trim($parser->data['headers']['etag']); |
102 | 102 | |
103 | 103 | $feed_etag = $this->_feed->get_parameter('net.nemein.rss', 'etag'); |
104 | - if ( !empty($feed_etag) |
|
104 | + if (!empty($feed_etag) |
|
105 | 105 | && $feed_etag == $etag) { |
106 | 106 | // Feed hasn't changed, skip updating |
107 | 107 | debug_add("Feed {$this->_feed->url} has not changed since " . date('c', $this->_feed->latestfetch), MIDCOM_LOG_WARN); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $guid = $item->get_id(); |
188 | 188 | $title = $item->get_title(); |
189 | 189 | |
190 | - if ( ( empty($title) |
|
190 | + if ((empty($title) |
|
191 | 191 | || trim($title) == '...') |
192 | 192 | && empty($guid)) { |
193 | 193 | // Something wrong with this entry, skip it |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $meta_values['published'] = $article_date; |
256 | 256 | } |
257 | 257 | |
258 | - if ( $this->apply_values($article, $values, $meta_values) |
|
258 | + if ($this->apply_values($article, $values, $meta_values) |
|
259 | 259 | && !$article->update()) { |
260 | 260 | return false; |
261 | 261 | } |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | private function find_author(net_nemein_rss_parser_item $item) |
285 | 285 | { |
286 | 286 | // Try to figure out item author |
287 | - if ( $this->_feed->forceauthor |
|
287 | + if ($this->_feed->forceauthor |
|
288 | 288 | && $this->_feed->defaultauthor) { |
289 | 289 | // Feed has a "default author" set, use it |
290 | 290 | return new midcom_db_person($this->_feed->defaultauthor); |
291 | 291 | } |
292 | 292 | $author = $this->match_item_author($item); |
293 | 293 | $fallback_person_id = 1; |
294 | - if ( !$author |
|
294 | + if (!$author |
|
295 | 295 | || $author->id == $fallback_person_id) { |
296 | 296 | if ($this->_feed->defaultauthor) { |
297 | 297 | // Feed has a "default author" set, use it |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | - if ( !empty($author_info['username']) |
|
480 | + if (!empty($author_info['username']) |
|
481 | 481 | && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) { |
482 | 482 | return $person->get_storage(); |
483 | 483 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $qb->add_constraint('name', '<>', ''); |
47 | 47 | |
48 | 48 | // Unless in Auto-Index mode or the index article is hidden, we skip the index article. |
49 | - if ( !$this->_config->get('autoindex') |
|
49 | + if (!$this->_config->get('autoindex') |
|
50 | 50 | && !$this->_config->get('indexinnav')) { |
51 | 51 | $qb->add_constraint('name', '<>', 'index'); |
52 | 52 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // Check if we have an uploaded file |
70 | - if ( isset($_FILES['midgard_admin_asgard_file']) |
|
70 | + if (isset($_FILES['midgard_admin_asgard_file']) |
|
71 | 71 | && is_uploaded_file($_FILES['midgard_admin_asgard_file']['tmp_name'])) { |
72 | 72 | return $this->_process_file_upload($_FILES['midgard_admin_asgard_file']); |
73 | 73 | } |
@@ -86,19 +86,19 @@ discard block |
||
86 | 86 | |
87 | 87 | $needs_update = false; |
88 | 88 | |
89 | - if ( !empty($_POST['midgard_admin_asgard_filename']) |
|
89 | + if (!empty($_POST['midgard_admin_asgard_filename']) |
|
90 | 90 | && $local_file->name != $_POST['midgard_admin_asgard_filename']) { |
91 | 91 | $local_file->name = $_POST['midgard_admin_asgard_filename']; |
92 | 92 | $needs_update = true; |
93 | 93 | } |
94 | 94 | |
95 | - if ( !empty($_POST['midgard_admin_asgard_mimetype']) |
|
95 | + if (!empty($_POST['midgard_admin_asgard_mimetype']) |
|
96 | 96 | && $local_file->mimetype != $_POST['midgard_admin_asgard_mimetype']) { |
97 | 97 | $local_file->mimetype = $_POST['midgard_admin_asgard_mimetype']; |
98 | 98 | $needs_update = true; |
99 | 99 | } |
100 | 100 | |
101 | - if ( $needs_update |
|
101 | + if ($needs_update |
|
102 | 102 | && !$local_file->update()) { |
103 | 103 | return false; |
104 | 104 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $this->bind_view_to_object($this->_file); |
233 | 233 | |
234 | 234 | $filename = $this->_process_form(); |
235 | - if ( $filename |
|
235 | + if ($filename |
|
236 | 236 | && $filename != $data['filename']) { |
237 | 237 | return new midcom_response_relocate("__mfa/asgard/object/attachments/{$this->_object->guid}/{$filename}/"); |
238 | 238 | } |
@@ -109,8 +109,8 @@ |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | $help = new midcom_admin_help_help(); |
112 | - $this->_request_data['help'] = $help->get_help_contents('asgard_'.$this->type, $help_component); |
|
113 | - $this->_request_data['component'] = $component; |
|
112 | + $this->_request_data['help'] = $help->get_help_contents('asgard_' . $this->type, $help_component); |
|
113 | + $this->_request_data['component'] = $component; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $data['reflector'] = midcom_helper_reflector::get($data['type']); |
97 | 97 | $data['label_property'] = $data['reflector']->get_label_property(); |
98 | 98 | |
99 | - if ( isset($_POST['undelete']) |
|
99 | + if (isset($_POST['undelete']) |
|
100 | 100 | && is_array($_POST['undelete'])) { |
101 | 101 | if (isset($_POST['purge'])) { |
102 | 102 | $this->_purge(); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // List installed MgdSchema types and convert to DBA classes |
22 | 22 | foreach ($this->_request_data['schema_types'] as $schema_type) { |
23 | - if ( !is_null($type) |
|
23 | + if (!is_null($type) |
|
24 | 24 | && $schema_type != $type) { |
25 | 25 | // Skip |
26 | 26 | continue; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $qb->add_constraint('metadata.revised', '>=', $since); |
50 | 50 | } |
51 | 51 | |
52 | - if ( $only_mine |
|
52 | + if ($only_mine |
|
53 | 53 | && midcom::get()->auth->user) { |
54 | 54 | $qb->add_constraint('metadata.authors', 'LIKE', '|' . midcom::get()->auth->user->guid . '|'); |
55 | 55 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $data['view_title'] = $this->_l10n->get('asgard'); |
95 | 95 | |
96 | - if ( isset($_POST['execute_mass_action']) |
|
96 | + if (isset($_POST['execute_mass_action']) |
|
97 | 97 | && !empty($_POST['selections']) |
98 | 98 | && isset($_POST['mass_action'])) { |
99 | 99 | $method_name = "_mass_{$_POST['mass_action']}"; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | $data['review_by'] = null; |
111 | - if ( $this->_config->get('enable_review_dates') |
|
111 | + if ($this->_config->get('enable_review_dates') |
|
112 | 112 | && isset($_REQUEST['review_by']) |
113 | 113 | && $_REQUEST['review_by'] != 'any') { |
114 | 114 | $data['review_by'] = (int) $_REQUEST['review_by']; |
115 | 115 | } |
116 | 116 | |
117 | 117 | $data['type_filter'] = null; |
118 | - if ( isset($_REQUEST['type_filter']) |
|
118 | + if (isset($_REQUEST['type_filter']) |
|
119 | 119 | && $_REQUEST['type_filter'] != 'any') { |
120 | 120 | $data['type_filter'] = $_REQUEST['type_filter']; |
121 | 121 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | continue; |
275 | 275 | } |
276 | 276 | |
277 | - if ( $object->can_do('midgard:update') |
|
277 | + if ($object->can_do('midgard:update') |
|
278 | 278 | && $object->can_do('midcom:approve')) { |
279 | 279 | $object->metadata->approve(); |
280 | 280 | midcom::get()->uimessages->add($this->_l10n->get('midgard.admin.asgard'), sprintf($this->_l10n->get('object %s approved'), $object->guid)); |
@@ -147,7 +147,8 @@ discard block |
||
147 | 147 | foreach ($activities as $activity) { |
148 | 148 | try { |
149 | 149 | $object = midcom::get()->dbfactory->get_object_by_guid($activity->target); |
150 | - } catch (midcom_error $e) { |
|
150 | + } |
|
151 | + catch (midcom_error $e) { |
|
151 | 152 | if (midcom_connection::get_error() == MGD_ERR_OBJECT_DELETED) { |
152 | 153 | // TODO: Visualize deleted objects somehow |
153 | 154 | } |
@@ -155,7 +156,8 @@ discard block |
||
155 | 156 | } |
156 | 157 | try { |
157 | 158 | $actor = midcom_db_person::get_cached($activity->actor); |
158 | - } catch (midcom_error $e) { |
|
159 | + } |
|
160 | + catch (midcom_error $e) { |
|
159 | 161 | $actor = null; |
160 | 162 | } |
161 | 163 | |
@@ -253,7 +255,8 @@ discard block |
||
253 | 255 | foreach ($guids as $guid) { |
254 | 256 | try { |
255 | 257 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
256 | - } catch (midcom_error $e) { |
|
258 | + } |
|
259 | + catch (midcom_error $e) { |
|
257 | 260 | continue; |
258 | 261 | } |
259 | 262 | |
@@ -270,7 +273,8 @@ discard block |
||
270 | 273 | foreach ($guids as $guid) { |
271 | 274 | try { |
272 | 275 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
273 | - } catch (midcom_error $e) { |
|
276 | + } |
|
277 | + catch (midcom_error $e) { |
|
274 | 278 | continue; |
275 | 279 | } |
276 | 280 |