Test Failed
Push — CI ( 02428e...3e0292 )
by Adam
55:43
created
custom/modules/Prospects/logic_hooks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@
 block discarded – undo
5 5
 $hook_array = Array(); 
6 6
 // position, file, function 
7 7
 $hook_array['before_save'] = Array(); 
8
-$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Prospects/ProspectsJjwg_MapsLogicHook.php','ProspectsJjwg_MapsLogicHook', 'updateGeocodeInfo');
8
+$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Prospects/ProspectsJjwg_MapsLogicHook.php', 'ProspectsJjwg_MapsLogicHook', 'updateGeocodeInfo');
9 9
 $hook_array['after_save'] = Array(); 
10
-$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Prospects/ProspectsJjwg_MapsLogicHook.php','ProspectsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo');
10
+$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Prospects/ProspectsJjwg_MapsLogicHook.php', 'ProspectsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo');
11 11
 
12 12
 
13 13
 
Please login to merge, or discard this patch.
custom/modules/Meetings/logic_hooks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 $hook_array = Array(); 
6 6
 // position, file, function 
7 7
 $hook_array['after_save'] = Array(); 
8
-$hook_array['after_save'][] = Array(77, 'updateMeetingGeocodeInfo', 'modules/Meetings/MeetingsJjwg_MapsLogicHook.php','MeetingsJjwg_MapsLogicHook', 'updateMeetingGeocodeInfo');
8
+$hook_array['after_save'][] = Array(77, 'updateMeetingGeocodeInfo', 'modules/Meetings/MeetingsJjwg_MapsLogicHook.php', 'MeetingsJjwg_MapsLogicHook', 'updateMeetingGeocodeInfo');
9 9
 
10 10
 
11 11
 
Please login to merge, or discard this patch.
custom/modules/Opportunities/logic_hooks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@
 block discarded – undo
5 5
 $hook_array = Array(); 
6 6
 // position, file, function 
7 7
 $hook_array['before_save'] = Array(); 
8
-$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php','OpportunitiesJjwg_MapsLogicHook', 'updateGeocodeInfo'); 
9
-$hook_array['before_save'][] = Array(1, 'Opportunities push feed', 'modules/Opportunities/SugarFeeds/OppFeed.php','OppFeed', 'pushFeed');
8
+$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php', 'OpportunitiesJjwg_MapsLogicHook', 'updateGeocodeInfo'); 
9
+$hook_array['before_save'][] = Array(1, 'Opportunities push feed', 'modules/Opportunities/SugarFeeds/OppFeed.php', 'OppFeed', 'pushFeed');
10 10
 $hook_array['after_save'] = Array(); 
