Completed
Push — master ( 8c59e5...eb013e )
by Jonathan
09:17
created
src/Webtrees/GedcomRecord.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 	protected $gedcomrecord;
24 24
 
25 25
 	/** @var bool Is the GedcomRecord sourced (cache) */ 
26
-	protected $_issourced=null;
26
+	protected $_issourced = null;
27 27
 
28 28
 	/**
29 29
 	 * Contructor for the decorator
30 30
 	 *
31 31
 	 * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend
32 32
 	 */
33
-	public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){
33
+	public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) {
34 34
 		$this->gedcomrecord = $gedcomrecord_in;
35 35
 	}
36 36
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record
41 41
 	 */
42
-	public function getDerivedRecord(){
42
+	public function getDerivedRecord() {
43 43
 		return $this->gedcomrecord;
44 44
 	}
45 45
 	
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
71 71
 				switch ($style) {
72 72
 					case 10:
73
-					    return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .'&nbsp;'. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>';
73
+					    return '<i>'.$fact->getLabel().' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact).'&nbsp;'.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>';
74 74
 					default:
75 75
 						return $this->gedcomrecord->formatFirstMajorFact($facts, $style);
76 76
 				}
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 * @param int $access_level
86 86
 	 * @return boolean
87 87
 	 */
88
-	public function canDisplayIsSourced($access_level = null){
89
-		if(!$this->gedcomrecord->canShow($access_level)) return false;
90
-		if($access_level === null )
88
+	public function canDisplayIsSourced($access_level = null) {
89
+		if (!$this->gedcomrecord->canShow($access_level)) return false;
90
+		if ($access_level === null)
91 91
 		    $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree());
92 92
 
93 93
 		$global_facts = Globals::getGlobalFacts();
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return int Level of sources
109 109
 	 */
110
-	public function isSourced(){
111
-		if($this->_issourced !== null) return $this->_issourced;
112
-		$this->_issourced=-1;
110
+	public function isSourced() {
111
+		if ($this->_issourced !== null) return $this->_issourced;
112
+		$this->_issourced = -1;
113 113
 		$sourcesfacts = $this->gedcomrecord->getFacts('SOUR');
114
-		foreach($sourcesfacts as $sourcefact){
115
-			$this->_issourced=max($this->_issourced, 1);
116
-			if($sourcefact->getAttribute('_ACT')){
117
-				$this->_issourced=max($this->_issourced, 2);
114
+		foreach ($sourcesfacts as $sourcefact) {
115
+			$this->_issourced = max($this->_issourced, 1);
116
+			if ($sourcefact->getAttribute('_ACT')) {
117
+				$this->_issourced = max($this->_issourced, 2);
118 118
 			}
119 119
 		}
120 120
 		return $this->_issourced;
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
 	 * @param string $eventslist
127 127
 	 * @return int Level of sources
128 128
 	 */
129
-	public function isFactSourced($eventslist){
130
-	    if(empty($eventslist)) return 0;
131
-		$isSourced=0;
129
+	public function isFactSourced($eventslist) {
130
+	    if (empty($eventslist)) return 0;
131
+		$isSourced = 0;
132 132
 		$facts = $this->gedcomrecord->getFacts($eventslist);
133
-		foreach($facts as $fact){
134
-			if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){
133
+		foreach ($facts as $fact) {
134
+			if ($isSourced < Fact::MAX_IS_SOURCED_LEVEL) {
135 135
 				$dfact = new Fact($fact);
136 136
 				$tmpIsSourced = $dfact->isSourced();
137
-				if($tmpIsSourced != 0) {
138
-					if($isSourced==0) {
139
-						$isSourced =  $tmpIsSourced;
137
+				if ($tmpIsSourced != 0) {
138
+					if ($isSourced == 0) {
139
+						$isSourced = $tmpIsSourced;
140 140
 					}
141
-					else{
141
+					else {
142 142
 						$isSourced = max($isSourced, $tmpIsSourced);
143 143
 					}
144 144
 				}
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaStatsView.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 			<?php 
32 32
 			/** @var \Fisharebest\Webtrees\Individual $root_indi */
33 33
 			$root_indi = $this->data->get('root_indi');
34
-			if($root_indi !== null && $root_indi->canShowName()) { ?>
34
+			if ($root_indi !== null && $root_indi->canShowName()) { ?>
35 35
 			<h4 class="center"><?= I18N::translate('%s: %s', I18N::translate('Root individual'), $root_indi->getFullName()); ?><h4>
36 36
 			<?php } ?>
37 37
 			
38
-			<?php  if($this->data->get('is_setup')) {  
38
+			<?php  if ($this->data->get('is_setup')) {  
39 39
 			    $general_stats = $this->data->get('general_stats'); ?>
40 40
 			<h3><?php echo I18N::translate('General statistics'); ?></h3>
41 41
 			<div class="maj-table">
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				</div>
58 58
 				<div class="maj-row">
59 59
 					<div class="label"><?php echo I18N::translate('Mean generation time'); ?></div>
60
-					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'],  I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
60
+					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'], I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
61 61
 				</div>
62 62
 			</div>
63 63
 			
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					</tr>
98 98
 				</thead>
99 99
 				<tbody>
100
-					<?php foreach($this->data->get('generation_stats') as $gen => $row) { ?>
100
+					<?php foreach ($this->data->get('generation_stats') as $gen => $row) { ?>
101 101
 					<tr class="maj-row">
102 102
 						<td class="label"><?php echo I18N::translate('<strong>G%d</strong>', $gen); ?></td>
103 103
 						<td class="label"><?php echo I18N::translate('%1$s <> %2$s', $row['gen_min_birth'], $row['gen_max_birth']); ?></td>
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 						<td class="value"><?php echo I18N::number($row['different']); ?></td>
112 112
 						<td class="value left percent_container">
113 113
 							<div class="percent_frame">
114
-								<div class="percent_cell" style="width:<?php echo 100*$row['perc_different'] ?>%;">
114
+								<div class="percent_cell" style="width:<?php echo 100 * $row['perc_different'] ?>%;">
115 115
 									&nbsp;<?php echo I18N::percentage($row['perc_different']); ?>&nbsp;
116 116
 								</div>
117 117
 							</div>
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				<tfoot>
125 125
 					<tr class="maj-row">
126 126
 						<td class="label" colspan="13">
127
-							<?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'),2)); ?>
127
+							<?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'), 2)); ?>
128 128
 						</td>
129 129
 					</tr>
130 130
 				</tfoot>
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 			
134 134
 			<?php  
135 135
 			$top10_multi_ancestors = $this->data->get('top10multiancestors');
136
-			if(count($top10_multi_ancestors) > 0) { ?>
136
+			if (count($top10_multi_ancestors) > 0) { ?>
137 137
 			<h3><?= I18N::translate('Most duplicated root Sosa ancestors'); ?></h3>
138 138
 			<div class="maj-table">
139
-			<?php foreach($top10_multi_ancestors as $count => $indis) { ?>
139
+			<?php foreach ($top10_multi_ancestors as $count => $indis) { ?>
140 140
 			    <div class="maj-row">
141 141
 			    	<div class="label"><?= I18N::translate('%s times', I18N::number($count)); ?></div>
142 142
 			    	<div class="value"><?php 
143 143
 			    	echo implode(
144 144
 			    	    I18N::$list_separator, 
145 145
 			    	    array_map(function(Individual $indi) {
146
-			    	        return '<a href="'. $indi->getHtmlUrl(). '">'. $indi->getFullName() . '&nbsp;' . $indi->getSexImage() . '</a>';
146
+			    	        return '<a href="'.$indi->getHtmlUrl().'">'.$indi->getFullName().'&nbsp;'.$indi->getSexImage().'</a>';
147 147
 			    	    }, $indis)
148 148
 			    	);
149 149
 			    	?></div>
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 			
155 155
 			<h3><?php echo I18N::translate('Known Sosa ancestors\' family dispersion'); ?></h3>
156 156
 			<div class="center">
157
-				<?php echo $this->data->get('chart_img_g2') ?: '' ; ?>
158
-				<?php echo $this->data->get('chart_img_g3') ?: '' ; ?>				
157
+				<?php echo $this->data->get('chart_img_g2') ?: ''; ?>
158
+				<?php echo $this->data->get('chart_img_g3') ?: ''; ?>				
159 159
 				<!--  <canvas id="chart_ancestors_g2" width="300" height="300"></canvas>  -->
160 160
 			</div>
161 161
 			
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/SosaStatsController.php 1 patch
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $view_bag->set('title', $controller->getPageTitle());
63 63
         $view_bag->set('is_setup', false);
64 64
         
65
-        if($this->sosa_provider->isSetup()) {
65
+        if ($this->sosa_provider->isSetup()) {
66 66
             $view_bag->set('is_setup', true);
67 67
             
68 68
             $view_bag->set('root_indi', $this->sosa_provider->getRootIndi());
@@ -83,23 +83,23 @@  discard block
 block discarded – undo
83 83
             $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$wt_tree->getNameUrl().'&gen=');
84 84
             $view_bag->set('sosaanc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList&ged='.$wt_tree->getNameUrl().'&gen=');
85 85
             
86
-            $gen_theoretical=1;
87
-            $total_theoretical=0;
88
-            $prev_diff=0;
89
-            $prev_known=0.5;
90
-            $gen_equiv=0;            
86
+            $gen_theoretical = 1;
87
+            $total_theoretical = 0;
88
+            $prev_diff = 0;
89
+            $prev_known = 0.5;
90
+            $gen_equiv = 0;            
91 91
             $generation_stats = array();
92 92
             
93
-            foreach($stats_gen as $gen => $tab){
94
-                $genY1= I18N::translate('-');
95
-                $genY2= I18N::translate('-');
96
-                if($tab['firstBirth']>0) $genY1=$tab['firstBirth'];
97
-                if($tab['lastBirth']>0) $genY2=$tab['lastBirth'];
93
+            foreach ($stats_gen as $gen => $tab) {
94
+                $genY1 = I18N::translate('-');
95
+                $genY2 = I18N::translate('-');
96
+                if ($tab['firstBirth'] > 0) $genY1 = $tab['firstBirth'];
97
+                if ($tab['lastBirth'] > 0) $genY2 = $tab['lastBirth'];
98 98
                 $total_theoretical += $gen_theoretical;
99 99
                 $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical);
100 100
                 $gen_equiv += $perc_sosa_count_theor;
101
-                $missing=2*$prev_known - $tab['sosaCount'];
102
-                $gen_diff=$tab['diffSosaTotalCount']-$prev_diff;
101
+                $missing = 2 * $prev_known - $tab['sosaCount'];
102
+                $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff;
103 103
                 
104 104
                 $generation_stats[$gen] = array(
105 105
                     'gen_min_birth' => $genY1,
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                     'known' => $tab['sosaCount'],
109 109
                     'perc_known' => $perc_sosa_count_theor,
110 110
                     'missing' => $missing,
111
-                    'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known),
111
+                    'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known),
112 112
                     'total_known' => $tab['sosaTotalCount'],
113 113
                     'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical),
114 114
                     'different' => $gen_diff,
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
                 );
119 119
                 
120 120
                 $gen_theoretical = $gen_theoretical * 2;
121
-                $prev_known=$tab['sosaCount'];
122
-                $prev_diff=$tab['diffSosaTotalCount'];
121
+                $prev_known = $tab['sosaCount'];
122
+                $prev_diff = $tab['diffSosaTotalCount'];
123 123
             }
124 124
             
125 125
             $view_bag->set('generation_stats', $generation_stats);
@@ -127,13 +127,12 @@  discard block
 block discarded – undo
127 127
             
128 128
             $top10multiancestors = $this->sosa_provider->getTopMultiSosaAncestorsNoTies(10);
129 129
             $top10ancestors = array();
130
-            if($top10multiancestors !== null && count($top10multiancestors)) {
131
-                foreach($top10multiancestors as $pid => $count) {
130
+            if ($top10multiancestors !== null && count($top10multiancestors)) {
131
+                foreach ($top10multiancestors as $pid => $count) {
132 132
                     $indi = Individual::getInstance($pid, $wt_tree);
133
-                    if($indi !== null && $indi->canShowName()) {
133
+                    if ($indi !== null && $indi->canShowName()) {
134 134
                         array_key_exists($count, $top10ancestors) ?
135
-                            $top10ancestors[$count][] = $indi:
136
-                            $top10ancestors[$count] = array($count => $indi);
135
+                            $top10ancestors[$count][] = $indi : $top10ancestors[$count] = array($count => $indi);
137 136
                     }
138 137
                 }
139 138
             }
@@ -154,27 +153,27 @@  discard block
 block discarded – undo
154 153
      private function htmlAncestorDispersionG2()
155 154
     {
156 155
         $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2);
157
-        if(count($ancestorsDispGen2) == 0) return;
156
+        if (count($ancestorsDispGen2) == 0) return;
158 157
         
159 158
         $size = '600x300';
160 159
         
161 160
         $total = array_sum($ancestorsDispGen2);
162 161
         $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0;
163
-        $father = array (
162
+        $father = array(
164 163
             'color' => '84beff', 
165 164
             'count' => $father_count, 
166 165
             'perc' => Functions::safeDivision($father_count, $total), 
167 166
             'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat')            
168 167
         );
169 168
         $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0;
170
-        $mother = array (
169
+        $mother = array(
171 170
             'color' => 'ffd1dc', 
172 171
             'count' => $mother_count, 
173 172
             'perc' => Functions::safeDivision($mother_count, $total),
174 173
             'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot')
175 174
         );
176 175
         $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
177
-        $shared = array (
176
+        $shared = array(
178 177
             'color' => '777777', 
179 178
             'count' => $shared_count, 
180 179
             'perc' => Functions::safeDivision($shared_count, $total),
@@ -184,10 +183,10 @@  discard block
 block discarded – undo
184 183
         $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc']));
185 184
         $chart_title = I18N::translate('Known Sosa ancestors\' dispersion');
186 185
         $chl = 
187
-             $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' .
188
-             $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' .
189
-             $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1);
190
-        return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
186
+             $father['name'].' - '.I18N::percentage($father['perc'], 1).'|'.
187
+             $shared['name'].' - '.I18N::percentage($shared['perc'], 1).'|'.
188
+             $mother['name'].' - '.I18N::percentage($mother['perc'], 1);
189
+        return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />";
191 190
     }
192 191
     
193 192
     /**
@@ -211,7 +210,7 @@  discard block
 block discarded – undo
211 210
         $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0;
212 211
         $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0;
213 212
         $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
214
-        $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha;
213
+        $total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha;
215 214
     
216 215
         $chd = $this->arrayToExtendedEncoding(array(
217 216
 	    4095 * Functions::safeDivision($total_fatfat, $total), 
@@ -222,12 +221,12 @@  discard block
 block discarded – undo
222 221
         ));
223 222
         $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3');
224 223
         $chl =
225
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' .
226
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' .
227
-            I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' .
228
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' .
229
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
230
-         return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
224
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat').' - '.I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1).'|'.
225
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot').' - '.I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1).'|'.
226
+            I18N::translate('Shared').' - '.I18N::percentage(Functions::safeDivision($total_sha, $total), 1).'|'.
227
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat').' - '.I18N::percentage(Functions::safeDivision($total_motfat, $total), 1).'|'.
228
+            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot').' - '.I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
229
+         return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />";
231 230
     }
232 231
 
233 232
     /**
@@ -243,9 +242,9 @@  discard block
 block discarded – undo
243 242
             if ($value < 0) {
244 243
                 $value = 0;
245 244
             }
246
-            $first  = (int) ($value / 64);
245
+            $first  = (int)($value / 64);
247 246
             $second = $value % 64;
248
-            $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second];
247
+            $encoding .= $xencoding[(int)$first].$xencoding[(int)$second];
249 248
         }
250 249
     
251 250
         return $encoding;
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $text Text to display
34 34
 	 */
35
-	static public function promptAlert($text){
35
+	static public function promptAlert($text) {
36 36
 		echo '<script>';
37
-		echo 'alert("',fw\Filter::escapeHtml($text),'")';
37
+		echo 'alert("', fw\Filter::escapeHtml($text), '")';
38 38
 		echo '</script>';
39 39
 	}
40 40
 	
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return float Result of the safe division
48 48
 	 */
49 49
 	public static function safeDivision($num, $denom, $default = 0) {
50
-		if($denom && $denom!=0){
50
+		if ($denom && $denom != 0) {
51 51
 			return $num / $denom;
52 52
 		}
53 53
 		return $default;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @param float $default Default value if denominator null or 0
62 62
 	 * @return float Percentage
63 63
 	 */
64
-	public static function getPercentage($num, $denom, $default = 0){
64
+	public static function getPercentage($num, $denom, $default = 0) {
65 65
 		return 100 * self::safeDivision($num, $denom, $default);
66 66
 	}
67 67
 	
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param int $target	The final max width/height
73 73
 	 * @return array array of ($width, $height). One of them must be $target
74 74
 	 */
75
-	static public function getResizedImageSize($file, $target=25){
76
-		list($width, $height, , ) = getimagesize($file);
75
+	static public function getResizedImageSize($file, $target = 25) {
76
+		list($width, $height,,) = getimagesize($file);
77 77
 		$max = max($width, $height);
78 78
 		$rapp = $target / $max;
79 79
 		$width = intval($rapp * $width);
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
 	 * @param int $length Length of the token, default to 32
104 104
 	 * @return string Random token
105 105
 	 */
106
-	public static function generateRandomToken($length=32) {
106
+	public static function generateRandomToken($length = 32) {
107 107
 		$chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
108 108
 		$len_chars = count($chars);
109 109
 		$token = '';
110 110
 		
111 111
 		for ($i = 0; $i < $length; $i++)
112
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
112
+			$token .= $chars[mt_rand(0, $len_chars - 1)];
113 113
 		
114 114
 		# Number of 32 char chunks
115
-		$chunks = ceil( strlen($token) / 32 );
115
+		$chunks = ceil(strlen($token) / 32);
116 116
 		$md5token = '';
117 117
 		
118 118
 		# Run each chunk through md5
119
-		for ( $i=1; $i<=$chunks; $i++ )
120
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
119
+		for ($i = 1; $i <= $chunks; $i++)
120
+			$md5token .= md5(substr($token, $i * 32 - 32, 32));
121 121
 		
122 122
 			# Trim the token
123 123
 		return substr($md5token, 0, $length);		
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected static function getBase64EncryptionKey() {	    
132 132
 	    $key = 'STANDARDKEYIFNOSERVER';
133
-	    if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
133
+	    if (!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
134 134
 	        $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
135 135
 	    
136 136
 	    return $key;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @param string $data Text to encrypt
144 144
 	 * @return string Encrypted and encoded text
145 145
 	 */
146
-	public static function encryptToSafeBase64($data){		
146
+	public static function encryptToSafeBase64($data) {		
147 147
 		$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);	
148 148
 		$id = sodium_crypto_secretbox($data, $nonce, self::getBase64EncryptionKey());
149 149
 		$encrypted = base64_encode($nonce.$id);
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
 	 * @param string $encrypted Text to decrypt
164 164
 	 * @return string Decrypted text
165 165
 	 */
166
-	public static function decryptFromSafeBase64($encrypted){
166
+	public static function decryptFromSafeBase64($encrypted) {
167 167
 		$encrypted = str_replace('-', '+', $encrypted);
168 168
 		$encrypted = str_replace('_', '/', $encrypted);
169 169
 		$encrypted = str_replace('*', '=', $encrypted);
170 170
 		$encrypted = base64_decode($encrypted);
171
-		if($encrypted === false)
171
+		if ($encrypted === false)
172 172
 			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
173 173
 		
174 174
 		if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES))
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         
180 180
         $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey());
181 181
 		
182
-        if($decrypted === false) {
182
+        if ($decrypted === false) {
183 183
             throw new \InvalidArgumentException('The message has been tampered with in transit.');
184 184
         }
185 185
         
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 * @param string $string Filesystem encoded string to encode
195 195
 	 * @return string UTF-8 encoded string
196 196
 	 */
197
-	public static function encodeFileSystemToUtf8($string){
197
+	public static function encodeFileSystemToUtf8($string) {
198 198
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
199
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
199
+		    return iconv('cp1252', 'utf-8//IGNORE', $string);
200 200
 		}
201 201
 		return $string;
202 202
 	}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 	 * @param string $string UTF-8 encoded string to encode
208 208
 	 * @return string Filesystem encoded string
209 209
 	 */
210
-	public static function encodeUtf8ToFileSystem($string){
210
+	public static function encodeUtf8ToFileSystem($string) {
211 211
 		if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
212
-			return iconv('utf-8', 'cp1252//IGNORE' ,  $string);
212
+			return iconv('utf-8', 'cp1252//IGNORE', $string);
213 213
 		}
214 214
 		return $string;
215 215
 	}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return boolean True if path valid
223 223
 	 */
224 224
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
225
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
225
+		if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
226 226
 		return false;
227 227
 	}
228 228
 	
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @return array Array of month short names
235 235
 	 */
236 236
 	public static function getCalendarShortMonths($calendarId = 0) {
237
-		if(!isset(self::$calendarShortMonths[$calendarId])) {
237
+		if (!isset(self::$calendarShortMonths[$calendarId])) {
238 238
 			$calendar_info = cal_info($calendarId);
239 239
 			self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths'];
240 240
 		}		
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
 	 * @param int $sosa Sosa number
248 248
 	 * @return number
249 249
 	 */
250
-	public static function getGeneration($sosa){
251
-		return(int)log($sosa, 2)+1;
250
+	public static function getGeneration($sosa) {
251
+		return(int)log($sosa, 2) + 1;
252 252
 	}
253 253
 	
254 254
 	
Please login to merge, or discard this patch.
src/Webtrees/Map/GoogleMapsProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId()
26 26
 	 */
27 27
 	public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) {
28
-		if(!$place->isEmpty()) {
29
-			$parent = array_reverse(explode (',', $place->getGedcomName()));
28
+		if (!$place->isEmpty()) {
29
+			$parent = array_reverse(explode(',', $place->getGedcomName()));
30 30
 			$place_id = 0;
31 31
 			$nb_levels = count($parent);
32
-			for ($i=0; $i < $nb_levels; $i++) {
32
+			for ($i = 0; $i < $nb_levels; $i++) {
33 33
 				$parent[$i] = trim($parent[$i]);
34
-				if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , ,
35
-				$pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place')
34
+				if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , ,
35
+				$pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place')
36 36
 					->execute(array($i, $place_id, $parent[$i]))
37 37
 					->fetchOne();
38 38
 				if (empty($pl_id)) break;
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 	 * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon()
49 49
 	 */
50 50
 	public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) {
51
-		if(!$place->isEmpty()){
51
+		if (!$place->isEmpty()) {
52 52
 			$place_details =
53 53
 				Database::prepare('SELECT pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place')	
54 54
 				->execute(array($this->getProviderPlaceId($place)))
55 55
 				->fetchOneRow();
56
-			if($place_details){
56
+			if ($place_details) {
57 57
 				return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon;
58 58
 			}
59 59
 		}
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookProvider.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks()
72 72
 	 */
73 73
 	public function getPossibleHooks() {
74
-		static $hooks=null;
74
+		static $hooks = null;
75 75
 		if ($hooks === null) {
76 76
 		    $hooks = array();
77 77
 		    
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
 		        'SELECT module_name FROM `##module`'
84 84
 		    )->fetchOneColumn();
85 85
 		    
86
-		    foreach($module_names as $module_name) {
86
+		    foreach ($module_names as $module_name) {
87 87
 		        $module = Module::getModuleByName($module_name);
88 88
 		        
89
-		        if($module instanceof HookSubscriberInterface){
89
+		        if ($module instanceof HookSubscriberInterface) {
90 90
 					$subscribedhooks = $module->getSubscribedHooks();
91
-					if(is_array($subscribedhooks)){
92
-						foreach($subscribedhooks as $key => $value){
93
-							if(is_int($key)) {
91
+					if (is_array($subscribedhooks)) {
92
+						foreach ($subscribedhooks as $key => $value) {
93
+							if (is_int($key)) {
94 94
 								$hook_item = $value;
95 95
 								$priority = self::DEFAULT_PRIORITY;
96 96
 							}
97
-							else{
97
+							else {
98 98
 								$hook_item = explode('#', $key, 2);
99 99
 								$priority = $value;
100 100
 							}
101
-							if($hook_item && count($hook_item) == 2){
101
+							if ($hook_item && count($hook_item) == 2) {
102 102
 								$hook_func = $hook_item[0];
103 103
 								$hook_cont = $hook_item[1];
104 104
 							}
105
-							else{
105
+							else {
106 106
 								$hook_func = $hook_item[0];
107 107
 								$hook_cont = 'all';
108 108
 							}
109
-							if(method_exists($module, $hook_func)){
110
-								$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority;
109
+							if (method_exists($module, $hook_func)) {
110
+								$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority;
111 111
 							}
112 112
 						}
113 113
 					}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * {@inheritDoc}
122 122
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getRawInstalledHooks()
123 123
 	 */
124
-	public function getRawInstalledHooks(){
125
-		if(self::isModuleOperational()){
124
+	public function getRawInstalledHooks() {
125
+		if (self::isModuleOperational()) {
126 126
 			return Database::prepare(
127 127
 					"SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority,  majh_status AS status".
128 128
 					" FROM `##maj_hooks`".
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 * {@inheritDoc}
137 137
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getInstalledHooks()
138 138
 	 */
139
-	public function getInstalledHooks(){
140
-		static $installedhooks =null;
141
-		if($installedhooks===null){
142
-			$dbhooks=self::getRawInstalledHooks();
143
-			foreach($dbhooks as $dbhook){
139
+	public function getInstalledHooks() {
140
+		static $installedhooks = null;
141
+		if ($installedhooks === null) {
142
+			$dbhooks = self::getRawInstalledHooks();
143
+			foreach ($dbhooks as $dbhook) {
144 144
 				$installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority);
145 145
 			}
146 146
 		}
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function updateHooks() {
155 155
 	    
156
-	    if(Auth::isAdmin()){
156
+	    if (Auth::isAdmin()) {
157 157
 	        $ihooks = self::getInstalledHooks();
158 158
 	        $phooks = self::getPossibleHooks();
159 159
 	        	
160 160
 	        // Insert hooks not existing yet in the DB
161
-	        if($phooks !== null){
162
-	            foreach($phooks as $phook => $priority){
161
+	        if ($phooks !== null) {
162
+	            foreach ($phooks as $phook => $priority) {
163 163
 	                $array_hook = explode('#', $phook);
164
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
164
+	                if ($ihooks === null || !array_key_exists($phook, $ihooks)) {
165 165
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
166 166
 	                    $chook->subscribe($array_hook[0]);
167 167
 	                    $chook->setPriority($array_hook[0], $priority);
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 	        }
171 171
 	        	
172 172
 	        //Remove hooks not existing any more in the file system
173
-	        if($ihooks !== null){
174
-	            foreach(array_keys($ihooks) as $ihook){
173
+	        if ($ihooks !== null) {
174
+	            foreach (array_keys($ihooks) as $ihook) {
175 175
 	                $array_hook = explode('#', $ihook);
176
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
176
+	                if ($phooks === null || !array_key_exists($ihook, $phooks)) {
177 177
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
178 178
 	                    $chook->remove($array_hook[0]);
179 179
 	                }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysis.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @return string
164 164
 	 */
165 165
 	 public function getHtmlUrl() {
166
-        return 'module.php?mod='. Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl();
166
+        return 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&mod_action=GeoAnalysis&ga_id='.$this->getId().'&ged='.$this->tree->getNameUrl();
167 167
     }
168 168
     
169 169
     /**
@@ -186,53 +186,53 @@  discard block
 block discarded – undo
186 186
         $placesDispGeneral = null;
187 187
         $placesDispGenerations = null;
188 188
         
189
-        if($sosalist && count($sosalist) > 0) {
189
+        if ($sosalist && count($sosalist) > 0) {
190 190
             $placesDispGeneral['knownsum'] = 0;
191 191
             $placesDispGeneral['unknown'] = 0;
192 192
             $placesDispGeneral['max'] = 0;
193 193
             $placesDispGeneral['places'] = array();
194
-            foreach($sosalist as $sosaid => $gens) {
194
+            foreach ($sosalist as $sosaid => $gens) {
195 195
                 $sosa = Individual::getIntance($sosaid, $this->tree);
196
-                $place =$sosa->getSignificantPlace();
196
+                $place = $sosa->getSignificantPlace();
197 197
                 $genstab = explode(',', $gens);
198
-                $isUnknown=true;
199
-                if($sosa->getDerivedRecord()->canShow() && !is_null($place)){
200
-                    $levels = array_reverse(array_map('trim',explode(',', $place)));
201
-                    if(count($levels)>= $this->analysis_level){                        
198
+                $isUnknown = true;
199
+                if ($sosa->getDerivedRecord()->canShow() && !is_null($place)) {
200
+                    $levels = array_reverse(array_map('trim', explode(',', $place)));
201
+                    if (count($levels) >= $this->analysis_level) {                        
202 202
                         $toplevelvalues = array();
203
-                        if($this->hasMap()
203
+                        if ($this->hasMap()
204 204
                             && $this->options->getMap()->isLoaded()
205 205
                             && $toplevelvalue = $this->options->getMap()->getTopLevelName()
206 206
                         ) {
207
-                            $toplevelvalues = array_map('trim',explode(',', strtolower($toplevelvalue)));
207
+                            $toplevelvalues = array_map('trim', explode(',', strtolower($toplevelvalue)));
208 208
                         }
209
-                        if(!$this->hasMap() 
209
+                        if (!$this->hasMap() 
210 210
                             || is_null($this->options->getMapLevel()) 
211
-                            || ( $this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') 
211
+                            || ($this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') 
212 212
                             || (
213 213
                                 $this->options->getMapLevel() <= $this->analysis_level 
214 214
                                 && $this->options->getMapLevel() > 0
215 215
                                 && count($levels) >= $this->options->getMapLevel()
216
-                                && in_array(strtolower($levels[$this->options->getMapLevel()-1]), $toplevelvalues)
216
+                                && in_array(strtolower($levels[$this->options->getMapLevel() - 1]), $toplevelvalues)
217 217
                             )
218 218
                         ) {
219 219
                             $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level));
220
-                            if(isset($placesDispGeneral['places'][$placest])) {
220
+                            if (isset($placesDispGeneral['places'][$placest])) {
221 221
                                 $placesDispGeneral['places'][$placest] += 1;
222 222
                             }
223 223
                             else { 
224 224
                                 $placesDispGeneral['places'][$placest] = 1;
225 225
                             }
226
-                            if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max'])
226
+                            if ($placesDispGeneral['places'][$placest] > $placesDispGeneral['max'])
227 227
                                 $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest];
228
-                            foreach($genstab as $gen) {
229
-                                if(isset($placesDispGenerations[$gen]['places'][$placest])) {
228
+                            foreach ($genstab as $gen) {
229
+                                if (isset($placesDispGenerations[$gen]['places'][$placest])) {
230 230
                                     $placesDispGenerations[$gen]['places'][$placest] += 1;
231 231
                                 }
232 232
                                 else { 
233 233
                                     $placesDispGenerations[$gen]['places'][$placest] = 1;
234 234
                                 }
235
-                                if(isset($placesDispGenerations[$gen]['sum'])) {
235
+                                if (isset($placesDispGenerations[$gen]['sum'])) {
236 236
                                     $placesDispGenerations[$gen]['sum'] += 1;
237 237
                                 }
238 238
                                 else { 
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
                                 }
241 241
                             }
242 242
                         }
243
-                        else{
244
-                            if(isset($placesDispGeneral['other'])) {
243
+                        else {
244
+                            if (isset($placesDispGeneral['other'])) {
245 245
                                 $placesDispGeneral['other'] += 1;
246 246
                             }
247 247
                             else { 
248 248
                                 $placesDispGeneral['other'] = 1;
249 249
                             }
250
-                            foreach($genstab as $gen) {
251
-                                if(isset($placesDispGenerations[$gen]['other'])) {
250
+                            foreach ($genstab as $gen) {
251
+                                if (isset($placesDispGenerations[$gen]['other'])) {
252 252
                                     $placesDispGenerations[$gen]['other'] += 1;
253 253
                                 }
254 254
                                 else { 
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
                         $isUnknown = false;
261 261
                     }
262 262
                 }
263
-                if($isUnknown){
263
+                if ($isUnknown) {
264 264
                     $placesDispGeneral['unknown'] += 1;
265
-                    foreach($genstab as $gen) {
266
-                        if(isset($placesDispGenerations[$gen]['unknown'])) { 
265
+                    foreach ($genstab as $gen) {
266
+                        if (isset($placesDispGenerations[$gen]['unknown'])) { 
267 267
                             $placesDispGenerations[$gen]['unknown'] += 1;
268 268
                         }
269 269
                         else { 
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/GeoAnalysisEditView.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		
45 45
 		<form class="form-horizontal" name="newform" method="post" role="form" action="<?php echo $this->data->get('save_url'); ?>" autocomplete="off">
46 46
     		<?php echo Filter::getCsrf(); ?>
47
-    		<?php if(!$is_new) { ?>
47
+    		<?php if (!$is_new) { ?>
48 48
     		<input type="hidden" name="ga_id" value="<?php echo $ga->getId(); ?>">
49 49
     		<?php } ?>
50 50
     
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     				<?php echo I18N::translate('Description'); ?>
55 55
     			</label>
56 56
     			<div class="col-sm-9">
57
-    				<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">
57
+    				<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">
58 58
     				<p class="small text-muted">
59 59
     					<?php echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.'); ?>
60 60
     				</p>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         				<?php echo I18N::translate('Map'); ?>
98 98
         			</label>
99 99
         			<div class="col-sm-9">
100
-        				<?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"'); ?>
100
+        				<?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"'); ?>
101 101
         				<p class="small text-muted">
102 102
         					<?php echo I18N::translate('Map outline to be used for the result display.'); ?>
103 103
         				</p>
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         				<?php echo I18N::translate('Map parent level'); ?>
111 111
         			</label>
112 112
         			<div class="col-sm-9">
113
-        				<?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || ! $ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?>
113
+        				<?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || !$ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?>
114 114
         				<p class="small text-muted">
115 115
         					<?php echo I18N::translate('Subdivision level of the parent subdivision(s) represented by the map.'); ?><br />
116 116
         					<?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/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.