Completed
Push — master ( 95506d...0f93c5 )
by Jonathan
07:55
created
src/Webtrees/Module/Sosa/SosaStatsController.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -25,215 +25,215 @@
 block discarded – undo
25 25
  */
26 26
 class SosaStatsController extends MvcController
27 27
 {
28
-    /**
29
-     * Sosa Provider for the controller
30
-     * @var SosaProvider $sosa_provider
31
-     */
32
-    protected $sosa_provider;
28
+	/**
29
+	 * Sosa Provider for the controller
30
+	 * @var SosaProvider $sosa_provider
31
+	 */
32
+	protected $sosa_provider;
33 33
     
34
-    /**
35
-     * Constructor for SosaStatsController
36
-     * @param AbstractModule $module
37
-     */
38
-    public function __construct(AbstractModule $module) {
39
-        global $WT_TREE;
34
+	/**
35
+	 * Constructor for SosaStatsController
36
+	 * @param AbstractModule $module
37
+	 */
38
+	public function __construct(AbstractModule $module) {
39
+		global $WT_TREE;
40 40
         
41
-        parent::__construct($module);
41
+		parent::__construct($module);
42 42
         
43
-        $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user());
44
-    }
43
+		$this->sosa_provider = new SosaProvider($WT_TREE, Auth::user());
44
+	}
45 45
     
46
-    /**
47
-     * Pages
48
-     */
46
+	/**
47
+	 * Pages
48
+	 */
49 49
     
50
-    /**
51
-     * SosaStats@index
52
-     */
53
-    public function index() {
54
-        global $WT_TREE;
50
+	/**
51
+	 * SosaStats@index
52
+	 */
53
+	public function index() {
54
+		global $WT_TREE;
55 55
         
56
-        $controller = new PageController();
57
-        $controller
58
-            ->setPageTitle(I18N::translate('Sosa Statistics'))
59
-            ->addInlineJavascript('$(".help_tooltip").tooltip();')
60
-        ;
56
+		$controller = new PageController();
57
+		$controller
58
+			->setPageTitle(I18N::translate('Sosa Statistics'))
59
+			->addInlineJavascript('$(".help_tooltip").tooltip();')
60
+		;
61 61
 
62
-        $view_bag = new ViewBag();
63
-        $view_bag->set('title', $controller->getPageTitle());
64
-        $view_bag->set('is_setup', false);
62
+		$view_bag = new ViewBag();
63
+		$view_bag->set('title', $controller->getPageTitle());
64
+		$view_bag->set('is_setup', false);
65 65
         
66
-        if($this->sosa_provider->isSetup()) {
67
-            $view_bag->set('is_setup', true);
66
+		if($this->sosa_provider->isSetup()) {
67
+			$view_bag->set('is_setup', true);
68 68
             
69
-            $sosaCount = $this->sosa_provider->getSosaCount();
70
-            $diffSosaCount = $this->sosa_provider->getDifferentSosaCount();
69
+			$sosaCount = $this->sosa_provider->getSosaCount();
70
+			$diffSosaCount = $this->sosa_provider->getDifferentSosaCount();
71 71
             
72
-            $general_stats = array(
73
-                'sosa_count' => $sosaCount,
74
-                'distinct_count' => $diffSosaCount,
75
-                'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()),
76
-                'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount),
77
-                'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime()
78
-            );
79
-            $view_bag->set('general_stats', $general_stats);
72
+			$general_stats = array(
73
+				'sosa_count' => $sosaCount,
74
+				'distinct_count' => $diffSosaCount,
75
+				'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()),
76
+				'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount),
77
+				'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime()
78
+			);
79
+			$view_bag->set('general_stats', $general_stats);
80 80
             
81
-            $stats_gen = $this->sosa_provider->getStatisticsByGeneration();
82
-            $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen=');
81
+			$stats_gen = $this->sosa_provider->getStatisticsByGeneration();
82
+			$view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen=');
83 83
             
84
-            $gen_theoretical=1;
85
-            $total_theoretical=0;
86
-            $prev_diff=0;
87
-            $prev_known=0.5;
88
-            $gen_equiv=0;            
89
-            $generation_stats = array();
84
+			$gen_theoretical=1;
85
+			$total_theoretical=0;
86
+			$prev_diff=0;
87
+			$prev_known=0.5;
88
+			$gen_equiv=0;            
89
+			$generation_stats = array();
90 90
             
91
-            foreach($stats_gen as $gen => $tab){
92
-                $genY1= I18N::translate('-');
93
-                $genY2= I18N::translate('-');
94
-                if($tab['firstBirth']>0) $genY1=$tab['firstBirth'];
95
-                if($tab['lastBirth']>0) $genY2=$tab['lastBirth'];
96
-                $total_theoretical += $gen_theoretical;
97
-                $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical);
98
-                $gen_equiv += $perc_sosa_count_theor;
99
-                $missing=2*$prev_known - $tab['sosaCount'];
100
-                $gen_diff=$tab['diffSosaTotalCount']-$prev_diff;
91
+			foreach($stats_gen as $gen => $tab){
92
+				$genY1= I18N::translate('-');
93
+				$genY2= I18N::translate('-');
94
+				if($tab['firstBirth']>0) $genY1=$tab['firstBirth'];
95
+				if($tab['lastBirth']>0) $genY2=$tab['lastBirth'];
96
+				$total_theoretical += $gen_theoretical;
97
+				$perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical);
98
+				$gen_equiv += $perc_sosa_count_theor;
99
+				$missing=2*$prev_known - $tab['sosaCount'];
100
+				$gen_diff=$tab['diffSosaTotalCount']-$prev_diff;
101 101
                 
102
-                $generation_stats[$gen] = array(
103
-                    'gen_min_birth' => $genY1,
104
-                    'gen_max_birth' => $genY2,
105
-                    'theoretical' => $gen_theoretical,
106
-                    'known' => $tab['sosaCount'],
107
-                    'perc_known' => $perc_sosa_count_theor,
108
-                    'missing' => $missing,
109
-                    'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known),
110
-                    'total_known' => $tab['sosaTotalCount'],
111
-                    'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical),
112
-                    'different' => $gen_diff,
113
-                    'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']),
114
-                    'total_different' => $tab['diffSosaTotalCount'],
115
-                    'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount'])
116
-                );
102
+				$generation_stats[$gen] = array(
103
+					'gen_min_birth' => $genY1,
104
+					'gen_max_birth' => $genY2,
105
+					'theoretical' => $gen_theoretical,
106
+					'known' => $tab['sosaCount'],
107
+					'perc_known' => $perc_sosa_count_theor,
108
+					'missing' => $missing,
109
+					'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known),
110
+					'total_known' => $tab['sosaTotalCount'],
111
+					'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical),
112
+					'different' => $gen_diff,
113
+					'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']),
114
+					'total_different' => $tab['diffSosaTotalCount'],
115
+					'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount'])
116
+				);
117 117
                 
