@@ -50,12 +50,12 @@ |
||
50 | 50 | */ |
51 | 51 | public static function compile(string $content) : string |
52 | 52 | { |
53 | - return preg_replace_callback("%&\(([^)]*)\);%i", function ($variable) |
|
53 | + return preg_replace_callback("%&\(([^)]*)\);%i", function($variable) |
|
54 | 54 | { |
55 | 55 | $parts = explode(':', $variable[1]); |
56 | 56 | $variable = '$' . str_replace('.', '->', $parts[0]); |
57 | 57 | |
58 | - if ( isset($parts[1]) |
|
58 | + if (isset($parts[1]) |
|
59 | 59 | && array_key_exists($parts[1], self::$_filters)) { |
60 | 60 | if ($parts[1] == 'p') { |
61 | 61 | $command = 'eval(\'?>\' . ' . $variable . ')'; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | $count = count($data['navigation_items']); |
5 | 5 | |
6 | 6 | foreach ($data['navigation_items'] as $i => $item) { |
7 | - if ( isset($item[MIDCOM_NAV_SORTABLE]) |
|
7 | + if (isset($item[MIDCOM_NAV_SORTABLE]) |
|
8 | 8 | && !$item[MIDCOM_NAV_SORTABLE]) { |
9 | 9 | continue; |
10 | 10 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $style = ''; |
16 | 16 | |
17 | 17 | // Skip all components that return the default icon |
18 | - if ( isset($item[MIDCOM_NAV_COMPONENT]) |
|
18 | + if (isset($item[MIDCOM_NAV_COMPONENT]) |
|
19 | 19 | && ($tmp = midcom::get()->componentloader->get_component_icon($item[MIDCOM_NAV_COMPONENT], false))) { |
20 | 20 | $icon = '<i class="fa fa-' . $tmp . '"></i>'; |
21 | 21 | } elseif (!$item[MIDCOM_NAV_GUID]) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | protected function match(string $property, array $data1, array $data2) : bool |
115 | 115 | { |
116 | - if ( !empty($data1[$property]) |
|
116 | + if (!empty($data1[$property]) |
|
117 | 117 | && $data1[$property] == $data2[$property]) { |
118 | 118 | return true; |
119 | 119 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | continue; |
196 | 196 | } |
197 | 197 | |
198 | - if ( $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
198 | + if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
199 | 199 | || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid)) { |
200 | 200 | // Not-duplicate parameter found, returning zero probability |
201 | 201 | continue; |
@@ -190,7 +190,8 @@ |
||
190 | 190 | try { |
191 | 191 | $obj1 = $this->load($arr1['guid']); |
192 | 192 | $obj2 = $this->load($arr2['guid']); |
193 | - } catch (midcom_error $e) { |
|
193 | + } |
|
194 | + catch (midcom_error $e) { |
|
194 | 195 | $e->log(); |
195 | 196 | continue; |
196 | 197 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | // if user's lastname is part of the email address, check to see if the difference is only in the domain part |
43 | 43 | $email1 = preg_replace('/@.+/', '', $person1['email']); |
44 | 44 | $email2 = preg_replace('/@.+/', '', $person2['email']); |
45 | - if ( str_contains($email1, $person1['lastname']) |
|
45 | + if (str_contains($email1, $person1['lastname']) |
|
46 | 46 | && $email1 == $email2) { |
47 | 47 | $p += 0.5; |
48 | 48 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | private function load_next() |
61 | 61 | { |
62 | - $i =& $this->_request_data['loop_i']; |
|
62 | + $i = & $this->_request_data['loop_i']; |
|
63 | 63 | while ($i < 100) { |
64 | 64 | debug_add("Loop iteration {$i}"); |
65 | 65 | $qb = new midgard_query_builder('midgard_parameter'); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | // Make sure we actually have enough rights to do this |
90 | - if ( !$object1->can_do('midgard:update') |
|
90 | + if (!$object1->can_do('midgard:update') |
|
91 | 91 | || !$object1->can_do('midgard:delete') |
92 | 92 | || !$object2->can_do('midgard:update') |
93 | 93 | || !$object2->can_do('midgard:delete')) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
99 | - if ( $object1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $object2->guid) |
|
99 | + if ($object1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $object2->guid) |
|
100 | 100 | || $object2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $object1->guid)) { |
101 | 101 | debug_add("It seems these two (#{$object1->id} and #{$object2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
102 | 102 | $i++; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if ($keep == 'both') { |
129 | 129 | $option1->require_do('midgard:update'); |
130 | 130 | $option2->require_do('midgard:update'); |
131 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
131 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
132 | 132 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) { |
133 | 133 | // Clear the possible duplicate parameters |
134 | 134 | $option1->delete_parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid); |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | } |
147 | 147 | } else { |
148 | 148 | if ($keep == $option1->guid) { |
149 | - $object1 =& $option1; |
|
150 | - $object2 =& $option2; |
|
149 | + $object1 = & $option1; |
|
150 | + $object2 = & $option2; |
|
151 | 151 | } elseif ($keep == $option2->guid) { |
152 | - $object1 =& $option2; |
|
153 | - $object2 =& $option1; |
|
152 | + $object1 = & $option2; |
|
153 | + $object2 = & $option1; |
|
154 | 154 | } else { |
155 | 155 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
156 | 156 | } |
@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | try { |
83 | 83 | $object1 = $this->load($param->parentguid); |
84 | 84 | $object2 = $this->load($param->name); |
85 | - } catch (midcom_error) { |
|
85 | + } |
|
86 | + catch (midcom_error) { |
|
86 | 87 | $i++; |
87 | 88 | continue; |
88 | 89 | } |
@@ -160,7 +161,8 @@ discard block |
||
160 | 161 | try { |
161 | 162 | $merger = new org_openpsa_contacts_duplicates_merge($this->mode, $this->_config); |
162 | 163 | $merger->merge_delete($object1, $object2); |
163 | - } catch (midcom_error $e) { |
|
164 | + } |
|
165 | + catch (midcom_error $e) { |
|
164 | 166 | // TODO: Localize |
165 | 167 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
166 | 168 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | if ($path === '') { |
66 | 66 | // Infinite loop, set an UI message and stop executing |
67 | - if ( !isset($schema['extends']['name']) |
|
67 | + if (!isset($schema['extends']['name']) |
|
68 | 68 | || $schema['extends']['name'] === $schema_name) { |
69 | 69 | throw new midcom_error('schema ' . $schema_name . ' extends itself'); |
70 | 70 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function _on_creating() : bool |
27 | 27 | { |
28 | - if ( !$this->referrer |
|
28 | + if (!$this->referrer |
|
29 | 29 | && !empty($_SERVER['HTTP_REFERER'])) { |
30 | 30 | $this->referrer = $_SERVER['HTTP_REFERER']; |
31 | 31 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function _on_creating() : bool |
42 | 42 | { |
43 | - return ( $this->validate_tag($this->tag) |
|
43 | + return ($this->validate_tag($this->tag) |
|
44 | 44 | && $this->_check_duplicates() == 0); |
45 | 45 | } |
46 | 46 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function _on_updating() : bool |
71 | 71 | { |
72 | - return ( $this->validate_tag($this->tag) |
|
72 | + return ($this->validate_tag($this->tag) |
|
73 | 73 | && $this->_check_duplicates() == 0); |
74 | 74 | } |
75 | 75 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $this->save_attachment_list(); |
57 | 57 | } |
58 | 58 | |
59 | - if ( array_intersect_key(array_flip(['description', 'title', 'score']), $this->value) |
|
59 | + if (array_intersect_key(array_flip(['description', 'title', 'score']), $this->value) |
|
60 | 60 | && $main = $this->get_main()) { |
61 | 61 | $needs_update = false; |
62 | 62 | if (array_key_exists('description', $this->value)) { |