11
-$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php','OpportunitiesJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo'); 
12
-$hook_array['after_save'][] = Array(78, 'updateRelatedProjectGeocodeInfo', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php','OpportunitiesJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo'); 
11
+$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php', 'OpportunitiesJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo'); 
12
+$hook_array['after_save'][] = Array(78, 'updateRelatedProjectGeocodeInfo', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php', 'OpportunitiesJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo'); 
13 13
 $hook_array['after_relationship_add'] = Array(); 
14
-$hook_array['after_relationship_add'][] = Array(77, 'addRelationship', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php','OpportunitiesJjwg_MapsLogicHook', 'addRelationship'); 
14
+$hook_array['after_relationship_add'][] = Array(77, 'addRelationship', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php', 'OpportunitiesJjwg_MapsLogicHook', 'addRelationship'); 
15 15
 $hook_array['after_relationship_delete'] = Array(); 
16
-$hook_array['after_relationship_delete'][] = Array(77, 'deleteRelationship', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php','OpportunitiesJjwg_MapsLogicHook', 'deleteRelationship'); 
16
+$hook_array['after_relationship_delete'][] = Array(77, 'deleteRelationship', 'modules/Opportunities/OpportunitiesJjwg_MapsLogicHook.php', 'OpportunitiesJjwg_MapsLogicHook', 'deleteRelationship'); 
17 17
 
18 18
 
19 19
 
Please login to merge, or discard this patch.
custom/modules/Project/logic_hooks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 // position, file, function
7 7
 
8 8
 $hook_array['before_delete'] = Array();
9
-$hook_array['before_delete'][] = Array(1, 'Delete Project Tasks', 'modules/Project/delete_project_tasks.php','delete_project_tasks', 'delete_tasks');
9
+$hook_array['before_delete'][] = Array(1, 'Delete Project Tasks', 'modules/Project/delete_project_tasks.php', 'delete_project_tasks', 'delete_tasks');
10 10
 ?>
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
custom/modules/Accounts/logic_hooks.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 // position, file, function 
7 7
 $hook_array['after_ui_frame'] = Array(); 
8 8
 $hook_array['before_save'] = Array(); 
9
-$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo'); 
9
+$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo'); 
10 10
 $hook_array['after_save'] = Array(); 
11
-$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo'); 
12
-$hook_array['after_save'][] = Array(78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo'); 
13
-$hook_array['after_save'][] = Array(79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo'); 
14
-$hook_array['after_save'][] = Array(80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo'); 
11
+$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo'); 
12
+$hook_array['after_save'][] = Array(78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo'); 
13
+$hook_array['after_save'][] = Array(79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo'); 
14
+$hook_array['after_save'][] = Array(80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo'); 
15 15
 $hook_array['after_relationship_add'] = Array(); 
16
-$hook_array['after_relationship_add'][] = Array(77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'addRelationship'); 
16
+$hook_array['after_relationship_add'][] = Array(77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship'); 
17 17
 $hook_array['after_relationship_delete'] = Array(); 
18
-$hook_array['after_relationship_delete'][] = Array(77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php','AccountsJjwg_MapsLogicHook', 'deleteRelationship'); 
18
+$hook_array['after_relationship_delete'][] = Array(77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship'); 
19 19
 
20 20
 
21 21
 
Please login to merge, or discard this patch.
custom/modules/unified_search_modules_display.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,140 +1,140 @@
 block discarded – undo
1 1
 <?php
2 2
 // created: 2014-01-29 09:59:23
3
-$unified_search_modules_display = array (
3
+$unified_search_modules_display = array(
4 4
   'AOP_Case_Events' => 
5
-  array (
5
+  array(
6 6
     'visible' => false,
7 7
   ),
8 8
   'AOP_Case_Updates' => 
9
-  array (
9
+  array(
10 10
     'visible' => false,
11 11
   ),
12 12
   'AOR_Reports' => 
13
-  array (
13
+  array(
14 14
     'visible' => false,
15 15
   ),
16 16
   'AOS_Contracts' => 
17
-  array (
17
+  array(
18 18
     'visible' => false,
19 19
   ),
20 20
   'AOS_Invoices' => 
21
-  array (
21
+  array(
22 22
     'visible' => false,
23 23
   ),
24 24
   'AOS_PDF_Templates' => 
25
-  array (
25
+  array(
26 26
     'visible' => false,
27 27
   ),
28 28
   'AOS_Product_Categories' => 
29
-  array (
29
+  array(
30 30
     'visible' => false,
31 31
   ),
32 32
   'AOS_Products' => 
33
-  array (
33
+  array(
34 34
     'visible' => false,
35 35
   ),
36 36
   'AOS_Quotes' => 
37
-  array (
37
+  array(
38 38
     'visible' => false,
39 39
   ),
40 40
   'AOW_Processed' => 
41
-  array (
41
+  array(
42 42
     'visible' => false,
43 43
   ),
44 44
   'AOW_WorkFlow' => 
45
-  array (
45
+  array(
46 46
     'visible' => false,
47 47
   ),
48 48
   'Accounts' => 
49
-  array (
49
+  array(
50 50
     'visible' => true,
51 51
   ),
52 52
   'Bugs' => 
53
-  array (
53
+  array(
54 54
     'visible' => false,
55 55
   ),
56 56
   'Calls' => 
57
-  array (
57
+  array(
58 58
     'visible' => true,
59 59
   ),
60 60
   'Calls_Reschedule' => 
61
-  array (
61
+  array(
62 62
     'visible' => false,
63 63
   ),
64 64
   'Campaigns' => 
65
-  array (
65
+  array(
66 66
     'visible' => false,
67 67
   ),
68 68
   'Cases' => 
69
-  array (
69
+  array(
70 70
     'visible' => true,
71 71
   ),
72 72
   'Contacts' => 
73
-  array (
73
+  array(
74 74
     'visible' => true,
75 75
   ),
76 76
   'Documents' => 
77
-  array (
77
+  array(
78 78
     'visible' => true,
79 79
   ),
80 80
   'FP_Event_Locations' => 
81
-  array (
81
+  array(
82 82
     'visible' => false,
83 83
   ),
84 84
   'FP_events' => 
85
-  array (
85
+  array(
86 86
     'visible' => false,
87 87
   ),
88 88
   'Leads' => 
89
-  array (
89
+  array(
90 90
     'visible' => true,
91 91
   ),
92 92
   'Meetings' => 
93
-  array (
93
+  array(
94 94
     'visible' => true,
95 95
   ),
96 96
   'Notes' => 
97
-  array (
97
+  array(
98 98
     'visible' => true,
99 99
   ),
100 100
   'Opportunities' => 
101
-  array (
101
+  array(
102 102
     'visible' => true,
103 103
   ),
104 104
   'Project' => 
105
-  array (
105
+  array(
106 106
     'visible' => false,
107 107
   ),
108 108
   'ProjectTask' => 
109
-  array (
109
+  array(
110 110
     'visible' => false,
111 111
   ),
112 112
   'ProspectLists' => 
113
-  array (
113
+  array(
114 114
     'visible' => false,
115 115
   ),
116 116
   'Prospects' => 
117
-  array (
117
+  array(
118 118
     'visible' => false,
119 119
   ),
120 120
   'Tasks' => 
121
-  array (
121
+  array(
122 122
     'visible' => false,
123 123
   ),
124 124
   'jjwg_Address_Cache' => 
125
-  array (
125
+  array(
126 126
     'visible' => false,
127 127
   ),
128 128
   'jjwg_Areas' => 
129
-  array (
129
+  array(
130 130
     'visible' => false,
131 131
   ),
132 132
   'jjwg_Maps' => 
133
-  array (
133
+  array(
134 134
     'visible' => false,
135 135
   ),
136 136
   'jjwg_Markers' => 
137
-  array (
137
+  array(
138 138
     'visible' => false,
139 139
   ),
140 140
 );
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
custom/modules/Contacts/logic_hooks.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 $hook_array = Array(); 
6 6
 // position, file, function 
7 7
 $hook_array['before_save'] = Array(); 
8
-$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Contacts/ContactsJjwg_MapsLogicHook.php','ContactsJjwg_MapsLogicHook', 'updateGeocodeInfo');
9
-$hook_array['before_save'][] = Array(1, 'Contacts push feed', 'modules/Contacts/SugarFeeds/ContactFeed.php','ContactFeed', 'pushFeed');
8
+$hook_array['before_save'][] = Array(77, 'updateGeocodeInfo', 'modules/Contacts/ContactsJjwg_MapsLogicHook.php', 'ContactsJjwg_MapsLogicHook', 'updateGeocodeInfo');
9
+$hook_array['before_save'][] = Array(1, 'Contacts push feed', 'modules/Contacts/SugarFeeds/ContactFeed.php', 'ContactFeed', 'pushFeed');
10 10
 $hook_array['after_save'] = Array(); 
11
-$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Contacts/ContactsJjwg_MapsLogicHook.php','ContactsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo');
12
-$hook_array['after_save'][] = Array(1, 'Update Portal', 'modules/Contacts/updatePortal.php','updatePortal', 'updateUser');
11
+$hook_array['after_save'][] = Array(77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Contacts/ContactsJjwg_MapsLogicHook.php', 'ContactsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo');
12
+$hook_array['after_save'][] = Array(1, 'Update Portal', 'modules/Contacts/updatePortal.php', 'updatePortal', 'updateUser');
13 13
 
14 14
 
15 15
 
Please login to merge, or discard this patch.
custom/Extension/application/Ext/LogicHooks/AOW_WorkFlow_Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,4 +28,4 @@
 block discarded – undo
28 28
 if (!isset($hook_array['after_save']) || !is_array($hook_array['after_save'])) {
29 29
     $hook_array['after_save'] = array();
30 30
 }
31
-$hook_array['after_save'][] = Array(99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php','AOW_WorkFlow', 'run_bean_flows');
32 31
\ No newline at end of file
32
+$hook_array['after_save'][] = Array(99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php', 'AOW_WorkFlow', 'run_bean_flows');
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
include/SugarFields/Parsers/MetaParser.php 1 patch
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * Parses for contents enclosed within <form>...</form> tags
67 67
  */
68 68
 function getFormContents($contents, $all = true) {
69
-   if($all) {
69
+   if ($all) {
70 70
       preg_match_all("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches);
71 71
       return $matches;
72 72
    }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 function getFormElements($contents) {
87 87
    preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $contents, $matches, PREG_PATTERN_ORDER);
88 88
    $elems = array();
89
-   foreach($matches[3] as $match) {
89
+   foreach ($matches[3] as $match) {
90 90
    	  $elems[] = $match;
91 91
    }
92 92
    return $elems;
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 
119 119
    $exp = "'".$name."[\s]*?=[\s]*?[\'\"]([^\'^\"]*?)[\'\"]'si";
120 120
    preg_match_all($exp, $contents, $matches, PREG_SET_ORDER);
121
-   if(empty($filter)) {
121
+   if (empty($filter)) {
122 122
    	  return !empty($matches[0][1]) ? $matches[0][1] : '';
123 123
    }
124 124
 
125 125
    $filtered = array();
126
-   foreach($matches as $tag) {
127
-   	  if(preg_match($filter, $tag[1])) {
126
+   foreach ($matches as $tag) {
127
+   	  if (preg_match($filter, $tag[1])) {
128 128
    	  	 $filtered[] = $tag;
129 129
    	  }
130 130
    }
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
  */
142 142
 function getTables($tableClass = null, $contents) {
143 143
    preg_match_all("'(<table[^>]*?>)(.*?)(</table[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
144
-   if($tableClass == null) {
144
+   if ($tableClass == null) {
145 145
    	  return $matches;
146 146
    }
147 147
 
148 148
    $tables = array();
149
-   foreach($matches as $key => $table) {
150
-   	  if(strpos($table[1], $tableClass) > 0) {
149
+   foreach ($matches as $key => $table) {
150
+   	  if (strpos($table[1], $tableClass) > 0) {
151 151
    	  	 $tables[] = $table;
152 152
    	  }
153 153
    }
@@ -170,27 +170,27 @@  discard block
 block discarded – undo
170 170
    $x = strlen($contents);
171 171
    $mark = 0;
172 172
    $count = 0;
173
-   $stag1 = "<" . trim($type, " <>") . '>';
174
-   $stag2 = "<" . trim($type, " <>") . ' ';
173
+   $stag1 = "<".trim($type, " <>").'>';
174
+   $stag2 = "<".trim($type, " <>").' ';
175 175
    $etag = "</".$type.">";
176 176
    $sincrement = strlen($stag1);
177 177
    $eincrement = strlen($etag);
178 178
    $sarr = array();
179 179
    $values = array();
180 180
 
181
-   while($count < $x) {
181
+   while ($count < $x) {
182 182
    	     $stok = substr($contents, $count, $sincrement);
183 183
    	     $etok = substr($contents, $count, $eincrement);
184
-   	     if($stok == $stag1 || $stok == $stag2) {
184
+   	     if ($stok == $stag1 || $stok == $stag2) {
185 185
    	     	//Reset mark;
186
-   	        if(count($sarr) == 0) {
186
+   	        if (count($sarr) == 0) {
187 187
    	           $mark = $count;
188 188
    	        }
189 189
             $sarr[] = $count;
190 190
 
191
-   	     } else if($etok == $etag) {
191
+   	     } else if ($etok == $etag) {
192 192
    	        array_shift($sarr);
193
-   	        if(count($sarr) == 0) {
193
+   	        if (count($sarr) == 0) {
194 194
    	           $val = substr($contents, $mark, ($count - $mark) + $eincrement);
195 195
    	           $values[] = $val;
196 196
    	           $mark = $count;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 function stripFlavorTags($contents) {
232 232
    $flavor = isset($GLOBALS['sugar_flavor']) ? $GLOBALS['sugar_flavor'] : 'PRO';
233 233
    $isPro = ($flavor == 'ENT' || $flavor == 'PRO') ? true : false;
234
-   if($isPro) {
234
+   if ($isPro) {
235 235
    	 $contents = preg_replace('/<!-- BEGIN: open_source -->.*?<!-- END: open_source -->/', '', $contents);
236 236
    } else {
237 237
    	 $contents = preg_replace('/<!-- BEGIN: pro -->.*?<!-- END: pro -->/', '', $contents);
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 function getMaxColumns($contents, $filter) {
250 250
    preg_match_all("'(<tr[^>]*?>)(.*?)(</tr[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
251 251
    $max = 0;
252
-   foreach($matches as $tableRows) {
252
+   foreach ($matches as $tableRows) {
253 253
            $count = substr_count($tableRows[2], $filter);
254
-           if($count > $max) {
254
+           if ($count > $max) {
255 255
            	  $max = $count;
256 256
            }
257 257
    }
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 
264 264
    $elements = array();
265 265
 
266
-   foreach($matches as $data) {
266
+   foreach ($matches as $data) {
267 267
    	   // We need 4 because the 1,2,3 indexes make up start,body,end
268
-	   if(count($data) == 4) {
268
+	   if (count($data) == 4) {
269 269
 	   	  $element = array();
270 270
 	   	  $element['start'] = $data[1];
271 271
 	   	  $element['body'] = $data[2];
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 
307 307
 //Check if there are Javascript blocks of code to process
308 308
 preg_match_all("'(<script[^>]*?>)(.*?)(</script[^>]*?>)'si", $contents, $matches, PREG_PATTERN_ORDER);
309
-if(empty($matches)) {
309
+if (empty($matches)) {
310 310
    return $javascript;
311 311
 }
312 312
 
313
-foreach($matches[0] as $scriptBlock) {
314
-	    $javascript .= "\n" . $scriptBlock;
313
+foreach ($matches[0] as $scriptBlock) {
314
+	    $javascript .= "\n".$scriptBlock;
315 315
 } //foreach
316 316
 
317 317
 $javascript = substr($javascript, 1);
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
 //Find all blocks that may need to be replaced with Smarty syntax
324 324
 preg_match_all("'([\{])([a-zA-Z0-9_]*?)([\}])'si", $javascript, $matches, PREG_PATTERN_ORDER);
325
-if(!empty($matches)) {
325
+if (!empty($matches)) {
326 326
 	$replace = array();
327 327
 
328
-	foreach($matches[0] as $xTemplateCode) {
329
-		    if(!isset($replace[$xTemplateCode])) {
328
+	foreach ($matches[0] as $xTemplateCode) {
329
+		    if (!isset($replace[$xTemplateCode])) {
330 330
 		       $replace[$xTemplateCode] = str_replace("{", "{\$", $xTemplateCode);
331 331
 		    } //if
332 332
 	} //foreach
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	$javascript = str_replace(array_keys($replace), array_values($replace), $javascript);
335 335
 } //if
336 336
 
337
-if(!$addLiterals) {
337
+if (!$addLiterals) {
338 338
    return $javascript;
339 339
 }
340 340
 
@@ -348,12 +348,12 @@  discard block
 block discarded – undo
348 348
 	$count = 0;
349 349
 	$inSmartyVariable = false;
350 350
 
351
-	while($count < $scriptLength) {
351
+	while ($count < $scriptLength) {
352 352
 
353
-	      if($inSmartyVariable) {
353
+	      if ($inSmartyVariable) {
354 354
 	      	 $start = $count;
355 355
 	      	 $numOfChars = 1;
356
-	      	 while(isset($javascript[$count]) && $javascript[$count] != '}') {
356
+	      	 while (isset($javascript[$count]) && $javascript[$count] != '}') {
357 357
 	      	 	   $count++;
358 358
 	      	 	   $numOfChars++;
359 359
 	      	 }
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
 			  $char = $javascript[$count];
367 367
 			  $nextChar = ($count + 1 >= $scriptLength) ? '' : $javascript[$count + 1];
368 368
 
369
-			  if($char == "{" && $nextChar == "$") {
369
+			  if ($char == "{" && $nextChar == "$") {
370 370
 			  	 $inSmartyVariable = true;
371 371
 			  	 $newJavascript .= $javascript[$count];
372
-			  } else if($char == "{") {
373
-			  	 $newJavascript .=  " {ldelim} ";
374
-			  } else if($char == "}") {
372
+			  } else if ($char == "{") {
373
+			  	 $newJavascript .= " {ldelim} ";
374
+			  } else if ($char == "}") {
375 375
 			  	 $newJavascript .= " {rdelim} ";
376 376
 			  } else {
377 377
 			     $newJavascript .= $javascript[$count];
@@ -397,32 +397,32 @@  discard block
 block discarded – undo
397 397
  */
398 398
 function findAssignedVariableName($name, $filePath) {
399 399
 
400
-	if($this->mPHPFile == "INVALID") {
400
+	if ($this->mPHPFile == "INVALID") {
401 401
 	   return $name;
402 402
 	}
403 403
 
404
-	if(!isset($this->mPHPFile)) {
405
-	   if(preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) {
404
+	if (!isset($this->mPHPFile)) {
405
+	   if (preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) {
406 406
 	   	 $dir = $matches[1];
407
-	   } else if(preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) {
407
+	   } else if (preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) {
408 408
 	   	 $dir = $matches[1];
409 409
 	   }
410 410
 
411
-	   if(!isset($dir) || !is_dir($dir)) {
411
+	   if (!isset($dir) || !is_dir($dir)) {
412 412
 	      $this->mPHPFile = "INVALID";
413 413
 	      return $name;
414 414
 	   }
415 415
 
416 416
        $filesInDir = $this->dirList($dir);
417 417
        $phpFile = $matches[2].'.*?[\.]php';
418
-       foreach($filesInDir as $file) {
419
-       	  if(preg_match("/$phpFile/", $file)) {
420
-       	  	 $this->mPHPFile = $matches[1] . $file;
418
+       foreach ($filesInDir as $file) {
419
+       	  if (preg_match("/$phpFile/", $file)) {
420
+       	  	 $this->mPHPFile = $matches[1].$file;
421 421
        	  	 break;
422 422
        	  }
423 423
        }
424 424
 
425
-       if(!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) {
425
+       if (!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) {
426 426
        	  $this->mPHPFile = "INVALID";
427 427
        	  return $name;
428 428
        }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
 	$phpContents = file_get_contents($this->mPHPFile);
432 432
 	$uname = strtoupper($name);
433
-	if(preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) {
433
+	if (preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) {
434 434
 	   return $matches[1];
435 435
 	}
436 436
 	return $name;
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
  * @param $directory The directory to scan
445 445
  * @return $results The files in the directory that were found
446 446
  */
447
-function dirList ($directory) {
447
+function dirList($directory) {
448 448
 
449 449
     // create an array to hold directory list
450 450
     $results = array();
@@ -476,19 +476,19 @@  discard block
 block discarded – undo
476 476
  */
477 477
 function getCustomField($elementNames) {
478 478
 
479
-   if(!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) {
479
+   if (!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) {
480 480
    	  return null;
481 481
    }
482 482
 
483
-   if(is_string($elementNames)) {
484
-   	  if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) {
483
+   if (is_string($elementNames)) {
484
+   	  if (preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) {
485 485
    	  	 return count($matches) == 1 ? $matches[0] : $matches[1];
486 486
    	  }
487 487
    	  return null;
488 488
    }
489 489
 
490
-   foreach($elementNames as $name) {
491
-   	  if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) {
490
+   foreach ($elementNames as $name) {
491
+   	  if (preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) {
492 492
    	  	 return count($matches) == 1 ? $matches[0] : $matches[1];
493 493
    	  }
494 494
    }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 }
498 498
 
499 499
 function applyPreRules($moduleDir, $panels) {
500
-   if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
500
+   if (file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
501 501
 	  require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
502 502
 	  $class = $moduleDir."ParseRule";
503 503
 	  $parseRule = new $class();
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 function applyPostRules($moduleDir, $panels) {
514 514
    //Run module specific rules
515
-   if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
515
+   if (file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
516 516
 	  require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
517 517
 	  $class = $moduleDir."ParseRule";
518 518
 	  $parseRule = new $class();
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
    require_once("include/SugarFields/Parsers/Rules/ParseRules.php");
524 524
    $rules = ParseRules::getRules();
525 525
 
526
-   foreach($rules as $rule) {
527
-   	  if(!file_exists($rule['file'])) {
528
-   	  	 $GLOBALS['log']->error("Cannot run rule for " . $rule['file']);
526
+   foreach ($rules as $rule) {
527
+   	  if (!file_exists($rule['file'])) {
528
+   	  	 $GLOBALS['log']->error("Cannot run rule for ".$rule['file']);
529 529
    	  	 continue;
530 530
    	  } //if
531 531
    	  require_once($rule['file']);
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
    return $panels;
538 538
 }
539 539
 
540
-function createFileContents($moduleDir, $panels, $templateMeta=array(), $htmlFilePath) {
540
+function createFileContents($moduleDir, $panels, $templateMeta = array(), $htmlFilePath) {
541 541
 
542 542
 $header = "<?php\n\n";
543 543
 
544
-if(empty($templateMeta)) {
544
+if (empty($templateMeta)) {
545 545
 $header .= "\$viewdefs['$moduleDir']['$this->mView'] = array(
546 546
     'templateMeta' => array('maxColumns' => '2',
547 547
                             'widths' => array(
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
     ),";
552 552
 } else {
553 553
 $header .= "\$viewdefs['$moduleDir']['$this->mView'] = array(
554
-    'templateMeta' =>" . var_export($templateMeta, true) . ",";
554
+    'templateMeta' =>".var_export($templateMeta, true).",";
555 555
 }
556 556
 
557 557
 //Replace all the @sq (single quote tags that may have been inserted)
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
 
577 577
    $metadata = '';
578 578
    $body = var_export($panels, true);
579
-   $metadata = $header . $body . $footer;
580
-   $metadata = preg_replace('/(\d+)[\s]=>[\s]?/',"",$metadata);
579
+   $metadata = $header.$body.$footer;
580
+   $metadata = preg_replace('/(\d+)[\s]=>[\s]?/', "", $metadata);
581 581
    return $metadata;
582 582
 
583 583
 }
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
    $masterpanels = $viewdefs[$moduleDir][$this->mView]['panels'];
597 597
    $hasMultiplePanels = $this->hasMultiplePanels($masterpanels);
598 598
 
599
-   if(!$hasMultiplePanels) {
599
+   if (!$hasMultiplePanels) {
600 600
    	    $keys = array_keys($viewdefs[$moduleDir][$this->mView]['panels']);
601
-        if(!empty($keys) && count($keys) == 1) {
602
-        	if(strtolower($keys[0]) == 'default') {
601
+        if (!empty($keys) && count($keys) == 1) {
602
+        	if (strtolower($keys[0]) == 'default') {
603 603
         	   $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels'][$keys[0]]);
604 604
         	} else {
605 605
         	   $firstPanel = array_values($viewdefs[$moduleDir][$this->mView]['panels']);
@@ -609,18 +609,18 @@  discard block
 block discarded – undo
609 609
         	$masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels']);
610 610
         }
611 611
    }
612
-   foreach($masterpanels as $name=>$masterpanel) {
613
-   	       if(isset($panels[$name])) {
612
+   foreach ($masterpanels as $name=>$masterpanel) {
613
+   	       if (isset($panels[$name])) {
614 614
 	   	       	  // Get all the names in the panel
615 615
 	   	       	  $existingElements = array();
616 616
 	   	       	  $existingLocation = array();
617 617
 
618
-	   	       	  foreach($panels[$name] as $rowKey=>$row) {
619
-	   	       	  	 foreach($row as $colKey=>$column) {
620
-	   	       	  	 	if(is_array($column) && !empty($column['name'])) {
618
+	   	       	  foreach ($panels[$name] as $rowKey=>$row) {
619
+	   	       	  	 foreach ($row as $colKey=>$column) {
620
+	   	       	  	 	if (is_array($column) && !empty($column['name'])) {
621 621
 	   	       	  	 	   $existingElements[$column['name']] = $column['name'];
622 622
 	   	       	  	 	   $existingLocation[$column['name']] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
623
-	   	       	  	 	} else if(!is_array($column) && !empty($column)) {
623
+	   	       	  	 	} else if (!is_array($column) && !empty($column)) {
624 624
 	   	       	  	 	   $existingElements[$column] = $column;
625 625
 	   	       	  	 	   $existingLocation[$column] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
626 626
 	   	       	  	 	}
@@ -628,23 +628,23 @@  discard block
 block discarded – undo
628 628
 	   	       	  } //foreach
629 629
 
630 630
 	   	       	  // Now check against the $masterCopy
631
-	   	       	  foreach($masterpanel as $rowKey=>$row) {
631
+	   	       	  foreach ($masterpanel as $rowKey=>$row) {
632 632
 
633 633
 	   	       	  	 $addRow = array();
634 634
 
635
-	   	       	  	 foreach($row as $colKey=>$column) {
636
-	   	       	  	 	if(is_array($column) && isset($column['name'])) {
635
+	   	       	  	 foreach ($row as $colKey=>$column) {
636
+	   	       	  	 	if (is_array($column) && isset($column['name'])) {
637 637
 	   	       	  	 	   $id = $column['name'];
638
-	   	       	  	 	} else if(!is_array($column) && !empty($column)) {
638
+	   	       	  	 	} else if (!is_array($column) && !empty($column)) {
639 639
 	   	       	  	 	   $id = $column;
640 640
 	   	       	  	 	} else {
641 641
 	   	       	  	 	   continue;
642 642
 	   	       	  	 	}
643
-	   	       	  	 	if(empty($existingElements[$id])) {
643
+	   	       	  	 	if (empty($existingElements[$id])) {
644 644
 	   	       	  	 	   //Only add if
645 645
 	   	       	  	 	   // 1) if it is a required field (as defined in metadata)
646 646
 	   	       	  	 	   // 2) or if it has a customLabel and customCode (a very deep customization)
647
-	   	       	  	 	   if((is_array($column) && !empty($column['displayParams']['required'])) ||
647
+	   	       	  	 	   if ((is_array($column) && !empty($column['displayParams']['required'])) ||
648 648
 	   	       	  	 	      (is_array($column) && !empty($column['customCode']) && !empty($column['customLabel']))) {
649 649
 	   	       	  	 	   	  $addRow[] = $column;
650 650
 	   	       	  	 	   }
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	   	       	  	 } //foreach
656 656
 
657 657
 	   	       	  	 // Add it to the $panels
658
-	   	       	  	 if(!empty($addRow)) {
658
+	   	       	  	 if (!empty($addRow)) {
659 659
 	   	       	  	 	$panels[$name][] = $addRow;
660 660
 	   	       	  	 }
661 661
 	   	       	  } //foreach
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 
668 668
    // We're not done yet... go through the $panels Array now and try to remove duplicate
669 669
    // or empty panels
670
-   foreach($panels as $name=>$panel) {
671
-   	   if(count($panel) == 0 || !isset($masterpanels[$name])) {
670
+   foreach ($panels as $name=>$panel) {
671
+   	   if (count($panel) == 0 || !isset($masterpanels[$name])) {
672 672
    	   	  unset($panels[$name]);
673 673
    	   }
674 674
    } //foreach
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
    require($masterCopy);
689 689
    $masterTemplateMeta = $viewdefs[$moduleDir][$this->mView]['templateMeta'];
690 690
 
691
-   if(isset($masterTemplateMeta['javascript'])) {
691
+   if (isset($masterTemplateMeta['javascript'])) {
692 692
    	  //Insert the getJSPath code back into src value
693 693
    	  $masterTemplateMeta['javascript'] = preg_replace('/src\s*=\s*[\'\"].*?(modules\/|include\/)([^\.]*?\.js)([^\'\"]*?)[\'\"]/i', 'src="@sq . getJSPath(@sq${1}${2}@sq) . @sq"', $masterTemplateMeta['javascript']);
694 694
    }
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 }
698 698
 
699 699
 function hasRequiredSpanLabel($html) {
700
-   if(empty($html)) {
700
+   if (empty($html)) {
701 701
    	  return false;
702 702
    }
703 703
 
@@ -706,20 +706,20 @@  discard block
 block discarded – undo
706 706
 
707 707
 function hasMultiplePanels($panels) {
708 708
 
709
-   if(!isset($panels) || empty($panels) || !is_array($panels)) {
709
+   if (!isset($panels) || empty($panels) || !is_array($panels)) {
710 710
    	  return false;
711 711
    }
712 712
 
713
-   if(is_array($panels) && (count($panels) == 0 || count($panels) == 1)) {
713
+   if (is_array($panels) && (count($panels) == 0 || count($panels) == 1)) {
714 714
    	  return false;
715 715
    }
716 716
 
717
-   foreach($panels as $panel) {
718
-   	  if(!empty($panel) && !is_array($panel)) {
717
+   foreach ($panels as $panel) {
718
+   	  if (!empty($panel) && !is_array($panel)) {
719 719
    	  	 return false;
720 720
    	  } else {
721
-   	  	 foreach($panel as $row) {
722
-   	  	    if(!empty($row) && !is_array($row)) {
721
+   	  	 foreach ($panel as $row) {
722
+   	  	    if (!empty($row) && !is_array($row)) {
723 723
    	  	       return false;
724 724
    	  	    } //if
725 725
    	  	 } //foreach
@@ -729,16 +729,16 @@  discard block
 block discarded – undo
729 729
    return true;
730 730
 }
731 731
 
732
-function getRelateFieldName($mixed='') {
733
-   if(!is_array($mixed)) {
732
+function getRelateFieldName($mixed = '') {
733
+   if (!is_array($mixed)) {
734 734
    	  return '';
735
-   } else if(count($mixed) == 2){
735
+   } else if (count($mixed) == 2) {
736 736
       $id = '';
737 737
    	  $name = '';
738
-   	  foreach($mixed as $el) {
739
-   	  	 if(preg_match('/_id$/', $el)) {
738
+   	  foreach ($mixed as $el) {
739
+   	  	 if (preg_match('/_id$/', $el)) {
740 740
    	  	    $id = $el;
741
-   	  	 } else if(preg_match('/_name$/', $el)) {
741
+   	  	 } else if (preg_match('/_name$/', $el)) {
742 742
    	  	    $name = $el;
743 743
    	  	 }
744 744
    	  }
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
  *
760 760
  */
761 761
 function fixTablesWithMissingTr($tableContents) {
762
-   if(preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
762
+   if (preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
763 763
    	  return preg_replace('/(<table[^>]*?[\/]?>\s*?<td)/i', '<table><tr><td', $tableContents);
764 764
    }
765 765
    return $tableContents;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
  * This is a very crude function to fix instances where files have an </tr> tag immediately followed by a <td> tag
771 771
  */
772 772
 function fixRowsWithMissingTr($tableContents) {
773
-   if(preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
773
+   if (preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
774 774
    	  return preg_replace('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', '</tr><tr><td', $tableContents);
775 775
    }
776 776
    return $tableContents;
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
  * This is a very crude function to fix instances where files have two consecutive <tr> tags
782 782
  */
783 783
 function fixDuplicateTrTags($tableContents) {
784
-   if(preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) {
784
+   if (preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) {
785 785
    	  return preg_replace('/(<tr[^>]*?[\/]?>\s*?<tr)/i', '<tr', $tableContents);
786 786
    }
787 787
    return $tableContents;
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
  * Scans array of form elements to see if just one is a vardef element and, if so,
793 793
  * return that vardef name
794 794
  */
795
-function findSingleVardefElement($formElements=array(), $vardefs=array()) {
796
-   if(empty($formElements) || !is_array($formElements)) {
795
+function findSingleVardefElement($formElements = array(), $vardefs = array()) {
796
+   if (empty($formElements) || !is_array($formElements)) {
797 797
    	  return '';
798 798
    }
799 799
 
800 800
    $found = array();
801
-   foreach($formElements as $el) {
802
-   	   if(isset($vardefs[$el])) {
801
+   foreach ($formElements as $el) {
802
+   	   if (isset($vardefs[$el])) {
803 803
    	   	  $found[] = $el;
804 804
    	   }
805 805
    }
Please login to merge, or discard this patch.