118
-                $gen_theoretical = $gen_theoretical * 2;
119
-                $prev_known=$tab['sosaCount'];
120
-                $prev_diff=$tab['diffSosaTotalCount'];
121
-            }
118
+				$gen_theoretical = $gen_theoretical * 2;
119
+				$prev_known=$tab['sosaCount'];
120
+				$prev_diff=$tab['diffSosaTotalCount'];
121
+			}
122 122
             
123
-            $view_bag->set('generation_stats', $generation_stats);
124
-            $view_bag->set('equivalent_gen', $gen_equiv);
123
+			$view_bag->set('generation_stats', $generation_stats);
124
+			$view_bag->set('equivalent_gen', $gen_equiv);
125 125
                         
126
-            $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2());
127
-            $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3());
126
+			$view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2());
127
+			$view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3());
128 128
             
129
-        }
129
+		}
130 130
         
131
-        ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render();   
132
-    }
131
+		ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render();   
132
+	}
133 133
     
134
-    /**
135
-     * Returns HTML code for a graph showing the dispersion of ancestors across father & mother
136
-     * @return string HTML code
137
-     */
138
-     private function htmlAncestorDispersionG2()
139
-    {
140
-        $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2);
141
-        if(count($ancestorsDispGen2) == 0) return;
134
+	/**
135
+	 * Returns HTML code for a graph showing the dispersion of ancestors across father & mother
136
+	 * @return string HTML code
137
+	 */
138
+	 private function htmlAncestorDispersionG2()
139
+	{
140
+		$ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2);
141
+		if(count($ancestorsDispGen2) == 0) return;
142 142
         
143
-        $size = '600x300';
143
+		$size = '600x300';
144 144
         
145
-        $total = array_sum($ancestorsDispGen2);
146
-        $father_count = isset($ancestorsDispGen2[1]) ? $ancestorsDispGen2[1] : 0;
147
-        $father = array (
148
-            'color' => '84beff', 
149
-            'count' => $father_count, 
150
-            'perc' => Functions::safeDivision($father_count, $total), 
151
-            'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat')            
152
-        );
153
-        $mother_count = isset($ancestorsDispGen2[2]) ? $ancestorsDispGen2[2] : 0;
154
-        $mother = array (
155
-            'color' => 'ffd1dc', 
156
-            'count' => $mother_count, 
157
-            'perc' => Functions::safeDivision($mother_count, $total),
158
-            'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot')
159
-        );
160
-        $shared_count = isset($ancestorsDispGen2[-1]) ? $ancestorsDispGen2[-1] : 0;
161
-        $shared = array (
162
-            'color' => '777777', 
163
-            'count' => $shared_count, 
164
-            'perc' => Functions::safeDivision($shared_count, $total),
165
-            'name' => I18N::translate('Shared')
166
-        );
145
+		$total = array_sum($ancestorsDispGen2);
146
+		$father_count = isset($ancestorsDispGen2[1]) ? $ancestorsDispGen2[1] : 0;
147
+		$father = array (
148
+			'color' => '84beff', 
149
+			'count' => $father_count, 
150
+			'perc' => Functions::safeDivision($father_count, $total), 
151
+			'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat')            
152
+		);
153
+		$mother_count = isset($ancestorsDispGen2[2]) ? $ancestorsDispGen2[2] : 0;
154
+		$mother = array (
155
+			'color' => 'ffd1dc', 
156
+			'count' => $mother_count, 
157
+			'perc' => Functions::safeDivision($mother_count, $total),
158
+			'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot')
159
+		);
160
+		$shared_count = isset($ancestorsDispGen2[-1]) ? $ancestorsDispGen2[-1] : 0;
161
+		$shared = array (
162
+			'color' => '777777', 
163
+			'count' => $shared_count, 
164
+			'perc' => Functions::safeDivision($shared_count, $total),
165
+			'name' => I18N::translate('Shared')
166
+		);
167 167
         
168
-        $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc']));
169
-        $chart_title = I18N::translate('Known Sosa ancestors\' dispersion');
170
-        $chl = 
171
-             $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' .
172
-             $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' .
173
-             $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1);
174
-        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 . "\" />";
175
-    }
168
+		$chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc']));
169
+		$chart_title = I18N::translate('Known Sosa ancestors\' dispersion');
170
+		$chl = 
171
+			 $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' .
172
+			 $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' .
173
+			 $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1);
174
+		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 . "\" />";
175
+	}
176 176
     
177
-    /**
178
-     * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents
179
-     * @return string HTML code
180
-     */
181
-    private function htmlAncestorDispersionG3()
182
-    {
183
-        $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3);
177
+	/**
178
+	 * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents
179
+	 * @return string HTML code
180
+	 */
181
+	private function htmlAncestorDispersionG3()
182
+	{
183
+		$ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3);
184 184
         
185
-        $size = '700x300';
185
+		$size = '700x300';
186 186
         
187
-        $color_motmot = 'ffd1dc';
188
-        $color_motfat = 'b998a0';
189
-        $color_fatfat = '577292';
190
-        $color_fatmot = '84beff';
191
-        $color_shared = '777777';
187
+		$color_motmot = 'ffd1dc';
188
+		$color_motfat = 'b998a0';
189
+		$color_fatfat = '577292';
190
+		$color_fatmot = '84beff';
191
+		$color_shared = '777777';
192 192
     
193
-        $total_fatfat = $ancestorsDispGen2[1] ?: 0;
194
-        $total_fatmot = $ancestorsDispGen2[2] ?: 0;
195
-        $total_motfat = $ancestorsDispGen2[4] ?: 0;
196
-        $total_motmot = $ancestorsDispGen2[8] ?: 0;
197
-        $total_sha = $ancestorsDispGen2[-1] ?: 0;
198
-        $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha;
193
+		$total_fatfat = $ancestorsDispGen2[1] ?: 0;
194
+		$total_fatmot = $ancestorsDispGen2[2] ?: 0;
195
+		$total_motfat = $ancestorsDispGen2[4] ?: 0;
196
+		$total_motmot = $ancestorsDispGen2[8] ?: 0;
197
+		$total_sha = $ancestorsDispGen2[-1] ?: 0;
198
+		$total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha;
199 199
     
