@@ -114,7 +114,8 @@ discard block |
||
114 | 114 | |
115 | 115 | try { |
116 | 116 | $person = org_openpsa_contacts_person_dba::get_cached($src); |
117 | - } catch (midcom_error $e) { |
|
117 | + } |
|
118 | + catch (midcom_error $e) { |
|
118 | 119 | $widget = new self(); |
119 | 120 | $cache[$src] = $widget; |
120 | 121 | return $widget; |
@@ -323,7 +324,8 @@ discard block |
||
323 | 324 | foreach ($memberships as $data) { |
324 | 325 | try { |
325 | 326 | $group = org_openpsa_contacts_group_dba::get_cached($data['gid']); |
326 | - } catch (midcom_error $e) { |
|
327 | + } |
|
328 | + catch (midcom_error $e) { |
|
327 | 329 | $e->log(); |
328 | 330 | continue; |
329 | 331 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | private function read_object($person) |
138 | 138 | { |
139 | - if ( !is_object($person) |
|
139 | + if (!is_object($person) |
|
140 | 140 | || !$person instanceof midcom_db_person) { |
141 | 141 | // Given $person is not one |
142 | 142 | return false; |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - if ( $this->_config->get('jabber_enable_presence') |
|
163 | + if ($this->_config->get('jabber_enable_presence') |
|
164 | 164 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
165 | 165 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
166 | 166 | } |
167 | 167 | |
168 | - if ( $this->_config->get('skype_enable_presence') |
|
168 | + if ($this->_config->get('skype_enable_presence') |
|
169 | 169 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
170 | 170 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
171 | 171 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | if (!empty($attachments[$type])) { |
205 | 205 | return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">'; |
206 | 206 | } |
207 | - if ( $this->_config->get('gravatar_enable') |
|
207 | + if ($this->_config->get('gravatar_enable') |
|
208 | 208 | && !empty($this->contact_details['email'])) { |
209 | 209 | $size = ($type == 'view') ? 500 : 32; |
210 | 210 | $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon'; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | private function _show_groups() |
316 | 316 | { |
317 | - if ( !$this->show_groups |
|
317 | + if (!$this->show_groups |
|
318 | 318 | || empty($this->contact_details['id'])) { |
319 | 319 | return; |
320 | 320 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $default_shown = true; |
380 | 380 | $cards_to_show[] = $cardname; |
381 | 381 | } |
382 | - } elseif ( $customer->$property |
|
382 | + } elseif ($customer->$property |
|
383 | 383 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
384 | 384 | $inherited_cards_only = false; |
385 | 385 | $multiple_addresses = true; |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | |
401 | 401 | foreach ($cards_to_show as $cardname) { |
402 | 402 | echo '<div class="vcard">'; |
403 | - if ( $multiple_addresses |
|
404 | - || ( $cardname != 'visiting' |
|
403 | + if ($multiple_addresses |
|
404 | + || ($cardname != 'visiting' |
|
405 | 405 | && !$inherited_cards_only)) { |
406 | 406 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
407 | 407 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | public function _on_reindex($topic, $config, &$indexer) |
52 | 52 | { |
53 | - if ( !$config->get('index_products') |
|
53 | + if (!$config->get('index_products') |
|
54 | 54 | && !$config->get('index_groups')) { |
55 | 55 | debug_add("No indexing to groups and products, skipping", MIDCOM_LOG_WARN); |
56 | 56 | return true; |
@@ -83,7 +83,8 @@ discard block |
||
83 | 83 | try { |
84 | 84 | $dms['group']->set_storage($group); |
85 | 85 | org_openpsa_products_viewer::index($dms['group'], $indexer, $topic, $config); |
86 | - } catch (midcom_error $e) { |
|
86 | + } |
|
87 | + catch (midcom_error $e) { |
|
87 | 88 | $e->log(MIDCOM_LOG_WARN); |
88 | 89 | } |
89 | 90 | } |
@@ -96,7 +97,8 @@ discard block |
||
96 | 97 | try { |
97 | 98 | $dms['product']->set_storage($product); |
98 | 99 | org_openpsa_products_viewer::index($dms['product'], $indexer, $topic, $config); |
99 | - } catch (midcom_error $e) { |
|
100 | + } |
|
101 | + catch (midcom_error $e) { |
|
100 | 102 | $e->log(MIDCOM_LOG_WARN); |
101 | 103 | } |
102 | 104 | } |
@@ -57,7 +57,8 @@ discard block |
||
57 | 57 | try { |
58 | 58 | midcom::get()->dynamic_load($batch_url); |
59 | 59 | $ret = true; |
60 | - } catch (midcom_error $e) { |
|
60 | + } |
|
61 | + catch (midcom_error $e) { |
|
61 | 62 | $ret = $e->getMessage(); |
62 | 63 | } |
63 | 64 | ob_end_clean(); |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | midcom::get()->auth->request_sudo($this->_component); |
84 | 85 | try { |
85 | 86 | $campaign = new org_openpsa_directmarketing_campaign_dba($args['campaign_guid']); |
86 | - } catch (midcom_error $e) { |
|
87 | + } |
|
88 | + catch (midcom_error $e) { |
|
87 | 89 | $handler->print_error("{$args['campaign_guid']} is not a valid campaign GUID"); |
88 | 90 | return false; |
89 | 91 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function _on_watched_dba_delete(midcom_core_dbaobject $object) |
18 | 18 | { |
19 | 19 | $qb = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
20 | - if ( $object instanceof midcom_db_person |
|
20 | + if ($object instanceof midcom_db_person |
|
21 | 21 | || $object instanceof org_openpsa_contacts_person_dba) { |
22 | 22 | $qb->add_constraint('person', '=', $object->id); |
23 | 23 | } elseif ($object instanceof org_openpsa_directmarketing_campaign_dba) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function background_send_message(array $args, midcom_baseclasses_components_cron_handler $handler) |
44 | 44 | { |
45 | - if ( !isset($args['url_base']) |
|
45 | + if (!isset($args['url_base']) |
|
46 | 46 | || !isset($args['batch'])) { |
47 | 47 | $handler->print_error('url_base or batch number not set, aborting'); |
48 | 48 | return false; |
@@ -269,7 +269,8 @@ |
||
269 | 269 | $guid = $mc_parameter->get_subkey($parameter_key, 'parentguid'); |
270 | 270 | try { |
271 | 271 | $parent = midcom::get()->dbfactory->get_object_by_guid($guid); |
272 | - } catch (midcom_error $e) { |
|
272 | + } |
|
273 | + catch (midcom_error $e) { |
|
273 | 274 | $e->log(); |
274 | 275 | continue; |
275 | 276 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | private function add_misc_rule(array $rule, $class, $person_property) |
315 | 315 | { |
316 | - $persons = [ 0 => -1]; |
|
316 | + $persons = [0 => -1]; |
|
317 | 317 | $match = $rule['match']; |
318 | 318 | $constraint_match = "IN"; |
319 | 319 | if ($rule['match'] == '<>') { |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $ret = []; |
391 | 391 | |
392 | 392 | foreach ($object->get_properties() as $property) { |
393 | - if ( preg_match('/^_/', $property) |
|
393 | + if (preg_match('/^_/', $property) |
|
394 | 394 | || in_array($property, $skip_properties) |
395 | 395 | || property_exists($object, $property)) { |
396 | 396 | // Skip private or otherwise invalid properties |
@@ -151,7 +151,7 @@ |
||
151 | 151 | return; |
152 | 152 | } |
153 | 153 | foreach ($parameters as $param_data) { |
154 | - if ( empty($param_data['domain']) |
|
154 | + if (empty($param_data['domain']) |
|
155 | 155 | || empty($param_data['name']) |
156 | 156 | || empty($param_data['value'])) { |
157 | 157 | // TODO: Log warning |
@@ -59,7 +59,8 @@ discard block |
||
59 | 59 | { |
60 | 60 | try { |
61 | 61 | $person = new org_openpsa_contacts_person_dba($member->person); |
62 | - } catch (midcom_error $e) { |
|
62 | + } |
|
63 | + catch (midcom_error $e) { |
|
63 | 64 | $e->log(); |
64 | 65 | return; |
65 | 66 | } |
@@ -82,7 +83,8 @@ discard block |
||
82 | 83 | $row['organization_member'] = $membership; |
83 | 84 | try { |
84 | 85 | $row['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid); |
85 | - } catch (midcom_error $e) { |
|
86 | + } |
|
87 | + catch (midcom_error $e) { |
|
86 | 88 | debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN); |
87 | 89 | continue; |
88 | 90 | } |
@@ -142,7 +142,8 @@ |
||
142 | 142 | try { |
143 | 143 | $person = org_openpsa_contacts_person_dba::get_cached($link->person); |
144 | 144 | $segment = $person->get_parameter('org.openpsa.directmarketing.segments', $segmentation_param); |
145 | - } catch (midcom_error $e) { |
|
145 | + } |
|
146 | + catch (midcom_error $e) { |
|
146 | 147 | } |
147 | 148 | if (empty($segment)) { |
148 | 149 | $segment = $this->_l10n->get('no segment'); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $qb_receipts->add_constraint('message', '=', $this->_message->id); |
44 | 44 | $qb_receipts->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT); |
45 | 45 | $receipts = $qb_receipts->execute_unchecked(); |
46 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
46 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
47 | 47 | $receipt_data['first_send'] = time(); |
48 | 48 | $receipt_data['last_send'] = 0; |
49 | 49 | $receipt_data['sent'] = count($receipts); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | private function _get_campaign_data($first_send) |
78 | 78 | { |
79 | - $campaign_data =& $this->_request_data['report']['campaign_data']; |
|
79 | + $campaign_data = & $this->_request_data['report']['campaign_data']; |
|
80 | 80 | $qb_unsub = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
81 | 81 | $qb_unsub->add_constraint('campaign', '=', $this->_message->campaign); |
82 | 82 | $qb_unsub->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | private function _get_link_data($segmentation_param) |
101 | 101 | { |
102 | 102 | $this->_request_data['report']['link_data'] = []; |
103 | - $link_data =& $this->_request_data['report']['link_data']; |
|
103 | + $link_data = & $this->_request_data['report']['link_data']; |
|
104 | 104 | |
105 | 105 | $link_data['counts'] = []; |
106 | 106 | $link_data['percentages'] = ['of_links' => [], 'of_recipients' => []]; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | foreach ($links as $link) { |
127 | 127 | $segment = ''; |
128 | 128 | $segment_notfound = false; |
129 | - if ( $segmentation_param |
|
129 | + if ($segmentation_param |
|
130 | 130 | && !empty($link->person)) { |
131 | 131 | try { |
132 | 132 | $person = org_openpsa_contacts_person_dba::get_cached($link->person); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if (!isset($link_data['segments'][$segment])) { |
141 | 141 | $link_data['segments'][$segment] = $segment_prototype; |
142 | 142 | } |
143 | - $segment_data =& $link_data['segments'][$segment]; |
|
143 | + $segment_data = & $link_data['segments'][$segment]; |
|
144 | 144 | } else { |
145 | 145 | $segment_data = $segment_prototype; |
146 | 146 | } |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | $this->_initialize_field($array['percentages']['of_links'], $link); |
251 | 251 | $this->_initialize_field($array['percentages']['of_recipients'], $link); |
252 | 252 | |
253 | - $link_data =& $this->_request_data['report']['link_data']; |
|
254 | - $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total']/$link_data['total'])*100; |
|
255 | - $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/$link_data['total'])*100; |
|
253 | + $link_data = & $this->_request_data['report']['link_data']; |
|
254 | + $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total'] / $link_data['total']) * 100; |
|
255 | + $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / $link_data['total']) * 100; |
|
256 | 256 | |
257 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
258 | - $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target])-1)/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
259 | - $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
257 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
258 | + $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target]) - 1) / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
259 | + $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
260 | 260 | |
261 | - if ( !isset($array['percentages']['of_recipients']['total']) |
|
261 | + if (!isset($array['percentages']['of_recipients']['total']) |
|
262 | 262 | || $array['percentages']['of_recipients'][$link->target]['total'] > $array['percentages']['of_recipients']['total']) { |
263 | 263 | $array['percentages']['of_recipients']['total'] = $array['percentages']['of_recipients'][$link->target]['total']; |
264 | 264 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | //Substyle handling |
61 | - if ( !empty($data['message_array']['substyle']) |
|
61 | + if (!empty($data['message_array']['substyle']) |
|
62 | 62 | && !preg_match('/^builtin:/', $data['message_array']['substyle'])) { |
63 | 63 | debug_add("Appending substyle {$data['message_array']['substyle']}"); |
64 | 64 | midcom::get()->style->append_substyle($data['message_array']['substyle']); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | private function _real_show_compose($handler_id, array &$data) |
118 | 118 | { |
119 | 119 | $prefix = ''; |
120 | - if ( !empty($data['message_array']['substyle']) |
|
120 | + if (!empty($data['message_array']['substyle']) |
|
121 | 121 | && preg_match('/^builtin:(.*)/', $data['message_array']['substyle'], $matches_style)) { |
122 | 122 | $prefix = $matches_style[1] . '-'; |
123 | 123 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if (!$this->timestamp) { |
25 | 25 | $this->timestamp = time(); |
26 | 26 | } |
27 | - if ( !$this->referrer |
|
27 | + if (!$this->referrer |
|
28 | 28 | && !empty($_SERVER['HTTP_REFERER'])) { |
29 | 29 | $this->referrer = $_SERVER['HTTP_REFERER']; |
30 | 30 | } |