@@ -61,7 +61,7 @@ |
||
61 | 61 | public function get_link($key = 0, $rel = 'alternate') |
62 | 62 | { |
63 | 63 | $link = parent::get_link($key, $rel); |
64 | - if ( $rel !== 'alternate' |
|
64 | + if ($rel !== 'alternate' |
|
65 | 65 | || $key !== 0) { |
66 | 66 | return $link; |
67 | 67 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->_article = new midcom_db_article(); |
84 | 84 | $this->_article->topic = $this->_topic->id; |
85 | 85 | |
86 | - if ( array_key_exists('name', $this->_defaults) |
|
86 | + if (array_key_exists('name', $this->_defaults) |
|
87 | 87 | && $this->_defaults['name'] == 'index') { |
88 | 88 | // Store this to article directly in case name field is not editable in schema |
89 | 89 | $this->_article->name = 'index'; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | if (!$this->_article->create()) { |
93 | 93 | debug_print_r('We operated on this object:', $this->_article); |
94 | - throw new midcom_error('Failed to create a new article. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
94 | + throw new midcom_error('Failed to create a new article. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | // Callback possibility |
@@ -73,7 +73,7 @@ |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - if ( $this->_topic->can_do('midgard:update') |
|
76 | + if ($this->_topic->can_do('midgard:update') |
|
77 | 77 | && $this->_topic->can_do('midcom:component_config')) { |
78 | 78 | $buttons[] = $workflow->get_button('config/', array( |
79 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Hide the articles that have the publish time in the future and if |
43 | 43 | // the user is not administrator |
44 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
44 | + if ($this->_config->get('enable_scheduled_publishing') |
|
45 | 45 | && !midcom::get()->auth->admin) { |
46 | 46 | // Show the article only if the publishing time has passed or the viewer |
47 | 47 | // is the author |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | |
84 | 84 | private function _add_pseudo_leaves(array &$leaves) |
85 | 85 | { |
86 | - if ( $this->_config->get('archive_enable') |
|
86 | + if ($this->_config->get('archive_enable') |
|
87 | 87 | && $this->_config->get('archive_in_navigation')) { |
88 | 88 | $leaves["{$this->_topic->id}_ARCHIVE"] = array( |
89 | 89 | MIDCOM_NAV_URL => "archive/", |
90 | 90 | MIDCOM_NAV_NAME => $this->_l10n->get('archive'), |
91 | 91 | ); |
92 | 92 | } |
93 | - if ( $this->_config->get('rss_enable') |
|
93 | + if ($this->_config->get('rss_enable') |
|
94 | 94 | && $this->_config->get('feeds_in_navigation')) { |
95 | 95 | $leaves[self::LEAFID_FEEDS] = array( |
96 | 96 | MIDCOM_NAV_URL => "feeds/", |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( $this->_config->get('categories_in_navigation') |
|
101 | + if ($this->_config->get('categories_in_navigation') |
|
102 | 102 | && $this->_config->get('categories') != '') { |
103 | 103 | $categories = explode(',', $this->_config->get('categories')); |
104 | 104 | foreach ($categories as $category) { |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if ( $this->_config->get('archive_years_in_navigation') |
|
112 | + if ($this->_config->get('archive_years_in_navigation') |
|
113 | 113 | && $this->_config->get('archive_years_enable')) { |
114 | 114 | $qb = midcom_db_article::new_query_builder(); |
115 | 115 | $qb->add_constraint('topic', '=', $this->_topic->id); |
116 | 116 | |
117 | 117 | // Hide the articles that have the publish time in the future and if |
118 | 118 | // the user is not administrator |
119 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
119 | + if ($this->_config->get('enable_scheduled_publishing') |
|
120 | 120 | && !midcom::get()->auth->admin) { |
121 | 121 | // Show the article only if the publishing time has passed or the viewer |
122 | 122 | // is the author |
@@ -218,7 +218,8 @@ |
||
218 | 218 | if ($this->_config->get('comments_topic')) { |
219 | 219 | try { |
220 | 220 | $comments_topic = new midcom_db_topic($this->_config->get('comments_topic')); |
221 | - } catch (midcom_error $e) { |
|
221 | + } |
|
222 | + catch (midcom_error $e) { |
|
222 | 223 | return false; |
223 | 224 | } |
224 | 225 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $data['page_title'] = $this->_topic->extra; |
63 | 63 | |
64 | 64 | // Filter by categories |
65 | - if ( $handler_id == 'index-category' |
|
65 | + if ($handler_id == 'index-category' |
|
66 | 66 | || $handler_id == 'latest-category') { |
67 | 67 | $data['category'] = trim(strip_tags($args[0])); |
68 | 68 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | midcom::get()->head->set_pagetitle($this->_request_data['page_title']); |
112 | 112 | |
113 | 113 | // Activate correct leaf |
114 | - if ( $this->_config->get('show_navigation_pseudo_leaves') |
|
114 | + if ($this->_config->get('show_navigation_pseudo_leaves') |
|
115 | 115 | && in_array($this->_request_data['category'], $this->_request_data['categories'])) { |
116 | 116 | $this->set_active_leaf($this->_topic->id . '_CAT_' . $this->_request_data['category']); |
117 | 117 | } |
@@ -137,7 +137,7 @@ |
||
137 | 137 | |
138 | 138 | private function _verify_post_data() |
139 | 139 | { |
140 | - if ( !array_key_exists('action', $_POST) |
|
140 | + if (!array_key_exists('action', $_POST) |
|
141 | 141 | || !array_key_exists('guid', $_POST)) { |
142 | 142 | throw new midcom_error_notfound('Incomplete POST data'); |
143 | 143 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function array2data(array $array, $root_node = 'array', $prefix = '') |
82 | 82 | { |
83 | - $data = "{$prefix}<{$root_node}>\n"; |
|
83 | + $data = "{$prefix}<{$root_node}>\n"; |
|
84 | 84 | |
85 | 85 | foreach ($array as $key => $field) { |
86 | 86 | if (is_numeric($key)) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return $data; |
253 | 253 | } |
254 | 254 | |
255 | - $preg='/s:([0-9]+):"(.*?)";/ms'; |
|
255 | + $preg = '/s:([0-9]+):"(.*?)";/ms'; |
|
256 | 256 | preg_match_all($preg, $data, $matches); |
257 | 257 | $cache = array(); |
258 | 258 | |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | $theme_path = implode('/', $path_array); |
349 | 349 | $candidates = array(); |
350 | 350 | if ($substyle) { |
351 | - $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php"; |
|
351 | + $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php"; |
|
352 | 352 | } |
353 | 353 | if ($page) { |
354 | - $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php"; |
|
354 | + $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php"; |
|
355 | 355 | } |
356 | 356 | |
357 | - $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php"; |
|
357 | + $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php"; |
|
358 | 358 | |
359 | 359 | foreach (array_filter($candidates, 'file_exists') as $candidate) { |
360 | 360 | return file_get_contents($candidate); |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | if (is_null($name_property)) { |
37 | 37 | $name_property = midcom_helper_reflector::get_name_property($this->_object); |
38 | 38 | } |
39 | - if ( empty($name_property) |
|
39 | + if (empty($name_property) |
|
40 | 40 | || !midcom::get()->dbfactory->property_exists($this->_object, $name_property)) { |
41 | 41 | // Could not resolve valid property |
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | // Make copy via typecast, very important or we might accidentally manipulate the given object |
45 | - return (string)$this->_object->{$name_property}; |
|
45 | + return (string) $this->_object->{$name_property}; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function name_is_unique_or_empty() |
130 | 130 | { |
131 | 131 | $name_copy = $this->get_object_name(); |
132 | - if ( empty($name_copy) |
|
132 | + if (empty($name_copy) |
|
133 | 133 | && $name_copy !== false) { |
134 | 134 | // Allow empty string name |
135 | 135 | return true; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $qb->add_constraint($child_name_property, '=', $name_copy); |
212 | 212 | if ($qb->count()) { |
213 | - debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
213 | + debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | $qb->add_constraint($child_name_property, '=', $name_copy); |
243 | 243 | if ($qb->count()) { |
244 | - debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
244 | + debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $name_prop = midcom_helper_reflector::get_name_property($this->_object); |
275 | 275 | |
276 | 276 | if (!empty($original_name)) { |
277 | - $current_name = (string)$original_name; |
|
277 | + $current_name = (string) $original_name; |
|
278 | 278 | } else { |
279 | 279 | // Empty name, try to generate from title |
280 | 280 | $title_copy = midcom_helper_reflector::get_object_title($this->_object, $title_property); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | } while (!$this->name_is_unique()); |
320 | 320 | |
321 | 321 | // Get a copy of the current, usable name |
322 | - $ret = (string)$this->_object->{$name_prop}; |
|
322 | + $ret = (string) $this->_object->{$name_prop}; |
|
323 | 323 | // Restore the original name |
324 | 324 | $this->_object->{$name_prop} = $original_name; |
325 | 325 | return $ret; |