Passed
Branch feature/2.0 (2da243)
by Jonathan
05:05
created
src/Webtrees/Hook/HookProvider.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks()
72 72
 	 */
73 73
 	public function getPossibleHooks() {
74
-		static $hooks=null;
74
+		static $hooks = null;
75 75
 		if ($hooks === null) {
76 76
 		    $hooks = array();
77 77
 		    
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
 		        'SELECT module_name FROM `##module`'
84 84
 		    )->fetchOneColumn();
85 85
 		    
86
-		    foreach($module_names as $module_name) {
86
+		    foreach ($module_names as $module_name) {
87 87
 		        $module = Module::getModuleByName($module_name);
88 88
 		        
89
-		        if($module instanceof HookSubscriberInterface){
89
+		        if ($module instanceof HookSubscriberInterface) {
90 90
 					$subscribedhooks = $module->getSubscribedHooks();
91
-					if(is_array($subscribedhooks)){
92
-						foreach($subscribedhooks as $key => $value){
93
-							if(is_int($key)) {
91
+					if (is_array($subscribedhooks)) {
92
+						foreach ($subscribedhooks as $key => $value) {
93
+							if (is_int($key)) {
94 94
 								$hook_item = $value;
95 95
 								$priority = self::DEFAULT_PRIORITY;
96 96
 							}
97
-							else{
97
+							else {
98 98
 								$hook_item = explode('#', $key, 2);
99 99
 								$priority = $value;
100 100
 							}
101
-							if($hook_item && count($hook_item) == 2){
101
+							if ($hook_item && count($hook_item) == 2) {
102 102
 								$hook_func = $hook_item[0];
103 103
 								$hook_cont = $hook_item[1];
104 104
 							}
105
-							else{
105
+							else {
106 106
 								$hook_func = $hook_item[0];
107 107
 								$hook_cont = 'all';
108 108
 							}
109
-							if(method_exists($module, $hook_func)){
110
-								$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority;
109
+							if (method_exists($module, $hook_func)) {
110
+								$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority;
111 111
 							}
112 112
 						}
113 113
 					}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * {@inheritDoc}
122 122
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getRawInstalledHooks()
123 123
 	 */
124
-	public function getRawInstalledHooks(){
125
-		if(self::isModuleOperational()){
124
+	public function getRawInstalledHooks() {
125
+		if (self::isModuleOperational()) {
126 126
 			return Database::prepare(
127 127
 					"SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority,  majh_status AS status".
128 128
 					" FROM `##maj_hooks`".
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 * {@inheritDoc}
137 137
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getInstalledHooks()
138 138
 	 */
139
-	public function getInstalledHooks(){
140
-		static $installedhooks =null;
141
-		if($installedhooks===null){
142
-			$dbhooks=self::getRawInstalledHooks();
143
-			foreach($dbhooks as $dbhook){
139
+	public function getInstalledHooks() {
140
+		static $installedhooks = null;
141
+		if ($installedhooks === null) {
142
+			$dbhooks = self::getRawInstalledHooks();
143
+			foreach ($dbhooks as $dbhook) {
144 144
 				$installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority);
145 145
 			}
146 146
 		}
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function updateHooks() {
155 155
 	    
156
-	    if(Auth::isAdmin()){
156
+	    if (Auth::isAdmin()) {
157 157
 	        $ihooks = self::getInstalledHooks();
158 158
 	        $phooks = self::getPossibleHooks();
159 159
 	        	
160 160
 	        // Insert hooks not existing yet in the DB
161
-	        if($phooks !== null){
162
-	            foreach($phooks as $phook => $priority){
161
+	        if ($phooks !== null) {
162
+	            foreach ($phooks as $phook => $priority) {
163 163
 	                $array_hook = explode('#', $phook);
164
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
164
+	                if ($ihooks === null || !array_key_exists($phook, $ihooks)) {
165 165
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
166 166
 	                    $chook->subscribe($array_hook[0]);
167 167
 	                    $chook->setPriority($array_hook[0], $priority);
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 	        }
171 171
 	        	
172 172
 	        //Remove hooks not existing any more in the file system
173
-	        if($ihooks !== null){
174
-	            foreach(array_keys($ihooks) as $ihook){
173
+	        if ($ihooks !== null) {
174
+	            foreach (array_keys($ihooks) as $ihook) {
175 175
 	                $array_hook = explode('#', $ihook);
176
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
176
+	                if ($phooks === null || !array_key_exists($ihook, $phooks)) {
177 177
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
178 178
 	                    $chook->remove($array_hook[0]);
179 179
 	                }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysis.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @return string
164 164
 	 */
165 165
 	 public function getHtmlUrl() {
166
-        return 'module.php?mod='. Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl();
166
+        return 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&mod_action=GeoAnalysis&ga_id='.$this->getId().'&ged='.$this->tree->getNameUrl();
167 167
     }
168 168
     
169 169
     /**
@@ -186,53 +186,53 @@  discard block
 block discarded – undo
186 186
         $placesDispGeneral = null;
187 187
         $placesDispGenerations = null;
188 188
         
189
-        if($sosalist && count($sosalist) > 0) {
189
+        if ($sosalist && count($sosalist) > 0) {
190 190
             $placesDispGeneral['knownsum'] = 0;
191 191
             $placesDispGeneral['unknown'] = 0;
192 192
             $placesDispGeneral['max'] = 0;
193 193
             $placesDispGeneral['places'] = array();
194
-            foreach($sosalist as $sosaid => $gens) {
194
+            foreach ($sosalist as $sosaid => $gens) {
195 195
                 $sosa = Individual::getIntance($sosaid, $this->tree);
196
-                $place =$sosa->getSignificantPlace();
196
+                $place = $sosa->getSignificantPlace();
197 197
                 $genstab = explode(',', $gens);
198
-                $isUnknown=true;
199
-                if($sosa->getDerivedRecord()->canShow() && !is_null($place)){
200
-                    $levels = array_reverse(array_map('trim',explode(',', $place)));
201
-                    if(count($levels)>= $this->analysis_level){                        
198
+                $isUnknown = true;
199
+                if ($sosa->getDerivedRecord()->canShow() && !is_null($place)) {
200
+                    $levels = array_reverse(array_map('trim', explode(',', $place)));
201
+                    if (count($levels) >= $this->analysis_level) {                        
202 202
                         $toplevelvalues = array();
203
-                        if($this->hasMap()
203
+                        if ($this->hasMap()
204 204
                             && $this->options->getMap()->isLoaded()
205 205
                             && $toplevelvalue = $this->options->getMap()->getTopLevelName()
206 206
                         ) {
207
-                            $toplevelvalues = array_map('trim',explode(',', strtolower($toplevelvalue)));
207
+                            $toplevelvalues = array_map('trim', explode(',', strtolower($toplevelvalue)));
208 208
                         }
209
-                        if(!$this->hasMap() 
209
+                        if (!$this->hasMap() 
210 210
                             || is_null($this->options->getMapLevel()) 
211
-                            || ( $this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') 
211
+                            || ($this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') 
212 212
                             || (
213 213
                                 $this->options->getMapLevel() <= $this->analysis_level 
214 214
                                 && $this->options->getMapLevel() > 0
215 215
                                 && count($levels) >= $this->options->getMapLevel()
216
-                                && in_array(strtolower($levels[$this->options->getMapLevel()-1]), $toplevelvalues)
216
+                                && in_array(strtolower($levels[$this->options->getMapLevel() - 1]), $toplevelvalues)
217 217
                             )
218 218
                         ) {
219 219
                             $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level));
220
-                            if(isset($placesDispGeneral['places'][$placest])) {
220
+                            if (isset($placesDispGeneral['places'][$placest])) {
221 221
                                 $placesDispGeneral['places'][$placest] += 1;
222 222
                             }
223 223
                             else { 
224 224
                                 $placesDispGeneral['places'][$placest] = 1;
225 225
                             }
226
-                            if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max'])
226
+                            if ($placesDispGeneral['places'][$placest] > $placesDispGeneral['max'])
227 227
                                 $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest];
228
-                            foreach($genstab as $gen) {
229
-                                if(isset($placesDispGenerations[$gen]['places'][$placest])) {
228
+                            foreach ($genstab as $gen) {
229
+                                if (isset($placesDispGenerations[$gen]['places'][$placest])) {
230 230
                                     $placesDispGenerations[$gen]['places'][$placest] += 1;
231 231
                                 }
232 232
                                 else { 
233 233
                                     $placesDispGenerations[$gen]['places'][$placest] = 1;
234 234
                                 }
235
-                                if(isset($placesDispGenerations[$gen]['sum'])) {
235
+                                if (isset($placesDispGenerations[$gen]['sum'])) {
236 236
                                     $placesDispGenerations[$gen]['sum'] += 1;
237 237
                                 }
238 238
                                 else { 
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
                                 }
241 241
                             }
242 242
                         }
243
-                        else{
244
-                            if(isset($placesDispGeneral['other'])) {
243
+                        else {
244
+                            if (isset($placesDispGeneral['other'])) {
245 245
                                 $placesDispGeneral['other'] += 1;
246 246
                             }
247 247
                             else { 
248 248
                                 $placesDispGeneral['other'] = 1;
249 249
                             }
250
-                            foreach($genstab as $gen) {
251
-                                if(isset($placesDispGenerations[$gen]['other'])) {
250
+                            foreach ($genstab as $gen) {
251
+                                if (isset($placesDispGenerations[$gen]['other'])) {
252 252
                                     $placesDispGenerations[$gen]['other'] += 1;
253 253
                                 }
254 254
                                 else { 
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
                         $isUnknown = false;
261 261
                     }
262 262
                 }
263
-                if($isUnknown){
263
+                if ($isUnknown) {
264 264
                     $placesDispGeneral['unknown'] += 1;
265
-                    foreach($genstab as $gen) {
266
-                        if(isset($placesDispGenerations[$gen]['unknown'])) { 
265
+                    foreach ($genstab as $gen) {
266
+                        if (isset($placesDispGenerations[$gen]['unknown'])) { 
267 267
                             $placesDispGenerations[$gen]['unknown'] += 1;
268 268
                         }
269 269
                         else { 
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/GeoAnalysisTabGeneralMapView.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
         /** @var OutlineMap $map */
31 31
         $map = $this->data->get('map');
32 32
         
33
-        if($map === null) {
34
-            return '<p class="warning">' .
35
-                I18N::translate('The map could not be loaded.') . 
33
+        if ($map === null) {
34
+            return '<p class="warning">'.
35
+                I18N::translate('The map could not be loaded.'). 
36 36
             '</p>';
37 37
         }
38 38
         
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 				    }
83 83
 				});
84 84
 
85
-				var paper = new Raphael(document.getElementById("geodispersion_map"), '. $canvas->width .', '. $canvas->height .');
86
-				var background = paper.rect(0, 0, ' . $canvas->width . ', '. $canvas->height . ');
87
-				background.attr({"fill" : "'. $canvas->background_color .'", "stroke" : "'. $canvas->background_stroke .'", "stroke-width": 1, "stroke-linejoin": "round" });
88
-				var attr = { fill: "'. $canvas->default_color .'", stroke: "'. $canvas->default_stroke .'", "stroke-width": 1, "stroke-linejoin": "round" };
85
+				var paper = new Raphael(document.getElementById("geodispersion_map"), '. $canvas->width.', '.$canvas->height.');
86
+				var background = paper.rect(0, 0, ' . $canvas->width.', '.$canvas->height.');
87
+				background.attr({"fill" : "'. $canvas->background_color.'", "stroke" : "'.$canvas->background_stroke.'", "stroke-width": 1, "stroke-linejoin": "round" });
88
+				var attr = { fill: "'. $canvas->default_color.'", stroke: "'.$canvas->default_stroke.'", "stroke-width": 1, "stroke-linejoin": "round" };
89 89
 				var map = {};
90 90
 		';
91 91
         
92
-        foreach($subdvisions_results as $name => $location){
93
-            $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);';
94
-            if(isset($location['transparency'])) {
92
+        foreach ($subdvisions_results as $name => $location) {
93
+            $html .= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);';
94
+            if (isset($location['transparency'])) {
95 95
                 $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>';
96
-                if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>';
96
+                if ($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>';
97 97
                 $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1);
98
-                $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");';
99
-                $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });';
100
-                $html.= 'map.area'.$location['id'].'.mouseover(function () {'.
101
-                    'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'.
98
+                $html .= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");';
99
+                $html .= 'map.area'.$location['id'].'.attr({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].' });';
100
+                $html .= 'map.area'.$location['id'].'.mouseover(function () {'.
101
+                    'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->hover_color.'", "fill-opacity" : 1}, 100, "linear");'.
102 102
                     '});'.
103 103
                     'map.area'.$location['id'].'.mouseout(function () {'.
104 104
                     'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'.
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/OutlineMap.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $this->is_loaded = false;
72 72
         $this->subdivisions = array();
73 73
         $this->mappings = array();
74
-        if($load) $this->load();
74
+        if ($load) $this->load();
75 75
     }
76 76
     
77 77
     /**
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * 
101 101
      */
102 102
     protected function load() {
103
-        if(file_exists(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename)){
103
+        if (file_exists(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename)) {
104 104
             $xml = simplexml_load_file(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename);
105
-            if($xml){
105
+            if ($xml) {
106 106
                 $this->description = trim($xml->displayName);
107 107
                 $this->top_level_name = trim($xml->topLevel);
108 108
                 $this->canvas = new OutlineMapCanvas(
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
                     trim($xml->canvas->defaultcolor), 
116 116
                     trim($xml->canvas->defaultstroke)
117 117
                 );
118
-                foreach($xml->subdivisions->children() as $subdivision){
118
+                foreach ($xml->subdivisions->children() as $subdivision) {
119 119
                     $attributes = $subdivision->attributes();
120 120
                     $key = I18N::strtolower(trim($attributes['name']));
121
-                    if(isset($attributes['parent'])) $key .= '@'. I18N::strtolower(trim($attributes['parent']));
121
+                    if (isset($attributes['parent'])) $key .= '@'.I18N::strtolower(trim($attributes['parent']));
122 122
                     $this->subdivisions[$key] = array(
123 123
                         'id' => trim($attributes['id']),
124 124
                         'displayname' => trim($attributes['name']),
125 125
                         'coord' => trim($subdivision[0])
126 126
                     );
127 127
                 }
128
-                if(isset($xml->mappings)) {
129
-                    foreach($xml->mappings->children() as $mappings){
128
+                if (isset($xml->mappings)) {
129
+                    foreach ($xml->mappings->children() as $mappings) {
130 130
                         $attributes = $mappings->attributes();
131 131
                         $this->mappings[I18N::strtolower(trim($attributes['name']))] = I18N::strtolower(trim($attributes['mapto']));
132 132
                     }
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
      * @return bool
145 145
      */
146 146
     public function isLoaded() {
147
-        try{
148
-            if(!$this->is_loaded) $this->load();
147
+        try {
148
+            if (!$this->is_loaded) $this->load();
149 149
         }
150 150
         catch (\Exception $ex) { }
151 151
         return $this->is_loaded;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * @return string
165 165
 	 */
166 166
     public function getDescription() {
167
-        if(!$this->is_loaded) $this->load();
167
+        if (!$this->is_loaded) $this->load();
168 168
         return $this->description;
169 169
     }
170 170
     
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * @return string
174 174
 	 */
175 175
     public function getTopLevelName() {
176
-        if(!$this->is_loaded) $this->load();
176
+        if (!$this->is_loaded) $this->load();
177 177
         return $this->top_level_name;
178 178
     }    
179 179
     
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas
183 183
      */
184 184
     public function getCanvas() {
185
-        if(!$this->is_loaded) $this->load();
185
+        if (!$this->is_loaded) $this->load();
186 186
         return $this->canvas;
187 187
     }
188 188
     
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @return array
192 192
      */
193 193
     public function getSubdivisions() {
194
-        if(!$this->is_loaded) $this->load();
194
+        if (!$this->is_loaded) $this->load();
195 195
         return $this->subdivisions;
196 196
     }
197 197
     
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @return array
201 201
      */
202 202
     public function getPlacesMappings() {
203
-        if(!$this->is_loaded) $this->load();
203
+        if (!$this->is_loaded) $this->load();
204 204
         return $this->mappings;
205 205
     }
206 206
     
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/GeoAnalysisController.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         
71 71
         $ga_id = Filter::getInteger('ga_id');        
72 72
         
73
-        if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) {
73
+        if ($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) {
74 74
             $data->set('has_analysis', true);
75 75
             $data->set('geoanalysis', $ga);
76 76
             
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 jQuery.get(
84 84
 					"module.php",
85 85
 					{
86
-                        "mod" : "'. $this->module->getName() .'",  
86
+                        "mod" : "'. $this->module->getName().'",  
87 87
                         "mod_action": "GeoAnalysis@dataTabs",
88 88
                         "ga_id" : "'.$ga_id.'"
89 89
                     },
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $data->set('has_list', false);
116 116
         
117 117
         $ga_list = $this->provider->getGeoAnalysisList();
118
-        if(count($ga_list) > 0 ) {
118
+        if (count($ga_list) > 0) {
119 119
              $data->set('has_list', true);
120 120
              $data->set('geoanalysislist', $ga_list);
121 121
         }
@@ -139,19 +139,19 @@  discard block
 block discarded – undo
139 139
         );
140 140
         
141 141
         $status = Filter::getBool('status');
142
-        $res = array('geoanalysis' => $ga->getId() , 'error' => null);
143
-        try{
142
+        $res = array('geoanalysis' => $ga->getId(), 'error' => null);
143
+        try {
144 144
             $this->provider->setGeoAnalysisStatus($ga, $status);
145 145
             $res['status'] = $status;
146
-			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
146
+			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '.($status ? 'enabled' : 'disabled').'.');
147 147
         }
148 148
         catch (\Exception $ex) {
149 149
             $res['error'] = $ex->getMessage();
150
-			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
150
+			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage());
151 151
         }
152 152
         
153 153
         $controller->pageHeader();
154
-        if($res['error']) http_response_code(500);
154
+        if ($res['error']) http_response_code(500);
155 155
         
156 156
         $controller->encode($res);
157 157
     }
@@ -171,18 +171,18 @@  discard block
 block discarded – undo
171 171
             && $ga
172 172
             );
173 173
             
174
-        $res = array('geoanalysis' => $ga->getId() , 'error' => null);
175
-        try{
174
+        $res = array('geoanalysis' => $ga->getId(), 'error' => null);
175
+        try {
176 176
             $this->provider->deleteGeoAnalysis($ga);
177 177
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.');
178 178
         }
179 179
         catch (\Exception $ex) {
180 180
             $res['error'] = $ex->getMessage();
181
-			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage());
181
+			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '.$ex->getMessage());
182 182
         }
183 183
     
184 184
         $controller->pageHeader();
185
-        if($res['error']) http_response_code(500);
185
+        if ($res['error']) http_response_code(500);
186 186
 
187 187
         $controller->encode($res);
188 188
     }
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
         list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations());
208 208
         
209 209
         $flags = array();
210
-        if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) {
210
+        if ($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) {
211 211
             $mapProvider = new GoogleMapsProvider();            
212
-            foreach($placesDispGeneral['places'] as $place => $count) {
212
+            foreach ($placesDispGeneral['places'] as $place => $count) {
213 213
                 $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $wt_tree));
214 214
             }
215 215
         }
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 	 * @param (null|array) $flags Array of flags
229 229
 	 * @return string HTML code for the general tab
230 230
 	 */
231
-    protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) {        
232
-        if(!empty($placesGeneralResults)){
231
+    protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags = null) {        
232
+        if (!empty($placesGeneralResults)) {
233 233
             $data = new ViewBag();
234 234
             
235 235
             $nb_found = $placesGeneralResults['knownsum'];
236 236
             $nb_other = 0;
237
-            if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other'];
237
+            if (isset($placesGeneralResults['other'])) $nb_other = $placesGeneralResults['other'];
238 238
             $nb_unknown = $placesGeneralResults['unknown'];
239 239
             
240 240
             $data->set('stats_gen_nb_found', $nb_found);
@@ -243,30 +243,30 @@  discard block
 block discarded – undo
243 243
             
244 244
             $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags());
245 245
             
246
-            if($ga->hasMap()) {
246
+            if ($ga->hasMap()) {
247 247
                 $max = $placesGeneralResults['max'];
248 248
                 $map = $ga->getOptions()->getMap();
249
-                if($map->isLoaded()) {
249
+                if ($map->isLoaded()) {
250 250
                     $results_by_subdivs = $map->getSubdivisions();
251 251
                     $places_mappings = $map->getPlacesMappings();
252 252
                     foreach ($placesGeneralResults['places'] as $location => $count) {
253
-                        $levelvalues = array_reverse(array_map('trim',explode(',', $location)));
253
+                        $levelvalues = array_reverse(array_map('trim', explode(',', $location)));
254 254
                         $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel();
255
-                        if($level_map >= 0 && $level_map < count($levelvalues)) {
256
-                            $levelref = I18N::strtolower($levelvalues[0] . '@' . $levelvalues[$level_map]);
257
-                            if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; }
255
+                        if ($level_map >= 0 && $level_map < count($levelvalues)) {
256
+                            $levelref = I18N::strtolower($levelvalues[0].'@'.$levelvalues[$level_map]);
257
+                            if (!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; }
258 258
                         }
259 259
                         else {
260 260
                             $levelref = $levelvalues[0];
261 261
                         }
262 262
                         $levelref = I18N::strtolower($levelref);
263
-                        if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
264
-                        if(isset($results_by_subdivs[$levelref])) {
263
+                        if (isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
264
+                        if (isset($results_by_subdivs[$levelref])) {
265 265
                             $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0;
266
-                            $count_subd  += $count;
266
+                            $count_subd += $count;
267 267
                             $results_by_subdivs[$levelref]['count'] = $count_subd;   
268 268
                             $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max);
269
-                            if($ga->getOptions()->isUsingFlags() && $flags) {
269
+                            if ($ga->getOptions()->isUsingFlags() && $flags) {
270 270
                                 $results_by_subdivs[$levelref]['place'] = new Place($location, Globals::getTree());
271 271
                                 $results_by_subdivs[$levelref]['flag'] = $flags[$location];
272 272
                             }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             }
290 290
         }
291 291
         else {
292
-            $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>';
292
+            $html = '<p class="warning">'.I18N::translate('No data is available for the general analysis.').'</p>';
293 293
         }
294 294
         return $html;
295 295
     }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 * @return string HTML code for the generations tab
304 304
 	 */
305 305
     protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) {        
306
-        if(!empty($placesGenerationsResults) && $ga->getOptions()){
306
+        if (!empty($placesGenerationsResults) && $ga->getOptions()) {
307 307
             $data = new ViewBag();
308 308
             
309 309
             ksort($placesGenerationsResults);
@@ -316,26 +316,26 @@  discard block
 block discarded – undo
316 316
             $data->set('display_all_places', $display_all_places);
317 317
             
318 318
             $results_by_gen = array();
319
-            foreach($placesGenerationsResults as $gen => $genData){
319
+            foreach ($placesGenerationsResults as $gen => $genData) {
320 320
                 $sum = 0;
321 321
                 $other = 0;
322 322
                 $unknown = 0;
323
-                if(isset($genData['sum'])) $sum = $genData['sum'];
324
-                if(isset($genData['other'])) $other = $genData['other'];
325
-                if(isset($genData['unknown'])) $unknown = $genData['unknown'];
323
+                if (isset($genData['sum'])) $sum = $genData['sum'];
324
+                if (isset($genData['other'])) $other = $genData['other'];
325
+                if (isset($genData['unknown'])) $unknown = $genData['unknown'];
326 326
                 
327
-                if($sum > 0) {                
327
+                if ($sum > 0) {                
328 328
                     $results_by_gen[$gen]['sum'] = $sum;
329 329
                     $results_by_gen[$gen]['other'] = $other;
330 330
                     $results_by_gen[$gen]['unknown'] = $unknown;
331 331
                     $results_by_gen[$gen]['places'] = array();                    
332 332
                     arsort($genData['places']);
333 333
                     
334
-                    if($display_all_places){
335
-                        foreach($genData['places'] as $placename=> $count){
334
+                    if ($display_all_places) {
335
+                        foreach ($genData['places'] as $placename=> $count) {
336 336
                             $results_by_gen[$gen]['places'][$placename]['count'] = $count;
337 337
                             
338
-                            if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){
338
+                            if ($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != '') {
339 339
                                 $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, Globals::getTree());
340 340
                                 $results_by_gen[$gen]['places'][$placename]['flag'] = $flag;
341 341
                             }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                     }
344 344
                     else {
345 345
                         $tmp = $genData['places'];
346
-                        if($other > 0) {
346
+                        if ($other > 0) {
347 347
                             $tmp = array_slice($tmp, 0, 5, true);
348 348
                             $tmp['other'] = $other;
349 349
                             arsort($tmp);  
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             
360 360
         }
361 361
         else {
362
-            $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>';
362
+            $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'</p>';
363 363
         }
364 364
         return $html;
365 365
     }
Please login to merge, or discard this patch.
src/Webtrees/ImageBuilder.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	*
70 70
 	* @param Media|null $media Reference media object
71 71
 	*/
72
-	public function __construct(Media $media = null){
72
+	public function __construct(Media $media = null) {
73 73
 	    $this->media = $media;
74 74
 	    $this->use_ttf = function_exists('imagettftext');
75 75
 	    $this->expire_offset = 3600 * 24;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return ImageBuilder
96 96
 	 */
97 97
 	public function setExpireOffset($expireOffset) {
98
-	    if($expireOffset) $this->expire_offset = $expireOffset;
98
+	    if ($expireOffset) $this->expire_offset = $expireOffset;
99 99
 	    return $this;
100 100
 	}
101 101
 	
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return ImageBuilder
116 116
 	 */
117 117
 	public function setShowWatermark($show_watermark) {
118
-	    if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
118
+	    if (!is_null($show_watermark)) $this->show_watermark = $show_watermark;
119 119
 	    return $this;
120 120
 	}
121 121
 	
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return ImageBuilder
127 127
 	 */
128 128
 	public function setFontMaxSize($font_max_size) {
129
-	    if($font_max_size) $this->font_max_size = $font_max_size;
129
+	    if ($font_max_size) $this->font_max_size = $font_max_size;
130 130
 	    return $this;
131 131
 	}
132 132
 	
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return ImageBuilder
138 138
 	 */
139 139
 	public function setFontColor($font_color) {
140
-	    if($font_color) $this->font_color = $font_color;
140
+	    if ($font_color) $this->font_color = $font_color;
141 141
 	    return $this;
142 142
 	}
143 143
 	
@@ -148,32 +148,32 @@  discard block
 block discarded – undo
148 148
 	 * @return ImageBuilder
149 149
 	 */
150 150
 	public function setAsAttachment($is_attachement) {
151
-	    if(is_bool($is_attachement)) $this->as_attachment = $is_attachement;
151
+	    if (is_bool($is_attachement)) $this->as_attachment = $is_attachement;
152 152
 	    return $this;
153 153
 	}
154 154
 	
155 155
 	/**
156 156
 	 * Render the image to the output.
157 157
 	 */
158
-	public function render(){
158
+	public function render() {
159 159
 	    
160 160
 	    if (!$this->media || !$this->media->canShow()) {
161
-	        Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.'));
161
+	        Log::addMediaLog('Image Builder error: >'.I18N::translate('Missing or private media object.'));
162 162
 	        $this->renderError();
163 163
 	    }
164 164
 	    
165 165
 	    $serverFilename = $this->media->getServerFilename();
166 166
 	    
167 167
 	    if (!file_exists($serverFilename)) {
168
-	        Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
168
+	        Log::addMediaLog('Image Builder error: >'.I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
169 169
 	        $this->renderError();
170 170
 	    }
171 171
 	    
172 172
 	    $mimetype = $this->media->mimeType();
173 173
 	    $imgsize = $this->media->getImageAttributes();
174 174
 	    $filetime = $this->media->getFiletime();
175
-	    $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';	    
176
-	    $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT';
175
+	    $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime).' GMT';	    
176
+	    $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()).' GMT';
177 177
 	    
178 178
 	    $type = Functions::isImageTypeSupported($imgsize['ext']);
179 179
 	    $usewatermark = false;
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 	    }
206 206
 	    
207 207
 	    // add caching headers.  allow browser to cache file, but not proxy
208
-	    header('Last-Modified: ' . $filetimeHeader);
209
-	    header('ETag: "' . $etag . '"');
210
-	    header('Expires: ' . $expireHeader);
211
-	    header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate');
208
+	    header('Last-Modified: '.$filetimeHeader);
209
+	    header('ETag: "'.$etag.'"');
210
+	    header('Expires: '.$expireHeader);
211
+	    header('Cache-Control: max-age='.$this->getExpireOffset().', s-maxage=0, proxy-revalidate');
212 212
 	    
213 213
 	    // if this file is already in the user’s cache, don’t resend it
214 214
 	    // first check if the if_modified_since param matches
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 
224 224
 	    // send headers for the image
225 225
 	    $disposition = $this->as_attachment ? 'attachment' : 'inline';
226
-	    header('Content-Type: ' . $mimetype);
227
-	    header('Content-Disposition: ' . $disposition . '; filename="' . addslashes(basename($this->media->getFilename())) . '"');
226
+	    header('Content-Type: '.$mimetype);
227
+	    header('Content-Disposition: '.$disposition.'; filename="'.addslashes(basename($this->media->getFilename())).'"');
228 228
 	     
229 229
 	    if ($usewatermark) {
230 230
 	        // generate the watermarked image
231
-	        $imCreateFunc = 'imagecreatefrom' . $type;
232
-	        $imSendFunc   = 'image' . $type;
231
+	        $imCreateFunc = 'imagecreatefrom'.$type;
232
+	        $imSendFunc   = 'image'.$type;
233 233
 	    
234 234
 	        if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
235 235
 	            $im = $imCreateFunc($serverFilename);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	            return;
243 243
 	        } else {
244 244
 	            // this image is defective.  log it
245
-	            Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
245
+	            Log::addMediaLog('Image Builder error: >'.I18N::translate('This media file is broken and cannot be watermarked.').'< in file >'.$serverFilename.'< memory used: '.memory_get_usage());
246 246
 	        }
247 247
 	    }
248 248
 	    
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	    $filesize = filesize($serverFilename);
251 251
 	    
252 252
 	    // set content-length header, send file
253
-	    header('Content-Length: ' . $filesize);
253
+	    header('Content-Length: '.$filesize);
254 254
 	    
255 255
 	    // Some servers disable fpassthru() and readfile()
256 256
 	    if (function_exists('readfile')) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     	$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
281 281
     	imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
282 282
     
283
-    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
283
+    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT.Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
284 284
     
285 285
     	http_response_code(404);
286 286
     	header('Content-Type: image/png');
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	protected function applyWatermark($im) {
299 299
 	    
300 300
 	    // text to watermark with	    
301
-	    if(method_exists($this->media, 'getWatermarkText')) {
301
+	    if (method_exists($this->media, 'getWatermarkText')) {
302 302
 	       $word1_text = $this->media->getWatermarkText();
303 303
 	    }
304 304
 	    else {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	        $word1_text, 
311 311
 	        $this->font_max_size,
312 312
 	        $this->font_color,
313
-	        WT_ROOT . Config::FONT_DEJAVU_SANS_TTF,
313
+	        WT_ROOT.Config::FONT_DEJAVU_SANS_TTF,
314 314
 	        'top', 
315 315
 	        'left'
316 316
 	     );
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @param string $hexstr
430 430
 	 * @return int[]
431 431
 	 */
432
-	protected function hexrgb ($hexstr)
432
+	protected function hexrgb($hexstr)
433 433
 	{
434 434
 	    $int = hexdec($hexstr);
435 435
 	
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
      */
472 472
     function imageTtfTextErrorHandler($errno, $errstr) {
473 473
         // log the error
474
-        Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<');
474
+        Log::addErrorLog('Image Builder error: >'.$errno.'/'.$errstr.'< while processing file >'.$this->media->getServerFilename().'<');
475 475
     
476 476
         // change value of useTTF to false so the fallback watermarking can be used.
477 477
         $this->use_ttf = false;
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Schema/Migration1.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@
 block discarded – undo
22 22
 	public function upgrade() {
23 23
 
24 24
 		Database::exec(
25
-		    'ALTER TABLE `##maj_sosa`' . 
26
-		    ' ADD COLUMN majs_birth_year_est SMALLINT NULL AFTER majs_birth_year,' .
25
+		    'ALTER TABLE `##maj_sosa`'. 
26
+		    ' ADD COLUMN majs_birth_year_est SMALLINT NULL AFTER majs_birth_year,'.
27 27
 		    ' ADD COLUMN majs_death_year_est SMALLINT NULL AFTER majs_death_year'
28 28
 		);
29 29
 		
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/SosaStatsController.php 1 patch
Spacing   +40 added lines, -41 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $view_bag->set('title', $controller->getPageTitle());
64 64
         $view_bag->set('is_setup', false);
65 65
         
66
-        if($this->sosa_provider->isSetup()) {
66
+        if ($this->sosa_provider->isSetup()) {
67 67
             $view_bag->set('is_setup', true);
68 68
             
69 69
             $view_bag->set('root_indi', $this->sosa_provider->getRootIndi());
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
             $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$wt_tree->getNameUrl().'&gen=');
85 85
             $view_bag->set('sosaanc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList&ged='.$wt_tree->getNameUrl().'&gen=');
86 86
             
87
-            $gen_theoretical=1;
88
-            $total_theoretical=0;
89
-            $prev_diff=0;
90
-            $prev_known=0.5;
87
+            $gen_theoretical = 1;
88
+            $total_theoretical = 0;
89
+            $prev_diff = 0;
90
+            $prev_known = 0.5;
91 91
             $generation_stats = array();
92 92
             
93
-            foreach($stats_gen as $gen => $tab){
94
-                $genY1= I18N::translate('-');
95
-                $genY2= I18N::translate('-');
96
-                if($tab['firstBirth']>0) $genY1=$tab['firstEstimatedBirth'];
97
-                if($tab['lastBirth']>0) $genY2=$tab['lastEstimatedBirth'];
93
+            foreach ($stats_gen as $gen => $tab) {
94
+                $genY1 = I18N::translate('-');
95
+                $genY2 = I18N::translate('-');
96
+                if ($tab['firstBirth'] > 0) $genY1 = $tab['firstEstimatedBirth'];
97
+                if ($tab['lastBirth'] > 0) $genY2 = $tab['lastEstimatedBirth'];
98 98
                 $total_theoretical += $gen_theoretical;
99 99
                 $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical);
100
-                $missing=2*$prev_known - $tab['sosaCount'];
101
-                $gen_diff=$tab['diffSosaTotalCount']-$prev_diff;
100
+                $missing = 2 * $prev_known - $tab['sosaCount'];
101
+                $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff;
102 102
                 
103 103
                 $generation_stats[$gen] = array(
104 104
                     'gen_min_birth' => $genY1,
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     'known' => $tab['sosaCount'],
108 108
                     'perc_known' => $perc_sosa_count_theor,
109 109
                     'missing' => $missing,
110
-                    'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known),
110
+                    'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known),
111 111
                     'total_known' => $tab['sosaTotalCount'],
112 112
                     'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical),
113 113
                     'different' => $gen_diff,
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
                 );
118 118
                 
119 119
                 $gen_theoretical = $gen_theoretical * 2;
120
-                $prev_known=$tab['sosaCount'];
121
-                $prev_diff=$tab['diffSosaTotalCount'];
120
+                $prev_known = $tab['sosaCount'];
121
+                $prev_diff = $tab['diffSosaTotalCount'];
122 122
             }
123 123
             
124 124
             $view_bag->set('generation_stats', $generation_stats);
@@ -149,13 +149,12 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $top10multiancestors = $this->sosa_provider->getTopMultiSosaAncestorsNoTies(10);
151 151
         $top10ancestors = array();
152
-        if($top10multiancestors !== null && count($top10multiancestors)) {
153
-            foreach($top10multiancestors as $pid => $count) {
152
+        if ($top10multiancestors !== null && count($top10multiancestors)) {
153
+            foreach ($top10multiancestors as $pid => $count) {
154 154
                 $indi = Individual::getInstance($pid, $this->sosa_provider->getTree());
155
-                if($indi !== null && $indi->canShowName()) {
155
+                if ($indi !== null && $indi->canShowName()) {
156 156
                     array_key_exists($count, $top10ancestors) ?
157
-                        $top10ancestors[$count][] = $indi:
158
-                        $top10ancestors[$count] = array($count => $indi);
157
+                        $top10ancestors[$count][] = $indi : $top10ancestors[$count] = array($count => $indi);
159 158
                 }
160 159
             }
161 160
         }
@@ -169,27 +168,27 @@  discard block
 block discarded – undo
169 168
      private function htmlAncestorDispersionG2()
170 169
     {
171 170
         $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2);
172
-        if(count($ancestorsDispGen2) == 0) return;
171
+        if (count($ancestorsDispGen2) == 0) return;
173 172
         
174 173
         $size = '600x300';
175 174
         
176 175
         $total = array_sum($ancestorsDispGen2);
177 176
         $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0;
178
-        $father = array (
177
+        $father = array(
179 178
             'color' => '84beff', 
180 179
             'count' => $father_count, 
181 180
             'perc' => Functions::safeDivision($father_count, $total), 
182 181
             'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat')            
183 182
         );
184 183
         $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0;
185
-        $mother = array (
184
+        $mother = array(
186 185
             'color' => 'ffd1dc', 
187 186
             'count' => $mother_count, 
188 187
             'perc' => Functions::safeDivision($mother_count, $total),
189 188
             'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot')
190 189
         );
191 190
         $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
192
-        $shared = array (
191
+        $shared = array(
193 192
             'color' => '777777', 
194 193
             'count' => $shared_count, 
195 194
             'perc' => Functions::safeDivision($shared_count, $total),
@@ -199,10 +198,10 @@  discard block
 block discarded – undo
199 198
         $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc']));
200 199
         $chart_title = I18N::translate('Known Sosa ancestors\' dispersion');
201 200
         $chl = 
202
-             $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' .
203
-             $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' .
204
-             $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1);
205
-        return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
201
+             $father['name'].' - '.I18N::percentage($father['perc'], 1).'|'.
202
+             $shared['name'].' - '.I18N::percentage($shared['perc'], 1).'|'.
203
+             $mother['name'].' - '.I18N::percentage($mother['perc'], 1);
204
+        return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />";
206 205
     }
207 206
     
208 207
     /**
@@ -226,7 +225,7 @@  discard block
 block discarded – undo
226 225
         $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0;
227 226
         $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0;
228 227
         $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
229
-        $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha;
228
+        $total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha;
230 229
     
231 230
         $chd = $this->arrayToExtendedEncoding(array(
232 231
 	    4095 * Functions::safeDivision($total_fatfat, $total), 
@@ -237,12 +236,12 @@  discard block
 block discarded – undo
237 236
         ));
238 237
         $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3');
239 238
         $chl =
240
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' .
241
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' .
242
-            I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' .
243
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' .
244
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
245
-         return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
239
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat').' - '.I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1).'|'.
240
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot').' - '.I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1).'|'.
241
+            I18N::translate('Shared').' - '.I18N::percentage(Functions::safeDivision($total_sha, $total), 1).'|'.
242
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat').' - '.I18N::percentage(Functions::safeDivision($total_motfat, $total), 1).'|'.
243
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot').' - '.I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
244
+         return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />";
246 245
     }    
247 246
     
248 247
     /**
@@ -251,15 +250,15 @@  discard block
 block discarded – undo
251 250
      */
252 251
     private function htmlAncestorGenDepthG3() {
253 252
         $ancestorsGenDepth3 = $this->sosa_provider->getGenerationDepthStatsAtGen(3);
254
-        if(count($ancestorsGenDepth3) == 0) return;
253
+        if (count($ancestorsGenDepth3) == 0) return;
255 254
         
256 255
         $ancestors = array();
257 256
         $chd_mean = array();
258 257
         $chd_error_low = array();
259 258
         $chd_error_high = array();
260
-        foreach($ancestorsGenDepth3 as $sosa => $genDepthStat) {
259
+        foreach ($ancestorsGenDepth3 as $sosa => $genDepthStat) {
261 260
             $ancestor = Individual::getInstance($genDepthStat['root_ancestor_id'], $this->sosa_provider->getTree());
262
-            if($ancestor !== null && $ancestor->canShowName()) {
261
+            if ($ancestor !== null && $ancestor->canShowName()) {
263 262
                 $tmp = $ancestor->getAllNames();
264 263
                 $ancestors[] = Filter::escapeUrl($tmp[$ancestor->getPrimaryName()]['fullNN']);
265 264
             }
@@ -272,7 +271,7 @@  discard block
 block discarded – undo
272 271
         }
273 272
         
274 273
         $maxChd = ceil(max($chd_error_high));
275
-        $chd = implode(',', $chd_mean) . '|' . implode(',', $chd_error_low) . '|' . implode(',', $chd_error_high);
274
+        $chd = implode(',', $chd_mean).'|'.implode(',', $chd_error_low).'|'.implode(',', $chd_error_high);
276 275
         $chxl = implode('|', array_reverse($ancestors));
277 276
         $chbh = 30;
278 277
         $chs = count($ancestors) * $chbh + 50;
@@ -294,9 +293,9 @@  discard block
 block discarded – undo
294 293
             if ($value < 0) {
295 294
                 $value = 0;
296 295
             }
297
-            $first  = (int) ($value / 64);
296
+            $first  = (int)($value / 64);
298 297
             $second = $value % 64;
299
-            $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second];
298
+            $encoding .= $xencoding[(int)$first].$xencoding[(int)$second];
300 299
         }
301 300
     
302 301
         return $encoding;
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaStatsView.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 			<?php 
32 32
 			/** @var \Fisharebest\Webtrees\Individual $root_indi */
33 33
 			$root_indi = $this->data->get('root_indi');
34
-			if($root_indi !== null && $root_indi->canShowName()) { ?>
34
+			if ($root_indi !== null && $root_indi->canShowName()) { ?>
35 35
 			<h4 class="center"><?= I18N::translate('%s: %s', I18N::translate('Root individual'), $root_indi->getFullName()); ?><h4>
36 36
 			<?php } ?>
37 37
 			
38
-			<?php  if($this->data->get('is_setup')) {  
38
+			<?php  if ($this->data->get('is_setup')) {  
39 39
 			    $general_stats = $this->data->get('general_stats'); ?>
40 40
 			<h3><?php echo I18N::translate('General statistics'); ?></h3>
41 41
 			<div class="maj-table">
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				</div>
58 58
 				<div class="maj-row">
59 59
 					<div class="label"><?php echo I18N::translate('Generation mean duration'); ?></div>
60
-					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'],  I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
60
+					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'], I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
61 61
 				</div>
62 62
 			</div>
63 63
 			
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					</tr>
98 98
 				</thead>
99 99
 				<tbody>
100
-					<?php foreach($this->data->get('generation_stats') as $gen => $row) { ?>
100
+					<?php foreach ($this->data->get('generation_stats') as $gen => $row) { ?>
101 101
 					<tr class="maj-row">
102 102
 						<td class="label"><?php echo I18N::translate('<strong>G%d</strong>', $gen); ?></td>
103 103
 						<td class="label"><?php echo I18N::translate('%1$s <> %2$s', $row['gen_min_birth'], $row['gen_max_birth']); ?></td>
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 						<td class="value"><?php echo I18N::number($row['different']); ?></td>
112 112
 						<td class="value left percent_container">
113 113
 							<div class="percent_frame">
114
-								<div class="percent_cell" style="width:<?php echo 100*$row['perc_different'] ?>%;">
114
+								<div class="percent_cell" style="width:<?php echo 100 * $row['perc_different'] ?>%;">
115 115
 									&nbsp;<?php echo I18N::percentage($row['perc_different']); ?>&nbsp;
116 116
 								</div>
117 117
 							</div>
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
 							             I18N::translate('%s generation'),
132 132
 							             I18N::translate('%s generations'),
133 133
 							             $this->data->get('mean_gen_depth'),
134
-							             I18N::number($this->data->get('mean_gen_depth'),2)
134
+							             I18N::number($this->data->get('mean_gen_depth'), 2)
135 135
 							         )
136 136
 							    ).
137
-								' &mdash; ' . 
137
+								' &mdash; '. 
138 138
 								I18N::translate(
139 139
 								    'Standard deviation: %s',
140 140
 								    I18N::plural(
141 141
 								        I18N::translate('%s generation'), 
142 142
 								        I18N::translate('%s generations'), 
143 143
 								        $this->data->get('stddev_gen_depth'), 
144
-								        I18N::number($this->data->get('stddev_gen_depth'),2)
144
+								        I18N::number($this->data->get('stddev_gen_depth'), 2)
145 145
 								    )
146 146
 								);
147 147
 							?>
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 			
154 154
 			<?php  
155 155
 			$top10_multi_ancestors = $this->data->get('top10multiancestors');
156
-			if(count($top10_multi_ancestors) > 0) { ?>
156
+			if (count($top10_multi_ancestors) > 0) { ?>
157 157
 			<h3><?= I18N::translate('Most duplicated root Sosa ancestors'); ?></h3>
158 158
 			<div class="maj-table">
159
-			<?php foreach($top10_multi_ancestors as $count => $indis) { ?>
159
+			<?php foreach ($top10_multi_ancestors as $count => $indis) { ?>
160 160
 			    <div class="maj-row">
161 161
 			    	<div class="label"><?= I18N::translate('%s times', I18N::number($count)); ?></div>
162 162
 			    	<div class="value"><?php 
163 163
 			    	echo implode(
164 164
 			    	    I18N::$list_separator, 
165 165
 			    	    array_map(function(Individual $indi) {
166
-			    	        return '<a href="'. $indi->getHtmlUrl(). '">'. $indi->getFullName() . '&nbsp;' . $indi->getSexImage() . '</a>';
166
+			    	        return '<a href="'.$indi->getHtmlUrl().'">'.$indi->getFullName().'&nbsp;'.$indi->getSexImage().'</a>';
167 167
 			    	    }, $indis)
168 168
 			    	);
169 169
 			    	?></div>
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 			
175 175
 			<h3><?php echo I18N::translate('Known Sosa ancestors\' family dispersion'); ?></h3>
176 176
 			<div class="center">
177
-				<?php echo $this->data->get('chart_img_g2') ?: '' ; ?>
178
-				<?php echo $this->data->get('chart_img_g3') ?: '' ; ?>
177
+				<?php echo $this->data->get('chart_img_g2') ?: ''; ?>
178
+				<?php echo $this->data->get('chart_img_g3') ?: ''; ?>
179 179
 				<!--  <canvas id="chart_ancestors_g2" width="300" height="300"></canvas>  -->
180 180
 			</div>
181 181
 			
182 182
 			<h3><?php echo I18N::translate('Mean generation depth by grandparents'); ?></h3>
183 183
 			<div class="center">
184
-				<?php echo $this->data->get('chart_img_gendepth3') ?: '' ; ?>
184
+				<?php echo $this->data->get('chart_img_gendepth3') ?: ''; ?>
185 185
 			</div>
186 186
 			
187 187
 			<?php   } else { ?>
Please login to merge, or discard this patch.