200
-        $chd = $this->arrayToExtendedEncoding(array(
201
-            4095 * $total_fatfat / $total, 
202
-            4095 * $total_fatmot / $total,
203
-            4095 * $total_sha / $total, 
204
-            4095 * $total_motfat / $total,
205
-            4095 * $total_motmot / $total            
206
-        ));
207
-        $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3');
208
-        $chl =
209
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' .
210
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' .
211
-            I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' .
212
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' .
213
-            \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
214
-         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 . "\" />";
215
-    }
200
+		$chd = $this->arrayToExtendedEncoding(array(
201
+			4095 * $total_fatfat / $total, 
202
+			4095 * $total_fatmot / $total,
203
+			4095 * $total_sha / $total, 
204
+			4095 * $total_motfat / $total,
205
+			4095 * $total_motmot / $total            
206
+		));
207
+		$chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3');
208
+		$chl =
209
+			\Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' .
210
+			\Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' .
211
+			I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' .
212
+			\Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' .
213
+			\Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
214
+		 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 . "\" />";
215
+	}
216 216
 
217
-    /**
218
-     * Convert an array to Google Chart encoding
219
-     * @param arrat $a Array to encode
220
-     * @return string
221
-     */
222
-    private function arrayToExtendedEncoding($a) {
223
-        $xencoding = WT_GOOGLE_CHART_ENCODING;
217
+	/**
218
+	 * Convert an array to Google Chart encoding
219
+	 * @param arrat $a Array to encode
220
+	 * @return string
221
+	 */
222
+	private function arrayToExtendedEncoding($a) {
223
+		$xencoding = WT_GOOGLE_CHART_ENCODING;
224 224
     
225
-        $encoding = '';
226
-        foreach ($a as $value) {
227
-            if ($value < 0) {
228
-                $value = 0;
229
-            }
230
-            $first  = (int) ($value / 64);
231
-            $second = $value % 64;
232
-            $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second];
233
-        }
225
+		$encoding = '';
226
+		foreach ($a as $value) {
227
+			if ($value < 0) {
228
+				$value = 0;
229
+			}
230
+			$first  = (int) ($value / 64);
231
+			$second = $value % 64;
232
+			$encoding .= $xencoding[(int) $first] . $xencoding[(int) $second];
233
+		}
234 234
     
235
-        return $encoding;
236
-    }
235
+		return $encoding;
236
+	}
237 237
     
238 238
     
239 239
 }
