@@ -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 | } |
@@ -300,7 +300,8 @@ |
||
| 300 | 300 | $organization = $this->_import_subscribers_organization($subscriber); |
| 301 | 301 | $this->_import_subscribers_organization_member($subscriber, $person, $organization); |
| 302 | 302 | } |
| 303 | - } catch (midcom_error $e) { |
|
| 303 | + } |
|
| 304 | + catch (midcom_error $e) { |
|
| 304 | 305 | $e->log(); |
| 305 | 306 | // Clean up possibly created data |
| 306 | 307 | $this->_clean_new_objects(); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if ( !$person |
|
| 124 | + if (!$person |
|
| 125 | 125 | && !empty($subscriber['person']['handphone'])) { |
| 126 | 126 | // Perform a simple cell phone test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker |
| 127 | 127 | $qb = org_openpsa_contacts_person_dba::new_query_builder(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | // User is or has been subscriber earlier, update status |
| 168 | 168 | $member = $members[0]; |
| 169 | 169 | |
| 170 | - if ( $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
| 170 | + if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
| 171 | 171 | || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL) { |
| 172 | 172 | $this->_import_status['already_subscribed']++; |
| 173 | 173 | return; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
| 209 | 209 | $schema = $this->_schemadbs['organization']->get('default'); |
| 210 | - if ( $schema->has_field('company_id') |
|
| 210 | + if ($schema->has_field('company_id') |
|
| 211 | 211 | && !empty($subscriber['organization']['company_id'])) { |
| 212 | 212 | // Imported data has a company id, we use that instead of name |
| 213 | 213 | $qb->add_constraint($schema->get_field('company_id')['storage']['location'], '=', $subscriber['organization']['company_id']); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // Seek by official name |
| 216 | 216 | $qb->add_constraint('official', '=', $subscriber['organization']['official']); |
| 217 | 217 | |
| 218 | - if ( $schema->has_field('city') |
|
| 218 | + if ($schema->has_field('city') |
|
| 219 | 219 | && !empty($subscriber['organization']['city'])) { |
| 220 | 220 | // Imported data has a city, we use also that for matching |
| 221 | 221 | $qb->add_constraint($schema->get_field('city')['storage']['location'], '=', $subscriber['organization']['city']); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | echo " <th>{$type}</th>\n"; |
| 35 | 35 | echo " <td style=\"text-align: right;\">" . number_format($count) . "</td>\n"; |
| 36 | 36 | if (isset($cleanups_kept[$type])) { |
| 37 | - echo " <td style=\"text-align: right;\">" . number_format($cleanups_kept[$type]) ."</td>\n"; |
|
| 37 | + echo " <td style=\"text-align: right;\">" . number_format($cleanups_kept[$type]) . "</td>\n"; |
|
| 38 | 38 | } |
| 39 | 39 | echo " </tr>\n"; |
| 40 | 40 | } |
@@ -48,7 +48,8 @@ |
||
| 48 | 48 | |
| 49 | 49 | try { |
| 50 | 50 | $interface = \midcom::get()->componentloader->get_interface_class($this->component); |
| 51 | - } catch (\midcom_error $e) { |
|
| 51 | + } |
|
| 52 | + catch (\midcom_error $e) { |
|
| 52 | 53 | debug_add("Failed to load the component {$this->component}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
| 53 | 54 | return; |
| 54 | 55 | } |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $button_config[MIDCOM_TOOLBAR_URL] = $url; |
| 74 | 74 | //The constants are numeric, so array_merge won't work... |
| 75 | 75 | foreach ($options as $key => $value) { |
| 76 | - if ( is_array($value) |
|
| 76 | + if (is_array($value) |
|
| 77 | 77 | && !empty($button_config[$key])) { |
| 78 | 78 | $value = array_merge($button_config[$key], $value); |
| 79 | 79 | } |
@@ -37,7 +37,8 @@ |
||
| 37 | 37 | foreach ($items as $identifier => $guid) { |
| 38 | 38 | try { |
| 39 | 39 | $results[$identifier] = new midcom_db_attachment($guid); |
| 40 | - } catch (midcom_error $e) { |
|
| 40 | + } |
|
| 41 | + catch (midcom_error $e) { |
|
| 41 | 42 | $e->log(); |
| 42 | 43 | } |
| 43 | 44 | } |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | protected function save_attachment_list() : bool |
| 144 | 144 | { |
| 145 | 145 | if (!empty($this->config['widget_config']['sortable'])) { |
| 146 | - uasort($this->map, function ($a, $b) { |
|
| 146 | + uasort($this->map, function($a, $b) { |
|
| 147 | 147 | if ($a->metadata->score == $b->metadata->score) { |
| 148 | 148 | return strnatcasecmp($a->name, $b->name); |
| 149 | 149 | } |
@@ -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 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | ]); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if ( $this->_article->topic === $this->_topic->id |
|
| 47 | + if ($this->_article->topic === $this->_topic->id |
|
| 48 | 48 | && $this->_article->can_do('midgard:delete')) { |
| 49 | 49 | $delete = $this->get_workflow('delete', ['object' => $this->_article]); |
| 50 | 50 | $buttons[] = $delete->get_button("delete/{$this->_article->guid}/"); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if ($this->_config->get('comments_enable')) { |
| 97 | 97 | if ($comments_node = $this->_seek_comments()) { |
| 98 | 98 | $this->_request_data['comments_url'] = $comments_node[MIDCOM_NAV_RELATIVEURL] . "comment/{$this->_article->guid}"; |
| 99 | - if ( $this->_topic->can_do('midgard:update') |
|
| 99 | + if ($this->_topic->can_do('midgard:update') |
|
| 100 | 100 | && $this->_topic->can_do('net.nehmer.comments:moderation')) { |
| 101 | 101 | net_nehmer_comments_viewer::add_head_elements(); |
| 102 | 102 | } |