Passed
Branch feature/2.0 (9789a8)
by Jonathan
14:17
created
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/GeoDispersion/Model/GeoAnalysisProvider.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
         ->setUsingFlags($row['majgd_useflagsgen'] == 'yes')
66 66
         ->setMaxDetailsInGen($row['majgd_detailsgen']);
67 67
         
68
-        if($row['majgd_map']) {
68
+        if ($row['majgd_map']) {
69 69
             $options
70 70
             ->setMap(new OutlineMap($row['majgd_map']))
71 71
             ->setMapLevel($row['majgd_toplevel']);
72 72
         }
73 73
         
74 74
         $enabled = true;
75
-        if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
75
+        if (isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76 76
             $enabled = false;
77 77
         }
78 78
         
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getGeoAnalysisCount() {
95 95
         return Database::prepare(
96
-            'SELECT COUNT(majgd_id)' .
97
-            ' FROM `##maj_geodispersion`' .
96
+            'SELECT COUNT(majgd_id)'.
97
+            ' FROM `##maj_geodispersion`'.
98 98
             ' WHERE majgd_file = :gedcom_id'
99 99
             )->execute(array(
100 100
                 'gedcom_id' => $this->tree->getTreeId()
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111 111
      */
112 112
     public function getGeoAnalysis($id, $only_enabled = true) {
113
-        $args = array (
113
+        $args = array(
114 114
             'gedcom_id' => $this->tree->getTreeId(),
115 115
             'ga_id' => $id
116 116
         );
117 117
         
118
-        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
-            ' FROM `##maj_geodispersion`' .
118
+        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status'.
119
+            ' FROM `##maj_geodispersion`'.
120 120
             ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
-        if($only_enabled) {
121
+        if ($only_enabled) {
122 122
             $sql .= ' AND majgd_status = :status';
123 123
             $args['status'] = 'enabled';
124 124
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         
127 127
         $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
128 128
         
129
-        if($ga_array) {
129
+        if ($ga_array) {
130 130
             return $this->loadGeoAnalysisFromRow($ga_array);
131 131
         }
132 132
         
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @return GeoAnalysis
147 147
      */
148 148
 	public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) {
149
-		try{
149
+		try {
150 150
 			Database::beginTransaction();
151 151
 		
152 152
 			Database::prepare(
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			
169 169
 			Database::commit();
170 170
 		}
171
-		catch(\Exception $ex) {
171
+		catch (\Exception $ex) {
172 172
 			Database::rollback();
173 173
 			$ga = null;
174 174
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 			
212 212
 			 Database::commit();
213 213
 		}
214
-		catch(\Exception $ex) {		    
214
+		catch (\Exception $ex) {		    
215 215
 			Database::rollback();
216
-			Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
216
+			Log::addErrorLog('The Geo Analysis ID “'.$ga->getId().'” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
217 217
 			$ga = null;
218 218
 		}
219 219
 		return $ga;
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @return array List of enabled maps
260 260
      */
261
-    public function getGeoAnalysisList(){
261
+    public function getGeoAnalysisList() {
262 262
         $res = array();
263 263
         
264 264
         $list = Database::prepare(
265
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
-            ' FROM `##maj_geodispersion`' .
265
+            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen'.
266
+            ' FROM `##maj_geodispersion`'.
267 267
             ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268 268
             ' ORDER BY majgd_descr'
269 269
         )->execute(array(
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             'status' => 'enabled'
272 272
         ))->fetchAll(\PDO::FETCH_ASSOC);
273 273
         
274
-        foreach($list as $ga) {
274
+        foreach ($list as $ga) {
275 275
            $res[] = $this->loadGeoAnalysisFromRow($ga);
276 276
         }
277 277
         
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
      * @param int|null $limit Max number of items to return (for pagination)
288 288
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289 289
      */
290
-    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
290
+    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null) {
291 291
         $res = array();
292 292
             
293 293
         $sql = 
294
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
-            ' FROM `##maj_geodispersion`' .
294
+            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status'.
295
+            ' FROM `##maj_geodispersion`'.
296 296
             ' WHERE majgd_file = :gedcom_id';
297 297
         
298 298
         $args = array('gedcom_id'=> $this->tree->getTreeId());
299 299
         
300
-        if($search) {
300
+        if ($search) {
301 301
             $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302 302
             $args['search'] = $search;
303 303
         }
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
                 
312 312
                 switch ($value['dir']) {
313 313
                     case 'asc':
314
-                        $sql .= $value['column'] . ' ASC ';
314
+                        $sql .= $value['column'].' ASC ';
315 315
                         break;
316 316
                     case 'desc':
317
-                        $sql .= $value['column'] . ' DESC ';
317
+                        $sql .= $value['column'].' DESC ';
318 318
                         break;
319 319
                 }
320 320
             }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             
331 331
         $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
332 332
 
333
-        foreach($data as $ga) {
333
+        foreach ($data as $ga) {
334 334
             $res[] = $this->loadGeoAnalysisFromRow($ga);
335 335
         }
336 336
         
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
      * @return array
348 348
      */
349 349
     public function getPlacesHierarchy() {
350
-        if(!$this->place_hierarchy) {
351
-            if($place_structure = $this->getPlacesHierarchyFromHeader()) {
350
+        if (!$this->place_hierarchy) {
351
+            if ($place_structure = $this->getPlacesHierarchyFromHeader()) {
352 352
                 $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353 353
             }
354
-            elseif ($place_structure = $this->getPlacesHierarchyFromData()){
354
+            elseif ($place_structure = $this->getPlacesHierarchyFromData()) {
355 355
                 $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $place_structure);
356 356
             }
357 357
             else {
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
     protected function getPlacesHierarchyFromHeader() {
371 371
         $head = GedcomRecord::getInstance('HEAD', $this->tree);
372 372
         $head_place = $head->getFirstFact('PLAC');
373
-        if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
374
-            return array_reverse(array_map('trim',explode(',', $head_place_value)));
373
+        if ($head_place && $head_place_value = $head_place->getAttribute('FORM')) {
374
+            return array_reverse(array_map('trim', explode(',', $head_place_value)));
375 375
         }
376 376
         return null;
377 377
     }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
         $nb_levels = 0;
388 388
         
389 389
         //Select all '2 PLAC ' tags in the file and create array
390
-        $places_list=array();
390
+        $places_list = array();
391 391
         $ged_data = Database::prepare(
392 392
             'SELECT i_gedcom AS gedcom'.
393 393
             ' FROM `##individuals`'.
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
             $matches = null;
405 405
             preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
406 406
             foreach ($matches[1] as $match) {
407
-                $places_list[$match]=true;
407
+                $places_list[$match] = true;
408 408
             }
409 409
         }
410 410
         
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         foreach ($places_list as $place => $value) {
416 416
             $levels = array_filter(array_map('trim', explode(",", $place)));
417 417
             $parts = count($levels);
418
-            if($parts > $max_level) {
418
+            if ($parts > $max_level) {
419 419
                 $max_level = $parts;
420 420
                 $places_with_high_level = array($place);
421 421
             }
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
         }
426 426
         
427 427
         // If empty array, then return null
428
-        if($max_level == 0) return null;
428
+        if ($max_level == 0) return null;
429 429
                 
430 430
         // Else, return the first alphabetical element -- cannot return random to ensure always the same example if used
431 431
         usort($places_with_high_level, array('Fisharebest\\Webtrees\\I18N', 'strcasecmp'));        
432
-        return array_reverse(array_map('trim',explode(',', $places_with_high_level[0])));
432
+        return array_reverse(array_map('trim', explode(',', $places_with_high_level[0])));
433 433
         
434 434
     }
435 435
     
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
     public function getOutlineMapsList() {
442 442
         $res = array();
443 443
         $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
444
-        if(is_dir($root_path)){
444
+        if (is_dir($root_path)) {
445 445
             $dir = opendir($root_path);
446
-            while (($file=readdir($dir))!== false) {
446
+            while (($file = readdir($dir)) !== false) {
447 447
                 if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
448 448
                     $res[base64_encode($file)] = new OutlineMap($file, true);
449 449
                 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/GeoAnalysisEditView.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 		
43 43
 		<h1><?php echo $this->data->get('title'); ?></h1>
44 44
 		
45
-		<?php if($places_hierarchy['type'] == 'none') { ?>		
45
+		<?php if ($places_hierarchy['type'] == 'none') { ?>		
46 46
 		<div class="warning"><?php echo I18N::translate('No place structure could be determined. Please make sure that at least a place exists.'); ?></div>		
47 47
 		<?php } else { ?>
48 48
 		
49 49
 		<form class="form-horizontal" name="newform" method="post" role="form" action="<?php echo $this->data->get('save_url'); ?>" autocomplete="off">
50 50
     		<?php echo Filter::getCsrf(); ?>
51
-    		<?php if(!$is_new) { ?>
51
+    		<?php if (!$is_new) { ?>
52 52
     		<input type="hidden" name="ga_id" value="<?php echo $ga->getId(); ?>">
53 53
     		<?php } ?>
54 54
     
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     				<?php echo I18N::translate('Description'); ?>
59 59
     			</label>
60 60
     			<div class="col-sm-9">
61
-    				<input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; ?> dir="auto">
61
+    				<input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if (!$is_new) echo 'value="'.Filter::escapeHtml($ga->getTitle()).'"'; ?> dir="auto">
62 62
     				<p class="small text-muted">
63 63
     					<?php echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.'); ?>
64 64
     				</p>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         				<?php echo I18N::translate('Map'); ?>
102 102
         			</label>
103 103
         			<div class="col-sm-9">
104
-        				<?php echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list') , null, ($is_new || ! $ga->hasMap()) ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"'); ?>
104
+        				<?php echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list'), null, ($is_new || !$ga->hasMap()) ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"'); ?>
105 105
         				<p class="small text-muted">
106 106
         					<?php echo I18N::translate('Map outline to be used for the result display.'); ?>
107 107
         				</p>
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         				<?php echo I18N::translate('Map parent level'); ?>
115 115
         			</label>
116 116
         			<div class="col-sm-9">
117
-        				<?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || ! $ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?>
117
+        				<?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || !$ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?>
118 118
         				<p class="small text-muted">
119 119
         					<?php echo I18N::translate('Subdivision level of the parent subdivision(s) represented by the map.'); ?><br />
120 120
         					<?php echo I18N::translate('For instance, if the map is intended to represent a country by county analysis, then the map parent level would be “Country”, and the analysis level would be “County”.'); ?>
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/AdminConfigView.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 		
42 42
 		<h2>
43 43
 			<?php echo $tree->getTitleHtml(); ?>
44
-			<?php if(count($other_trees) > 0) {?>
44
+			<?php if (count($other_trees) > 0) {?>
45 45
 			<div class="btn-group">
46 46
 				<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
47 47
 					<?php echo I18N::translate('Change tree'); ?>
48 48
 					<span class="caret"></span>
49 49
 				</button>
50
-				<?php foreach($other_trees as $other_tree) { ?>
50
+				<?php foreach ($other_trees as $other_tree) { ?>
51 51
 				<ul class="dropdown-menu" role="menu">
52 52
 					<li>
53
-						<a href="<?php echo $root_url . '&ged=' . $other_tree->getNameUrl(); ?>">
53
+						<a href="<?php echo $root_url.'&ged='.$other_tree->getNameUrl(); ?>">
54 54
 							<i class="fa fa-fw fa-tree"></i>&nbsp;<?php echo $other_tree->getTitleHtml(); ?>
55 55
 						</a>
56 56
 					</li>
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		
63 63
 		<p>
64 64
 		<?php $places_hierarchy = $this->data->get('places_hierarchy'); 
65
-		if($places_hierarchy && $places_hierarchy['type'] != 'none') {
65
+		if ($places_hierarchy && $places_hierarchy['type'] != 'none') {
66 66
 		    switch ($places_hierarchy['type']) {
67 67
 		        case 'header':
68 68
 		            echo I18N::translate('According to the GEDCOM header, the places within your file follows the structure: ');
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 		            break;
77 77
 		    }
78 78
 		    $str_hierarchy = array();
79
-		    foreach($places_hierarchy['hierarchy'] as $key => $level) {
79
+		    foreach ($places_hierarchy['hierarchy'] as $key => $level) {
80 80
 		        $str_hierarchy[] = I18N::translate('(%d) %s', $key + 1, $level);
81 81
 		    }
82
-		    echo '<strong>' . implode(I18N::$list_separator, $str_hierarchy) . '</strong>';
82
+		    echo '<strong>'.implode(I18N::$list_separator, $str_hierarchy).'</strong>';
83 83
 		}
84 84
 		?>
85 85
 		</p>
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     		</tbody>
104 104
     	</table>
105 105
     	
106
-        <a type="button" class="btn btn-primary" href="<?php echo $root_url . '@add&ged=' . $tree->getNameUrl(); ?>" title="<?php echo I18N::translate('Add'); ?>">
106
+        <a type="button" class="btn btn-primary" href="<?php echo $root_url.'@add&ged='.$tree->getNameUrl(); ?>" title="<?php echo I18N::translate('Add'); ?>">
107 107
         	<i class="fa fa-plus"></i>
108 108
         	<?php echo I18N::translate('Add'); ?>
109 109
         </a>
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Spacing   +44 added lines, -46 removed lines patch added patch discarded remove patch
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
         $data->set('title', $controller->getPageTitle());
72 72
         $data->set('tree', $wt_tree);
73 73
         
74
-        $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig');
74
+        $data->set('root_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig');
75 75
                 
76
-        $table_id = 'table-geoanalysis-' . Uuid::uuid4();
76
+        $table_id = 'table-geoanalysis-'.Uuid::uuid4();
77 77
         $data->set('table_id', $table_id);
78 78
         
79 79
         $other_trees = array();
80 80
         foreach (Tree::getAll() as $tree) {
81
-            if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
81
+            if ($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
82 82
         }      
83 83
         $data->set('other_trees', $other_trees);
84 84
         
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                     processing: true,
102 102
                     serverSide : true,
103 103
 					ajax : {
104
-						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='. $wt_tree->getNameUrl().'",
104
+						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='.$wt_tree->getNameUrl().'",
105 105
                         type : "POST"
106 106
 					},
107 107
                     columns: [
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                             url: "module.php", 
126 126
                             type: "GET",
127 127
                             data: {
128
-                			    mod: "' . $this->module->getName() .'",
128
+                			    mod: "' . $this->module->getName().'",
129 129
                                 mod_action:  "GeoAnalysis@setStatus",
130 130
                 			    ga_id: ga_id,
131 131
                 			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                             },
134 134
                             error: function(result, stat, error) {
135 135
                                 var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
136
-                                alert("' . I18N::translate('An error occured while editing this analysis:') . '" + err);
136
+                                alert("' . I18N::translate('An error occured while editing this analysis:').'" + err);
137 137
                             },
138 138
                             complete: function(result, stat) {
139 139
                                 geoAnalysisTable.ajax.reload(null, false);
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
                             url: "module.php", 
147 147
                             type: "GET",
148 148
                             data: {
149
-                			    mod: "' . $this->module->getName() .'",
149
+                			    mod: "' . $this->module->getName().'",
150 150
                                 mod_action:  "GeoAnalysis@delete",
151 151
                 			    ga_id: ga_id,
152 152
                 			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom
153 153
                             },
154 154
                             error: function(result, stat, error) {
155 155
                                 var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
156
-                                alert("' . I18N::translate('An error occured while deleting this analysis:') . '" + err);
156
+                                alert("' . I18N::translate('An error occured while deleting this analysis:').'" + err);
157 157
                             },
158 158
                             complete: function(result, stat) {
159 159
                                 geoAnalysisTable.ajax.reload(null, false);
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
         
178 178
         // Generate an AJAX/JSON response for datatables to load a block of rows
179 179
         $search = Filter::postArray('search');
180
-        if($search) $search = $search['value'];
180
+        if ($search) $search = $search['value'];
181 181
         $start  = Filter::postInteger('start');
182 182
         $length = Filter::postInteger('length');
183 183
         $order  = Filter::postArray('order');
184 184
         
185
-        foreach($order as $key => &$value) {
186
-            switch($value['column']) {
185
+        foreach ($order as $key => &$value) {
186
+            switch ($value['column']) {
187 187
                 case 3:
188 188
                     $value['column'] = 'majgd_descr';
189 189
                     break;
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
         
205 205
         $data = array();
206 206
         $place_hierarchy = $this->provider->getPlacesHierarchy();
207
-        foreach($list as $ga) {
207
+        foreach ($list as $ga) {
208 208
             /** @var GeoAnalysis $ga */
209 209
             
210 210
             $datum = array();
211
-            $options= $ga->getOptions();
211
+            $options = $ga->getOptions();
212 212
             
213 213
             $datum[0] = '
214 214
                 <div class="btn-group">
@@ -218,47 +218,46 @@  discard block
 block discarded – undo
218 218
                     <ul class="dropdown-menu" role="menu">
219 219
                        <li>
220 220
                             <a href="#" onclick="return set_geoanalysis_status('. $ga->getId().', '.($ga->isEnabled() ? 'false' : 'true').', \''.Filter::escapeJs($wt_tree->getName()).'\');">
221
-                                <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
221
+                                <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).'
222 222
                             </a>
223 223
                        </li>
224 224
                         <li>
225 225
                             <a href="module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$wt_tree->getName().'">
226
-                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
226
+                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').'
227 227
                             </a>
228 228
                        </li>
229 229
                        <li class="divider" />
230 230
                        <li>
231 231
                             <a href="#" onclick="return delete_geoanalysis('. $ga->getId().', \''.Filter::escapeJs($wt_tree->getName()).'\');">
232
-                                <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete') . '
232
+                                <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete').'
233 233
                             </a>
234 234
                        </li>
235 235
                     </ul>
236 236
                 </div>';
237 237
 		    $datum[1] = $ga->getId();
238 238
 		    $datum[2] = $ga->isEnabled() ? 
239
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
240
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
239
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
241 240
 		    $datum[3] = $ga->getTitle();
242 241
 		    $analysis_level = $ga->getAnalysisLevel();
243
-		    if($place_hierarchy['type'] == 'header') {
242
+		    if ($place_hierarchy['type'] == 'header') {
244 243
 		        $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
245 244
 		    } elseif ($place_hierarchy['type'] == 'data') {
246
-		        $datum[4] = $analysis_level . ' (' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
245
+		        $datum[4] = $analysis_level.' ('.$place_hierarchy['hierarchy'][$analysis_level - 1].')';
247 246
 		    } else {
248 247
 		        $datum[4] = $analysis_level;
249 248
 		    }
250 249
 		    $datum[5] = $ga->getAnalysisLevel();
251 250
 		    $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
252 251
 		    $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
253
-		    if($ga->hasMap()) {
254
-		        if($options->getMap()->isLoaded()) {
252
+		    if ($ga->hasMap()) {
253
+		        if ($options->getMap()->isLoaded()) {
255 254
     		        $datum[6] = $options->getMap()->getDescription();
256
-    		        $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
255
+    		        $datum[7] = '<span data-toggle="tooltip" title="'.$options->getMap()->getTopLevelName().'" />';
257 256
     		        $top_level = $options->getMapLevel();
258
-    		        if($place_hierarchy['type'] == 'header') {
257
+    		        if ($place_hierarchy['type'] == 'header') {
259 258
     		            $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
260 259
     		        } elseif ($place_hierarchy['type'] == 'data') {
261
-    		            $datum[7] .= $top_level . ' (' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
260
+    		            $datum[7] .= $top_level.' ('.$place_hierarchy['hierarchy'][$top_level - 1].')';
262 261
     		        } else {
263 262
     		            $datum[7] .= $top_level;
264 263
     		        }
@@ -269,8 +268,7 @@  discard block
 block discarded – undo
269 268
 		        }
270 269
 		    }
271 270
 		    $datum[8] = $options->isUsingFlags() ? 
272
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
273
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
271
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
274 272
 		    $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
275 273
 		    
276 274
 		    $data[] = $datum;
@@ -319,24 +317,24 @@  discard block
 block discarded – undo
319 317
         $description    = Filter::post('description');
320 318
         $analysislevel  = Filter::postInteger('analysislevel');
321 319
         $use_map        = Filter::postBool('use_map');
322
-        if($use_map) {
320
+        if ($use_map) {
323 321
             $map_file   = base64_decode(Filter::post('map_file'));
324
-            $map_top_level   = Filter::postInteger('map_top_level');
322
+            $map_top_level = Filter::postInteger('map_top_level');
325 323
         }
326 324
         $use_flags      = Filter::postBool('use_flags');
327 325
         $gen_details    = Filter::postInteger('gen_details');
328 326
         
329 327
         $success = false; 
330
-        if($ga_id) {
328
+        if ($ga_id) {
331 329
             $ga = $this->provider->getGeoAnalysis($ga_id, false);
332
-            if($ga) {
330
+            if ($ga) {
333 331
                 $ga->setTitle($description);
334 332
                 $ga->setAnalysisLevel($analysislevel + 1);
335 333
                 $options = $ga->getOptions();
336
-                if($options) {
334
+                if ($options) {
337 335
                     $options->setUsingFlags($use_flags);
338 336
                     $options->setMaxDetailsInGen($gen_details);
339
-                    if($use_map) {
337
+                    if ($use_map) {
340 338
                         $options->setMap(new OutlineMap($map_file));
341 339
                         $options->setMapLevel($map_top_level + 1);
342 340
                     }
@@ -346,7 +344,7 @@  discard block
 block discarded – undo
346 344
                 }
347 345
 				
348 346
 				$res = $this->provider->updateGeoAnalysis($ga);
349
-				if($res) {
347
+				if ($res) {
350 348
 					FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully updated', $res->getTitle()), 'success');
351 349
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.');
352 350
 					$ga = $res;
@@ -354,7 +352,7 @@  discard block
 block discarded – undo
354 352
 				}
355 353
 				else {
356 354
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
357
-					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
355
+					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” could not be updated. See error log.');
358 356
 				}
359 357
             }
360 358
         } else {
@@ -366,7 +364,7 @@  discard block
 block discarded – undo
366 364
 				$use_flags,
367 365
 				$gen_details
368 366
 			);
369
-			if($ga) {
367
+			if ($ga) {
370 368
 				FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
371 369
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.');
372 370
 				$success = true;
@@ -377,16 +375,16 @@  discard block
 block discarded – undo
377 375
 			}
378 376
         }
379 377
         
380
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl();
381
-        if(!$success) {			
382
-            if($ga) {
383
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl();
378
+        $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$wt_tree->getNameUrl();
379
+        if (!$success) {			
380
+            if ($ga) {
381
+                $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$wt_tree->getNameUrl();
384 382
             }
385 383
             else {
386
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl();
384
+                $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@add&ged='.$wt_tree->getNameUrl();
387 385
             }
388 386
         }        
389
-        header('Location: ' . WT_BASE_URL . $redirection_url);
387
+        header('Location: '.WT_BASE_URL.$redirection_url);
390 388
         
391 389
     }
392 390
      
@@ -416,7 +414,7 @@  discard block
 block discarded – undo
416 414
             ');
417 415
         
418 416
         $data = new ViewBag();
419
-        if($ga) {
417
+        if ($ga) {
420 418
             $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
421 419
             $data->set('geo_analysis', $ga);
422 420
         } else {
@@ -424,9 +422,9 @@  discard block
 block discarded – undo
424 422
         }
425 423
         
426 424
         $data->set('title', $controller->getPageTitle());
427
-        $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl());
425
+        $data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$wt_tree->getNameUrl());
428 426
         $data->set('module_title', $this->module->getTitle());
429
-        $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $wt_tree->getNameUrl());
427
+        $data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@save&ged='.$wt_tree->getNameUrl());
430 428
         $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
431 429
     
432 430
         $map_list = array_map(
@@ -439,7 +437,7 @@  discard block
 block discarded – undo
439 437
         $data->set('map_list', $map_list);
440 438
     
441 439
         $gen_details = array(0 => I18N::translate('All'));
442
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
440
+        for ($i = 1; $i <= 10; $i++) $gen_details[$i] = $i;
443 441
         $data->set('generation_details', $gen_details);
444 442
     
445 443
         ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
Please login to merge, or discard this patch.
src/Webtrees/Module/PatronymicLineage/Model/LineageNode.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function addFamily(Family $fams): object
69 69
     {
70 70
         if (!$this->linked_fams->has($fams->xref())) {
71
-            $this->linked_fams->put($fams->xref(), (object) [
71
+            $this->linked_fams->put($fams->xref(), (object)[
72 72
                 'family'   =>  $fams,
73 73
                 'children' =>  new Collection()
74 74
             ]);
@@ -135,6 +135,6 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function hasFollowUpSurname(): bool
137 137
     {
138
-        return mb_strlen($this->followUpSurname()) > 0 ;
138
+        return mb_strlen($this->followUpSurname()) > 0;
139 139
     }
140 140
 }
Please login to merge, or discard this patch.