240 240
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -35,59 +35,59 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class AdminConfigController extends MvcController
37 37
 {    
38
-    /**
39
-     * GeoAnalysis Provider
40
-     * @var GeoAnalysisProvider $provider
41
-     */
42
-    protected $provider;    
38
+	/**
39
+	 * GeoAnalysis Provider
40
+	 * @var GeoAnalysisProvider $provider
41
+	 */
42
+	protected $provider;    
43 43
     
44
-    /**
45
-     * Constructor for Admin Config controller
46
-     * @param AbstractModule $module
47
-     */
48
-    public function __construct(AbstractModule $module) {
49
-        parent::__construct($module);
44
+	/**
45
+	 * Constructor for Admin Config controller
46
+	 * @param AbstractModule $module
47
+	 */
48
+	public function __construct(AbstractModule $module) {
49
+		parent::__construct($module);
50 50
         
51
-        $this->provider = $this->module->getProvider();
52
-    }    
51
+		$this->provider = $this->module->getProvider();
52
+	}    
53 53
     
54
-    /**
55
-     * Pages
56
-     */
54
+	/**
55
+	 * Pages
56
+	 */
57 57
         
58
-    /**
59
-     * AdminConfig@index
60
-     */
61
-    public function index() {
62
-        global $WT_TREE;
58
+	/**
59
+	 * AdminConfig@index
60
+	 */
61
+	public function index() {
62
+		global $WT_TREE;
63 63
         
64
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);
65
-        $controller = new PageController();
66
-        $controller
67
-            ->restrictAccess(Auth::isManager($WT_TREE))
68
-            ->setPageTitle($this->module->getTitle());
64
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);
65
+		$controller = new PageController();
66
+		$controller
67
+			->restrictAccess(Auth::isManager($WT_TREE))
68
+			->setPageTitle($this->module->getTitle());
69 69
         
70
-        $data = new ViewBag();
71
-        $data->set('title', $controller->getPageTitle());
72
-        $data->set('tree', $WT_TREE);
70
+		$data = new ViewBag();
71
+		$data->set('title', $controller->getPageTitle());
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();
77
-        $data->set('table_id', $table_id);
76
+		$table_id = 'table-geoanalysis-' . Uuid::uuid4();
77
+		$data->set('table_id', $table_id);
78 78
         
79
-        $other_trees = array();
80
-        foreach (Tree::getAll() as $tree) {
81
-            if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree;
82
-        }      
83
-        $data->set('other_trees', $other_trees);
79
+		$other_trees = array();
80
+		foreach (Tree::getAll() as $tree) {
81
+			if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree;
82
+		}      
83
+		$data->set('other_trees', $other_trees);
84 84
         
85
-        $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
85
+		$data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
86 86
         
87
-        $controller
88
-            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
89
-            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
90
-            ->addInlineJavascript('
87
+		$controller
88
+			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
89
+			->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
90
+			->addInlineJavascript('
91 91
                 //Datatable initialisation
92 92
 				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
93 93
 				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				});
123 123
                 
124 124
                 ')
125
-                ->addInlineJavascript('				
125
+				->addInlineJavascript('				
126 126
                     function set_geoanalysis_status(ga_id, status, gedcom) {
127 127
                 		jQuery.ajax({
128 128
                             url: "module.php", 
@@ -166,55 +166,55 @@  discard block
 block discarded – undo
166 166
                 ');
167 167
         
168 168
         
169
-        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
170
-    }
169
+		ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
170
+	}
171 171
 
172
-    /**
173
-     * AdminConfig@jsonGeoAnalysisList
174
-     */
175
-    public function jsonGeoAnalysisList() {
176
-        global $WT_TREE;
172
+	/**
173
+	 * AdminConfig@jsonGeoAnalysisList
174
+	 */
175
+	public function jsonGeoAnalysisList() {
176
+		global $WT_TREE;
177 177
         
178
-        $controller = new JsonController();
179
-        $controller
180
-            ->restrictAccess(Auth::isManager($WT_TREE));
178
+		$controller = new JsonController();
179
+		$controller
180
+			->restrictAccess(Auth::isManager($WT_TREE));
181 181
         
182
-        // Generate an AJAX/JSON response for datatables to load a block of rows
183
-        $search = Filter::postArray('search');
184
-        if($search) $search = $search['value'];
185
-        $start  = Filter::postInteger('start');
186
-        $length = Filter::postInteger('length');
187
-        $order  = Filter::postArray('order');
182
+		// Generate an AJAX/JSON response for datatables to load a block of rows
183
+		$search = Filter::postArray('search');
184
+		if($search) $search = $search['value'];
185
+		$start  = Filter::postInteger('start');
186
+		$length = Filter::postInteger('length');
187
+		$order  = Filter::postArray('order');
188 188
         
189
-        foreach($order as $key => &$value) {
190
-            switch($value['column']) {
191
-                case 3:
192
-                    $value['column'] = 'majgd_descr';
193
-                    break;
194
-                case 5;
195
-                    $value['column'] = 'majgd_sublevel';
196
-                    break;
197
-                default:
198
-                    unset($order[$key]);
199
-            }
200
-        }
189
+		foreach($order as $key => &$value) {
190
+			switch($value['column']) {
191
+				case 3:
192
+					$value['column'] = 'majgd_descr';
193
+					break;
194
+				case 5;
195
+					$value['column'] = 'majgd_sublevel';
196
+					break;
197
+				default:
198
+					unset($order[$key]);
199
+			}
200
+		}
201 201
         
202
-        /** @var GeoAnalysisProvider $provider */
203
-        $provider = $this->module->getProvider();
202
+		/** @var GeoAnalysisProvider $provider */
203
+		$provider = $this->module->getProvider();
204 204
         
205
-        $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length);
206
-        $recordsFiltered = count($list);
207
-        $recordsTotal = $this->provider->getGeoAnalysisCount();
205
+		$list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length);
206
+		$recordsFiltered = count($list);
207
+		$recordsTotal = $this->provider->getGeoAnalysisCount();
208 208
         
209
-        $data = array();
210
-        $place_hierarchy = $this->provider->getPlacesHierarchy();
211
-        foreach($list as $ga) {
212
-            /** @var GeoAnalysis $ga */
209
+		$data = array();
210
+		$place_hierarchy = $this->provider->getPlacesHierarchy();
211
+		foreach($list as $ga) {
212
+			/** @var GeoAnalysis $ga */
213 213
             
214
-            $datum = array();
215
-            $options= $ga->getOptions();
214
+			$datum = array();
215
+			$options= $ga->getOptions();
216 216
             
217
-            $datum[0] = '
217
+			$datum[0] = '
218 218
                 <div class="btn-group">
219 219
                     <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
220 220
                         <i class="fa fa-pencil"></i><span class="caret"></span>
@@ -238,108 +238,108 @@  discard block
 block discarded – undo
238 238
                        </li>
239 239
                     </ul>
240 240
                 </div>';
241
-		    $datum[1] = $ga->getId();
242
-		    $datum[2] = $ga->isEnabled() ? 
241
+			$datum[1] = $ga->getId();
242
+			$datum[2] = $ga->isEnabled() ? 
243 243
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
244 244
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
245
-		    $datum[3] = $ga->getTitle();
246
-		    $analysis_level = $ga->getAnalysisLevel();
247
-		    if($place_hierarchy['type'] == 'header') {
248
-		        $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
249
-		    } else {
250
-		        $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
251
-		    }
252
-		    $datum[5] = $ga->getAnalysisLevel();
253
-		    $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
254
-		    $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
255
-		    if($ga->hasMap()) {
256
-		        $datum[6] = $options->getMap()->getDescription();
257
-		        $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
258
-		        $top_level = $options->getMapLevel();
259
-		        if($place_hierarchy['type'] == 'header') {
260
-		            $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
261
-		        } else {
262
-		            $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
263
-		        }
264
-		        $datum[7] .= '</span>';
265
-		    }
266
-		    $datum[8] = $options->isUsingFlags() ? 
245
+			$datum[3] = $ga->getTitle();
246
+			$analysis_level = $ga->getAnalysisLevel();
247
+			if($place_hierarchy['type'] == 'header') {
248
+				$datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
249
+			} else {
250
+				$datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
251
+			}
252
+			$datum[5] = $ga->getAnalysisLevel();
253
+			$datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
254
+			$datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
255
+			if($ga->hasMap()) {
256
+				$datum[6] = $options->getMap()->getDescription();
257
+				$datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
258
+				$top_level = $options->getMapLevel();
259
+				if($place_hierarchy['type'] == 'header') {
260
+					$datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
261
+				} else {
262
+					$datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
263
+				}
264
+				$datum[7] .= '</span>';
265
+			}
266
+			$datum[8] = $options->isUsingFlags() ? 
267 267
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
268 268
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
269
-		    $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
269
+			$datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
270 270
 		    
271
-		    $data[] = $datum;
272
-        }
271
+			$data[] = $datum;
272
+		}
273 273
         
274
-        $controller->pageHeader();
274
+		$controller->pageHeader();
275 275
         
276
-        echo \Zend_Json::encode(array(
277
-            'draw'            => Filter::getInteger('draw'),
278
-            'recordsTotal'    => $recordsTotal,
279
-            'recordsFiltered' => $recordsFiltered,
280
-            'data'            => $data
281
-        ));
276
+		echo \Zend_Json::encode(array(
277
+			'draw'            => Filter::getInteger('draw'),
278
+			'recordsTotal'    => $recordsTotal,
279
+			'recordsFiltered' => $recordsFiltered,
280
+			'data'            => $data
281
+		));
282 282
         
283
-    }
283
+	}
284 284
 
285
-    /**
286
-     * AdminConfig@edit
287
-     */
288
-    public function edit() {
289
-        $ga_id = Filter::getInteger('ga_id');
290
-        $ga = $this->provider->getGeoAnalysis($ga_id, false);
285
+	/**
286
+	 * AdminConfig@edit
287
+	 */
288
+	public function edit() {
289
+		$ga_id = Filter::getInteger('ga_id');
290
+		$ga = $this->provider->getGeoAnalysis($ga_id, false);
291 291
         
292
-        $this->renderEdit($ga);
293
-    }
292
+		$this->renderEdit($ga);
293
+	}
294 294
     
295
-    /**
296
-     * AdminConfig@add
297
-     */
298
-    public function add() {
299
-        $this->renderEdit(null);
300
-    }
295
+	/**
296
+	 * AdminConfig@add
297
+	 */
298
+	public function add() {
299
+		$this->renderEdit(null);
300
+	}
301 301
     
302
-    /**
303
-     * AdminConfig@save
304
-     */
305
-    public function save() {
306
-        global $WT_TREE;
302
+	/**
303
+	 * AdminConfig@save
304
+	 */
305
+	public function save() {
306
+		global $WT_TREE;
307 307
         
308
-        $tmp_contrl = new PageController();
309
-        $tmp_contrl->restrictAccess(
310
-            Auth::isManager($WT_TREE) 
311
-            && Filter::checkCsrf()
312
-         );
308
+		$tmp_contrl = new PageController();
309
+		$tmp_contrl->restrictAccess(
310
+			Auth::isManager($WT_TREE) 
311
+			&& Filter::checkCsrf()
312
+		 );
313 313
         
314
-        $ga_id          = Filter::postInteger('ga_id');
315
-        $description    = Filter::post('description');
316
-        $analysislevel  = Filter::postInteger('analysislevel');
317
-        $use_map        = Filter::postBool('use_map');
318
-        if($use_map) {
319
-            $map_file   = base64_decode(Filter::post('map_file'));
320
-            $map_top_level   = Filter::postInteger('map_top_level');
321
-        }
322
-        $use_flags      = Filter::postBool('use_flags');
323
-        $gen_details    = Filter::postInteger('gen_details');
314
+		$ga_id          = Filter::postInteger('ga_id');
315
+		$description    = Filter::post('description');
316
+		$analysislevel  = Filter::postInteger('analysislevel');
317
+		$use_map        = Filter::postBool('use_map');
318
+		if($use_map) {
319
+			$map_file   = base64_decode(Filter::post('map_file'));
320
+			$map_top_level   = Filter::postInteger('map_top_level');
321
+		}
322
+		$use_flags      = Filter::postBool('use_flags');
323
+		$gen_details    = Filter::postInteger('gen_details');
324 324
         
325
-        $success = false; 
326
-        if($ga_id) {
327
-            $ga = $this->provider->getGeoAnalysis($ga_id, false);
328
-            if($ga) {
329
-                $ga->setTitle($description);
330
-                $ga->setAnalysisLevel($analysislevel + 1);
331
-                $options = $ga->getOptions();
332
-                if($options) {
333
-                    $options->setIsUsingFlags($use_flags);
334
-                    $options->setMaxDetailsInGen($gen_details);
335
-                    if($use_map) {
336
-                        $options->setMap(new OutlineMap($map_file));
337
-                        $options->setMapLevel($map_top_level + 1);
338
-                    }
339
-                    else {
340
-                        $options->setMap(null);
341
-                    }
342
-                }
325
+		$success = false; 
326
+		if($ga_id) {
327
+			$ga = $this->provider->getGeoAnalysis($ga_id, false);
328
+			if($ga) {
329
+				$ga->setTitle($description);
330
+				$ga->setAnalysisLevel($analysislevel + 1);
331
+				$options = $ga->getOptions();
332
+				if($options) {
333
+					$options->setIsUsingFlags($use_flags);
334
+					$options->setMaxDetailsInGen($gen_details);
335
+					if($use_map) {
336
+						$options->setMap(new OutlineMap($map_file));
337
+						$options->setMapLevel($map_top_level + 1);
338
+					}
339
+					else {
340
+						$options->setMap(null);
341
+					}
342
+				}
343 343
 				
344 344
 				$res = $this->provider->updateGeoAnalysis($ga);
345 345
 				if($res) {
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
353 353
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
354 354
 				}
355
-            }
356
-        } else {
355
+			}
356
+		} else {
357 357
 			$ga = $this->provider->createGeoAnalysis(
358 358
 				$description,
359 359
 				$analysislevel + 1,
@@ -371,34 +371,34 @@  discard block
 block discarded – undo
371 371
 				FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger');
372 372
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.');
373 373
 			}
374
-        }
374
+		}
375 375
         
376
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl();
377
-        if(!$success) {			
378
-            if($ga) {
379
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl();
380
-            }
381
-            else {
382
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl();
383
-            }
384
-        }        
385
-        header('Location: ' . WT_BASE_URL . $redirection_url);
376
+		$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl();
377
+		if(!$success) {			
378
+			if($ga) {
379
+				$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl();
380
+			}
381
+			else {
382
+				$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl();
383
+			}
384
+		}        
385
+		header('Location: ' . WT_BASE_URL . $redirection_url);
386 386
         
387
-    }
387
+	}
388 388
      
389 389
 	/**
390 390
 	 * Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one.
391 391
 	 * 
392 392
 	 * @param (GeoAnalysis!null) $ga GeoAnalysis to edit
393 393
 	 */
394
-    protected function renderEdit(GeoAnalysis $ga = null) {
395
-        global $WT_TREE;
394
+	protected function renderEdit(GeoAnalysis $ga = null) {
395
+		global $WT_TREE;
396 396
         
397
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);
398
-        $controller = new PageController();        
399
-        $controller
400
-            ->restrictAccess(Auth::isManager($WT_TREE))
401
-            ->addInlineJavascript('
397
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);
398
+		$controller = new PageController();        
399
+		$controller
400
+			->restrictAccess(Auth::isManager($WT_TREE))
401
+			->addInlineJavascript('
402 402
                 function toggleMapOptions() {
403 403
                     if($("input:radio[name=\'use_map\']:checked").val() == 1) {
404 404
                         $("#map_options").show();
@@ -412,34 +412,34 @@  discard block
 block discarded – undo
412 412
                 toggleMapOptions();
413 413
             ');
414 414
         
415
-        $data = new ViewBag();
416
-        if($ga) {
417
-            $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
418
-            $data->set('geo_analysis', $ga);
419
-        } else {
420
-            $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis'));
421
-        }
415
+		$data = new ViewBag();
416
+		if($ga) {
417
+			$controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
418
+			$data->set('geo_analysis', $ga);
419
+		} else {
420
+			$controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis'));
421
+		}
422 422
         
423
-        $data->set('title', $controller->getPageTitle());
424
-        $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
425
-        $data->set('module_title', $this->module->getTitle());
426
-        $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl());
427
-        $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
423
+		$data->set('title', $controller->getPageTitle());
424
+		$data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
425
+		$data->set('module_title', $this->module->getTitle());
426
+		$data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl());
427
+		$data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
428 428
     
429
-        $map_list = array_map(
430
-            function(OutlineMap $map) {
431
-                return $map->getDescription();
432
-            },
433
-            $this->provider->getOutlineMapsList()
434
-            );
435
-        asort($map_list);
436
-        $data->set('map_list', $map_list);
429
+		$map_list = array_map(
430
+			function(OutlineMap $map) {
431
+				return $map->getDescription();
432
+			},
433
+			$this->provider->getOutlineMapsList()
434
+			);
435
+		asort($map_list);
436
+		$data->set('map_list', $map_list);
437 437
     
438
-        $gen_details = array(0 => I18N::translate('All'));
439
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
440
-        $data->set('generation_details', $gen_details);
438
+		$gen_details = array(0 => I18N::translate('All'));
439
+		for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
440
+		$data->set('generation_details', $gen_details);
441 441
     
442
-        ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
443
-    }
442
+		ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
443
+	}
444 444
     
445 445
 }
446 446
\ No newline at end of file
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 = explode (',', $place->getGedcomName());
28
+		if (!$place->isEmpty()) {
29
+			$parent = 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 SQL_CACHE 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/HookInterfaces/RecordNameTextExtenderInterface.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook;
12 12
 
13 13
 use \Fisharebest\Webtrees as fw;
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/FactSourceTextExtenderInterface.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook;
12 12
 
13 13
 use \Fisharebest\Webtrees as fw;
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/IndividualHeaderExtenderInterface.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook;
12 12
 
13 13
 use \Fisharebest\Webtrees as fw;
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookProvider.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @return Hook
39 39
 	 */
40 40
 	public static function get($hook_function, $hook_context = null) {
41
-	    return new Hook($hook_function, $hook_context);
41
+		return new Hook($hook_function, $hook_context);
42 42
 	}
43 43
 	
44 44
 	/**
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 	static public function getPossibleHooks() {
64 64
 		static $hooks=null;
65 65
 		if ($hooks === null) {
66
-		    $hooks = array();
67
-		    foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
68
-		        try {
69
-		            $module = include $file;
70
-		            if($module instanceof HookSubscriberInterface){
66
+			$hooks = array();
67
+			foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
68
+				try {
69
+					$module = include $file;
70
+					if($module instanceof HookSubscriberInterface){
71 71
 						$subscribedhooks = $module->getSubscribedHooks();
72 72
 						if(is_array($subscribedhooks)){
73 73
 							foreach($subscribedhooks as $key => $value){
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 							}
94 94
 						}
95 95
 					}
96
-    			} catch (\Exception $ex) {
97
-    				// Old or invalid module?
98
-    			}
96
+				} catch (\Exception $ex) {
97
+					// Old or invalid module?
98
+				}
99 99
 			}
100 100
 		}
101 101
 		return $hooks;
@@ -138,33 +138,33 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	static public function updateHooks() {
140 140
 	    
141
-	    if(Auth::isAdmin()){
142
-	        $ihooks = self::getInstalledHooks();
143
-	        $phooks = self::getPossibleHooks();
141
+		if(Auth::isAdmin()){
142
+			$ihooks = self::getInstalledHooks();
143
+			$phooks = self::getPossibleHooks();
144 144
 	        	
145
-	        // Insert hooks not existing yet in the DB
146
-	        if($phooks !== null){
147
-	            foreach($phooks as $phook => $priority){
148
-	                $array_hook = explode('#', $phook);
149
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
150
-	                    $chook = new Hook($array_hook[1], $array_hook[2]);
151
-	                    $chook->subscribe($array_hook[0]);
152
-	                    $chook->setPriority($array_hook[0], $priority);
153
-	                }
154
-	            }
155
-	        }
145
+			// Insert hooks not existing yet in the DB
146
+			if($phooks !== null){
147
+				foreach($phooks as $phook => $priority){
148
+					$array_hook = explode('#', $phook);
149
+					if($ihooks === null || !array_key_exists($phook, $ihooks)){
150
+						$chook = new Hook($array_hook[1], $array_hook[2]);
151
+						$chook->subscribe($array_hook[0]);
152
+						$chook->setPriority($array_hook[0], $priority);
153
+					}
154
+				}
155
+			}
156 156
 	        	
157
-	        //Remove hooks not existing any more in the file system
158
-	        if($ihooks !== null){
159
-	            foreach($ihooks as $ihook => $status){
160
-	                $array_hook = explode('#', $ihook);
161
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
162
-	                    $chook = new Hook($array_hook[1], $array_hook[2]);
163
-	                    $chook->remove($array_hook[0]);
164
-	                }
165
-	            }
166
-	        }
167
-	    }
157
+			//Remove hooks not existing any more in the file system
158
+			if($ihooks !== null){
159
+				foreach($ihooks as $ihook => $status){
160
+					$array_hook = explode('#', $ihook);
161
+					if($phooks === null || !array_key_exists($ihook, $phooks)){
162
+						$chook = new Hook($array_hook[1], $array_hook[2]);
163
+						$chook->remove($array_hook[0]);
164
+					}
165
+				}
166
+			}
167
+		}
168 168
 	}
169 169
 	
170 170
 }
171 171
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -61,34 +61,34 @@  discard block
 block discarded – undo
61 61
 	 * @return Array List of possible hooks, with the priority
62 62
 	 */
63 63
 	static public function getPossibleHooks() {
64
-		static $hooks=null;
64
+		static $hooks = null;
65 65
 		if ($hooks === null) {
66 66
 		    $hooks = array();
67
-		    foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
67
+		    foreach (glob(WT_ROOT.WT_MODULES_DIR.'*/module.php') as $file) {
68 68
 		        try {
69 69
 		            $module = include $file;
70
-		            if($module instanceof HookSubscriberInterface){
70
+		            if ($module instanceof HookSubscriberInterface) {
71 71
 						$subscribedhooks = $module->getSubscribedHooks();
72
-						if(is_array($subscribedhooks)){
73
-							foreach($subscribedhooks as $key => $value){
74
-								if(is_int($key)) {
72
+						if (is_array($subscribedhooks)) {
73
+							foreach ($subscribedhooks as $key => $value) {
74
+								if (is_int($key)) {
75 75
 									$hook_item = $value;
76 76
 									$priority = self::DEFAULT_PRIORITY;
77 77
 								}
78
-								else{
78
+								else {
79 79
 									$hook_item = explode('#', $key, 2);
80 80
 									$priority = $value;
81 81
 								}
82
-								if($hook_item && count($hook_item) == 2){
82
+								if ($hook_item && count($hook_item) == 2) {
83 83
 									$hook_func = $hook_item[0];
84 84
 									$hook_cont = $hook_item[1];
85 85
 								}
86
-								else{
86
+								else {
87 87
 									$hook_func = $hook_item[0];
88 88
 									$hook_cont = 'all';
89 89
 								}
90
-								if(method_exists($module, $hook_func)){
91
-									$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority;
90
+								if (method_exists($module, $hook_func)) {
91
+									$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority;
92 92
 								}
93 93
 							}
94 94
 						}
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return array List of installed hooks
108 108
 	 */
109
-	static public function getRawInstalledHooks(){
110
-		if(self::isModuleOperational()){
109
+	static public function getRawInstalledHooks() {
110
+		if (self::isModuleOperational()) {
111 111
 			return fw\Database::prepare(
112 112
 					"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".
113 113
 					" FROM `##maj_hooks`".
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return Array List of installed hooks, with id, status and priority
124 124
 	 */
125
-	static public function getInstalledHooks(){
126
-		static $installedhooks =null;
127
-		if($installedhooks===null){
128
-			$dbhooks=self::getRawInstalledHooks();
129
-			foreach($dbhooks as $dbhook){
125
+	static public function getInstalledHooks() {
126
+		static $installedhooks = null;
127
+		if ($installedhooks === null) {
128
+			$dbhooks = self::getRawInstalledHooks();
129
+			foreach ($dbhooks as $dbhook) {
130 130
 				$installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority);
131 131
 			}
132 132
 		}
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	static public function updateHooks() {
140 140
 	    
141
-	    if(Auth::isAdmin()){
141
+	    if (Auth::isAdmin()) {
142 142
 	        $ihooks = self::getInstalledHooks();
143 143
 	        $phooks = self::getPossibleHooks();
144 144
 	        	
145 145
 	        // Insert hooks not existing yet in the DB
146
-	        if($phooks !== null){
147
-	            foreach($phooks as $phook => $priority){
146
+	        if ($phooks !== null) {
147
+	            foreach ($phooks as $phook => $priority) {
148 148
 	                $array_hook = explode('#', $phook);
149
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
149
+	                if ($ihooks === null || !array_key_exists($phook, $ihooks)) {
150 150
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
151 151
 	                    $chook->subscribe($array_hook[0]);
152 152
 	                    $chook->setPriority($array_hook[0], $priority);
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	        }
156 156
 	        	
157 157
 	        //Remove hooks not existing any more in the file system
158
-	        if($ihooks !== null){
159
-	            foreach($ihooks as $ihook => $status){
158
+	        if ($ihooks !== null) {
159
+	            foreach ($ihooks as $ihook => $status) {
160 160
 	                $array_hook = explode('#', $ihook);
161
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
161
+	                if ($phooks === null || !array_key_exists($ihook, $phooks)) {
162 162
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
163 163
 	                    $chook->remove($array_hook[0]);
164 164
 	                }
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 1 patch
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -116,16 +116,18 @@  discard block
 block discarded – undo
116 116
 		$len_chars = count($chars);
117 117
 		$token = '';
118 118
 		
119
-		for ($i = 0; $i < $length; $i++)
120
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
119
+		for ($i = 0; $i < $length; $i++) {
120
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
121
+		}
121 122
 		
122 123
 		# Number of 32 char chunks
123 124
 		$chunks = ceil( strlen($token) / 32 );
124 125
 		$md5token = '';
125 126
 		
126 127
 		# Run each chunk through md5
127
-		for ( $i=1; $i<=$chunks; $i++ )
128
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
128
+		for ( $i=1; $i<=$chunks; $i++ ) {
129
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
130
+		}
129 131
 		
130 132
 			# Trim the token
131 133
 		return substr($md5token, 0, $length);		
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
 	 */
141 143
 	public static function encryptToSafeBase64($data){
142 144
 		$key = 'STANDARDKEYIFNOSERVER';
143
-		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE'])
144
-			$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
145
+		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) {
146
+					$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
147
+		}
145 148
 		$iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND);
146 149
 		$id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv);
147 150
 		$encrypted = base64_encode($iv.$id);
@@ -160,16 +163,19 @@  discard block
 block discarded – undo
160 163
 	 */
161 164
 	public static function decryptFromSafeBase64($encrypted){
162 165
 		$key = 'STANDARDKEYIFNOSERVER';
163
-		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE'])
164
-			$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
166
+		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) {
167
+					$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
168
+		}
165 169
 		$encrypted = str_replace('-', '+', $encrypted);
166 170
 		$encrypted = str_replace('_', '/', $encrypted);
167 171
 		$encrypted = str_replace('*', '=', $encrypted);
168 172
 		$encrypted = base64_decode($encrypted);
169
-		if(!$encrypted)
170
-			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
171
-		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) 
172
-			throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
173
+		if(!$encrypted) {
174
+					throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
175
+		}
176
+		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) {
177
+					throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
178
+		}
173 179
 		$iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE);
174 180
 		$encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE);
175 181
 		$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec);
@@ -210,7 +216,9 @@  discard block
 block discarded – undo
210 216
 	 * @return boolean True if path valid
211 217
 	 */
212 218
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
213
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
219
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
220
+			return true;
221
+		}
214 222
 		return false;
215 223
 	}
216 224
 	
Please login to merge, or discard this patch.
src/Webtrees/Functions/FunctionsPrint.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return string List of elements
33 33
 	 */
34 34
 	static public function getListFromArray(array $array) {
35
-		$n=count($array);
35
+		$n = count($array);
36 36
 		switch ($n) {
37 37
 			case 0:
38 38
 				return '';
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				return implode(
43 43
 						/* I18N: list separator */ I18N::translate(', '), 
44
-						array_slice($array, 0, $n-1)
45
-					) .
46
-					/* I18N: last list separator, " and " in English, " et " in French  */ I18N::translate(' and ') . 
47
-					$array[$n-1];
44
+						array_slice($array, 0, $n - 1)
45
+					).
46
+					/* I18N: last list separator, " and " in English, " et " in French  */ I18N::translate(' and '). 
47
+					$array[$n - 1];
48 48
 		}
49 49
 	}
50 50
 
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 			\Fisharebest\Webtrees\Fact $fact,
60 60
 			\MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider
61 61
 	) {
62
-		$html='';
63
-		if($place = $fact->getPlace()) {
64
-			$iconPlace= $mapProvider->getPlaceIcon($place);	
65
-			if($iconPlace && strlen($iconPlace) > 0){
66
-				$html.=	'<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>';
62
+		$html = '';
63
+		if ($place = $fact->getPlace()) {
64
+			$iconPlace = $mapProvider->getPlaceIcon($place);	
65
+			if ($iconPlace && strlen($iconPlace) > 0) {
66
+				$html .= '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>';
67 67
 			}
68 68
 		}
69 69
 		return $html;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param number $size
78 78
 	 * @return string HTML code of the inserted flag
79 79
 	 */
80
-	public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) {
81
-	    return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />';
80
+	public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) {
81
+	    return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />';
82 82
 	}
83 83
 	
84 84
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$minimum = PHP_INT_MAX;
97 97
 		$maximum = 1;
98 98
 		foreach ($list as $item => $params) {
99
-			if(array_key_exists('count', $params)) {
99
+			if (array_key_exists('count', $params)) {
100 100
 				$maximum = max($maximum, $params['count']);
101 101
 				$minimum = min($minimum, $params['count']);
102 102
 			}
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 				$size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum);
115 115
 			}
116 116
 			
117
-			$html .= '<a style="font-size:' . $size . '%" href="' . $url . '">';
117
+			$html .= '<a style="font-size:'.$size.'%" href="'.$url.'">';
118 118
 			if ($totals) {
119
-				$html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count));
119
+				$html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count));
120 120
 			} else {
121 121
 				$html .= $text;
122 122
 			}
123 123
 			$html .= '</a>';
124 124
 		}
125
-		return '<div class="tag_cloud">' . $html . '</div>';
125
+		return '<div class="tag_cloud">'.$html.'</div>';
126 126
 	}
127 127
 	
128 128
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 * @param bool $isStrong Bolden the name ?
158 158
 	 * @return string HTML Code for individual item
159 159
 	 */
160
-	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){
160
+	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) {
161 161
 		$html = '';
162 162
 		$tag = 'em';
163
-		if($isStrong) $tag = 'strong';
164
-		if($individual && $individual->canShow()){
163
+		if ($isStrong) $tag = 'strong';
164
+		if ($individual && $individual->canShow()) {
165 165
 			$dindi = new Individual($individual);
166 166
 			$html = $individual->getSexImage();
167 167
 			$html .= '<a class="list_item" href="'.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			$html .= '</a>';
177 177
 		}
178 178
 		else {
179
-			$html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>';
179
+			$html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>';
180 180
 		}
181 181
 		return $html;
182 182
 	}
@@ -188,22 +188,22 @@  discard block
 block discarded – undo
188 188
 	 * @param boolean $anchor option to print a link to calendar
189 189
 	 * @return string HTML code for short date
190 190
 	 */
191
-	public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) {
191
+	public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) {
192 192
 		global $SEARCH_SPIDER;
193 193
 
194
-		$html='';
194
+		$html = '';
195 195
 		$date = $fact->getDate();
196
-		if($date->isOK()){
197
-			$html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y');
196
+		if ($date->isOK()) {
197
+			$html .= ' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y');
198 198
 		}
199
-		else{
199
+		else {
200 200
 			// 1 DEAT Y with no DATE => print YES
201 201
 			// 1 BIRT 2 SOUR @S1@ => print YES
202 202
 			// 1 DEAT N is not allowed
203 203
 			// It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen.
204 204
 			$factdetail = explode(' ', trim($fact->getGedcom()));
205 205
 			if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) {
206
-				$html.=I18N::translate('yes');
206
+				$html .= I18N::translate('yes');
207 207
 			}
208 208
 		}
209 209
 		return $html;
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 	 * @param boolean $anchor option to print a link to placelist
218 218
 	 * @return string HTML code for short place
219 219
 	 */
220
-	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){
221
-		$html='';
220
+	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) {
221
+		$html = '';
222 222
 		
223 223
 		if ($fact === null) return $html;
224 224
 		$place = $fact->getPlace();
225
-		if($place){
225
+		if ($place) {
226 226
 			$dplace = new Place($place);
227 227
 			$html .= $dplace->htmlFormattedName($format, $anchor);
228 228
 		}
@@ -240,21 +240,21 @@  discard block
 block discarded – undo
240 240
 	 * @param string $size CSS size for the icon. A CSS style css_$size is required
241 241
 	 * @return string HTML code for the formatted Sosa numbers
242 242
 	 */
243
-	public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){
243
+	public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') {
244 244
 		$html = '';
245
-		switch($format){
245
+		switch ($format) {
246 246
 			case 1:
247
-				if(count($sosatab)>0){
247
+				if (count($sosatab) > 0) {
248 248
 					$html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>';
249 249
 				}
250 250
 				break;
251 251
 			case 2:
252
-				if(count($sosatab)>0){
252
+				if (count($sosatab) > 0) {
253 253
 					ksort($sosatab);
254 254
 					$tmp_html = array();
255 255
 					foreach ($sosatab as $sosa => $gen) {
256 256
 						$tmp_html[] = sprintf(
257
-								'<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i>&nbsp;<strong>%2$d&nbsp;'.I18N::translate('(G%s)', $gen) .'</strong>',
257
+								'<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i>&nbsp;<strong>%2$d&nbsp;'.I18N::translate('(G%s)', $gen).'</strong>',
258 258
 								$size,
259 259
 								$sosa
260 260
 							);
@@ -280,15 +280,15 @@  discard block
 block discarded – undo
280 280
 	 * @param string $size CSS size for the icon. A CSS style css_$size is required
281 281
 	 * @return string HTML code for IsSourced icon
282 282
 	 */
283
-	public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){
284
-		$html='';
285
-		$image=null;
286
-		$title=null;
287
-		switch($format){
283
+	public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') {
284
+		$html = '';
285
+		$image = null;
286
+		$title = null;
287
+		switch ($format) {
288 288
 			case 1:
289
-				switch($sourceType){
289
+				switch ($sourceType) {
290 290
 					case 'E':
291
-						switch($isSourced){
291
+						switch ($isSourced) {
292 292
 							case 0:
293 293
 								$image = 'event_unknown';
294 294
 								$title = I18N::translate('%s not found', GedcomTag::getLabel($tag));
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 						}
319 319
 						break;
320 320
 					case 'R':
321
-						switch($isSourced){
321
+						switch ($isSourced) {
322 322
 							case -1:
323 323
 								$image = 'record_notsourced';
324 324
 								$title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag));
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 					default:
340 340
 						break;
341 341
 				}
342
-				if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
342
+				if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
343 343
 				break;
344 344
 			default:
345 345
 				break;
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@  discard block
 block discarded – undo
160 160
 	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){
161 161
 		$html = '';
162 162
 		$tag = 'em';
163
-		if($isStrong) $tag = 'strong';
163
+		if($isStrong) {
164
+			$tag = 'strong';
165
+		}
164 166
 		if($individual && $individual->canShow()){
165 167
 			$dindi = new Individual($individual);
166 168
 			$html = $individual->getSexImage();
@@ -174,8 +176,7 @@  discard block
 block discarded – undo
174 176
 			$html .= '&nbsp;<span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_BIRT, 10).'</em></small></span>';
175 177
 			$html .= '&nbsp;<span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_DEAT, 10).'</em></small></span>';
176 178
 			$html .= '</a>';
177
-		}
178
-		else {
179
+		} else {
179 180
 			$html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>';
180 181
 		}
181 182
 		return $html;
@@ -195,8 +196,7 @@  discard block
 block discarded – undo
195 196
 		$date = $fact->getDate();
196 197
 		if($date->isOK()){
197 198
 			$html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y');
198
-		}
199
-		else{
199
+		} else{
200 200
 			// 1 DEAT Y with no DATE => print YES
201 201
 			// 1 BIRT 2 SOUR @S1@ => print YES
202 202
 			// 1 DEAT N is not allowed
@@ -220,7 +220,9 @@  discard block
 block discarded – undo
220 220
 	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){
221 221
 		$html='';
222 222
 		
223
-		if ($fact === null) return $html;
223
+		if ($fact === null) {
224
+			return $html;
225
+		}
224 226
 		$place = $fact->getPlace();
225 227
 		if($place){
226 228
 			$dplace = new Place($place);
@@ -339,7 +341,9 @@  discard block
 block discarded – undo
339 341
 					default:
340 342
 						break;
341 343
 				}
342
-				if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
344
+				if($image && $title) {
345
+					$html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
346
+				}
343 347
 				break;
344 348
 			default:
345 349
 				break;
Please login to merge, or discard this patch.