Completed
Push — master ( b40ea8...2ebfe4 )
by Jonathan
05:27
created
src/Webtrees/Module/Hooks/AdminConfigController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
      * Manage updates sent from the AdminConfig@index form.
34 34
      */
35 35
     protected function update() {
36
-        if(Auth::isAdmin()){
36
+        if (Auth::isAdmin()) {
37 37
             $ihooks = HookProvider::getInstance()->getInstalledHooks();
38 38
             	
39
-            $module_names= Database::prepare(
39
+            $module_names = Database::prepare(
40 40
                 "SELECT module_name FROM `##module` WHERE status='disabled'"
41 41
             )->fetchOneColumn();
42 42
             	
43
-            if($ihooks !== null){
43
+            if ($ihooks !== null) {
44 44
                 foreach ($ihooks as $ihook => $params) {
45
-                    if(Filter::post('hook-' . $params['id']) === 'yes') {                    
45
+                    if (Filter::post('hook-'.$params['id']) === 'yes') {                    
46 46
                         $array_hook = explode('#', $ihook);
47 47
                         //Update status
48
-                        $new_status= Filter::postBool('status-' . $params['id']);
49
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
48
+                        $new_status = Filter::postBool('status-'.$params['id']);
49
+                        if (in_array($array_hook[0], $module_names)) $new_status = false;
50 50
                         $previous_status = $params['status'];
51 51
                         if ($new_status !== null) {
52
-                            $new_status= $new_status ? 'enabled' : 'disabled';
53
-                            if($new_status != $previous_status){
52
+                            $new_status = $new_status ? 'enabled' : 'disabled';
53
+                            if ($new_status != $previous_status) {
54 54
                                 $chook = new Hook($array_hook[1], $array_hook[2]);
55
-                                switch($new_status){
55
+                                switch ($new_status) {
56 56
                                     case 'enabled':
57 57
                                         $chook->enable($array_hook[0]);
58 58
                                         break;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         $new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70 70
                         $previous_priority = $params['priority'];
71 71
                         if ($new_priority !== null) {
72
-                            if($new_priority != $previous_priority){
72
+                            if ($new_priority != $previous_priority) {
73 73
                                 $chook = new Hook($array_hook[1], $array_hook[2]);
74 74
                                 $chook->setPriority($array_hook[0], $new_priority);
75 75
                             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         HookProvider::getInstance()->updateHooks();
94 94
         
95 95
         $action = Filter::post('action');        
96
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
96
+        if ($action == 'update' && Filter::checkCsrf()) $this->update();
97 97
         
98 98
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99 99
         $ctrl = new PageController();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             ->restrictAccess(Auth::isAdmin())
102 102
             ->setPageTitle($this->module->getTitle());
103 103
         
104
-        $table_id = 'table-installedhooks-' . Uuid::uuid4();
104
+        $table_id = 'table-installedhooks-'.Uuid::uuid4();
105 105
 
106 106
         $view_bag = new ViewBag();
107 107
         $view_bag->set('title', $ctrl->getPageTitle());
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/TaskController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		
69 69
 		$tasks = $this->provider->getTasksToRun($token == $token_submitted, $task_name);
70 70
 		
71
-		foreach($tasks as $task) {
71
+		foreach ($tasks as $task) {
72 72
 			$task->execute();		
73 73
 		}
74 74
 	}	
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
         );
90 90
         
91 91
         $status = Filter::getBool('status');
92
-        $res = array('task' => $task->getName() , 'error' => null);
93
-        try{
92
+        $res = array('task' => $task->getName(), 'error' => null);
93
+        try {
94 94
             $this->provider->setTaskStatus($task, $status);
95 95
             $res['status'] = $status;
96
-			Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
96
+			Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '.($status ? 'enabled' : 'disabled').'.');
97 97
         }
98 98
         catch (\Exception $ex) {
99 99
             $res['error'] = $ex->getMessage();
100
-			Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
100
+			Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage());
101 101
         }
102 102
         
103 103
         $controller->pageHeader();
104
-        if($res['error']) http_response_code(500);
104
+        if ($res['error']) http_response_code(500);
105 105
         
106 106
         $controller->encode($res);
107 107
     }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
         
139 139
         $data = new ViewBag();        
140 140
         $data->set('title', $controller->getPageTitle());
141
-		$data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
141
+		$data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl());
142 142
         $data->set('module_title', $this->module->getTitle());
143
-		$data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl());
143
+		$data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=Task@save&ged='.$WT_TREE->getNameUrl());
144 144
 		$data->set('task', $task);
145 145
 		    
146 146
         ViewFactory::make('TaskEdit', $this, $controller, $data)->render();	
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
             && Filter::checkCsrf()
158 158
          );
159 159
         
160
-		$task_name      = Filter::post('task');
161
-        $frequency    	= Filter::postInteger('frequency');
162
-        $is_limited  	= Filter::postInteger('is_limited', 0, 1);
163
-        $nb_occur       = Filter::postInteger('nb_occur');
160
+		$task_name = Filter::post('task');
161
+        $frequency = Filter::postInteger('frequency');
162
+        $is_limited = Filter::postInteger('is_limited', 0, 1);
163
+        $nb_occur = Filter::postInteger('nb_occur');
164 164
 				
165 165
 		$task = $this->provider->getTask($task_name, false);
166 166
         
167 167
         $success = false; 
168
-        if($task) {
168
+        if ($task) {
169 169
 			$task->setFrequency($frequency);
170
-			if($is_limited == 1) {
170
+			if ($is_limited == 1) {
171 171
 				$task->setRemainingOccurrences($nb_occur);
172 172
 			}
173 173
 			else {
@@ -176,34 +176,34 @@  discard block
 block discarded – undo
176 176
 			
177 177
 			$res = $task->save();
178 178
 						
179
-			if($res) {						
180
-				if($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) {
179
+			if ($res) {						
180
+				if ($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) {
181 181
 					$res = $task->saveConfig();
182 182
 					
183
-					if(!$res) {
183
+					if (!$res) {
184 184
 						FlashMessages::addMessage(I18N::translate('An error occured while updating the specific settings of administrative task “%s”', $task->getTitle()), 'danger');
185
-						Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” specific settings could not be updated. See error log.');
185
+						Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” specific settings could not be updated. See error log.');
186 186
 					}
187 187
 				}
188 188
 			
189
-				if($res) {
189
+				if ($res) {
190 190
 					FlashMessages::addMessage(I18N::translate('The administrative task “%s” has been successfully updated', $task->getTitle()), 'success');
191
-					Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName() .'” has been updated.');
191
+					Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” has been updated.');
192 192
 					$success = true;
193 193
 				}
194 194
 			}
195 195
 			else {
196 196
 				FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger');
197
-				Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.');
197
+				Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” could not be updated. See error log.');
198 198
 			}
199 199
 			
200 200
         }
201 201
         
202
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig';
203
-        if(!$success) {
204
-			$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName();
202
+        $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig';
203
+        if (!$success) {
204
+			$redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName();
205 205
         }        
206
-        header('Location: ' . WT_BASE_URL . $redirection_url);
206
+        header('Location: '.WT_BASE_URL.$redirection_url);
207 207
 	}
208 208
      
209 209
 }
210 210
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/HooksModule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     public function getConfigLink() {
58 58
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
59 59
         
60
-        return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
60
+        return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig';
61 61
     }
62 62
     
63 63
     /**
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Spacing   +43 added lines, -45 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);
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
         
179 179
         // Generate an AJAX/JSON response for datatables to load a block of rows
180 180
         $search = Filter::postArray('search');
181
-        if($search) $search = $search['value'];
181
+        if ($search) $search = $search['value'];
182 182
         $start  = Filter::postInteger('start');
183 183
         $length = Filter::postInteger('length');
184 184
         $order  = Filter::postArray('order');
185 185
         
186
-        foreach($order as $key => &$value) {
187
-            switch($value['column']) {
186
+        foreach ($order as $key => &$value) {
187
+            switch ($value['column']) {
188 188
                 case 3:
189 189
                     $value['column'] = 'majgd_descr';
190 190
                     break;
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
         
206 206
         $data = array();
207 207
         $place_hierarchy = $this->provider->getPlacesHierarchy();
208
-        foreach($list as $ga) {
208
+        foreach ($list as $ga) {
209 209
             /** @var GeoAnalysis $ga */
210 210
             
211 211
             $datum = array();
212
-            $options= $ga->getOptions();
212
+            $options = $ga->getOptions();
213 213
             
214 214
             $datum[0] = '
215 215
                 <div class="btn-group">
@@ -219,50 +219,48 @@  discard block
 block discarded – undo
219 219
                     <ul class="dropdown-menu" role="menu">
220 220
                        <li>
221 221
                             <a href="#" onclick="return set_geoanalysis_status('. $ga->getId().', '.($ga->isEnabled() ? 'false' : 'true').', \''.Filter::escapeJs($WT_TREE->getName()).'\');">
222
-                                <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
222
+                                <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).'
223 223
                             </a>
224 224
                        </li>
225 225
                         <li>
226 226
                             <a href="module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$WT_TREE->getName().'">
227
-                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
227
+                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').'
228 228
                             </a>
229 229
                        </li>
230 230
                        <li class="divider" />
231 231
                        <li>
232 232
                             <a href="#" onclick="return delete_geoanalysis('. $ga->getId().', \''.Filter::escapeJs($WT_TREE->getName()).'\');">
233
-                                <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete') . '
233
+                                <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete').'
234 234
                             </a>
235 235
                        </li>
236 236
                     </ul>
237 237
                 </div>';
238 238
 		    $datum[1] = $ga->getId();
239 239
 		    $datum[2] = $ga->isEnabled() ? 
240
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
241
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
240
+				'<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>';
242 241
 		    $datum[3] = $ga->getTitle();
243 242
 		    $analysis_level = $ga->getAnalysisLevel();
244
-		    if($place_hierarchy['type'] == 'header') {
243
+		    if ($place_hierarchy['type'] == 'header') {
245 244
 		        $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
246 245
 		    } else {
247
-		        $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
246
+		        $datum[4] = $analysis_level.'('.$place_hierarchy['hierarchy'][$analysis_level - 1].')';
248 247
 		    }
249 248
 		    $datum[5] = $ga->getAnalysisLevel();
250 249
 		    $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
251 250
 		    $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
252
-		    if($ga->hasMap()) {
251
+		    if ($ga->hasMap()) {
253 252
 		        $datum[6] = $options->getMap()->getDescription();
254
-		        $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
253
+		        $datum[7] = '<span data-toggle="tooltip" title="'.$options->getMap()->getTopLevelName().'" />';
255 254
 		        $top_level = $options->getMapLevel();
256
-		        if($place_hierarchy['type'] == 'header') {
255
+		        if ($place_hierarchy['type'] == 'header') {
257 256
 		            $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
258 257
 		        } else {
259
-		            $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
258
+		            $datum[7] .= $top_level.'('.$place_hierarchy['hierarchy'][$top_level - 1].')';
260 259
 		        }
261 260
 		        $datum[7] .= '</span>';
262 261
 		    }
263 262
 		    $datum[8] = $options->isUsingFlags() ? 
264
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
265
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
263
+				'<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>';
266 264
 		    $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
267 265
 		    
268 266
 		    $data[] = $datum;
@@ -312,24 +310,24 @@  discard block
 block discarded – undo
312 310
         $description    = Filter::post('description');
313 311
         $analysislevel  = Filter::postInteger('analysislevel');
314 312
         $use_map        = Filter::postBool('use_map');
315
-        if($use_map) {
313
+        if ($use_map) {
316 314
             $map_file   = base64_decode(Filter::post('map_file'));
317
-            $map_top_level   = Filter::postInteger('map_top_level');
315
+            $map_top_level = Filter::postInteger('map_top_level');
318 316
         }
319 317
         $use_flags      = Filter::postBool('use_flags');
320 318
         $gen_details    = Filter::postInteger('gen_details');
321 319
         
322 320
         $success = false; 
323
-        if($ga_id) {
321
+        if ($ga_id) {
324 322
             $ga = $this->provider->getGeoAnalysis($ga_id, false);
325
-            if($ga) {
323
+            if ($ga) {
326 324
                 $ga->setTitle($description);
327 325
                 $ga->setAnalysisLevel($analysislevel + 1);
328 326
                 $options = $ga->getOptions();
329
-                if($options) {
327
+                if ($options) {
330 328
                     $options->setUsingFlags($use_flags);
331 329
                     $options->setMaxDetailsInGen($gen_details);
332
-                    if($use_map) {
330
+                    if ($use_map) {
333 331
                         $options->setMap(new OutlineMap($map_file));
334 332
                         $options->setMapLevel($map_top_level + 1);
335 333
                     }
@@ -339,7 +337,7 @@  discard block
 block discarded – undo
339 337
                 }
340 338
 				
341 339
 				$res = $this->provider->updateGeoAnalysis($ga);
342
-				if($res) {
340
+				if ($res) {
343 341
 					FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully updated', $res->getTitle()), 'success');
344 342
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.');
345 343
 					$ga = $res;
@@ -347,7 +345,7 @@  discard block
 block discarded – undo
347 345
 				}
348 346
 				else {
349 347
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
350
-					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
348
+					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” could not be updated. See error log.');
351 349
 				}
352 350
             }
353 351
         } else {
@@ -359,7 +357,7 @@  discard block
 block discarded – undo
359 357
 				$use_flags,
360 358
 				$gen_details
361 359
 			);
362
-			if($ga) {
360
+			if ($ga) {
363 361
 				FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
364 362
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.');
365 363
 				$success = true;
@@ -370,16 +368,16 @@  discard block
 block discarded – undo
370 368
 			}
371 369
         }
372 370
         
373
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl();
374
-        if(!$success) {			
375
-            if($ga) {
376
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl();
371
+        $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl();
372
+        if (!$success) {			
373
+            if ($ga) {
374
+                $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$WT_TREE->getNameUrl();
377 375
             }
378 376
             else {
379
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl();
377
+                $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@add&ged='.$WT_TREE->getNameUrl();
380 378
             }
381 379
         }        
382
-        header('Location: ' . WT_BASE_URL . $redirection_url);
380
+        header('Location: '.WT_BASE_URL.$redirection_url);
383 381
         
384 382
     }
385 383
      
@@ -410,7 +408,7 @@  discard block
 block discarded – undo
410 408
             ');
411 409
         
412 410
         $data = new ViewBag();
413
-        if($ga) {
411
+        if ($ga) {
414 412
             $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
415 413
             $data->set('geo_analysis', $ga);
416 414
         } else {
@@ -418,9 +416,9 @@  discard block
 block discarded – undo
418 416
         }
419 417
         
420 418
         $data->set('title', $controller->getPageTitle());
421
-        $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
419
+        $data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl());
422 420
         $data->set('module_title', $this->module->getTitle());
423
-        $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl());
421
+        $data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@save&ged='.$WT_TREE->getNameUrl());
424 422
         $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
425 423
     
426 424
         $map_list = array_map(
@@ -433,7 +431,7 @@  discard block
 block discarded – undo
433 431
         $data->set('map_list', $map_list);
434 432
     
435 433
         $gen_details = array(0 => I18N::translate('All'));
436
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
434
+        for ($i = 1; $i <= 10; $i++) $gen_details[$i] = $i;
437 435
         $data->set('generation_details', $gen_details);
438 436
     
439 437
         ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/GeoAnalysisController.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         
70 70
         $ga_id = Filter::getInteger('ga_id');        
71 71
         
72
-        if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) {
72
+        if ($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) {
73 73
             $data->set('has_analysis', true);
74 74
             $data->set('geoanalysis', $ga);
75 75
             
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 jQuery.get(
83 83
 					"module.php",
84 84
 					{
85
-                        "mod" : "'. $this->module->getName() .'",  
85
+                        "mod" : "'. $this->module->getName().'",  
86 86
                         "mod_action": "GeoAnalysis@dataTabs",
87 87
                         "ga_id" : "'.$ga_id.'"
88 88
                     },
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $data->set('has_list', false);
115 115
         
116 116
         $ga_list = $this->provider->getGeoAnalysisList();
117
-        if(count($ga_list) > 0 ) {
117
+        if (count($ga_list) > 0) {
118 118
              $data->set('has_list', true);
119 119
              $data->set('geoanalysislist', $ga_list);
120 120
         }
@@ -140,19 +140,19 @@  discard block
 block discarded – undo
140 140
         );
141 141
         
142 142
         $status = Filter::getBool('status');
143
-        $res = array('geoanalysis' => $ga->getId() , 'error' => null);
144
-        try{
143
+        $res = array('geoanalysis' => $ga->getId(), 'error' => null);
144
+        try {
145 145
             $this->provider->setGeoAnalysisStatus($ga, $status);
146 146
             $res['status'] = $status;
147
-			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
147
+			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '.($status ? 'enabled' : 'disabled').'.');
148 148
         }
149 149
         catch (\Exception $ex) {
150 150
             $res['error'] = $ex->getMessage();
151
-			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
151
+			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage());
152 152
         }
153 153
         
154 154
         $controller->pageHeader();
155
-        if($res['error']) http_response_code(500);
155
+        if ($res['error']) http_response_code(500);
156 156
         
157 157
         $controller->encode($res);
158 158
     }
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
             && $ga
175 175
             );
176 176
             
177
-        $res = array('geoanalysis' => $ga->getId() , 'error' => null);
178
-        try{
177
+        $res = array('geoanalysis' => $ga->getId(), 'error' => null);
178
+        try {
179 179
             $this->provider->deleteGeoAnalysis($ga);
180 180
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.');
181 181
         }
182 182
         catch (\Exception $ex) {
183 183
             $res['error'] = $ex->getMessage();
184
-			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage());
184
+			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '.$ex->getMessage());
185 185
         }
186 186
     
187 187
         $controller->pageHeader();
188
-        if($res['error']) http_response_code(500);
188
+        if ($res['error']) http_response_code(500);
189 189
 
190 190
         $controller->encode($res);
191 191
     }
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
         list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations());
212 212
         
213 213
         $flags = array();
214
-        if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) {
214
+        if ($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) {
215 215
             $mapProvider = new GoogleMapsProvider();            
216
-            foreach($placesDispGeneral['places'] as $place => $count) {
216
+            foreach ($placesDispGeneral['places'] as $place => $count) {
217 217
                 $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE));
218 218
             }
219 219
         }
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
 	 * @param (null|array) $flags Array of flags
233 233
 	 * @return string HTML code for the general tab
234 234
 	 */
235
-    protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) {
235
+    protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags = null) {
236 236
         global $WT_TREE;
237 237
         
238
-        if(!empty($placesGeneralResults)){
238
+        if (!empty($placesGeneralResults)) {
239 239
             $data = new ViewBag();
240 240
             
241 241
             $nb_found = $placesGeneralResults['knownsum'];
242 242
             $nb_other = 0;
243
-            if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other'];
243
+            if (isset($placesGeneralResults['other'])) $nb_other = $placesGeneralResults['other'];
244 244
             $nb_unknown = $placesGeneralResults['unknown'];
245 245
             
246 246
             $data->set('stats_gen_nb_found', $nb_found);
@@ -249,28 +249,28 @@  discard block
 block discarded – undo
249 249
             
250 250
             $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags());
251 251
             
252
-            if($ga->hasMap()) {
252
+            if ($ga->hasMap()) {
253 253
                 $max = $placesGeneralResults['max'];
254 254
                 $map = $ga->getOptions()->getMap();
255 255
                 $results_by_subdivs = $map->getSubdivisions();
256 256
                 $places_mappings = $map->getPlacesMappings();
257 257
                 foreach ($placesGeneralResults['places'] as $location => $count) {
258
-                    $levelvalues = array_reverse(array_map('trim',explode(',', $location)));
258
+                    $levelvalues = array_reverse(array_map('trim', explode(',', $location)));
259 259
                     $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel();
260
-                    if($level_map >= 0 && $level_map < count($levelvalues)) {
261
-                        $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map];
262
-                        if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; }
260
+                    if ($level_map >= 0 && $level_map < count($levelvalues)) {
261
+                        $levelref = $levelvalues[0].'@'.$levelvalues[$level_map];
262
+                        if (!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; }
263 263
                     }
264 264
                     else {
265 265
                         $levelref = $levelvalues[0];
266 266
                     }
267
-                    if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
268
-                    if(isset($results_by_subdivs[$levelref])) {
267
+                    if (isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
268
+                    if (isset($results_by_subdivs[$levelref])) {
269 269
                         $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0;
270
-                        $count_subd  += $count;
270
+                        $count_subd += $count;
271 271
                         $results_by_subdivs[$levelref]['count'] = $count_subd;   
272 272
                         $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max);
273
-                        if($ga->getOptions()->isUsingFlags() && $flags) {
273
+                        if ($ga->getOptions()->isUsingFlags() && $flags) {
274 274
                             $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE);
275 275
                             $results_by_subdivs[$levelref]['flag'] = $flags[$location];
276 276
                         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             }
293 293
         }
294 294
         else {
295
-            $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>';
295
+            $html = '<p class="warning">'.I18N::translate('No data is available for the general analysis.').'</p>';
296 296
         }
297 297
         return $html;
298 298
     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) {
309 309
         global $WT_TREE;
310 310
         
311
-        if(!empty($placesGenerationsResults) && $ga->getOptions()){
311
+        if (!empty($placesGenerationsResults) && $ga->getOptions()) {
312 312
             $data = new ViewBag();
313 313
             
314 314
             ksort($placesGenerationsResults);
@@ -321,26 +321,26 @@  discard block
 block discarded – undo
321 321
             $data->set('display_all_places', $display_all_places);
322 322
             
323 323
             $results_by_gen = array();
324
-            foreach($placesGenerationsResults as $gen => $genData){
324
+            foreach ($placesGenerationsResults as $gen => $genData) {
325 325
                 $sum = 0;
326 326
                 $other = 0;
327 327
                 $unknown = 0;
328
-                if(isset($genData['sum'])) $sum = $genData['sum'];
329
-                if(isset($genData['other'])) $other = $genData['other'];
330
-                if(isset($genData['unknown'])) $unknown = $genData['unknown'];
328
+                if (isset($genData['sum'])) $sum = $genData['sum'];
329
+                if (isset($genData['other'])) $other = $genData['other'];
330
+                if (isset($genData['unknown'])) $unknown = $genData['unknown'];
331 331
                 
332
-                if($sum > 0) {                
332
+                if ($sum > 0) {                
333 333
                     $results_by_gen[$gen]['sum'] = $sum;
334 334
                     $results_by_gen[$gen]['other'] = $other;
335 335
                     $results_by_gen[$gen]['unknown'] = $unknown;
336 336
                     $results_by_gen[$gen]['places'] = array();                    
337 337
                     arsort($genData['places']);
338 338
                     
339
-                    if($display_all_places){
340
-                        foreach($genData['places'] as $placename=> $count){
339
+                    if ($display_all_places) {
340
+                        foreach ($genData['places'] as $placename=> $count) {
341 341
                             $results_by_gen[$gen]['places'][$placename]['count'] = $count;
342 342
                             
343
-                            if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){
343
+                            if ($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != '') {
344 344
                                 $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE);
345 345
                                 $results_by_gen[$gen]['places'][$placename]['flag'] = $flag;
346 346
                             }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                     }
349 349
                     else {
350 350
                         $tmp = $genData['places'];
351
-                        if($other > 0) {
351
+                        if ($other > 0) {
352 352
                             $tmp = array_slice($tmp, 0, 5, true);
353 353
                             $tmp['other'] = $other;
354 354
                             arsort($tmp);  
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             
365 365
         }
366 366
         else {
367
-            $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>';
367
+            $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'</p>';
368 368
         }
369 369
         return $html;
370 370
     }
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/CertificateController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $cid = Filter::get('cid');
70 70
         
71 71
         $certificate = null;
72
-        if(!empty($cid) && strlen($cid) > 22){
72
+        if (!empty($cid) && strlen($cid) > 22) {
73 73
             $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
74 74
         }
75 75
         
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $data->set('title', $controller->getPageTitle());
78 78
         
79 79
         $data->set('has_certif', false);
80
-        if($certificate) {
80
+        if ($certificate) {
81 81
             $controller->restrictAccess($certificate->canShow());
82 82
             $data->set('title', $certificate->getTitle());
83 83
             $data->set('has_certif', true);
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
             
86 86
             $data->set(
87 87
                 'url_certif_city', 
88
-                'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . 
89
-                    '&mod_action=Certificate@listAll' .
90
-                    '&ged=' . $WT_TREE->getNameUrl() .
91
-                    '&city=' . Functions::encryptToSafeBase64($certificate->getCity())
88
+                'module.php?mod='.Constants::MODULE_MAJ_CERTIF_NAME. 
89
+                    '&mod_action=Certificate@listAll'.
90
+                    '&ged='.$WT_TREE->getNameUrl().
91
+                    '&city='.Functions::encryptToSafeBase64($certificate->getCity())
92 92
             );
93 93
             
94 94
             $controller->addInlineJavascript('
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
             $linked_indis = $certificate->linkedIndividuals();
103 103
             $linked_fams = $certificate->linkedFamilies();
104 104
                         
105
-            if($linked_indis && count($linked_indis) > 0) {
105
+            if ($linked_indis && count($linked_indis) > 0) {
106 106
                 $data->set('has_linked_indis', true);
107 107
                 $data->set('linked_indis', $linked_indis);
108 108
             }
109 109
             
110
-            if(!empty($linked_fams)) {
110
+            if (!empty($linked_fams)) {
111 111
                 $data->set('has_linked_fams', true);
112 112
                 $data->set('linked_fams', $linked_fams);
113 113
             }
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
     public function image() {      
123 123
         global $WT_TREE;
124 124
         
125
-        $cid   = Filter::get('cid');
125
+        $cid = Filter::get('cid');
126 126
         $certificate = null;
127
-        if(!empty($cid)) $certificate =  Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
127
+        if (!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
128 128
         
129 129
         $imageBuilder = new ImageBuilder($certificate);
130 130
         
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         
158 158
         $city = Filter::get('city');
159 159
         
160
-        if(!empty($city) && strlen($city) > 22){
160
+        if (!empty($city) && strlen($city) > 22) {
161 161
             $city = Functions::decryptFromSafeBase64($city);
162 162
             $controller->setPageTitle(I18N::translate('Certificates for %s', $city));
163 163
         }
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
         $data->set('selected_city', $city);
173 173
         
174 174
         $data->set('has_list', false);        
175
-        if(!empty($city)) {            
176
-            $table_id = 'table-certiflist-' . Uuid::uuid4();
175
+        if (!empty($city)) {            
176
+            $table_id = 'table-certiflist-'.Uuid::uuid4();
177 177
             
178 178
             $certif_list = $this->provider->getCertificatesList($city);            
179
-            if(!empty($certif_list)) {                
179
+            if (!empty($certif_list)) {                
180 180
                 $data->set('has_list', true);
181 181
                 $data->set('table_id', $table_id);
182 182
                 $data->set('certificate_list', $certif_list);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 				        jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
189 189
                         
190 190
                         jQuery("#'.$table_id.'").dataTable( {
191
-        					dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
191
+        					dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\',
192 192
     					    '.I18N::datatablesI18N().',
193 193
     					    jQueryUI: true,
194 194
         					autoWidth: false,
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Model/Certificate.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class Certificate extends Media {
36 36
     
37
-    const URL_PREFIX  = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid=';
37
+    const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid=';
38 38
 		
39 39
     /** @var string The "TITL" value from the GEDCOM 
40 40
      * This is a tweak to overcome the private level from the parent object...
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		
95 95
 		$match = null;
96 96
 		$ct = preg_match("/(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}) )?(?<details>.*)/", $this->title, $match);
97
-		if($ct > 0){
98
-			$monthId = (int) $match['month'];
97
+		if ($ct > 0) {
98
+			$monthId = (int)$match['month'];
99 99
 			$calendarShortMonths = Functions::getCalendarShortMonths();
100 100
 			$monthShortName = array_key_exists($monthId, $calendarShortMonths) ? $calendarShortMonths[$monthId] : $monthId;
101 101
 			$this->certDate = new Date($match['day'].' '.strtoupper($monthShortName).' '.$match['year']);
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	 * @see \Fisharebest\Webtrees\GedcomRecord::getInstance()
112 112
 	 */	
113 113
 	static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) {
114
-		try{
114
+		try {
115 115
 			$certfile = Functions::decryptFromSafeBase64($xref);
116 116
 			
117 117
 			//NEED TO CHECK THAT !!!
118
-			if(Functions::isValidPath($certfile, true)) {
118
+			if (Functions::isValidPath($certfile, true)) {
119 119
 				return new Certificate($certfile, $tree, $provider);
120 120
 			}
121 121
 		}
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @param string|Source $xref
154 154
 	 */
155
-	public function setSource($xref){
156
-		if($xref instanceof Source){
155
+	public function setSource($xref) {
156
+		if ($xref instanceof Source) {
157 157
 			$this->source = $xref;
158 158
 		} else {
159 159
 			$this->source = Source::getInstance($xref, $this->tree);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return Date Certificate date
175 175
 	 */
176
-	public function getCertificateDate(){
176
+	public function getCertificateDate() {
177 177
 		return $this->certDate;
178 178
 	}
179 179
 	
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return string Certificate date
184 184
 	 */
185
-	public function getCertificateType(){
185
+	public function getCertificateType() {
186 186
 		return $this->certType;
187 187
 	}
188 188
 	
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return string Certificate details
193 193
 	 */
194
-	public function getCertificateDetails(){
194
+	public function getCertificateDetails() {
195 195
 		return $this->certDetails;
196 196
 	}
197 197
 	
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return string|NULL Certificate city
202 202
 	 */
203
-	public function getCity(){
203
+	public function getCity() {
204 204
 		$chunks = explode('/', $this->getFilename(), 2);
205
-		if(count($chunks) > 1) return $chunks[0];
205
+		if (count($chunks) > 1) return $chunks[0];
206 206
 		return null;
207 207
 	}
208 208
 	
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 * {@inhericDoc}
211 211
 	 * @see \Fisharebest\Webtrees\Media::getServerFilename()
212 212
 	 */
213
-	public function getServerFilename($which='main') {
214
-		$filename =  $this->provider->getRealCertificatesDirectory() . $this->getFilename();
213
+	public function getServerFilename($which = 'main') {
214
+		$filename = $this->provider->getRealCertificatesDirectory().$this->getFilename();
215 215
 		return Functions::encodeUtf8ToFileSystem($filename);
216 216
 	}
217 217
 	
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	public function getHtmlUrlDirect($which = 'main', $download = false) {
223 223
 		$sidstr = ($this->source) ? '&sid='.$this->source->getXref() : '';
224 224
 		return
225
-			'module.php?mod='. \MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME . 
226
-			'&mod_action=Certificate@image' . 
227
-			'&ged='. $this->tree->getNameUrl() .
228
-			'&cid=' . $this->getXref() . $sidstr .
229
-			'&cb=' . $this->getEtag($which);
225
+			'module.php?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME. 
226
+			'&mod_action=Certificate@image'. 
227
+			'&ged='.$this->tree->getNameUrl().
228
+			'&cid='.$this->getXref().$sidstr.
229
+			'&cb='.$this->getEtag($which);
230 230
 	}
231 231
 	
232 232
 	/**
@@ -237,26 +237,26 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return string Watermark text
239 239
 	 */
240
-	 public function getWatermarkText(){	
240
+	 public function getWatermarkText() {	
241 241
 	 	$module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME);
242 242
 	 	
243
-	 	if($module) {
243
+	 	if ($module) {
244 244
     		$wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.'));
245
-    		$sid= Filter::get('sid', WT_REGEX_XREF);	
245
+    		$sid = Filter::get('sid', WT_REGEX_XREF);	
246 246
     	
247
-    		if($sid){
247
+    		if ($sid) {
248 248
     			$this->source = Source::getInstance($sid, $this->tree);
249 249
     		}
250
-    		else{
251
-    			$this->fetchALinkedSource();  // the method already attach the source to the Certificate object;
250
+    		else {
251
+    			$this->fetchALinkedSource(); // the method already attach the source to the Certificate object;
252 252
     		}
253 253
     		
254
-    		if($this->source) {
254
+    		if ($this->source) {
255 255
     			$wmtext = '&copy;';
256 256
     			$repofact = $this->source->getFirstFact('REPO');
257
-    			if($repofact) {
257
+    			if ($repofact) {
258 258
     				$repo = $repofact->getTarget();
259
-    				if($repo && $repo instanceof Repository)  $wmtext .= ' '.$repo->getFullName().' - ';
259
+    				if ($repo && $repo instanceof Repository)  $wmtext .= ' '.$repo->getFullName().' - ';
260 260
     			}
261 261
     			$wmtext .= $this->source->getFullName();			
262 262
     		}	
@@ -279,45 +279,45 @@  discard block
 block discarded – undo
279 279
 		';
280 280
 		
281 281
 		$script = '';
282
-		if($controller && !($controller instanceof IndividualController)){
282
+		if ($controller && !($controller instanceof IndividualController)) {
283 283
 			$controller->addInlineJavascript('$(document).ready(function() { '.$js.' });');
284 284
 		} else {
285
-			$script = '<script>' . $js . '</script>';
285
+			$script = '<script>'.$js.'</script>';
286 286
 		}
287 287
 		
288 288
 		if ($which == 'icon' || !file_exists($this->getServerFilename())) {
289 289
 			// Use an icon
290 290
 			$image =
291
-			'<i dir="auto" class="icon-maj-certificate margin-h-2"' .
292
-			' title="' . strip_tags($this->getFullName()) . '"' .
291
+			'<i dir="auto" class="icon-maj-certificate margin-h-2"'.
292
+			' title="'.strip_tags($this->getFullName()).'"'.
293 293
 			'></i>';
294 294
 		} else {
295 295
 			$imgsize = getimagesize($this->getServerFilename());
296 296
 			$image =
297
-			'<img' .
298
-			' class ="'. 'certif_image'					 	. '"' .
299
-			' dir="'   . 'auto'                           	. '"' . // For the tool-tip
300
-			' src="'   . $this->getHtmlUrlDirect() 			. '"' .
301
-			' alt="'   . strip_tags($this->getFullName()) 	. '"' .
302
-			' title="' . strip_tags($this->getFullName()) 	. '"' .
303
-			$imgsize[3] . // height="yyy" width="xxx"
297
+			'<img'.
298
+			' class ="'.'certif_image'.'"'.
299
+			' dir="'.'auto'.'"'.// For the tool-tip
300
+			' src="'.$this->getHtmlUrlDirect().'"'.
301
+			' alt="'.strip_tags($this->getFullName()).'"'.
302
+			' title="'.strip_tags($this->getFullName()).'"'.
303
+			$imgsize[3].// height="yyy" width="xxx"
304 304
 			'>';
305 305
 		}	
306 306
 		return
307
-		'<a' .
308
-		' class="'          . 'certgallery'                          . '"' .
309
-		' href="'           . $this->getHtmlUrlDirect()    		 . '"' .
310
-		' type="'           . $this->mimeType()                  . '"' .
311
-		' data-obje-url="'  . $this->getHtmlUrl()                . '"' .
312
-		' data-title="'     . strip_tags($this->getFullName())   . '"' .
313
-		'>' . $image . '</a>'.$script;
307
+		'<a'.
308
+		' class="'.'certgallery'.'"'.
309
+		' href="'.$this->getHtmlUrlDirect().'"'.
310
+		' type="'.$this->mimeType().'"'.
311
+		' data-obje-url="'.$this->getHtmlUrl().'"'.
312
+		' data-title="'.strip_tags($this->getFullName()).'"'.
313
+		'>'.$image.'</a>'.$script;
314 314
 	}
315 315
 	
316 316
 	/**
317 317
 	 * {@inhericDoc}
318 318
 	 * @see \Fisharebest\Webtrees\GedcomRecord::linkedIndividuals()
319 319
 	 */
320
-	public function linkedIndividuals($link = '_ACT'){
320
+	public function linkedIndividuals($link = '_ACT') {
321 321
 		$rows = Database::prepare(
322 322
 				'SELECT i_id AS xref, i_gedcom AS gedcom'.
323 323
 				' FROM `##individuals`'.
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * {@inhericDoc}
342 342
 	 * @see \Fisharebest\Webtrees\GedcomRecord::linkedFamilies()
343 343
 	 */
344
-	public function linkedFamilies($link = '_ACT'){
344
+	public function linkedFamilies($link = '_ACT') {
345 345
 		$rows = Database::prepare(
346 346
 				'SELECT f_id AS xref, f_gedcom AS gedcom'.
347 347
 				' FROM `##families`'.
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 *
367 367
 	 * @return Source|NULL Linked source
368 368
 	 */
369
-	public function fetchALinkedSource(){		
369
+	public function fetchALinkedSource() {		
370 370
 		$sid = null;
371 371
 		
372 372
 		// Try to find in individual, then families, then other types of records. We are interested in the first available value.
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		      'gedcom_id' => $this->tree->getTreeId(), 
379 379
 		      'gedcom' => '%_ACT '.$this->getFilename().'%'		      
380 380
 		  ))->fetchOne();
381
-		if(!$ged){
381
+		if (!$ged) {
382 382
 			$ged = Database::prepare(
383 383
 					'SELECT f_gedcom AS gedrec FROM `##families`'.
384 384
 					' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom')
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 			         'gedcom_id' => $this->tree->getTreeId(), 
387 387
 			         'gedcom' => '%_ACT '.$this->getFilename().'%'			         
388 388
 			     ))->fetchOne();
389
-			if(!$ged){
389
+			if (!$ged) {
390 390
 				$ged = Database::prepare(
391 391
 				    'SELECT o_gedcom AS gedrec FROM `##other`'.
392 392
 				    ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom')
@@ -397,19 +397,19 @@  discard block
 block discarded – undo
397 397
 			}
398 398
 		}
399 399
 		//If a record has been found, parse it to find the source reference.
400
-		if($ged){
400
+		if ($ged) {
401 401
 			$gedlines = explode("\n", $ged);
402 402
 			$level = 0;
403 403
 			$levelsource = -1;
404
-			$sid_tmp=null;
404
+			$sid_tmp = null;
405 405
 			$sourcefound = false;
406
-			foreach($gedlines as $gedline){
406
+			foreach ($gedlines as $gedline) {
407 407
 				// Get the level
408 408
 				$match = null;
409 409
 				if (!$sourcefound && preg_match('~^('.WT_REGEX_INTEGER.') ~', $gedline, $match)) {
410 410
 					$level = $match[1];
411 411
 					//If we are not any more within the context of a source, reset
412
-					if($level <= $levelsource){
412
+					if ($level <= $levelsource) {
413 413
 						$levelsource = -1;
414 414
 						$sid_tmp = null;
415 415
 					}
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
 					$match2 = null;
418 418
 					if (preg_match('~^'.$level.' SOUR @('.WT_REGEX_XREF.')@$~', $gedline, $match2)) {
419 419
 						$levelsource = $level;
420
-						$sid_tmp=$match2[1];
420
+						$sid_tmp = $match2[1];
421 421
 					}
422 422
 					// If the image has be found, get the source reference and exit.
423 423
 					$match3 = null;
424
-					if($levelsource>=0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)){
424
+					if ($levelsource >= 0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)) {
425 425
 						$sid = $sid_tmp;
426 426
 						$sourcefound = true;
427 427
 					}
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 			}
430 430
 		}
431 431
 		
432
-		if($sid) $this->source = Source::getInstance($sid, $this->tree);
432
+		if ($sid) $this->source = Source::getInstance($sid, $this->tree);
433 433
 		
434 434
 		return $this->source;	
435 435
 	}
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/AdminConfigController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,39 +33,39 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected function update() {
35 35
         
36
-        if(Auth::isAdmin()){
36
+        if (Auth::isAdmin()) {
37 37
             
38 38
             $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT'));
39 39
             $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK'));
40 40
             
41
-            if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) {
41
+            if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) {
42 42
                 $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT);
43 43
             }
44 44
             
45
-            if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) {
45
+            if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) {
46 46
                 $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE);
47 47
             }
48 48
             
49 49
             // Only accept valid color for MAJ_WM_FONT_COLOR
50 50
             $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}');            
51
-            if($MAJ_WM_FONT_COLOR) {
51
+            if ($MAJ_WM_FONT_COLOR) {
52 52
                 $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR);
53 53
             }
54 54
             
55 55
             // Only accept valid folders for MAJ_CERT_ROOTDIR
56
-            $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/');
56
+            $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR').'/');
57 57
             if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') {
58 58
                 $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1);
59 59
             }
60 60
             
61 61
             if ($MAJ_CERT_ROOTDIR) {
62
-                if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
62
+                if (is_dir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) {
63 63
                     $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
64
-                } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
64
+                } elseif (File::mkdir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) {
65 65
                     $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
66
-                    FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info');
66
+                    FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'info');
67 67
                 } else {
68
-                    FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger');
68
+                    FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'danger');
69 69
                 }
70 70
             }
71 71
             
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         global $WT_TREE;
87 87
         
88 88
         $action = Filter::post('action');        
89
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
89
+        if ($action == 'update' && Filter::checkCsrf()) $this->update();
90 90
         
91 91
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
92 92
         $ctrl = new PageController();
Please login to merge, or discard this patch.
src/Webtrees/Module/IsSourcedModule.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons()
64 64
 	 */
65 65
 	public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
66
-	    if($ctrlIndi){
66
+	    if ($ctrlIndi) {
67 67
 	        $dindi = new Individual($ctrlIndi->getSignificantIndividual());
68 68
 	        if ($dindi->canDisplayIsSourced()) 
69 69
 	            return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large');
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 	 * {@inheritDoc}
88 88
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend()
89 89
 	 */
90
-	public function hRecordNamePrepend(GedcomRecord $grec){ }
90
+	public function hRecordNamePrepend(GedcomRecord $grec) { }
91 91
 	
92 92
 	/**
93 93
 	 * {@inheritDoc}
94 94
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend()
95 95
 	 */
96
-	public function hRecordNameAppend(GedcomRecord $grec){
96
+	public function hRecordNameAppend(GedcomRecord $grec) {
97 97
 	    $html = '';
98
-	    if($grec instanceof \Fisharebest\Webtrees\Individual){
98
+	    if ($grec instanceof \Fisharebest\Webtrees\Individual) {
99 99
 	        $dindi = new Individual($grec);
100 100
 	        $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small');
101 101
 	        $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small');
102
-	        if($grec->isDead())
102
+	        if ($grec->isDead())
103 103
 	            $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small');
104 104
 	    }
105 105
 	    return $html;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * {@inheritDoc}
118 118
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
119 119
 	 */
120
-	public function hasSidebarContent(){ 
120
+	public function hasSidebarContent() { 
121 121
 	    return true;
122 122
 	}
123 123
 	
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 	            echo '
148 148
 	                <table class="issourcedtable">
149 149
 	                   <tr>
150
-	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td>
150
+	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI').'</td>
151 151
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1).'</td>
152 152
 	                   </tr>
153 153
 	                   <tr>
154
-	                       <td class="slabel">' . GedcomTag::getLabel('BIRT') . '</td>
154
+	                       <td class="slabel">' . GedcomTag::getLabel('BIRT').'</td>
155 155
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td>
156 156
 	                   </tr>';
157 157
 	            
158 158
 	            $fams = $root->getSpouseFamilies();
159
-	            ($ct = count($fams)) > 1 ? $nb=1 : $nb=' ';	            
160
-	            foreach($fams as $fam){
159
+	            ($ct = count($fams)) > 1 ? $nb = 1 : $nb = ' ';	            
160
+	            foreach ($fams as $fam) {
161 161
 	                $dfam = new Family($fam);
162 162
 	                echo '
163 163
 	                    <tr>
164 164
 	                       <td class="slabel right">
165
-	                           <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR');
166
-	                if($ct > 1){
167
-	                    echo ' ',$nb;
165
+	                           <a href="' . $fam->getHtmlUrl().'"> '.GedcomTag::getLabel('MARR');
166
+	                if ($ct > 1) {
167
+	                    echo ' ', $nb;
168 168
 	                    $nb++;
169 169
 	                }
170 170
 	                echo '     </a>
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 	                   </tr>';
174 174
 	            }
175 175
 	            
176
-	            if( $root->isDead() )
176
+	            if ($root->isDead())
177 177
 	                echo '
178 178
 	                    <tr>
179
-	                       <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td>
179
+	                       <td class="slabel">' . GedcomTag::getLabel('DEAT').'</td>
180 180
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td>
181 181
 	                   </tr>';
182 182
 	            
Please login to merge, or discard this patch.