@@ -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_helper_reflector::get($this->_object)->property_exists($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; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | |
432 | 432 | $label_prop = $this->get_label_property(); |
433 | 433 | |
434 | - if ( is_string($label_prop) |
|
434 | + if (is_string($label_prop) |
|
435 | 435 | && $label_prop != 'guid' |
436 | 436 | && $this->_mgd_reflector->property_exists($label_prop)) { |
437 | 437 | $search_properties[$label_prop] = true; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | continue; |
493 | 493 | } |
494 | 494 | |
495 | - if ( !$ref->is_link($property) |
|
495 | + if (!$ref->is_link($property) |
|
496 | 496 | && $ref->get_midgard_type($property) != MGD_TYPE_GUID) { |
497 | 497 | continue; |
498 | 498 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | return $schema_type; |
557 | 557 | } |
558 | 558 | } |
559 | - if ( isset($extends[$schema_type]) |
|
559 | + if (isset($extends[$schema_type]) |
|
560 | 560 | && class_exists($extends[$schema_type])) { |
561 | 561 | return $extends[$schema_type]; |
562 | 562 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | { |
577 | 577 | $one = self::resolve_baseclass($class_one); |
578 | 578 | $two = self::resolve_baseclass($class_two); |
579 | - return ( $one == $two |
|
579 | + return ($one == $two |
|
580 | 580 | || self::class_rewrite($one) == $two |
581 | 581 | || $one == self::class_rewrite($two)); |
582 | 582 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | // Check for decorators first |
636 | 636 | if (!empty($class_instance->__mgdschema_class_name__)) { |
637 | 637 | $parent_class = $class_instance->__mgdschema_class_name__; |
638 | - if ( !empty($class_instance->__object) |
|
638 | + if (!empty($class_instance->__object) |
|
639 | 639 | && !$class_instance->__object instanceof $class_instance->__mgdschema_class_name__) { |
640 | 640 | $parent_class = get_class($class_instance->__object); |
641 | 641 | debug_add('mgdschema object class ' . $parent_class . ' is not an instance of ' . $class_instance->__mgdschema_class_name__, MIDCOM_LOG_INFO); |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | $name_exceptions = $this->_config->get('name_exceptions'); |
671 | 671 | foreach ($name_exceptions as $class => $property) { |
672 | 672 | if (midcom::get()->dbfactory->is_a($object, $class)) { |
673 | - if ( $property !== false |
|
673 | + if ($property !== false |
|
674 | 674 | && !$this->_mgd_reflector->property_exists($property)) { |
675 | 675 | debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR); |
676 | 676 | self::$_cache['name'][$key] = false; |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | if (is_null($title_property)) { |
727 | 727 | $title_property = self::get_title_property($object); |
728 | 728 | } |
729 | - if ( empty($title_property) |
|
729 | + if (empty($title_property) |
|
730 | 730 | || !self::get($object)->property_exists($title_property)) { |
731 | 731 | // Could not resolve valid property |
732 | 732 | return false; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | |
774 | 774 | foreach ($title_exceptions as $class => $property) { |
775 | 775 | if (midcom::get()->dbfactory->is_a($object, $class)) { |
776 | - if ( $property !== false |
|
776 | + if ($property !== false |
|
777 | 777 | && !$this->_mgd_reflector->property_exists($property)) { |
778 | 778 | debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR); |
779 | 779 | self::$_cache['title'][$key] = false; |
@@ -239,7 +239,8 @@ discard block |
||
239 | 239 | // Not a MidCOM DBA object |
240 | 240 | try { |
241 | 241 | $obj = midcom::get()->dbfactory->convert_midgard_to_midcom($object); |
242 | - } catch (midcom_error $e) { |
|
242 | + } |
|
243 | + catch (midcom_error $e) { |
|
243 | 244 | return false; |
244 | 245 | } |
245 | 246 | } else { |
@@ -702,7 +703,8 @@ discard block |
||
702 | 703 | if (!isset(self::$_cache['name'][$key])) { |
703 | 704 | try { |
704 | 705 | self::$_cache['name'][$key] = self::get($object)->get_name_property_nonstatic($object); |
705 | - } catch (midcom_error $e) { |
|
706 | + } |
|
707 | + catch (midcom_error $e) { |
|
706 | 708 | debug_add('Could not get reflector instance for class ' . $key . ': ' . $e->getMessage(), MIDCOM_LOG_ERROR); |
707 | 709 | self::$_cache['name'][$key] = null; |
708 | 710 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | public function number($value, $precision = 2) |
31 | 31 | { |
32 | - if ( is_float($value) |
|
32 | + if (is_float($value) |
|
33 | 33 | && version_compare(Intl::getIcuVersion(), '49', '<')) { |
34 | 34 | // workaround for http://bugs.icu-project.org/trac/ticket/8561 |
35 | 35 | if ($precision == 0) { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | that is populated only once, and even then only the |
130 | 130 | first time we encounter a namespaced wikilink */ |
131 | 131 | static $folder_tree = []; |
132 | - if ( count($folder_tree) == 0 |
|
132 | + if (count($folder_tree) == 0 |
|
133 | 133 | || $force_resolve_folder_tree) { |
134 | 134 | $folder_tree = $this->_resolve_folder_tree($force_as_root); |
135 | 135 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $localpath = $path; |
160 | 160 | $matches['latest_parent'] = $folder_tree['/']; |
161 | 161 | $missing_levels = 0; |
162 | - while ( $localpath |
|
162 | + while ($localpath |
|
163 | 163 | && $localpath != '/') { |
164 | 164 | $localpath = dirname($localpath); |
165 | 165 | $missing_levels++; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $root_folder = $folder; |
188 | 188 | $max = 100; |
189 | - while ( $folder[MIDCOM_NAV_COMPONENT] == 'net.nemein.wiki' |
|
189 | + while ($folder[MIDCOM_NAV_COMPONENT] == 'net.nemein.wiki' |
|
190 | 190 | && (($parent = $nap->get_node_uplink($folder[MIDCOM_NAV_ID])) != -1) |
191 | 191 | && $max > 0) { |
192 | 192 | $root_folder = $folder; |
@@ -25,7 +25,8 @@ |
||
25 | 25 | { |
26 | 26 | try { |
27 | 27 | $viewer->register_plugin_namespace('__feeds', ['rss' => ['class' => __CLASS__]]); |
28 | - } catch (midcom_error $e) { |
|
28 | + } |
|
29 | + catch (midcom_error $e) { |
|
29 | 30 | $e->log(); |
30 | 31 | } |
31 | 32 | } |
@@ -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"] = [ |
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] = [ |
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 |
@@ -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/', [ |
79 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $this->load_comment($args[0], false); |
40 | 40 | $moderators = $this->_config->get('moderators'); |
41 | - if ( $this->_comment->report_abuse() |
|
41 | + if ($this->_comment->report_abuse() |
|
42 | 42 | && $moderators) { |
43 | 43 | // Prepare notification message |
44 | 44 | $message = []; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $message['content'] = ''; |
47 | 47 | $logs = $this->_comment->get_logs(); |
48 | 48 | if (count($logs) > 0) { |
49 | - $message['content'] .= $this->_l10n->get('moderation history').":\n\n"; |
|
49 | + $message['content'] .= $this->_l10n->get('moderation history') . ":\n\n"; |
|
50 | 50 | foreach ($logs as $time => $log) { |
51 | 51 | $reported = $this->_l10n->get_formatter()->datetime(strtotime("{$time}Z")); |
52 | 52 | $message['content'] .= $this->_l10n->get(sprintf('%s: %s by %s (from %s)', "$reported:\n", $this->_l10n->get($log['action']), $log['reporter'], $log['ip'])) . "\n\n"; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->_comment = new net_nehmer_comments_comment($identifier); |
120 | 120 | |
121 | 121 | if (!$this->_comment->can_do('midgard:update')) { |
122 | - $this->_comment->_sudo_requested = midcom::get()->auth->request_sudo('net.nehmer.comments');; |
|
122 | + $this->_comment->_sudo_requested = midcom::get()->auth->request_sudo('net.nehmer.comments'); ; |
|
123 | 123 | } |
124 | 124 | if ($require_moderation_privilege) { |
125 | 125 | $this->_comment->require_do('net.nehmer.comments:moderation'); |
@@ -94,7 +94,7 @@ |
||
94 | 94 | 'midcom' => [ |
95 | 95 | 'style-init' => '', |
96 | 96 | 'style-finish' => '', |
97 | - ] |
|
97 | + ] |
|
98 | 98 | ], |
99 | 99 | 'nodes' => [], |
100 | 100 | ]; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct(array &$data) |
24 | 24 | { |
25 | - $this->_data =& $data; |
|
25 | + $this->_data = & $data; |
|
26 | 26 | midcom::get()->head->enable_jquery_ui(['accordion']); |
27 | 27 | } |
28 | 28 | |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if ( midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_style') |
|
37 | - && ( $this->_data['handler_id'] !== '____mfa-asgard-object_create' |
|
36 | + if (midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_style') |
|
37 | + && ($this->_data['handler_id'] !== '____mfa-asgard-object_create' |
|
38 | 38 | || $this->_data['current_type'] == 'midgard_element')) { |
39 | 39 | $help_element = $this->_get_help_style_elementnames($this->_data['object']); |
40 | - } elseif ( midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_element') |
|
40 | + } elseif (midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_element') |
|
41 | 41 | && $this->_data['handler_id'] !== '____mfa-asgard-object_create') { |
42 | 42 | $help_element = $this->_get_help_element(); |
43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | private function _get_help_element() |
51 | 51 | { |
52 | - if ( empty($this->_data['object']->name) |
|
52 | + if (empty($this->_data['object']->name) |
|
53 | 53 | || empty($this->_data['object']->style)) { |
54 | 54 | // We cannot help with empty elements |
55 | 55 | return; |