Completed
Push — develop ( 3dca19...6b586f )
by Greg
11:52
created
app/Functions/FunctionsImport.php 2 patches
Switch Indentation   +644 added lines, -644 removed lines patch added patch discarded remove patch
@@ -59,477 +59,477 @@  discard block
 block discarded – undo
59 59
 			$tag                               = strtoupper($tag); // Tags should always be upper case
60 60
 			switch ($tag) {
61 61
 				// Convert PhpGedView tags to WT
62
-				case '_PGVU':
63
-					$tag = '_WT_USER';
64
-					break;
65
-				case '_PGV_OBJS':
66
-					$tag = '_WT_OBJE_SORT';
67
-					break;
68
-				// Convert FTM-style "TAG_FORMAL_NAME" into "TAG".
69
-				case 'ABBREVIATION':
70
-					$tag = 'ABBR';
71
-					break;
72
-				case 'ADDRESS':
73
-					$tag = 'ADDR';
74
-					break;
75
-				case 'ADDRESS1':
76
-					$tag = 'ADR1';
77
-					break;
78
-				case 'ADDRESS2':
79
-					$tag = 'ADR2';
80
-					break;
81
-				case 'ADDRESS3':
82
-					$tag = 'ADR3';
83
-					break;
84
-				case 'ADOPTION':
85
-					$tag = 'ADOP';
86
-					break;
87
-				case 'ADULT_CHRISTENING':
88
-					$tag = 'CHRA';
89
-					break;
90
-				case 'AFN':
91
-					// AFN values are upper case
92
-					$data = strtoupper($data);
93
-					break;
94
-				case 'AGENCY':
95
-					$tag = 'AGNC';
96
-					break;
97
-				case 'ALIAS':
98
-					$tag = 'ALIA';
99
-					break;
100
-				case 'ANCESTORS':
101
-					$tag = 'ANCE';
102
-					break;
103
-				case 'ANCES_INTEREST':
104
-					$tag = 'ANCI';
105
-					break;
106
-				case 'ANNULMENT':
107
-					$tag = 'ANUL';
108
-					break;
109
-				case 'ASSOCIATES':
110
-					$tag = 'ASSO';
111
-					break;
112
-				case 'AUTHOR':
113
-					$tag = 'AUTH';
114
-					break;
115
-				case 'BAPTISM':
116
-					$tag = 'BAPM';
117
-					break;
118
-				case 'BAPTISM_LDS':
119
-					$tag = 'BAPL';
120
-					break;
121
-				case 'BAR_MITZVAH':
122
-					$tag = 'BARM';
123
-					break;
124
-				case 'BAS_MITZVAH':
125
-					$tag = 'BASM';
126
-					break;
127
-				case 'BIRTH':
128
-					$tag = 'BIRT';
129
-					break;
130
-				case 'BLESSING':
131
-					$tag = 'BLES';
132
-					break;
133
-				case 'BURIAL':
134
-					$tag = 'BURI';
135
-					break;
136
-				case 'CALL_NUMBER':
137
-					$tag = 'CALN';
138
-					break;
139
-				case 'CASTE':
140
-					$tag = 'CAST';
141
-					break;
142
-				case 'CAUSE':
143
-					$tag = 'CAUS';
144
-					break;
145
-				case 'CENSUS':
146
-					$tag = 'CENS';
147
-					break;
148
-				case 'CHANGE':
149
-					$tag = 'CHAN';
150
-					break;
151
-				case 'CHARACTER':
152
-					$tag = 'CHAR';
153
-					break;
154
-				case 'CHILD':
155
-					$tag = 'CHIL';
156
-					break;
157
-				case 'CHILDREN_COUNT':
158
-					$tag = 'NCHI';
159
-					break;
160
-				case 'CHRISTENING':
161
-					$tag = 'CHR';
162
-					break;
163
-				case 'CONCATENATION':
164
-					$tag = 'CONC';
165
-					break;
166
-				case 'CONFIRMATION':
167
-					$tag = 'CONF';
168
-					break;
169
-				case 'CONFIRMATION_LDS':
170
-					$tag = 'CONL';
171
-					break;
172
-				case 'CONTINUED':
173
-					$tag = 'CONT';
174
-					break;
175
-				case 'COPYRIGHT':
176
-					$tag = 'COPR';
177
-					break;
178
-				case 'CORPORATE':
179
-					$tag = 'CORP';
180
-					break;
181
-				case 'COUNTRY':
182
-					$tag = 'CTRY';
183
-					break;
184
-				case 'CREMATION':
185
-					$tag = 'CREM';
186
-					break;
187
-				case 'DATE':
188
-					// Preserve text from INT dates
189
-					if (strpos($data, '(') !== false) {
190
-						list($date, $text) = explode('(', $data, 2);
191
-						$text              = ' (' . $text;
192
-					} else {
193
-						$date = $data;
194
-						$text = '';
195
-					}
196
-					// Capitals
197
-					$date = strtoupper($date);
198
-					// Temporarily add leading/trailing spaces, to allow efficient matching below
199
-					$date = " {$date} ";
200
-					// Ensure space digits and letters
201
-					$date = preg_replace('/([A-Z])(\d)/', '$1 $2', $date);
202
-					$date = preg_replace('/(\d)([A-Z])/', '$1 $2', $date);
203
-					// Ensure space before/after calendar escapes
204
-					$date = preg_replace('/@#[^@]+@/', ' $0 ', $date);
205
-					// "BET." => "BET"
206
-					$date = preg_replace('/(\w\w)\./', '$1', $date);
207
-					// "CIR" => "ABT"
208
-					$date = str_replace(' CIR ', ' ABT ', $date);
209
-					$date = str_replace(' APX ', ' ABT ', $date);
210
-					// B.C. => BC (temporarily, to allow easier handling of ".")
211
-					$date = str_replace(' B.C. ', ' BC ', $date);
212
-					// "BET X - Y " => "BET X AND Y"
213
-					$date = preg_replace('/^(.* BET .+) - (.+)/', '$1 AND $2', $date);
214
-					$date = preg_replace('/^(.* FROM .+) - (.+)/', '$1 TO $2', $date);
215
-					// "@#ESC@ FROM X TO Y" => "FROM @#ESC@ X TO @#ESC@ Y"
216
-					$date = preg_replace('/^ +(@#[^@]+@) +FROM +(.+) +TO +(.+)/', ' FROM $1 $2 TO $1 $3', $date);
217
-					$date = preg_replace('/^ +(@#[^@]+@) +BET +(.+) +AND +(.+)/', ' BET $1 $2 AND $1 $3', $date);
218
-					// "@#ESC@ AFT X" => "AFT @#ESC@ X"
219
-					$date = preg_replace('/^ +(@#[^@]+@) +(FROM|BET|TO|AND|BEF|AFT|CAL|EST|INT|ABT) +(.+)/', ' $2 $1 $3', $date);
220
-					// Ignore any remaining punctuation, e.g. "14-MAY, 1900" => "14 MAY 1900"
221
-					// (don't change "/" - it is used in NS/OS dates)
222
-					$date = preg_replace('/[.,:;-]/', ' ', $date);
223
-					// BC => B.C.
224
-					$date = str_replace(' BC ', ' B.C. ', $date);
225
-					// Append the "INT" text
226
-					$data = $date . $text;
227
-					break;
228
-				case 'DEATH':
229
-					$tag = 'DEAT';
230
-					break;
231
-				case '_DEATH_OF_SPOUSE':
232
-					$tag = '_DETS';
233
-					break;
234
-				case '_DEGREE':
235
-					$tag = '_DEG';
236
-					break;
237
-				case 'DESCENDANTS':
238
-					$tag = 'DESC';
239
-					break;
240
-				case 'DESCENDANT_INT':
241
-					$tag = 'DESI';
242
-					break;
243
-				case 'DESTINATION':
244
-					$tag = 'DEST';
245
-					break;
246
-				case 'DIVORCE':
247
-					$tag = 'DIV';
248
-					break;
249
-				case 'DIVORCE_FILED':
250
-					$tag = 'DIVF';
251
-					break;
252
-				case 'EDUCATION':
253
-					$tag = 'EDUC';
254
-					break;
255
-				case 'EMIGRATION':
256
-					$tag = 'EMIG';
257
-					break;
258
-				case 'ENDOWMENT':
259
-					$tag = 'ENDL';
260
-					break;
261
-				case 'ENGAGEMENT':
262
-					$tag = 'ENGA';
263
-					break;
264
-				case 'EVENT':
265
-					$tag = 'EVEN';
266
-					break;
267
-				case 'FACSIMILE':
268
-					$tag = 'FAX';
269
-					break;
270
-				case 'FAMILY':
271
-					$tag = 'FAM';
272
-					break;
273
-				case 'FAMILY_CHILD':
274
-					$tag = 'FAMC';
275
-					break;
276
-				case 'FAMILY_FILE':
277
-					$tag = 'FAMF';
278
-					break;
279
-				case 'FAMILY_SPOUSE':
280
-					$tag = 'FAMS';
281
-					break;
282
-				case 'FIRST_COMMUNION':
283
-					$tag = 'FCOM';
284
-					break;
285
-				case '_FILE':
286
-					$tag = 'FILE';
287
-					break;
288
-				case 'FORMAT':
289
-					$tag = 'FORM';
290
-				case 'FORM':
291
-					// Consistent commas
292
-					$data = preg_replace('/ *, */', ', ', $data);
293
-					break;
294
-				case 'GEDCOM':
295
-					$tag = 'GEDC';
296
-					break;
297
-				case 'GIVEN_NAME':
298
-					$tag = 'GIVN';
299
-					break;
300
-				case 'GRADUATION':
301
-					$tag = 'GRAD';
302
-					break;
303
-				case 'HEADER':
304
-					$tag = 'HEAD';
305
-				case 'HEAD':
306
-					// HEAD records don't have an XREF or DATA
307
-					if ($level == '0') {
308
-						$xref = '';
309
-						$data = '';
310
-					}
311
-					break;
312
-				case 'HUSBAND':
313
-					$tag = 'HUSB';
314
-					break;
315
-				case 'IDENT_NUMBER':
316
-					$tag = 'IDNO';
317
-					break;
318
-				case 'IMMIGRATION':
319
-					$tag = 'IMMI';
320
-					break;
321
-				case 'INDIVIDUAL':
322
-					$tag = 'INDI';
323
-					break;
324
-				case 'LANGUAGE':
325
-					$tag = 'LANG';
326
-					break;
327
-				case 'LATITUDE':
328
-					$tag = 'LATI';
329
-					break;
330
-				case 'LONGITUDE':
331
-					$tag = 'LONG';
332
-					break;
333
-				case 'MARRIAGE':
334
-					$tag = 'MARR';
335
-					break;
336
-				case 'MARRIAGE_BANN':
337
-					$tag = 'MARB';
338
-					break;
339
-				case 'MARRIAGE_COUNT':
340
-					$tag = 'NMR';
341
-					break;
342
-				case 'MARRIAGE_CONTRACT':
343
-					$tag = 'MARC';
344
-					break;
345
-				case 'MARRIAGE_LICENSE':
346
-					$tag = 'MARL';
347
-					break;
348
-				case 'MARRIAGE_SETTLEMENT':
349
-					$tag = 'MARS';
350
-					break;
351
-				case 'MEDIA':
352
-					$tag = 'MEDI';
353
-					break;
354
-				case '_MEDICAL':
355
-					$tag = '_MDCL';
356
-					break;
357
-				case '_MILITARY_SERVICE':
358
-					$tag = '_MILT';
359
-					break;
360
-				case 'NAME':
361
-					// Tidy up whitespace
362
-					$data = preg_replace('/  +/', ' ', trim($data));
363
-					break;
364
-				case 'NAME_PREFIX':
365
-					$tag = 'NPFX';
366
-					break;
367
-				case 'NAME_SUFFIX':
368
-					$tag = 'NSFX';
369
-					break;
370
-				case 'NATIONALITY':
371
-					$tag = 'NATI';
372
-					break;
373
-				case 'NATURALIZATION':
374
-					$tag = 'NATU';
375
-					break;
376
-				case 'NICKNAME':
377
-					$tag = 'NICK';
378
-					break;
379
-				case 'OBJECT':
380
-					$tag = 'OBJE';
381
-					break;
382
-				case 'OCCUPATION':
383
-					$tag = 'OCCU';
384
-					break;
385
-				case 'ORDINANCE':
386
-					$tag = 'ORDI';
387
-					break;
388
-				case 'ORDINATION':
389
-					$tag = 'ORDN';
390
-					break;
391
-				case 'PEDIGREE':
392
-					$tag = 'PEDI';
393
-				case 'PEDI':
394
-					// PEDI values are lower case
395
-					$data = strtolower($data);
396
-					break;
397
-				case 'PHONE':
398
-					$tag = 'PHON';
399
-					break;
400
-				case 'PHONETIC':
401
-					$tag = 'FONE';
402
-					break;
403
-				case 'PHY_DESCRIPTION':
404
-					$tag = 'DSCR';
405
-					break;
406
-				case 'PLACE':
407
-					$tag = 'PLAC';
408
-				case 'PLAC':
409
-					// Consistent commas
410
-					$data = preg_replace('/ *(،|,) */', ', ', $data);
411
-					// The Master Genealogist stores LAT/LONG data in the PLAC field, e.g. Pennsylvania, USA, 395945N0751013W
412
-					if (preg_match('/(.*), (\d\d)(\d\d)(\d\d)([NS])(\d\d\d)(\d\d)(\d\d)([EW])$/', $data, $match)) {
413
-						$data =
414
-							$match[1] . "\n" .
415
-							($level + 1) . " MAP\n" .
416
-							($level + 2) . " LATI " . ($match[5] . (round($match[2] + ($match[3] / 60) + ($match[4] / 3600), 4))) . "\n" .
417
-							($level + 2) . " LONG " . ($match[9] . (round($match[6] + ($match[7] / 60) + ($match[8] / 3600), 4)));
418
-					}
419
-					break;
420
-				case 'POSTAL_CODE':
421
-					$tag = 'POST';
422
-					break;
423
-				case 'PROBATE':
424
-					$tag = 'PROB';
425
-					break;
426
-				case 'PROPERTY':
427
-					$tag = 'PROP';
428
-					break;
429
-				case 'PUBLICATION':
430
-					$tag = 'PUBL';
431
-					break;
432
-				case 'QUALITY_OF_DATA':
433
-					$tag = 'QUAL';
434
-					break;
435
-				case 'REC_FILE_NUMBER':
436
-					$tag = 'RFN';
437
-					break;
438
-				case 'REC_ID_NUMBER':
439
-					$tag = 'RIN';
440
-					break;
441
-				case 'REFERENCE':
442
-					$tag = 'REFN';
443
-					break;
444
-				case 'RELATIONSHIP':
445
-					$tag = 'RELA';
446
-					break;
447
-				case 'RELIGION':
448
-					$tag = 'RELI';
449
-					break;
450
-				case 'REPOSITORY':
451
-					$tag = 'REPO';
452
-					break;
453
-				case 'RESIDENCE':
454
-					$tag = 'RESI';
455
-					break;
456
-				case 'RESTRICTION':
457
-					$tag = 'RESN';
458
-				case 'RESN':
459
-					// RESN values are lower case (confidential, privacy, locked, none)
460
-					$data = strtolower($data);
461
-					if ($data == 'invisible') {
462
-						$data = 'confidential'; // From old versions of Legacy.
463
-					}
464
-					break;
465
-				case 'RETIREMENT':
466
-					$tag = 'RETI';
467
-					break;
468
-				case 'ROMANIZED':
469
-					$tag = 'ROMN';
470
-					break;
471
-				case 'SEALING_CHILD':
472
-					$tag = 'SLGC';
473
-					break;
474
-				case 'SEALING_SPOUSE':
475
-					$tag = 'SLGS';
476
-					break;
477
-				case 'SOC_SEC_NUMBER':
478
-					$tag = 'SSN';
479
-					break;
480
-				case 'SEX':
481
-					$data = strtoupper($data);
482
-					break;
483
-				case 'SOURCE':
484
-					$tag = 'SOUR';
485
-					break;
486
-				case 'STATE':
487
-					$tag = 'STAE';
488
-					break;
489
-				case 'STATUS':
490
-					$tag = 'STAT';
491
-				case 'STAT':
492
-					if ($data == 'CANCELLED') {
493
-						// PhpGedView mis-spells this tag - correct it.
494
-						$data = 'CANCELED';
495
-					}
496
-					break;
497
-				case 'SUBMISSION':
498
-					$tag = 'SUBN';
499
-					break;
500
-				case 'SUBMITTER':
501
-					$tag = 'SUBM';
502
-					break;
503
-				case 'SURNAME':
504
-					$tag = 'SURN';
505
-					break;
506
-				case 'SURN_PREFIX':
507
-					$tag = 'SPFX';
508
-					break;
509
-				case 'TEMPLE':
510
-					$tag = 'TEMP';
511
-				case 'TEMP':
512
-					// Temple codes are upper case
513
-					$data = strtoupper($data);
514
-					break;
515
-				case 'TITLE':
516
-					$tag = 'TITL';
517
-					break;
518
-				case 'TRAILER':
519
-					$tag = 'TRLR';
520
-				case 'TRLR':
521
-					// TRLR records don't have an XREF or DATA
522
-					if ($level == '0') {
523
-						$xref = '';
524
-						$data = '';
525
-					}
526
-					break;
527
-				case 'VERSION':
528
-					$tag = 'VERS';
529
-					break;
530
-				case 'WEB':
531
-					$tag = 'WWW';
532
-					break;
62
+			case '_PGVU':
63
+				$tag = '_WT_USER';
64
+				break;
65
+			case '_PGV_OBJS':
66
+				$tag = '_WT_OBJE_SORT';
67
+				break;
68
+			// Convert FTM-style "TAG_FORMAL_NAME" into "TAG".
69
+			case 'ABBREVIATION':
70
+				$tag = 'ABBR';
71
+				break;
72
+			case 'ADDRESS':
73
+				$tag = 'ADDR';
74
+				break;
75
+			case 'ADDRESS1':
76
+				$tag = 'ADR1';
77
+				break;
78
+			case 'ADDRESS2':
79
+				$tag = 'ADR2';
80
+				break;
81
+			case 'ADDRESS3':
82
+				$tag = 'ADR3';
83
+				break;
84
+			case 'ADOPTION':
85
+				$tag = 'ADOP';
86
+				break;
87
+			case 'ADULT_CHRISTENING':
88
+				$tag = 'CHRA';
89
+				break;
90
+			case 'AFN':
91
+				// AFN values are upper case
92
+				$data = strtoupper($data);
93
+				break;
94
+			case 'AGENCY':
95
+				$tag = 'AGNC';
96
+				break;
97
+			case 'ALIAS':
98
+				$tag = 'ALIA';
99
+				break;
100
+			case 'ANCESTORS':
101
+				$tag = 'ANCE';
102
+				break;
103
+			case 'ANCES_INTEREST':
104
+				$tag = 'ANCI';
105
+				break;
106
+			case 'ANNULMENT':
107
+				$tag = 'ANUL';
108
+				break;
109
+			case 'ASSOCIATES':
110
+				$tag = 'ASSO';
111
+				break;
112
+			case 'AUTHOR':
113
+				$tag = 'AUTH';
114
+				break;
115
+			case 'BAPTISM':
116
+				$tag = 'BAPM';
117
+				break;
118
+			case 'BAPTISM_LDS':
119
+				$tag = 'BAPL';
120
+				break;
121
+			case 'BAR_MITZVAH':
122
+				$tag = 'BARM';
123
+				break;
124
+			case 'BAS_MITZVAH':
125
+				$tag = 'BASM';
126
+				break;
127
+			case 'BIRTH':
128
+				$tag = 'BIRT';
129
+				break;
130
+			case 'BLESSING':
131
+				$tag = 'BLES';
132
+				break;
133
+			case 'BURIAL':
134
+				$tag = 'BURI';
135
+				break;
136
+			case 'CALL_NUMBER':
137
+				$tag = 'CALN';
138
+				break;
139
+			case 'CASTE':
140
+				$tag = 'CAST';
141
+				break;
142
+			case 'CAUSE':
143
+				$tag = 'CAUS';
144
+				break;
145
+			case 'CENSUS':
146
+				$tag = 'CENS';
147
+				break;
148
+			case 'CHANGE':
149
+				$tag = 'CHAN';
150
+				break;
151
+			case 'CHARACTER':
152
+				$tag = 'CHAR';
153
+				break;
154
+			case 'CHILD':
155
+				$tag = 'CHIL';
156
+				break;
157
+			case 'CHILDREN_COUNT':
158
+				$tag = 'NCHI';
159
+				break;
160
+			case 'CHRISTENING':
161
+				$tag = 'CHR';
162
+				break;
163
+			case 'CONCATENATION':
164
+				$tag = 'CONC';
165
+				break;
166
+			case 'CONFIRMATION':
167
+				$tag = 'CONF';
168
+				break;
169
+			case 'CONFIRMATION_LDS':
170
+				$tag = 'CONL';
171
+				break;
172
+			case 'CONTINUED':
173
+				$tag = 'CONT';
174
+				break;
175
+			case 'COPYRIGHT':
176
+				$tag = 'COPR';
177
+				break;
178
+			case 'CORPORATE':
179
+				$tag = 'CORP';
180
+				break;
181
+			case 'COUNTRY':
182
+				$tag = 'CTRY';
183
+				break;
184
+			case 'CREMATION':
185
+				$tag = 'CREM';
186
+				break;
187
+			case 'DATE':
188
+				// Preserve text from INT dates
189
+				if (strpos($data, '(') !== false) {
190
+					list($date, $text) = explode('(', $data, 2);
191
+					$text              = ' (' . $text;
192
+				} else {
193
+					$date = $data;
194
+					$text = '';
195
+				}
196
+				// Capitals
197
+				$date = strtoupper($date);
198
+				// Temporarily add leading/trailing spaces, to allow efficient matching below
199
+				$date = " {$date} ";
200
+				// Ensure space digits and letters
201
+				$date = preg_replace('/([A-Z])(\d)/', '$1 $2', $date);
202
+				$date = preg_replace('/(\d)([A-Z])/', '$1 $2', $date);
203
+				// Ensure space before/after calendar escapes
204
+				$date = preg_replace('/@#[^@]+@/', ' $0 ', $date);
205
+				// "BET." => "BET"
206
+				$date = preg_replace('/(\w\w)\./', '$1', $date);
207
+				// "CIR" => "ABT"
208
+				$date = str_replace(' CIR ', ' ABT ', $date);
209
+				$date = str_replace(' APX ', ' ABT ', $date);
210
+				// B.C. => BC (temporarily, to allow easier handling of ".")
211
+				$date = str_replace(' B.C. ', ' BC ', $date);
212
+				// "BET X - Y " => "BET X AND Y"
213
+				$date = preg_replace('/^(.* BET .+) - (.+)/', '$1 AND $2', $date);
214
+				$date = preg_replace('/^(.* FROM .+) - (.+)/', '$1 TO $2', $date);
215
+				// "@#ESC@ FROM X TO Y" => "FROM @#ESC@ X TO @#ESC@ Y"
216
+				$date = preg_replace('/^ +(@#[^@]+@) +FROM +(.+) +TO +(.+)/', ' FROM $1 $2 TO $1 $3', $date);
217
+				$date = preg_replace('/^ +(@#[^@]+@) +BET +(.+) +AND +(.+)/', ' BET $1 $2 AND $1 $3', $date);
218
+				// "@#ESC@ AFT X" => "AFT @#ESC@ X"
219
+				$date = preg_replace('/^ +(@#[^@]+@) +(FROM|BET|TO|AND|BEF|AFT|CAL|EST|INT|ABT) +(.+)/', ' $2 $1 $3', $date);
220
+				// Ignore any remaining punctuation, e.g. "14-MAY, 1900" => "14 MAY 1900"
221
+				// (don't change "/" - it is used in NS/OS dates)
222
+				$date = preg_replace('/[.,:;-]/', ' ', $date);
223
+				// BC => B.C.
224
+				$date = str_replace(' BC ', ' B.C. ', $date);
225
+				// Append the "INT" text
226
+				$data = $date . $text;
227
+				break;
228
+			case 'DEATH':
229
+				$tag = 'DEAT';
230
+				break;
231
+			case '_DEATH_OF_SPOUSE':
232
+				$tag = '_DETS';
233
+				break;
234
+			case '_DEGREE':
235
+				$tag = '_DEG';
236
+				break;
237
+			case 'DESCENDANTS':
238
+				$tag = 'DESC';
239
+				break;
240
+			case 'DESCENDANT_INT':
241
+				$tag = 'DESI';
242
+				break;
243
+			case 'DESTINATION':
244
+				$tag = 'DEST';
245
+				break;
246
+			case 'DIVORCE':
247
+				$tag = 'DIV';
248
+				break;
249
+			case 'DIVORCE_FILED':
250
+				$tag = 'DIVF';
251
+				break;
252
+			case 'EDUCATION':
253
+				$tag = 'EDUC';
254
+				break;
255
+			case 'EMIGRATION':
256
+				$tag = 'EMIG';
257
+				break;
258
+			case 'ENDOWMENT':
259
+				$tag = 'ENDL';
260
+				break;
261
+			case 'ENGAGEMENT':
262
+				$tag = 'ENGA';
263
+				break;
264
+			case 'EVENT':
265
+				$tag = 'EVEN';
266
+				break;
267
+			case 'FACSIMILE':
268
+				$tag = 'FAX';
269
+				break;
270
+			case 'FAMILY':
271
+				$tag = 'FAM';
272
+				break;
273
+			case 'FAMILY_CHILD':
274
+				$tag = 'FAMC';
275
+				break;
276
+			case 'FAMILY_FILE':
277
+				$tag = 'FAMF';
278
+				break;
279
+			case 'FAMILY_SPOUSE':
280
+				$tag = 'FAMS';
281
+				break;
282
+			case 'FIRST_COMMUNION':
283
+				$tag = 'FCOM';
284
+				break;
285
+			case '_FILE':
286
+				$tag = 'FILE';
287
+				break;
288
+			case 'FORMAT':
289
+				$tag = 'FORM';
290
+			case 'FORM':
291
+				// Consistent commas
292
+				$data = preg_replace('/ *, */', ', ', $data);
293
+				break;
294
+			case 'GEDCOM':
295
+				$tag = 'GEDC';
296
+				break;
297
+			case 'GIVEN_NAME':
298
+				$tag = 'GIVN';
299
+				break;
300
+			case 'GRADUATION':
301
+				$tag = 'GRAD';
302
+				break;
303
+			case 'HEADER':
304
+				$tag = 'HEAD';
305
+			case 'HEAD':
306
+				// HEAD records don't have an XREF or DATA
307
+				if ($level == '0') {
308
+					$xref = '';
309
+					$data = '';
310
+				}
311
+				break;
312
+			case 'HUSBAND':
313
+				$tag = 'HUSB';
314
+				break;
315
+			case 'IDENT_NUMBER':
316
+				$tag = 'IDNO';
317
+				break;
318
+			case 'IMMIGRATION':
319
+				$tag = 'IMMI';
320
+				break;
321
+			case 'INDIVIDUAL':
322
+				$tag = 'INDI';
323
+				break;
324
+			case 'LANGUAGE':
325
+				$tag = 'LANG';
326
+				break;
327
+			case 'LATITUDE':
328
+				$tag = 'LATI';
329
+				break;
330
+			case 'LONGITUDE':
331
+				$tag = 'LONG';
332
+				break;
333
+			case 'MARRIAGE':
334
+				$tag = 'MARR';
335
+				break;
336
+			case 'MARRIAGE_BANN':
337
+				$tag = 'MARB';
338
+				break;
339
+			case 'MARRIAGE_COUNT':
340
+				$tag = 'NMR';
341
+				break;
342
+			case 'MARRIAGE_CONTRACT':
343
+				$tag = 'MARC';
344
+				break;
345
+			case 'MARRIAGE_LICENSE':
346
+				$tag = 'MARL';
347
+				break;
348
+			case 'MARRIAGE_SETTLEMENT':
349
+				$tag = 'MARS';
350
+				break;
351
+			case 'MEDIA':
352
+				$tag = 'MEDI';
353
+				break;
354
+			case '_MEDICAL':
355
+				$tag = '_MDCL';
356
+				break;
357
+			case '_MILITARY_SERVICE':
358
+				$tag = '_MILT';
359
+				break;
360
+			case 'NAME':
361
+				// Tidy up whitespace
362
+				$data = preg_replace('/  +/', ' ', trim($data));
363
+				break;
364
+			case 'NAME_PREFIX':
365
+				$tag = 'NPFX';
366
+				break;
367
+			case 'NAME_SUFFIX':
368
+				$tag = 'NSFX';
369
+				break;
370
+			case 'NATIONALITY':
371
+				$tag = 'NATI';
372
+				break;
373
+			case 'NATURALIZATION':
374
+				$tag = 'NATU';
375
+				break;
376
+			case 'NICKNAME':
377
+				$tag = 'NICK';
378
+				break;
379
+			case 'OBJECT':
380
+				$tag = 'OBJE';
381
+				break;
382
+			case 'OCCUPATION':
383
+				$tag = 'OCCU';
384
+				break;
385
+			case 'ORDINANCE':
386
+				$tag = 'ORDI';
387
+				break;
388
+			case 'ORDINATION':
389
+				$tag = 'ORDN';
390
+				break;
391
+			case 'PEDIGREE':
392
+				$tag = 'PEDI';
393
+			case 'PEDI':
394
+				// PEDI values are lower case
395
+				$data = strtolower($data);
396
+				break;
397
+			case 'PHONE':
398
+				$tag = 'PHON';
399
+				break;
400
+			case 'PHONETIC':
401
+				$tag = 'FONE';
402
+				break;
403
+			case 'PHY_DESCRIPTION':
404
+				$tag = 'DSCR';
405
+				break;
406
+			case 'PLACE':
407
+				$tag = 'PLAC';
408
+			case 'PLAC':
409
+				// Consistent commas
410
+				$data = preg_replace('/ *(،|,) */', ', ', $data);
411
+				// The Master Genealogist stores LAT/LONG data in the PLAC field, e.g. Pennsylvania, USA, 395945N0751013W
412
+				if (preg_match('/(.*), (\d\d)(\d\d)(\d\d)([NS])(\d\d\d)(\d\d)(\d\d)([EW])$/', $data, $match)) {
413
+					$data =
414
+						$match[1] . "\n" .
415
+						($level + 1) . " MAP\n" .
416
+						($level + 2) . " LATI " . ($match[5] . (round($match[2] + ($match[3] / 60) + ($match[4] / 3600), 4))) . "\n" .
417
+						($level + 2) . " LONG " . ($match[9] . (round($match[6] + ($match[7] / 60) + ($match[8] / 3600), 4)));
418
+				}
419
+				break;
420
+			case 'POSTAL_CODE':
421
+				$tag = 'POST';
422
+				break;
423
+			case 'PROBATE':
424
+				$tag = 'PROB';
425
+				break;
426
+			case 'PROPERTY':
427
+				$tag = 'PROP';
428
+				break;
429
+			case 'PUBLICATION':
430
+				$tag = 'PUBL';
431
+				break;
432
+			case 'QUALITY_OF_DATA':
433
+				$tag = 'QUAL';
434
+				break;
435
+			case 'REC_FILE_NUMBER':
436
+				$tag = 'RFN';
437
+				break;
438
+			case 'REC_ID_NUMBER':
439
+				$tag = 'RIN';
440
+				break;
441
+			case 'REFERENCE':
442
+				$tag = 'REFN';
443
+				break;
444
+			case 'RELATIONSHIP':
445
+				$tag = 'RELA';
446
+				break;
447
+			case 'RELIGION':
448
+				$tag = 'RELI';
449
+				break;
450
+			case 'REPOSITORY':
451
+				$tag = 'REPO';
452
+				break;
453
+			case 'RESIDENCE':
454
+				$tag = 'RESI';
455
+				break;
456
+			case 'RESTRICTION':
457
+				$tag = 'RESN';
458
+			case 'RESN':
459
+				// RESN values are lower case (confidential, privacy, locked, none)
460
+				$data = strtolower($data);
461
+				if ($data == 'invisible') {
462
+					$data = 'confidential'; // From old versions of Legacy.
463
+				}
464
+				break;
465
+			case 'RETIREMENT':
466
+				$tag = 'RETI';
467
+				break;
468
+			case 'ROMANIZED':
469
+				$tag = 'ROMN';
470
+				break;
471
+			case 'SEALING_CHILD':
472
+				$tag = 'SLGC';
473
+				break;
474
+			case 'SEALING_SPOUSE':
475
+				$tag = 'SLGS';
476
+				break;
477
+			case 'SOC_SEC_NUMBER':
478
+				$tag = 'SSN';
479
+				break;
480
+			case 'SEX':
481
+				$data = strtoupper($data);
482
+				break;
483
+			case 'SOURCE':
484
+				$tag = 'SOUR';
485
+				break;
486
+			case 'STATE':
487
+				$tag = 'STAE';
488
+				break;
489
+			case 'STATUS':
490
+				$tag = 'STAT';
491
+			case 'STAT':
492
+				if ($data == 'CANCELLED') {
493
+					// PhpGedView mis-spells this tag - correct it.
494
+					$data = 'CANCELED';
495
+				}
496
+				break;
497
+			case 'SUBMISSION':
498
+				$tag = 'SUBN';
499
+				break;
500
+			case 'SUBMITTER':
501
+				$tag = 'SUBM';
502
+				break;
503
+			case 'SURNAME':
504
+				$tag = 'SURN';
505
+				break;
506
+			case 'SURN_PREFIX':
507
+				$tag = 'SPFX';
508
+				break;
509
+			case 'TEMPLE':
510
+				$tag = 'TEMP';
511
+			case 'TEMP':
512
+				// Temple codes are upper case
513
+				$data = strtoupper($data);
514
+				break;
515
+			case 'TITLE':
516
+				$tag = 'TITL';
517
+				break;
518
+			case 'TRAILER':
519
+				$tag = 'TRLR';
520
+			case 'TRLR':
521
+				// TRLR records don't have an XREF or DATA
522
+				if ($level == '0') {
523
+					$xref = '';
524
+					$data = '';
525
+				}
526
+				break;
527
+			case 'VERSION':
528
+				$tag = 'VERS';
529
+				break;
530
+			case 'WEB':
531
+				$tag = 'WWW';
532
+				break;
533 533
 			}
534 534
 			// Suppress "Y", for facts/events with a DATE or PLAC
535 535
 			if ($data == 'y') {
@@ -545,40 +545,40 @@  discard block
 block discarded – undo
545 545
 			}
546 546
 			// Reassemble components back into a single line
547 547
 			switch ($tag) {
548
-				default:
549
-					// Remove tabs and multiple/leading/trailing spaces
550
-					if (strpos($data, "\t") !== false) {
551
-						$data = str_replace("\t", ' ', $data);
552
-					}
553
-					if (substr($data, 0, 1) == ' ' || substr($data, -1, 1) == ' ') {
554
-						$data = trim($data);
555
-					}
556
-					while (strpos($data, '  ')) {
557
-						$data = str_replace('  ', ' ', $data);
558
-					}
559
-					$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != "NOTE" ? '' : ' ' . $data);
560
-					break;
561
-				case 'NOTE':
562
-				case 'TEXT':
563
-				case 'DATA':
564
-				case 'CONT':
565
-					$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != "NOTE" ? '' : ' ' . $data);
566
-					break;
567
-				case 'FILE':
568
-					// Strip off the user-defined path prefix
569
-					$GEDCOM_MEDIA_PATH = $tree->getPreference('GEDCOM_MEDIA_PATH');
570
-					if ($GEDCOM_MEDIA_PATH && strpos($data, $GEDCOM_MEDIA_PATH) === 0) {
571
-						$data = substr($data, strlen($GEDCOM_MEDIA_PATH));
572
-					}
573
-					// convert backslashes in filenames to forward slashes
574
-					$data = preg_replace("/\\\/", "/", $data);
548
+			default:
549
+				// Remove tabs and multiple/leading/trailing spaces
550
+				if (strpos($data, "\t") !== false) {
551
+					$data = str_replace("\t", ' ', $data);
552
+				}
553
+				if (substr($data, 0, 1) == ' ' || substr($data, -1, 1) == ' ') {
554
+					$data = trim($data);
555
+				}
556
+				while (strpos($data, '  ')) {
557
+					$data = str_replace('  ', ' ', $data);
558
+				}
559
+				$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != "NOTE" ? '' : ' ' . $data);
560
+				break;
561
+			case 'NOTE':
562
+			case 'TEXT':
563
+			case 'DATA':
564
+			case 'CONT':
565
+				$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != "NOTE" ? '' : ' ' . $data);
566
+				break;
567
+			case 'FILE':
568
+				// Strip off the user-defined path prefix
569
+				$GEDCOM_MEDIA_PATH = $tree->getPreference('GEDCOM_MEDIA_PATH');
570
+				if ($GEDCOM_MEDIA_PATH && strpos($data, $GEDCOM_MEDIA_PATH) === 0) {
571
+					$data = substr($data, strlen($GEDCOM_MEDIA_PATH));
572
+				}
573
+				// convert backslashes in filenames to forward slashes
574
+				$data = preg_replace("/\\\/", "/", $data);
575 575
 
576
-					$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != "NOTE" ? '' : ' ' . $data);
577
-					break;
578
-				case 'CONC':
579
-					// Merge CONC lines, to simplify access later on.
580
-					$newrec .= ($tree->getPreference('WORD_WRAPPED_NOTES') ? ' ' : '') . $data;
581
-					break;
576
+				$newrec .= ($newrec ? "\n" : '') . $level . ' ' . ($level == '0' && $xref ? $xref . ' ' : '') . $tag . ($data === '' && $tag != "NOTE" ? '' : ' ' . $data);
577
+				break;
578
+			case 'CONC':
579
+				// Merge CONC lines, to simplify access later on.
580
+				$newrec .= ($tree->getPreference('WORD_WRAPPED_NOTES') ? ' ' : '') . $data;
581
+				break;
582 582
 			}
583 583
 		}
584 584
 
@@ -635,136 +635,136 @@  discard block
 block discarded – undo
635 635
 		}
636 636
 
637 637
 		switch ($type) {
638
-			case 'INDI':
639
-				// Convert inline media into media objects
640
-				$gedrec = self::convertInlineMedia($tree, $gedrec);
638
+		case 'INDI':
639
+			// Convert inline media into media objects
640
+			$gedrec = self::convertInlineMedia($tree, $gedrec);
641 641
 
642
-				$record = new Individual($xref, $gedrec, null, $tree);
643
-				if ($tree->getPreference('USE_RIN') && preg_match('/\n1 RIN (.+)/', $gedrec, $match)) {
644
-					$rin = $match[1];
645
-				} else {
646
-					$rin = $xref;
647
-				}
648
-				Database::prepare(
649
-					"INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom) VALUES (?, ?, ?, ?, ?)"
650
-				)->execute(array(
651
-					$xref, $tree_id, $rin, $record->getSex(), $gedrec,
652
-				));
653
-				// Update the cross-reference/index tables.
654
-				self::updatePlaces($xref, $tree_id, $gedrec);
655
-				self::updateDates($xref, $tree_id, $gedrec);
656
-				self::updateLinks($xref, $tree_id, $gedrec);
657
-				self::updateNames($xref, $tree_id, $record);
658
-				break;
659
-			case 'FAM':
660
-				// Convert inline media into media objects
661
-				$gedrec = self::convertInlineMedia($tree, $gedrec);
642
+			$record = new Individual($xref, $gedrec, null, $tree);
643
+			if ($tree->getPreference('USE_RIN') && preg_match('/\n1 RIN (.+)/', $gedrec, $match)) {
644
+				$rin = $match[1];
645
+			} else {
646
+				$rin = $xref;
647
+			}
648
+			Database::prepare(
649
+				"INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom) VALUES (?, ?, ?, ?, ?)"
650
+			)->execute(array(
651
+				$xref, $tree_id, $rin, $record->getSex(), $gedrec,
652
+			));
653
+			// Update the cross-reference/index tables.
654
+			self::updatePlaces($xref, $tree_id, $gedrec);
655
+			self::updateDates($xref, $tree_id, $gedrec);
656
+			self::updateLinks($xref, $tree_id, $gedrec);
657
+			self::updateNames($xref, $tree_id, $record);
658
+			break;
659
+		case 'FAM':
660
+			// Convert inline media into media objects
661
+			$gedrec = self::convertInlineMedia($tree, $gedrec);
662 662
 
663
-				if (preg_match('/\n1 HUSB @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
664
-					$husb = $match[1];
665
-				} else {
666
-					$husb = '';
667
-				}
668
-				if (preg_match('/\n1 WIFE @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
669
-					$wife = $match[1];
670
-				} else {
671
-					$wife = '';
672
-				}
673
-				$nchi = preg_match_all('/\n1 CHIL @(' . WT_REGEX_XREF . ')@/', $gedrec, $match);
674
-				if (preg_match('/\n1 NCHI (\d+)/', $gedrec, $match)) {
675
-					$nchi = max($nchi, $match[1]);
676
-				}
677
-				Database::prepare(
678
-					"INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil) VALUES (?, ?, ?, ?, ?, ?)"
679
-				)->execute(array(
680
-					$xref, $tree_id, $husb, $wife, $gedrec, $nchi,
681
-				));
682
-				// Update the cross-reference/index tables.
683
-				self::updatePlaces($xref, $tree_id, $gedrec);
684
-				self::updateDates($xref, $tree_id, $gedrec);
685
-				self::updateLinks($xref, $tree_id, $gedrec);
686
-				break;
687
-			case 'SOUR':
688
-				// Convert inline media into media objects
689
-				$gedrec = self::convertInlineMedia($tree, $gedrec);
663
+			if (preg_match('/\n1 HUSB @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
664
+				$husb = $match[1];
665
+			} else {
666
+				$husb = '';
667
+			}
668
+			if (preg_match('/\n1 WIFE @(' . WT_REGEX_XREF . ')@/', $gedrec, $match)) {
669
+				$wife = $match[1];
670
+			} else {
671
+				$wife = '';
672
+			}
673
+			$nchi = preg_match_all('/\n1 CHIL @(' . WT_REGEX_XREF . ')@/', $gedrec, $match);
674
+			if (preg_match('/\n1 NCHI (\d+)/', $gedrec, $match)) {
675
+				$nchi = max($nchi, $match[1]);
676
+			}
677
+			Database::prepare(
678
+				"INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil) VALUES (?, ?, ?, ?, ?, ?)"
679
+			)->execute(array(
680
+				$xref, $tree_id, $husb, $wife, $gedrec, $nchi,
681
+			));
682
+			// Update the cross-reference/index tables.
683
+			self::updatePlaces($xref, $tree_id, $gedrec);
684
+			self::updateDates($xref, $tree_id, $gedrec);
685
+			self::updateLinks($xref, $tree_id, $gedrec);
686
+			break;
687
+		case 'SOUR':
688
+			// Convert inline media into media objects
689
+			$gedrec = self::convertInlineMedia($tree, $gedrec);
690 690
 
691
-				$record = new Source($xref, $gedrec, null, $tree);
692
-				if (preg_match('/\n1 TITL (.+)/', $gedrec, $match)) {
693
-					$name = $match[1];
694
-				} elseif (preg_match('/\n1 ABBR (.+)/', $gedrec, $match)) {
695
-					$name = $match[1];
696
-				} else {
697
-					$name = $xref;
698
-				}
699
-				Database::prepare(
700
-					"INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom) VALUES (?, ?, LEFT(?, 255), ?)"
701
-				)->execute(array(
702
-					$xref, $tree_id, $name, $gedrec,
703
-				));
704
-				// Update the cross-reference/index tables.
705
-				self::updateLinks($xref, $tree_id, $gedrec);
706
-				self::updateNames($xref, $tree_id, $record);
707
-				break;
708
-			case 'REPO':
709
-				// Convert inline media into media objects
710
-				$gedrec = self::convertInlineMedia($tree, $gedrec);
691
+			$record = new Source($xref, $gedrec, null, $tree);
692
+			if (preg_match('/\n1 TITL (.+)/', $gedrec, $match)) {
693
+				$name = $match[1];
694
+			} elseif (preg_match('/\n1 ABBR (.+)/', $gedrec, $match)) {
695
+				$name = $match[1];
696
+			} else {
697
+				$name = $xref;
698
+			}
699
+			Database::prepare(
700
+				"INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom) VALUES (?, ?, LEFT(?, 255), ?)"
701
+			)->execute(array(
702
+				$xref, $tree_id, $name, $gedrec,
703
+			));
704
+			// Update the cross-reference/index tables.
705
+			self::updateLinks($xref, $tree_id, $gedrec);
706
+			self::updateNames($xref, $tree_id, $record);
707
+			break;
708
+		case 'REPO':
709
+			// Convert inline media into media objects
710
+			$gedrec = self::convertInlineMedia($tree, $gedrec);
711 711
 
712
-				$record = new Repository($xref, $gedrec, null, $tree);
713
-				Database::prepare(
714
-					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'REPO', ?)"
715
-				)->execute(array(
716
-					$xref, $tree_id, $gedrec,
717
-				));
718
-				// Update the cross-reference/index tables.
719
-				self::updateLinks($xref, $tree_id, $gedrec);
720
-				self::updateNames($xref, $tree_id, $record);
721
-				break;
722
-			case 'NOTE':
723
-				$record = new Note($xref, $gedrec, null, $tree);
724
-				Database::prepare(
725
-					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'NOTE', ?)"
726
-				)->execute(array(
727
-					$xref, $tree_id, $gedrec,
728
-				));
729
-				// Update the cross-reference/index tables.
730
-				self::updateLinks($xref, $tree_id, $gedrec);
731
-				self::updateNames($xref, $tree_id, $record);
732
-				break;
733
-			case 'OBJE':
734
-				$record = new Media($xref, $gedrec, null, $tree);
735
-				Database::prepare(
736
-					"INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom) VALUES (?, ?, ?, ?, ?, ?, ?)"
737
-				)->execute(array(
738
-					$xref, $record->extension(), $record->getMediaType(), $record->getTitle(), $record->getFilename(), $tree_id, $gedrec,
739
-				));
740
-				// Update the cross-reference/index tables.
741
-				self::updateLinks($xref, $tree_id, $gedrec);
742
-				self::updateNames($xref, $tree_id, $record);
743
-				break;
744
-			case 'HEAD':
745
-				// Force HEAD records to have a creation date.
746
-				if (!strpos($gedrec, "\n1 DATE ")) {
747
-					$gedrec .= "\n1 DATE " . date('j M Y');
748
-				}
749
-			// No break;
750
-			case 'TRLR':
751
-			case 'SUBM':
752
-			case 'SUBN':
753
-				Database::prepare(
754
-					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, ?, ?)"
755
-				)->execute(array($xref, $tree_id, $type, $gedrec));
756
-				// Update the cross-reference/index tables.
712
+			$record = new Repository($xref, $gedrec, null, $tree);
713
+			Database::prepare(
714
+				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'REPO', ?)"
715
+			)->execute(array(
716
+				$xref, $tree_id, $gedrec,
717
+			));
718
+			// Update the cross-reference/index tables.
757 719
 			self::updateLinks($xref, $tree_id, $gedrec);
758
-				break;
759
-			default:
760
-				$record = new GedcomRecord($xref, $gedrec, null, $tree);
761
-				Database::prepare(
762
-					"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, ?, ?)"
763
-				)->execute(array($xref, $tree_id, $type, $gedrec));
764
-				// Update the cross-reference/index tables.
765
-				self::updateLinks($xref, $tree_id, $gedrec);
766
-				self::updateNames($xref, $tree_id, $record);
767
-				break;
720
+			self::updateNames($xref, $tree_id, $record);
721
+			break;
722
+		case 'NOTE':
723
+			$record = new Note($xref, $gedrec, null, $tree);
724
+			Database::prepare(
725
+				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, 'NOTE', ?)"
726
+			)->execute(array(
727
+				$xref, $tree_id, $gedrec,
728
+			));
729
+			// Update the cross-reference/index tables.
730
+			self::updateLinks($xref, $tree_id, $gedrec);
731
+			self::updateNames($xref, $tree_id, $record);
732
+			break;
733
+		case 'OBJE':
734
+			$record = new Media($xref, $gedrec, null, $tree);
735
+			Database::prepare(
736
+				"INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom) VALUES (?, ?, ?, ?, ?, ?, ?)"
737
+			)->execute(array(
738
+				$xref, $record->extension(), $record->getMediaType(), $record->getTitle(), $record->getFilename(), $tree_id, $gedrec,
739
+			));
740
+			// Update the cross-reference/index tables.
741
+			self::updateLinks($xref, $tree_id, $gedrec);
742
+			self::updateNames($xref, $tree_id, $record);
743
+			break;
744
+		case 'HEAD':
745
+			// Force HEAD records to have a creation date.
746
+			if (!strpos($gedrec, "\n1 DATE ")) {
747
+				$gedrec .= "\n1 DATE " . date('j M Y');
748
+			}
749
+		// No break;
750
+		case 'TRLR':
751
+		case 'SUBM':
752
+		case 'SUBN':
753
+			Database::prepare(
754
+				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, ?, ?)"
755
+			)->execute(array($xref, $tree_id, $type, $gedrec));
756
+			// Update the cross-reference/index tables.
757
+		self::updateLinks($xref, $tree_id, $gedrec);
758
+			break;
759
+		default:
760
+			$record = new GedcomRecord($xref, $gedrec, null, $tree);
761
+			Database::prepare(
762
+				"INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom) VALUES (?, ?, ?, ?)"
763
+			)->execute(array($xref, $tree_id, $type, $gedrec));
764
+			// Update the cross-reference/index tables.
765
+			self::updateLinks($xref, $tree_id, $gedrec);
766
+			self::updateNames($xref, $tree_id, $record);
767
+			break;
768 768
 		}
769 769
 	}
770 770
 
@@ -1137,21 +1137,21 @@  discard block
 block discarded – undo
1137 1137
 		Database::prepare("DELETE FROM `##link` WHERE l_from=? AND l_file=?")->execute(array($gid, $ged_id));
1138 1138
 
1139 1139
 		switch ($type) {
1140
-			case 'INDI':
1141
-				Database::prepare("DELETE FROM `##individuals` WHERE i_id=? AND i_file=?")->execute(array($gid, $ged_id));
1142
-				break;
1143
-			case 'FAM':
1144
-				Database::prepare("DELETE FROM `##families` WHERE f_id=? AND f_file=?")->execute(array($gid, $ged_id));
1145
-				break;
1146
-			case 'SOUR':
1147
-				Database::prepare("DELETE FROM `##sources` WHERE s_id=? AND s_file=?")->execute(array($gid, $ged_id));
1148
-				break;
1149
-			case 'OBJE':
1150
-				Database::prepare("DELETE FROM `##media` WHERE m_id=? AND m_file=?")->execute(array($gid, $ged_id));
1151
-				break;
1152
-			default:
1153
-				Database::prepare("DELETE FROM `##other` WHERE o_id=? AND o_file=?")->execute(array($gid, $ged_id));
1154
-				break;
1140
+		case 'INDI':
1141
+			Database::prepare("DELETE FROM `##individuals` WHERE i_id=? AND i_file=?")->execute(array($gid, $ged_id));
1142
+			break;
1143
+		case 'FAM':
1144
+			Database::prepare("DELETE FROM `##families` WHERE f_id=? AND f_file=?")->execute(array($gid, $ged_id));
1145
+			break;
1146
+		case 'SOUR':
1147
+			Database::prepare("DELETE FROM `##sources` WHERE s_id=? AND s_file=?")->execute(array($gid, $ged_id));
1148
+			break;
1149
+		case 'OBJE':
1150
+			Database::prepare("DELETE FROM `##media` WHERE m_id=? AND m_file=?")->execute(array($gid, $ged_id));
1151
+			break;
1152
+		default:
1153
+			Database::prepare("DELETE FROM `##other` WHERE o_id=? AND o_file=?")->execute(array($gid, $ged_id));
1154
+			break;
1155 1155
 		}
1156 1156
 
1157 1157
 		if (!$delete) {
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Functions/FunctionsMedia.php 2 patches
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,17 +34,17 @@
 block discarded – undo
34 34
 			$val = -1;
35 35
 		}
36 36
 		switch (substr($val, -1)) {
37
-			case 'g':
38
-			case 'G':
39
-				return (int) $val * 1024 * 1024 * 1024;
40
-			case 'm':
41
-			case 'M':
42
-				return (int) $val * 1024 * 1024;
43
-			case 'k':
44
-			case 'K':
45
-				return (int) $val * 1024;
46
-			default:
47
-				return (int) $val;
37
+		case 'g':
38
+		case 'G':
39
+			return (int) $val * 1024 * 1024 * 1024;
40
+		case 'm':
41
+		case 'M':
42
+			return (int) $val * 1024 * 1024;
43
+		case 'k':
44
+		case 'K':
45
+			return (int) $val * 1024;
46
+		default:
47
+			return (int) $val;
48 48
 		}
49 49
 	}
50 50
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Functions/FunctionsPrint.php 2 patches
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 	public static function printPedigreePerson(Individual $person = null, $show_full = 1) {
51 51
 
52 52
 		switch ($show_full) {
53
-			case 0:
54
-				if ($person) {
55
-					echo Theme::theme()->individualBoxSmall($person);
56
-				} else {
57
-					echo Theme::theme()->individualBoxSmallEmpty();
58
-				}
59
-				break;
60
-			case 1:
61
-				if ($person) {
62
-					echo Theme::theme()->individualBox($person);
63
-				} else {
64
-					echo Theme::theme()->individualBoxEmpty();
65
-				}
66
-				break;
53
+		case 0:
54
+			if ($person) {
55
+				echo Theme::theme()->individualBoxSmall($person);
56
+			} else {
57
+				echo Theme::theme()->individualBoxSmallEmpty();
58
+			}
59
+			break;
60
+		case 1:
61
+			if ($person) {
62
+				echo Theme::theme()->individualBox($person);
63
+			} else {
64
+				echo Theme::theme()->individualBoxEmpty();
65
+			}
66
+			break;
67 67
 		}
68 68
 	}
69 69
 
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
 					$age      = Date::getAge($parent->getBirthDate(), $birth_date, 2);
260 260
 					$deatdate = $parent->getDeathDate();
261 261
 					switch ($parent->getSex()) {
262
-						case 'F':
263
-							// Highlight mothers who die in childbirth or shortly afterwards
264
-							if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
265
-								$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
266
-							} else {
267
-								$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
268
-							}
269
-							break;
270
-						case 'M':
271
-							// Highlight fathers who die before the birth
272
-							if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
273
-								$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
274
-							} else {
275
-								$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
276
-							}
277
-							break;
278
-						default:
279
-							$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
280
-							break;
262
+					case 'F':
263
+						// Highlight mothers who die in childbirth or shortly afterwards
264
+						if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
265
+							$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
266
+						} else {
267
+							$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
268
+						}
269
+						break;
270
+					case 'M':
271
+						// Highlight fathers who die before the birth
272
+						if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
273
+							$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
274
+						} else {
275
+							$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
276
+						}
277
+						break;
278
+					default:
279
+						$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
280
+						break;
281 281
 					}
282 282
 				}
283 283
 			}
@@ -578,33 +578,33 @@  discard block
 block discarded – undo
578 578
 
579 579
 		// -- Add from pick list
580 580
 		switch ($type) {
581
-			case "INDI":
582
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
583
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
584
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
585
-				break;
586
-			case "FAM":
587
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
588
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
589
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
590
-				break;
591
-			case "SOUR":
592
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
593
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
594
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
595
-				break;
596
-			case "NOTE":
597
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
598
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
599
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
600
-				break;
601
-			case "REPO":
602
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
603
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
604
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
605
-				break;
606
-			default:
607
-				return;
581
+		case "INDI":
582
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
583
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
584
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
585
+			break;
586
+		case "FAM":
587
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
588
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
589
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
590
+			break;
591
+		case "SOUR":
592
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
593
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
594
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
595
+			break;
596
+		case "NOTE":
597
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
598
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
599
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
600
+			break;
601
+		case "REPO":
602
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
603
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
604
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
605
+			break;
606
+		default:
607
+			return;
608 608
 		}
609 609
 		$addfacts            = array_merge(self::checkFactUnique($uniquefacts, $usedfacts, $type), $addfacts);
610 610
 		$quickfacts          = array_intersect($quickfacts, $addfacts);
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Functions/FunctionsPrintFacts.php 2 patches
Switch Indentation   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -60,34 +60,34 @@  discard block
 block discarded – undo
60 60
 
61 61
 		// Some facts don't get printed here ...
62 62
 		switch ($fact->getTag()) {
63
-			case 'NOTE':
64
-				self::printMainNotes($fact, 1);
63
+		case 'NOTE':
64
+			self::printMainNotes($fact, 1);
65 65
 
66
-				return;
67
-			case 'SOUR':
68
-				self::printMainSources($fact, 1);
66
+			return;
67
+		case 'SOUR':
68
+			self::printMainSources($fact, 1);
69 69
 
70
-				return;
71
-			case 'OBJE':
72
-				self::printMainMedia($fact, 1);
70
+			return;
71
+		case 'OBJE':
72
+			self::printMainMedia($fact, 1);
73 73
 
74
+			return;
75
+		case 'FAMC':
76
+		case 'FAMS':
77
+		case 'CHIL':
78
+		case 'HUSB':
79
+		case 'WIFE':
80
+			// These are internal links, not facts
81
+			return;
82
+		case '_WT_OBJE_SORT':
83
+			// These links are used internally to record the sort order.
84
+			return;
85
+		default:
86
+			// Hide unrecognized/custom tags?
87
+			if ($fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') && !GedcomTag::isTag($fact->getTag())) {
74 88
 				return;
75
-			case 'FAMC':
76
-			case 'FAMS':
77
-			case 'CHIL':
78
-			case 'HUSB':
79
-			case 'WIFE':
80
-				// These are internal links, not facts
81
-				return;
82
-			case '_WT_OBJE_SORT':
83
-				// These links are used internally to record the sort order.
84
-				return;
85
-			default:
86
-				// Hide unrecognized/custom tags?
87
-				if ($fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') && !GedcomTag::isTag($fact->getTag())) {
88
-					return;
89
-				}
90
-				break;
89
+			}
90
+			break;
91 91
 		}
92 92
 
93 93
 		// Who is this fact about?  Need it to translate fact label correctly
@@ -131,35 +131,35 @@  discard block
 block discarded – undo
131 131
 		}
132 132
 
133 133
 		switch ($fact->getTag()) {
134
-			case 'EVEN':
135
-			case 'FACT':
136
-				if (GedcomTag::isTag($type)) {
137
-					// Some users (just Meliza?) use "1 EVEN/2 TYPE BIRT".  Translate the TYPE.
138
-					$label = GedcomTag::getLabel($type, $label_person);
139
-					$type  = ''; // Do not print this again
140
-				} elseif ($type) {
141
-					// We don't have a translation for $type - but a custom translation might exist.
142
-					$label = I18N::translate(Filter::escapeHtml($type));
143
-					$type  = ''; // Do not print this again
144
-				} else {
145
-					// An unspecified fact/event
146
-					$label = $fact->getLabel();
147
-				}
148
-				break;
149
-			case 'MARR':
150
-				// This is a hack for a proprietory extension.  Is it still used/needed?
151
-				$utype = strtoupper($type);
152
-				if ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS') {
153
-					$label = GedcomTag::getLabel('MARR_' . $utype, $label_person);
154
-					$type  = ''; // Do not print this again
155
-				} else {
156
-					$label = $fact->getLabel();
157
-				}
158
-				break;
159
-			default:
160
-				// Normal fact/event
134
+		case 'EVEN':
135
+		case 'FACT':
136
+			if (GedcomTag::isTag($type)) {
137
+				// Some users (just Meliza?) use "1 EVEN/2 TYPE BIRT".  Translate the TYPE.
138
+				$label = GedcomTag::getLabel($type, $label_person);
139
+				$type  = ''; // Do not print this again
140
+			} elseif ($type) {
141
+				// We don't have a translation for $type - but a custom translation might exist.
142
+				$label = I18N::translate(Filter::escapeHtml($type));
143
+				$type  = ''; // Do not print this again
144
+			} else {
145
+				// An unspecified fact/event
161 146
 				$label = $fact->getLabel();
162
-				break;
147
+			}
148
+			break;
149
+		case 'MARR':
150
+			// This is a hack for a proprietory extension.  Is it still used/needed?
151
+			$utype = strtoupper($type);
152
+			if ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS') {
153
+				$label = GedcomTag::getLabel('MARR_' . $utype, $label_person);
154
+				$type  = ''; // Do not print this again
155
+			} else {
156
+				$label = $fact->getLabel();
157
+			}
158
+			break;
159
+		default:
160
+			// Normal fact/event
161
+			$label = $fact->getLabel();
162
+			break;
163 163
 		}
164 164
 
165 165
 		echo '<tr class="', $styleadd, '">';
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
 		}
209 209
 
210 210
 		switch ($fact->getTag()) {
211
-			case '_BIRT_CHIL':
212
-				echo '<br>', /* I18N: Abbreviation for "number %s" */
213
-				I18N::translate('#%s', ++$n_chil);
214
-				break;
215
-			case '_BIRT_GCHI':
216
-			case '_BIRT_GCH1':
217
-			case '_BIRT_GCH2':
218
-				echo '<br>', I18N::translate('#%s', ++$n_gchi);
219
-				break;
211
+		case '_BIRT_CHIL':
212
+			echo '<br>', /* I18N: Abbreviation for "number %s" */
213
+			I18N::translate('#%s', ++$n_chil);
214
+			break;
215
+		case '_BIRT_GCHI':
216
+		case '_BIRT_GCH1':
217
+		case '_BIRT_GCH2':
218
+			echo '<br>', I18N::translate('#%s', ++$n_gchi);
219
+			break;
220 220
 		}
221 221
 
222 222
 		echo '</td><td class="optionbox ', $styleadd, ' wrap">';
@@ -237,92 +237,92 @@  discard block
 block discarded – undo
237 237
 
238 238
 		// Print the value of this fact/event
239 239
 		switch ($fact->getTag()) {
240
-			case 'ADDR':
241
-				echo $fact->getValue();
242
-				break;
243
-			case 'AFN':
244
-				echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', Filter::escapeUrl($fact->getValue()), '">', Filter::escapeHtml($fact->getValue()), '</a></div>';
245
-				break;
246
-			case 'ASSO':
247
-				// we handle this later, in format_asso_rela_record()
248
-				break;
249
-			case 'EMAIL':
250
-			case 'EMAI':
251
-			case '_EMAIL':
252
-				echo '<div class="field"><a href="mailto:', Filter::escapeHtml($fact->getValue()), '">', Filter::escapeHtml($fact->getValue()), '</a></div>';
253
-				break;
254
-			case 'FILE':
255
-				if (Auth::isEditor($fact->getParent()->getTree())) {
256
-					echo '<div class="field">', Filter::escapeHtml($fact->getValue()), '</div>';
257
-				}
258
-				break;
259
-			case 'RESN':
260
-				echo '<div class="field">';
261
-				switch ($fact->getValue()) {
262
-					case 'none':
263
-						// Note: "1 RESN none" is not valid gedcom.
264
-						// However, webtrees privacy rules will interpret it as "show an otherwise private record to public".
265
-						echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
266
-						break;
267
-					case 'privacy':
268
-						echo '<i class="icon-class-none"></i> ', I18N::translate('Show to members');
269
-						break;
270
-					case 'confidential':
271
-						echo '<i class="icon-confidential-none"></i> ', I18N::translate('Show to managers');
272
-						break;
273
-					case 'locked':
274
-						echo '<i class="icon-locked-none"></i> ', I18N::translate('Only managers can edit');
275
-						break;
276
-					default:
277
-						echo Filter::escapeHtml($fact->getValue());
278
-						break;
279
-				}
240
+		case 'ADDR':
241
+			echo $fact->getValue();
242
+			break;
243
+		case 'AFN':
244
+			echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', Filter::escapeUrl($fact->getValue()), '">', Filter::escapeHtml($fact->getValue()), '</a></div>';
245
+			break;
246
+		case 'ASSO':
247
+			// we handle this later, in format_asso_rela_record()
248
+			break;
249
+		case 'EMAIL':
250
+		case 'EMAI':
251
+		case '_EMAIL':
252
+			echo '<div class="field"><a href="mailto:', Filter::escapeHtml($fact->getValue()), '">', Filter::escapeHtml($fact->getValue()), '</a></div>';
253
+			break;
254
+		case 'FILE':
255
+			if (Auth::isEditor($fact->getParent()->getTree())) {
256
+				echo '<div class="field">', Filter::escapeHtml($fact->getValue()), '</div>';
257
+			}
258
+			break;
259
+		case 'RESN':
260
+			echo '<div class="field">';
261
+			switch ($fact->getValue()) {
262
+			case 'none':
263
+			// Note: "1 RESN none" is not valid gedcom.
264
+			// However, webtrees privacy rules will interpret it as "show an otherwise private record to public".
265
+			echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
266
+			break;
267
+			case 'privacy':
268
+			echo '<i class="icon-class-none"></i> ', I18N::translate('Show to members');
269
+			break;
270
+			case 'confidential':
271
+			echo '<i class="icon-confidential-none"></i> ', I18N::translate('Show to managers');
272
+			break;
273
+			case 'locked':
274
+			echo '<i class="icon-locked-none"></i> ', I18N::translate('Only managers can edit');
275
+			break;
276
+			default:
277
+			echo Filter::escapeHtml($fact->getValue());
278
+			break;
279
+			}
280 280
 				echo '</div>';
281 281
 				break;
282
-			case 'PUBL': // Publication details might contain URLs.
283
-				echo '<div class="field">', Filter::expandUrls($fact->getValue()), '</div>';
284
-				break;
285
-			case 'REPO':
286
-				if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
287
-					self::printRepositoryRecord($match[1]);
288
-				} else {
289
-					echo '<div class="error">', Filter::escapeHtml($fact->getValue()), '</div>';
290
-				}
291
-				break;
292
-			case 'URL':
293
-			case '_URL':
294
-			case 'WWW':
295
-				echo '<div class="field"><a href="', Filter::escapeHtml($fact->getValue()), '">', Filter::escapeHtml($fact->getValue()), '</a></div>';
296
-				break;
297
-			case 'TEXT': // 0 SOUR / 1 TEXT
298
-				echo '<div class="field">', nl2br(Filter::escapeHtml($fact->getValue()), false), '</div>';
299
-				break;
282
+		case 'PUBL': // Publication details might contain URLs.
283
+			echo '<div class="field">', Filter::expandUrls($fact->getValue()), '</div>';
284
+			break;
285
+		case 'REPO':
286
+			if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
287
+				self::printRepositoryRecord($match[1]);
288
+			} else {
289
+				echo '<div class="error">', Filter::escapeHtml($fact->getValue()), '</div>';
290
+			}
291
+			break;
292
+		case 'URL':
293
+		case '_URL':
294
+		case 'WWW':
295
+			echo '<div class="field"><a href="', Filter::escapeHtml($fact->getValue()), '">', Filter::escapeHtml($fact->getValue()), '</a></div>';
296
+			break;
297
+		case 'TEXT': // 0 SOUR / 1 TEXT
298
+			echo '<div class="field">', nl2br(Filter::escapeHtml($fact->getValue()), false), '</div>';
299
+			break;
300
+		default:
301
+			// Display the value for all other facts/events
302
+			switch ($fact->getValue()) {
303
+			case '':
304
+			// Nothing to display
305
+			break;
306
+			case 'N':
307
+			// Not valid GEDCOM
308
+			echo '<div class="field">', I18N::translate('No'), '</div>';
309
+			break;
310
+			case 'Y':
311
+			// Do not display "Yes".
312
+			break;
300 313
 			default:
301
-				// Display the value for all other facts/events
302
-				switch ($fact->getValue()) {
303
-					case '':
304
-						// Nothing to display
305
-						break;
306
-					case 'N':
307
-						// Not valid GEDCOM
308
-						echo '<div class="field">', I18N::translate('No'), '</div>';
309
-						break;
310
-					case 'Y':
311
-						// Do not display "Yes".
312
-						break;
313
-					default:
314
-						if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
315
-							$target = GedcomRecord::getInstance($match[1], $fact->getParent()->getTree());
316
-							if ($target) {
317
-								echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>';
318
-							} else {
319
-								echo '<div class="error">', Filter::escapeHtml($fact->getValue()), '</div>';
320
-							}
321
-						} else {
322
-							echo '<div class="field"><span dir="auto">', Filter::escapeHtml($fact->getValue()), '</span></div>';
323
-						}
324
-						break;
325
-				}
314
+			if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
315
+			$target = GedcomRecord::getInstance($match[1], $fact->getParent()->getTree());
316
+			if ($target) {
317
+				echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>';
318
+			} else {
319
+				echo '<div class="error">', Filter::escapeHtml($fact->getValue()), '</div>';
320
+			}
321
+			} else {
322
+			echo '<div class="field"><span dir="auto">', Filter::escapeHtml($fact->getValue()), '</span></div>';
323
+			}
324
+			break;
325
+			}
326 326
 				break;
327 327
 		}
328 328
 
@@ -362,118 +362,118 @@  discard block
 block discarded – undo
362 362
 		preg_match_all('/\n2 (' . WT_REGEX_TAG . ') (.+)/', $fact->getGedcom(), $matches, PREG_SET_ORDER);
363 363
 		foreach ($matches as $match) {
364 364
 			switch ($match[1]) {
365
-				case 'DATE':
366
-				case 'TIME':
367
-				case 'AGE':
368
-				case 'PLAC':
369
-				case 'ADDR':
370
-				case 'ALIA':
371
-				case 'ASSO':
372
-				case '_ASSO':
373
-				case 'DESC':
374
-				case 'RELA':
375
-				case 'STAT':
376
-				case 'TEMP':
377
-				case 'TYPE':
378
-				case 'FAMS':
379
-				case 'CONT':
380
-					// These were already shown at the beginning
381
-					break;
382
-				case 'NOTE':
383
-				case 'OBJE':
384
-				case 'SOUR':
385
-					// These will be shown at the end
386
-					break;
387
-				case 'EVEN': // 0 SOUR / 1 DATA / 2 EVEN / 3 DATE / 3 PLAC
388
-					$events = array();
389
-					foreach (preg_split('/ *, */', $match[2]) as $event) {
390
-						$events[] = GedcomTag::getLabel($event);
391
-					}
392
-					if (count($events) == 1) {
393
-						echo GedcomTag::getLabelValue('EVEN', $event);
394
-					} else {
395
-						echo GedcomTag::getLabelValue('EVEN', implode(I18N::$list_separator, $events));
396
-					}
397
-					if (preg_match('/\n3 DATE (.+)/', $fact->getGedcom(), $date_match)) {
398
-						$date = new Date($date_match[1]);
399
-						echo GedcomTag::getLabelValue('DATE', $date->display());
400
-					}
401
-					if (preg_match('/\n3 PLAC (.+)/', $fact->getGedcom(), $plac_match)) {
402
-						echo GedcomTag::getLabelValue('PLAC', $plac_match[1]);
403
-					}
404
-					break;
405
-				case 'FAMC': // 0 INDI / 1 ADOP / 2 FAMC / 3 ADOP
406
-					$family = Family::getInstance(str_replace('@', '', $match[2]), $fact->getParent()->getTree());
407
-					if ($family) {
408
-						echo GedcomTag::getLabelValue('FAM', '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a>');
409
-						if (preg_match('/\n3 ADOP (HUSB|WIFE|BOTH)/', $fact->getGedcom(), $match)) {
410
-							echo GedcomTag::getLabelValue('ADOP', GedcomCodeAdop::getValue($match[1], $label_person));
411
-						}
412
-					} else {
413
-						echo GedcomTag::getLabelValue('FAM', '<span class="error">' . $match[2] . '</span>');
414
-					}
415
-					break;
416
-				case '_WT_USER':
417
-					$user = User::findByIdentifier($match[2]); // may not exist
418
-					if ($user) {
419
-						echo GedcomTag::getLabelValue('_WT_USER', $user->getRealNameHtml());
420
-					} else {
421
-						echo GedcomTag::getLabelValue('_WT_USER', Filter::escapeHtml($match[2]));
422
-					}
423
-					break;
424
-				case 'RESN':
425
-					switch ($match[2]) {
426
-						case 'none':
427
-							// Note: "2 RESN none" is not valid gedcom.
428
-							// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
429
-							echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-none"></i> ' . I18N::translate('Show to visitors'));
430
-							break;
431
-						case 'privacy':
432
-							echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-privacy"></i> ' . I18N::translate('Show to members'));
433
-							break;
434
-						case 'confidential':
435
-							echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-confidential"></i> ' . I18N::translate('Show to managers'));
436
-							break;
437
-						case 'locked':
438
-							echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-locked"></i> ' . I18N::translate('Only managers can edit'));
439
-							break;
440
-						default:
441
-							echo GedcomTag::getLabelValue('RESN', Filter::escapeHtml($match[2]));
442
-							break;
443
-					}
444
-					break;
445
-				case 'CALN':
446
-					echo GedcomTag::getLabelValue('CALN', Filter::expandUrls($match[2]));
447
-					break;
448
-				case 'FORM': // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE
449
-					echo GedcomTag::getLabelValue('FORM', $match[2]);
450
-					if (preg_match('/\n3 TYPE (.+)/', $fact->getGedcom(), $type_match)) {
451
-						echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($type_match[1]));
365
+			case 'DATE':
366
+			case 'TIME':
367
+			case 'AGE':
368
+			case 'PLAC':
369
+			case 'ADDR':
370
+			case 'ALIA':
371
+			case 'ASSO':
372
+			case '_ASSO':
373
+			case 'DESC':
374
+			case 'RELA':
375
+			case 'STAT':
376
+			case 'TEMP':
377
+			case 'TYPE':
378
+			case 'FAMS':
379
+			case 'CONT':
380
+				// These were already shown at the beginning
381
+				break;
382
+			case 'NOTE':
383
+			case 'OBJE':
384
+			case 'SOUR':
385
+				// These will be shown at the end
386
+				break;
387
+			case 'EVEN': // 0 SOUR / 1 DATA / 2 EVEN / 3 DATE / 3 PLAC
388
+				$events = array();
389
+				foreach (preg_split('/ *, */', $match[2]) as $event) {
390
+					$events[] = GedcomTag::getLabel($event);
391
+				}
392
+				if (count($events) == 1) {
393
+					echo GedcomTag::getLabelValue('EVEN', $event);
394
+				} else {
395
+					echo GedcomTag::getLabelValue('EVEN', implode(I18N::$list_separator, $events));
396
+				}
397
+				if (preg_match('/\n3 DATE (.+)/', $fact->getGedcom(), $date_match)) {
398
+					$date = new Date($date_match[1]);
399
+					echo GedcomTag::getLabelValue('DATE', $date->display());
400
+				}
401
+				if (preg_match('/\n3 PLAC (.+)/', $fact->getGedcom(), $plac_match)) {
402
+					echo GedcomTag::getLabelValue('PLAC', $plac_match[1]);
403
+				}
404
+				break;
405
+			case 'FAMC': // 0 INDI / 1 ADOP / 2 FAMC / 3 ADOP
406
+				$family = Family::getInstance(str_replace('@', '', $match[2]), $fact->getParent()->getTree());
407
+				if ($family) {
408
+					echo GedcomTag::getLabelValue('FAM', '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a>');
409
+					if (preg_match('/\n3 ADOP (HUSB|WIFE|BOTH)/', $fact->getGedcom(), $match)) {
410
+						echo GedcomTag::getLabelValue('ADOP', GedcomCodeAdop::getValue($match[1], $label_person));
452 411
 					}
453
-					break;
454
-				case 'URL':
455
-				case '_URL':
456
-				case 'WWW':
457
-					$link = '<a href="' . Filter::escapeHtml($match[2]) . '">' . Filter::escapeHtml($match[2]) . '</a>';
458
-					echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
459
-					break;
412
+				} else {
413
+					echo GedcomTag::getLabelValue('FAM', '<span class="error">' . $match[2] . '</span>');
414
+				}
415
+				break;
416
+			case '_WT_USER':
417
+				$user = User::findByIdentifier($match[2]); // may not exist
418
+				if ($user) {
419
+					echo GedcomTag::getLabelValue('_WT_USER', $user->getRealNameHtml());
420
+				} else {
421
+					echo GedcomTag::getLabelValue('_WT_USER', Filter::escapeHtml($match[2]));
422
+				}
423
+				break;
424
+			case 'RESN':
425
+				switch ($match[2]) {
426
+				case 'none':
427
+				// Note: "2 RESN none" is not valid gedcom.
428
+				// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
429
+				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-none"></i> ' . I18N::translate('Show to visitors'));
430
+				break;
431
+				case 'privacy':
432
+				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-privacy"></i> ' . I18N::translate('Show to members'));
433
+				break;
434
+				case 'confidential':
435
+				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-confidential"></i> ' . I18N::translate('Show to managers'));
436
+				break;
437
+				case 'locked':
438
+				echo GedcomTag::getLabelValue('RESN', '<i class="icon-resn-locked"></i> ' . I18N::translate('Only managers can edit'));
439
+				break;
460 440
 				default:
461
-					if (!$fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') || GedcomTag::isTag($match[1])) {
462
-						if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $match[2], $xmatch)) {
463
-							// Links
464
-							$linked_record = GedcomRecord::getInstance($xmatch[1], $fact->getParent()->getTree());
465
-							if ($linked_record) {
466
-								$link = '<a href="' . $linked_record->getHtmlUrl() . '">' . $linked_record->getFullName() . '</a>';
467
-								echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
468
-							} else {
469
-								echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], Filter::escapeHtml($match[2]));
470
-							}
441
+				echo GedcomTag::getLabelValue('RESN', Filter::escapeHtml($match[2]));
442
+				break;
443
+				}
444
+					break;
445
+			case 'CALN':
446
+				echo GedcomTag::getLabelValue('CALN', Filter::expandUrls($match[2]));
447
+				break;
448
+			case 'FORM': // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE
449
+				echo GedcomTag::getLabelValue('FORM', $match[2]);
450
+				if (preg_match('/\n3 TYPE (.+)/', $fact->getGedcom(), $type_match)) {
451
+					echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($type_match[1]));
452
+				}
453
+				break;
454
+			case 'URL':
455
+			case '_URL':
456
+			case 'WWW':
457
+				$link = '<a href="' . Filter::escapeHtml($match[2]) . '">' . Filter::escapeHtml($match[2]) . '</a>';
458
+				echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
459
+				break;
460
+			default:
461
+				if (!$fact->getParent()->getTree()->getPreference('HIDE_GEDCOM_ERRORS') || GedcomTag::isTag($match[1])) {
462
+					if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $match[2], $xmatch)) {
463
+						// Links
464
+						$linked_record = GedcomRecord::getInstance($xmatch[1], $fact->getParent()->getTree());
465
+						if ($linked_record) {
466
+							$link = '<a href="' . $linked_record->getHtmlUrl() . '">' . $linked_record->getFullName() . '</a>';
467
+							echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
471 468
 						} else {
472
-							// Non links
473 469
 							echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], Filter::escapeHtml($match[2]));
474 470
 						}
471
+					} else {
472
+						// Non links
473
+						echo GedcomTag::getLabelValue($fact->getTag() . ':' . $match[1], Filter::escapeHtml($match[2]));
475 474
 					}
476
-					break;
475
+				}
476
+				break;
477 477
 			}
478 478
 		}
479 479
 		echo self::printFactSources($fact->getGedcom(), 2);
@@ -815,23 +815,23 @@  discard block
 block discarded – undo
815 815
 						foreach ($rmatches[1] as $rmatch) {
816 816
 							echo '<br><span class="label">', GedcomTag::getLabel('RESN'), ':</span> <span class="field">';
817 817
 							switch ($rmatch) {
818
-								case 'none':
819
-									// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
820
-									// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
821
-									echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
822
-									break;
823
-								case 'privacy':
824
-									echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
825
-									break;
826
-								case 'confidential':
827
-									echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
828
-									break;
829
-								case 'locked':
830
-									echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
831
-									break;
832
-								default:
833
-									echo $rmatch;
834
-									break;
818
+							case 'none':
819
+								// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
820
+								// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
821
+								echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
822
+								break;
823
+							case 'privacy':
824
+								echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
825
+								break;
826
+							case 'confidential':
827
+								echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
828
+								break;
829
+							case 'locked':
830
+								echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
831
+								break;
832
+							default:
833
+								echo $rmatch;
834
+								break;
835 835
 							}
836 836
 							echo '</span>';
837 837
 						}
@@ -1081,23 +1081,23 @@  discard block
 block discarded – undo
1081 1081
 				foreach ($matches[1] as $match) {
1082 1082
 					echo '<br><span class="label">', GedcomTag::getLabel('RESN'), ':</span> <span class="field">';
1083 1083
 					switch ($match) {
1084
-						case 'none':
1085
-							// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
1086
-							// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
1087
-							echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
1088
-							break;
1089
-						case 'privacy':
1090
-							echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
1091
-							break;
1092
-						case 'confidential':
1093
-							echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
1094
-							break;
1095
-						case 'locked':
1096
-							echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
1097
-							break;
1098
-						default:
1099
-							echo $match;
1100
-							break;
1084
+					case 'none':
1085
+						// Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
1086
+						// However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
1087
+						echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
1088
+						break;
1089
+					case 'privacy':
1090
+						echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
1091
+						break;
1092
+					case 'confidential':
1093
+						echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
1094
+						break;
1095
+					case 'locked':
1096
+						echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
1097
+						break;
1098
+					default:
1099
+						echo $match;
1100
+						break;
1101 1101
 					}
1102 1102
 					echo '</span>';
1103 1103
 				}
@@ -1198,12 +1198,12 @@  discard block
 block discarded – undo
1198 1198
 					}
1199 1199
 
1200 1200
 					switch ($media->isPrimary()) {
1201
-						case 'Y':
1202
-							echo GedcomTag::getLabelValue('_PRIM', I18N::translate('yes'));
1203
-							break;
1204
-						case 'N':
1205
-							echo GedcomTag::getLabelValue('_PRIM', I18N::translate('no'));
1206
-							break;
1201
+					case 'Y':
1202
+						echo GedcomTag::getLabelValue('_PRIM', I18N::translate('yes'));
1203
+						break;
1204
+					case 'N':
1205
+						echo GedcomTag::getLabelValue('_PRIM', I18N::translate('no'));
1206
+						break;
1207 1207
 					}
1208 1208
 					echo FunctionsPrint::printFactNotes($media->getGedcom(), 1);
1209 1209
 					echo self::printFactSources($media->getGedcom(), 1);
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Functions/FunctionsPrintLists.php 2 patches
Switch Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1687,37 +1687,37 @@  discard block
 block discarded – undo
1687 1687
 
1688 1688
 		}
1689 1689
 		switch ($style) {
1690
-			case 1:
1691
-				return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
1692
-			case 2:
1693
-				return implode(I18N::$list_separator, $html);
1694
-			case 3:
1695
-				$i     = 0;
1696
-				$count = count($html);
1697
-				if ($count > 36) {
1698
-					$col = 4;
1699
-				} elseif ($count > 18) {
1700
-					$col = 3;
1701
-				} elseif ($count > 6) {
1702
-					$col = 2;
1703
-				} else {
1704
-					$col = 1;
1705
-				}
1706
-				$newcol = ceil($count / $col);
1707
-				$html2  = '<table class="list_table"><tr>';
1708
-				$html2 .= '<td class="list_value" style="padding: 14px;">';
1709
-
1710
-				foreach ($html as $surns) {
1711
-					$html2 .= $surns . '<br>';
1712
-					$i++;
1713
-					if ($i == $newcol && $i < $count) {
1714
-						$html2 .= '</td><td class="list_value" style="padding: 14px;">';
1715
-						$newcol = $i + ceil($count / $col);
1716
-					}
1690
+		case 1:
1691
+			return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
1692
+		case 2:
1693
+			return implode(I18N::$list_separator, $html);
1694
+		case 3:
1695
+			$i     = 0;
1696
+			$count = count($html);
1697
+			if ($count > 36) {
1698
+				$col = 4;
1699
+			} elseif ($count > 18) {
1700
+				$col = 3;
1701
+			} elseif ($count > 6) {
1702
+				$col = 2;
1703
+			} else {
1704
+				$col = 1;
1705
+			}
1706
+			$newcol = ceil($count / $col);
1707
+			$html2  = '<table class="list_table"><tr>';
1708
+			$html2 .= '<td class="list_value" style="padding: 14px;">';
1709
+
1710
+			foreach ($html as $surns) {
1711
+				$html2 .= $surns . '<br>';
1712
+				$i++;
1713
+				if ($i == $newcol && $i < $count) {
1714
+					$html2 .= '</td><td class="list_value" style="padding: 14px;">';
1715
+					$newcol = $i + ceil($count / $col);
1717 1716
 				}
1718
-				$html2 .= '</td></tr></table>';
1717
+			}
1718
+			$html2 .= '</td></tr></table>';
1719 1719
 
1720
-				return $html2;
1720
+			return $html2;
1721 1721
 		}
1722 1722
 	}
1723 1723
 
@@ -1747,15 +1747,15 @@  discard block
 block discarded – undo
1747 1747
 		}
1748 1748
 
1749 1749
 		switch ($sort) {
1750
-			case 'name':
1751
-				uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSortName');
1752
-				break;
1753
-			case 'date_asc':
1754
-				uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1755
-				$arr = array_reverse($arr);
1756
-				break;
1757
-			case 'date_desc':
1758
-				uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1750
+		case 'name':
1751
+			uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSortName');
1752
+			break;
1753
+		case 'date_asc':
1754
+			uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1755
+			$arr = array_reverse($arr);
1756
+			break;
1757
+		case 'date_desc':
1758
+			uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1759 1759
 		}
1760 1760
 		$html = '';
1761 1761
 		foreach ($arr as $value) {
@@ -1788,15 +1788,15 @@  discard block
 block discarded – undo
1788 1788
 		$n        = 0;
1789 1789
 		$table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
1790 1790
 		switch ($sort) {
1791
-			case 'name':        //name
1792
-				$aaSorting = "[5,'asc'], [4,'desc']";
1793
-				break;
1794
-			case 'date_asc':    //date ascending
1795
-				$aaSorting = "[4,'asc'], [5,'asc']";
1796
-				break;
1797
-			case 'date_desc':   //date descending
1798
-				$aaSorting = "[4,'desc'], [5,'asc']";
1799
-				break;
1791
+		case 'name':        //name
1792
+			$aaSorting = "[5,'asc'], [4,'desc']";
1793
+			break;
1794
+		case 'date_asc':    //date ascending
1795
+			$aaSorting = "[4,'asc'], [5,'asc']";
1796
+			break;
1797
+		case 'date_desc':   //date descending
1798
+			$aaSorting = "[4,'desc'], [5,'asc']";
1799
+			break;
1800 1800
 		}
1801 1801
 		$html = '';
1802 1802
 		$controller
@@ -1843,27 +1843,27 @@  discard block
 block discarded – undo
1843 1843
 			}
1844 1844
 			$html .= '<tr><td>';
1845 1845
 			switch ($record::RECORD_TYPE) {
1846
-				case 'INDI':
1847
-					$icon = $record->getSexImage('small');
1848
-					break;
1849
-				case 'FAM':
1850
-					$icon = '<i class="icon-button_family"></i>';
1851
-					break;
1852
-				case 'OBJE':
1853
-					$icon = '<i class="icon-button_media"></i>';
1854
-					break;
1855
-				case 'NOTE':
1856
-					$icon = '<i class="icon-button_note"></i>';
1857
-					break;
1858
-				case 'SOUR':
1859
-					$icon = '<i class="icon-button_source"></i>';
1860
-					break;
1861
-				case 'REPO':
1862
-					$icon = '<i class="icon-button_repository"></i>';
1863
-					break;
1864
-				default:
1865
-					$icon = '&nbsp;';
1866
-					break;
1846
+			case 'INDI':
1847
+				$icon = $record->getSexImage('small');
1848
+				break;
1849
+			case 'FAM':
1850
+				$icon = '<i class="icon-button_family"></i>';
1851
+				break;
1852
+			case 'OBJE':
1853
+				$icon = '<i class="icon-button_media"></i>';
1854
+				break;
1855
+			case 'NOTE':
1856
+				$icon = '<i class="icon-button_note"></i>';
1857
+				break;
1858
+			case 'SOUR':
1859
+				$icon = '<i class="icon-button_source"></i>';
1860
+				break;
1861
+			case 'REPO':
1862
+				$icon = '<i class="icon-button_repository"></i>';
1863
+				break;
1864
+			default:
1865
+				$icon = '&nbsp;';
1866
+				break;
1867 1867
 			}
1868 1868
 			$html .= '<a href="' . $record->getHtmlUrl() . '">' . $icon . '</a>';
1869 1869
 			$html .= '</td>';
@@ -2092,14 +2092,14 @@  discard block
 block discarded – undo
2092 2092
 
2093 2093
 		// Now we've filtered the list, we can sort by event, if required
2094 2094
 		switch ($sort_by) {
2095
-			case 'anniv':
2096
-				// Data is already sorted by anniversary date
2097
-				break;
2098
-			case 'alpha':
2099
-				uasort($filtered_events, function (Fact $x, Fact $y) {
2100
-					return GedcomRecord::compare($x->getParent(), $y->getParent());
2101
-				});
2102
-				break;
2095
+		case 'anniv':
2096
+			// Data is already sorted by anniversary date
2097
+			break;
2098
+		case 'alpha':
2099
+			uasort($filtered_events, function (Fact $x, Fact $y) {
2100
+				return GedcomRecord::compare($x->getParent(), $y->getParent());
2101
+			});
2102
+			break;
2103 2103
 		}
2104 2104
 
2105 2105
 		foreach ($filtered_events as $fact) {
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Functions/FunctionsRtl.php 2 patches
Switch Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -124,227 +124,227 @@  discard block
 block discarded – undo
124 124
 			$closeParIndex = strpos(self::CLOSE_PARENTHESES, $currentLetter); // Which closing parenthesis is this?
125 125
 
126 126
 			switch ($currentLetter) {
127
-				case '<':
128
-					// Assume this '<' starts an HTML element
129
-					$endPos = strpos($workingText, '>'); // look for the terminating '>'
130
-					if ($endPos === false) {
131
-						$endPos = 0;
132
-					}
133
-					$currentLen += $endPos;
134
-					$element = substr($workingText, 0, $currentLen);
135
-					$temp    = strtolower(substr($element, 0, 3));
136
-					if (strlen($element) < 7 && $temp == '<br') {
137
-						if ($numberState) {
138
-							$numberState = false;
139
-							if (self::$currentState == 'RTL') {
140
-								self::$waitingText .= WT_UTF8_PDF;
141
-							}
127
+			case '<':
128
+				// Assume this '<' starts an HTML element
129
+				$endPos = strpos($workingText, '>'); // look for the terminating '>'
130
+				if ($endPos === false) {
131
+					$endPos = 0;
132
+				}
133
+				$currentLen += $endPos;
134
+				$element = substr($workingText, 0, $currentLen);
135
+				$temp    = strtolower(substr($element, 0, 3));
136
+				if (strlen($element) < 7 && $temp == '<br') {
137
+					if ($numberState) {
138
+						$numberState = false;
139
+						if (self::$currentState == 'RTL') {
140
+							self::$waitingText .= WT_UTF8_PDF;
142 141
 						}
143
-						self::breakCurrentSpan($result);
144
-					} elseif (self::$waitingText == '') {
145
-						$result .= $element;
146
-					} else {
147
-						self::$waitingText .= $element;
148 142
 					}
149
-					$workingText = substr($workingText, $currentLen);
150
-					break;
151
-				case '&':
152
-					// Assume this '&' starts an HTML entity
153
-					$endPos = strpos($workingText, ';'); // look for the terminating ';'
143
+					self::breakCurrentSpan($result);
144
+				} elseif (self::$waitingText == '') {
145
+					$result .= $element;
146
+				} else {
147
+					self::$waitingText .= $element;
148
+				}
149
+				$workingText = substr($workingText, $currentLen);
150
+				break;
151
+			case '&':
152
+				// Assume this '&' starts an HTML entity
153
+				$endPos = strpos($workingText, ';'); // look for the terminating ';'
154
+				if ($endPos === false) {
155
+					$endPos = 0;
156
+				}
157
+				$currentLen += $endPos;
158
+				$entity = substr($workingText, 0, $currentLen);
159
+				if (strtolower($entity) == '&nbsp;') {
160
+					$entity .= '&nbsp;'; // Ensure consistent case for this entity
161
+				}
162
+				if (self::$waitingText == '') {
163
+					$result .= $entity;
164
+				} else {
165
+					self::$waitingText .= $entity;
166
+				}
167
+				$workingText = substr($workingText, $currentLen);
168
+				break;
169
+			case '{':
170
+				if (substr($workingText, 1, 1) == '{') {
171
+					// Assume this '{{' starts a TCPDF directive
172
+					$endPos = strpos($workingText, '}}'); // look for the terminating '}}'
154 173
 					if ($endPos === false) {
155 174
 						$endPos = 0;
156 175
 					}
157
-					$currentLen += $endPos;
158
-					$entity = substr($workingText, 0, $currentLen);
159
-					if (strtolower($entity) == '&nbsp;') {
160
-						$entity .= '&nbsp;'; // Ensure consistent case for this entity
161
-					}
162
-					if (self::$waitingText == '') {
163
-						$result .= $entity;
164
-					} else {
165
-						self::$waitingText .= $entity;
166
-					}
167
-					$workingText = substr($workingText, $currentLen);
176
+					$currentLen        = $endPos + 2;
177
+					$directive         = substr($workingText, 0, $currentLen);
178
+					$workingText       = substr($workingText, $currentLen);
179
+					$result            = $result . self::$waitingText . $directive;
180
+					self::$waitingText = '';
168 181
 					break;
169
-				case '{':
170
-					if (substr($workingText, 1, 1) == '{') {
171
-						// Assume this '{{' starts a TCPDF directive
172
-						$endPos = strpos($workingText, '}}'); // look for the terminating '}}'
173
-						if ($endPos === false) {
174
-							$endPos = 0;
182
+				}
183
+			default:
184
+				// Look for strings of numbers with optional leading or trailing + or -
185
+				// and with optional embedded numeric punctuation
186
+				if ($numberState) {
187
+					// If we're inside a numeric string, look for reasons to end it
188
+					$offset    = 0; // Be sure to look at the current character first
189
+					$charArray = self::getChar($workingText . "\n", $offset);
190
+					if (strpos(self::NUMBERS, $charArray['letter']) === false) {
191
+						// This is not a digit.  Is it numeric punctuation?
192
+						if (substr($workingText . "\n", $offset, 6) == '&nbsp;') {
193
+							$offset += 6; // This could be numeric punctuation
194
+						} elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) {
195
+							$offset += $charArray['length']; // This could be numeric punctuation
175 196
 						}
176
-						$currentLen        = $endPos + 2;
177
-						$directive         = substr($workingText, 0, $currentLen);
178
-						$workingText       = substr($workingText, $currentLen);
179
-						$result            = $result . self::$waitingText . $directive;
180
-						self::$waitingText = '';
181
-						break;
182
-					}
183
-				default:
184
-					// Look for strings of numbers with optional leading or trailing + or -
185
-					// and with optional embedded numeric punctuation
186
-					if ($numberState) {
187
-						// If we're inside a numeric string, look for reasons to end it
188
-						$offset    = 0; // Be sure to look at the current character first
197
+						// If the next character is a digit, the current character is numeric punctuation
189 198
 						$charArray = self::getChar($workingText . "\n", $offset);
190 199
 						if (strpos(self::NUMBERS, $charArray['letter']) === false) {
191
-							// This is not a digit.  Is it numeric punctuation?
192
-							if (substr($workingText . "\n", $offset, 6) == '&nbsp;') {
193
-								$offset += 6; // This could be numeric punctuation
194
-							} elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) {
195
-								$offset += $charArray['length']; // This could be numeric punctuation
196
-							}
197
-							// If the next character is a digit, the current character is numeric punctuation
198
-							$charArray = self::getChar($workingText . "\n", $offset);
199
-							if (strpos(self::NUMBERS, $charArray['letter']) === false) {
200
-								// This is not a digit.  End the run of digits and punctuation.
201
-								$numberState = false;
202
-								if (self::$currentState == 'RTL') {
203
-									if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) {
204
-										$currentLetter = WT_UTF8_PDF . $currentLetter;
205
-									} else {
206
-										$currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run
207
-									}
200
+							// This is not a digit.  End the run of digits and punctuation.
201
+							$numberState = false;
202
+							if (self::$currentState == 'RTL') {
203
+								if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) {
204
+									$currentLetter = WT_UTF8_PDF . $currentLetter;
205
+								} else {
206
+									$currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run
208 207
 								}
209 208
 							}
210 209
 						}
211
-					} else {
212
-						// If we're outside a numeric string, look for reasons to start it
213
-						if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) {
214
-							// This might be a number lead-in
215
-							$offset   = $currentLen;
216
-							$nextChar = substr($workingText . "\n", $offset, 1);
217
-							if (strpos(self::NUMBERS, $nextChar) !== false) {
218
-								$numberState = true; // We found a digit: the lead-in is therefore numeric
219
-								if (self::$currentState == 'RTL') {
220
-									$currentLetter = WT_UTF8_LRE . $currentLetter;
221
-								}
222
-							}
223
-						} elseif (strpos(self::NUMBERS, $currentLetter) !== false) {
224
-							$numberState = true; // The current letter is a digit
210
+					}
211
+				} else {
212
+					// If we're outside a numeric string, look for reasons to start it
213
+					if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) {
214
+						// This might be a number lead-in
215
+						$offset   = $currentLen;
216
+						$nextChar = substr($workingText . "\n", $offset, 1);
217
+						if (strpos(self::NUMBERS, $nextChar) !== false) {
218
+							$numberState = true; // We found a digit: the lead-in is therefore numeric
225 219
 							if (self::$currentState == 'RTL') {
226 220
 								$currentLetter = WT_UTF8_LRE . $currentLetter;
227 221
 							}
228 222
 						}
223
+					} elseif (strpos(self::NUMBERS, $currentLetter) !== false) {
224
+						$numberState = true; // The current letter is a digit
225
+						if (self::$currentState == 'RTL') {
226
+							$currentLetter = WT_UTF8_LRE . $currentLetter;
227
+						}
229 228
 					}
229
+				}
230
+
231
+				// Determine the directionality of the current UTF-8 character
232
+				$newState = self::$currentState;
233
+				while (true) {
234
+					if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') {
235
+						if (self::$currentState == '') {
236
+							$newState = 'RTL';
237
+							break;
238
+						}
230 239
 
231
-					// Determine the directionality of the current UTF-8 character
232
-					$newState = self::$currentState;
233
-					while (true) {
234
-						if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') {
235
-							if (self::$currentState == '') {
240
+						if (self::$currentState == 'RTL') {
241
+							break;
242
+						}
243
+						// Switch to RTL only if this isn't a solitary RTL letter
244
+						$tempText = substr($workingText, $currentLen);
245
+						while ($tempText != '') {
246
+							$nextCharArray = self::getChar($tempText, 0);
247
+							$nextLetter    = $nextCharArray['letter'];
248
+							$nextLen       = $nextCharArray['length'];
249
+							$tempText      = substr($tempText, $nextLen);
250
+
251
+							if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') {
236 252
 								$newState = 'RTL';
237
-								break;
253
+								break 2;
238 254
 							}
239 255
 
240
-							if (self::$currentState == 'RTL') {
241
-								break;
256
+							if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) {
257
+								$newState = 'RTL';
258
+								break 2;
242 259
 							}
243
-							// Switch to RTL only if this isn't a solitary RTL letter
244
-							$tempText = substr($workingText, $currentLen);
245
-							while ($tempText != '') {
246
-								$nextCharArray = self::getChar($tempText, 0);
247
-								$nextLetter    = $nextCharArray['letter'];
248
-								$nextLen       = $nextCharArray['length'];
249
-								$tempText      = substr($tempText, $nextLen);
250
-
251
-								if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') {
252
-									$newState = 'RTL';
253
-									break 2;
254
-								}
255
-
256
-								if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) {
257
-									$newState = 'RTL';
258
-									break 2;
259
-								}
260 260
 
261
-								if ($nextLetter === ' ') {
262
-									break;
263
-								}
264
-								$nextLetter .= substr($tempText . "\n", 0, 5);
265
-								if ($nextLetter === '&nbsp;') {
266
-									break;
267
-								}
268
-							}
269
-							// This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality
270
-							$currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF;
271
-							$newState      = 'LTR';
272
-							break;
273
-						}
274
-						if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) {
275
-							// Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR
276
-							$newState = 'LTR';
277
-							break;
278
-						}
279
-						if ($closeParIndex !== false) {
280
-							// This closing parenthesis has to inherit the matching opening parenthesis' directionality
281
-							if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') {
282
-								$newState = $openParDirection[$closeParIndex];
261
+							if ($nextLetter === ' ') {
262
+								break;
283 263
 							}
284
-							$openParDirection[$closeParIndex] = '';
285
-							break;
286
-						}
287
-						if ($openParIndex !== false) {
288
-							// Opening parentheses always inherit the following directionality
289
-							self::$waitingText .= $currentLetter;
290
-							$workingText = substr($workingText, $currentLen);
291
-							while (true) {
292
-								if ($workingText === '') {
293
-									break;
294
-								}
295
-								if (substr($workingText, 0, 1) === ' ') {
296
-									// Spaces following this left parenthesis inherit the following directionality too
297
-									self::$waitingText .= ' ';
298
-									$workingText = substr($workingText, 1);
299
-									continue;
300
-								}
301
-								if (substr($workingText, 0, 6) === '&nbsp;') {
302
-									// Spaces following this left parenthesis inherit the following directionality too
303
-									self::$waitingText .= '&nbsp;';
304
-									$workingText = substr($workingText, 6);
305
-									continue;
306
-								}
264
+							$nextLetter .= substr($tempText . "\n", 0, 5);
265
+							if ($nextLetter === '&nbsp;') {
307 266
 								break;
308 267
 							}
309
-							$openParDirection[$openParIndex] = '?';
310
-							break 2; // double break because we're waiting for more information
311 268
 						}
312
-
313
-						// We have a digit or a "normal" special character.
314
-						//
315
-						// When this character is not at the start of the input string, it inherits the preceding directionality;
316
-						// at the start of the input string, it assumes the following directionality.
317
-						//
318
-						// Exceptions to this rule will be handled later during final clean-up.
319
-						//
269
+						// This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality
270
+						$currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF;
271
+						$newState      = 'LTR';
272
+						break;
273
+					}
274
+					if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) {
275
+						// Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR
276
+						$newState = 'LTR';
277
+						break;
278
+					}
279
+					if ($closeParIndex !== false) {
280
+						// This closing parenthesis has to inherit the matching opening parenthesis' directionality
281
+						if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') {
282
+							$newState = $openParDirection[$closeParIndex];
283
+						}
284
+						$openParDirection[$closeParIndex] = '';
285
+						break;
286
+					}
287
+					if ($openParIndex !== false) {
288
+						// Opening parentheses always inherit the following directionality
320 289
 						self::$waitingText .= $currentLetter;
321 290
 						$workingText = substr($workingText, $currentLen);
322
-						if (self::$currentState != '') {
323
-							$result .= self::$waitingText;
324
-							self::$waitingText = '';
291
+						while (true) {
292
+							if ($workingText === '') {
293
+								break;
294
+							}
295
+							if (substr($workingText, 0, 1) === ' ') {
296
+								// Spaces following this left parenthesis inherit the following directionality too
297
+								self::$waitingText .= ' ';
298
+								$workingText = substr($workingText, 1);
299
+								continue;
300
+							}
301
+							if (substr($workingText, 0, 6) === '&nbsp;') {
302
+								// Spaces following this left parenthesis inherit the following directionality too
303
+								self::$waitingText .= '&nbsp;';
304
+								$workingText = substr($workingText, 6);
305
+								continue;
306
+							}
307
+							break;
325 308
 						}
309
+						$openParDirection[$openParIndex] = '?';
326 310
 						break 2; // double break because we're waiting for more information
327 311
 					}
328
-					if ($newState != self::$currentState) {
329
-						// A direction change has occurred
330
-						self::finishCurrentSpan($result, false);
331
-						self::$previousState = self::$currentState;
332
-						self::$currentState  = $newState;
333
-						self::beginCurrentSpan($result);
334
-					}
312
+
313
+					// We have a digit or a "normal" special character.
314
+					//
315
+					// When this character is not at the start of the input string, it inherits the preceding directionality;
316
+					// at the start of the input string, it assumes the following directionality.
317
+					//
318
+					// Exceptions to this rule will be handled later during final clean-up.
319
+					//
335 320
 					self::$waitingText .= $currentLetter;
336 321
 					$workingText = substr($workingText, $currentLen);
337
-					$result .= self::$waitingText;
338
-					self::$waitingText = '';
322
+					if (self::$currentState != '') {
323
+						$result .= self::$waitingText;
324
+						self::$waitingText = '';
325
+					}
326
+					break 2; // double break because we're waiting for more information
327
+				}
328
+				if ($newState != self::$currentState) {
329
+					// A direction change has occurred
330
+					self::finishCurrentSpan($result, false);
331
+					self::$previousState = self::$currentState;
332
+					self::$currentState  = $newState;
333
+					self::beginCurrentSpan($result);
334
+				}
335
+				self::$waitingText .= $currentLetter;
336
+				$workingText = substr($workingText, $currentLen);
337
+				$result .= self::$waitingText;
338
+				self::$waitingText = '';
339 339
 
340
-					foreach ($openParDirection as $index => $value) {
341
-						// Since we now know the proper direction, remember it for all waiting opening parentheses
342
-						if ($value === '?') {
343
-							$openParDirection[$index] = self::$currentState;
344
-						}
340
+				foreach ($openParDirection as $index => $value) {
341
+					// Since we now know the proper direction, remember it for all waiting opening parentheses
342
+					if ($value === '?') {
343
+						$openParDirection[$index] = self::$currentState;
345 344
 					}
345
+				}
346 346
 
347
-					break;
347
+				break;
348 348
 			}
349 349
 		}
350 350
 
@@ -461,34 +461,34 @@  discard block
 block discarded – undo
461 461
 
462 462
 		// Finally, correct '<LTR>', '</LTR>', '<RTL>', and '</RTL>'
463 463
 		switch ($direction) {
464
-			case 'BOTH':
465
-			case 'both':
466
-				// LTR text: <span dir="ltr"> text </span>
467
-				// RTL text: <span dir="rtl"> text </span>
468
-				$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
469
-				$eLTR = $nothing . '</span>';
470
-				$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
471
-				$eRTL = $nothing . '</span>';
472
-				break;
473
-			case 'LTR':
474
-			case 'ltr':
475
-				// LTR text: <span dir="ltr"> text </span>
476
-				// RTL text: text
477
-				$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
478
-				$eLTR = $nothing . '</span>';
479
-				$sRTL = '';
480
-				$eRTL = '';
481
-				break;
482
-			case 'RTL':
483
-			case 'rtl':
484
-			default:
485
-				// LTR text: text
486
-				// RTL text: <span dir="rtl"> text </span>
487
-				$sLTR = '';
488
-				$eLTR = '';
489
-				$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
490
-				$eRTL = $nothing . '</span>';
491
-				break;
464
+		case 'BOTH':
465
+		case 'both':
466
+			// LTR text: <span dir="ltr"> text </span>
467
+			// RTL text: <span dir="rtl"> text </span>
468
+			$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
469
+			$eLTR = $nothing . '</span>';
470
+			$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
471
+			$eRTL = $nothing . '</span>';
472
+			break;
473
+		case 'LTR':
474
+		case 'ltr':
475
+			// LTR text: <span dir="ltr"> text </span>
476
+			// RTL text: text
477
+			$sLTR = '<span dir="ltr" ' . $class . '>' . $nothing;
478
+			$eLTR = $nothing . '</span>';
479
+			$sRTL = '';
480
+			$eRTL = '';
481
+			break;
482
+		case 'RTL':
483
+		case 'rtl':
484
+		default:
485
+			// LTR text: text
486
+			// RTL text: <span dir="rtl"> text </span>
487
+			$sLTR = '';
488
+			$eLTR = '';
489
+			$sRTL = '<span dir="rtl" ' . $class . '>' . $nothing;
490
+			$eRTL = $nothing . '</span>';
491
+			break;
492 492
 		}
493 493
 		$result = str_replace(array(self::$startLTR, self::$endLTR, self::$startRTL, self::$endRTL), array($sLTR, $eLTR, $sRTL, $eRTL), $result);
494 494
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/I18N.php 2 patches
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 	 */
284 284
 	public static function gedcomAge($string) {
285 285
 		switch ($string) {
286
-			case 'STILLBORN':
287
-				// I18N: Description of an individual’s age at an event.  For example, Died 14 Jan 1900 (stillborn)
288
-				return self::translate('(stillborn)');
289
-			case 'INFANT':
290
-				// I18N: Description of an individual’s age at an event.  For example, Died 14 Jan 1900 (in infancy)
291
-				return self::translate('(in infancy)');
292
-			case 'CHILD':
293
-				// I18N: Description of an individual’s age at an event.  For example, Died 14 Jan 1900 (in childhood)
294
-				return self::translate('(in childhood)');
286
+		case 'STILLBORN':
287
+			// I18N: Description of an individual’s age at an event.  For example, Died 14 Jan 1900 (stillborn)
288
+			return self::translate('(stillborn)');
289
+		case 'INFANT':
290
+			// I18N: Description of an individual’s age at an event.  For example, Died 14 Jan 1900 (in infancy)
291
+			return self::translate('(in infancy)');
292
+		case 'CHILD':
293
+			// I18N: Description of an individual’s age at an event.  For example, Died 14 Jan 1900 (in childhood)
294
+			return self::translate('(in childhood)');
295 295
 		}
296 296
 		$age = array();
297 297
 		if (preg_match('/(\d+)y/', $string, $match)) {
@@ -871,15 +871,15 @@  discard block
 block discarded – undo
871 871
 	 */
872 872
 	public static function defaultCalendar() {
873 873
 		switch (self::$locale->languageTag()) {
874
-			case 'ar':
875
-				return new ArabicCalendar;
876
-			case 'fa':
877
-				return new PersianCalendar;
878
-			case 'he':
879
-			case 'yi':
880
-				return new JewishCalendar;
881
-			default:
882
-				return new GregorianCalendar;
874
+		case 'ar':
875
+			return new ArabicCalendar;
876
+		case 'fa':
877
+			return new PersianCalendar;
878
+		case 'he':
879
+		case 'yi':
880
+			return new JewishCalendar;
881
+		default:
882
+			return new GregorianCalendar;
883 883
 		}
884 884
 	}
885 885
 }
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Module/CensusAssistantModule.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 	 * @return string
426 426
 	 */
427 427
 	public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) {
428
-		$headImg2  = '<i class="icon-button_head" title="' . I18N::translate('Click to choose individual as head of family.') . '"></i>';
428
+		$headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Click to choose individual as head of family.') . '"></i>';
429 429
 
430 430
 		foreach ($family->getSpouses() as $spouse) {
431
-			$menu  = new Menu(Functions::getCloseRelationshipName($head, $spouse));
431
+			$menu = new Menu(Functions::getCloseRelationshipName($head, $spouse));
432 432
 			foreach ($spouse->getChildFamilies() as $grandparents) {
433 433
 				foreach ($grandparents->getSpouses() as $grandparent) {
434 434
 					$submenu = new Menu(
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 
465 465
 		foreach ($family->getChildren() as $child) {
466
-			$menu  = new Menu(Functions::getCloseRelationshipName($head, $child));
466
+			$menu = new Menu(Functions::getCloseRelationshipName($head, $child));
467 467
 			foreach ($child->getSpouseFamilies() as $spouse_family) {
468 468
 				foreach ($spouse_family->getSpouses() as $spouse_family_spouse) {
469 469
 					if ($spouse_family_spouse != $child) {
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Module/GoogleMapsModule.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 							if ($level == 1) {
409 409
 								$label = I18N::translate('Country');
410 410
 							} else {
411
-								$label = I18N::translate('Level') .  ' ' . $level;
411
+								$label = I18N::translate('Level') . ' ' . $level;
412 412
 							}
413 413
 							?>
414 414
 							<div class="input-group">
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 							if ($level == 1) {
425 425
 								$label = I18N::translate('Country');
426 426
 							} else {
427
-								$label = I18N::translate('Level') .  ' ' . $level;
427
+								$label = I18N::translate('Level') . ' ' . $level;
428 428
 							}
429 429
 							?>
430 430
 							<div class="input-group">
@@ -3014,7 +3014,7 @@  discard block
 block discarded – undo
3014 3014
 			}
3015 3015
 		');
3016 3016
 
3017
-		$levelm                           = $this->setLevelMap($level, $parent);
3017
+		$levelm = $this->setLevelMap($level, $parent);
3018 3018
 		if (isset($levelo[0])) {
3019 3019
 			$levelo[0] = 0;
3020 3020
 		}
@@ -4170,7 +4170,7 @@  discard block
 block discarded – undo
4170 4170
 						} else {
4171 4171
 							$placelist[$j]['long'] = null;
4172 4172
 						}
4173
-						$j                          = $j + 1;
4173
+						$j = $j + 1;
4174 4174
 					}
4175 4175
 					$i        = $i + 1;
4176 4176
 					$placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
 			$j            = 0;
4367 4367
 			$maxLevel     = 0;
4368 4368
 			foreach ($lines as $p => $placerec) {
4369
-				$fieldrec                               = explode(';', $placerec);
4369
+				$fieldrec = explode(';', $placerec);
4370 4370
 				if ($fieldrec[0] > $maxLevel) {
4371 4371
 					$maxLevel = $fieldrec[0];
4372 4372
 				}
Please login to merge, or discard this patch.
Braces   +79 added lines, -34 removed lines patch added patch discarded remove patch
@@ -826,7 +826,9 @@  discard block
 block discarded – undo
826 826
 			$person = $this->ancestors[$i];
827 827
 			if (!empty($person)) {
828 828
 				$name = $person->getFullName();
829
-				if ($name == I18N::translate('Private')) $priv++;
829
+				if ($name == I18N::translate('Private')) {
830
+					$priv++;
831
+				}
830 832
 				$place = $person->getBirthPlace();
831 833
 				if (empty($place)) {
832 834
 					$latlongval[$i] = null;
@@ -1716,8 +1718,9 @@  discard block
 block discarded – undo
1716 1718
 
1717 1719
 				if ($row['pl_place'] != '') {
1718 1720
 					$placestr2 = $mapstr_edit . $id . "&amp;level=" . $level . $mapstr3 . $mapstr5 . I18N::translate('Zoom=') . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8;
1719
-					if ($row['pl_place'] === 'unknown')
1720
-						$matched[$x]++;
1721
+					if ($row['pl_place'] === 'unknown') {
1722
+											$matched[$x]++;
1723
+					}
1721 1724
 				} else {
1722 1725
 					if ($levels[$z] === 'unknown') {
1723 1726
 						$placestr2 = $mapstr_add . $id . "&amp;level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . I18N::translate('unknown') . "</strong>" . $mapstr8; $matched[$x]++;
@@ -2829,8 +2832,9 @@  discard block
 block discarded – undo
2829 2832
 			$parent[$level] = $place2['place'];
2830 2833
 			$this->printHowManyPeople($level + 1, $parent);
2831 2834
 			echo '<br>', I18N::translate('This place has no coordinates');
2832
-			if (Auth::isAdmin())
2833
-				echo "<br><a href='module.php?mod=googlemap&amp;mod_action=admin_places&amp;parent=", $levelm, "&amp;display=inactive'>", I18N::translate('Geographic data'), "</a>";
2835
+			if (Auth::isAdmin()) {
2836
+							echo "<br><a href='module.php?mod=googlemap&amp;mod_action=admin_places&amp;parent=", $levelm, "&amp;display=inactive'>", I18N::translate('Geographic data'), "</a>";
2837
+			}
2834 2838
 			echo "</div>\", icon_type, \"", str_replace(array('&lrm;', '&rlm;'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), "\");\n";
2835 2839
 		} else {
2836 2840
 			$lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place2['lati']);
@@ -3031,7 +3035,8 @@  discard block
 block discarded – undo
3031 3035
 		ob_start(); // TODO: rewrite print_gm_markers, and the functions called therein, to either return text or add JS directly.
3032 3036
 
3033 3037
 		if ($numfound == 0 && $level > 0) {
3034
-			if (isset($levelo[($level - 1)])) {  // ** BH not sure yet what this if statement is for ... TODO **
3038
+			if (isset($levelo[($level - 1)])) {
3039
+// ** BH not sure yet what this if statement is for ... TODO **
3035 3040
 				// show the current place on the map
3036 3041
 
3037 3042
 				$place = Database::prepare("SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id=?")
@@ -3306,10 +3311,11 @@  discard block
 block discarded – undo
3306 3311
 			$place_name       = $row->pl_place;
3307 3312
 			$place_icon       = $row->pl_icon;
3308 3313
 			$selected_country = explode("/", $place_icon);
3309
-			if (isset($selected_country[1]) && $selected_country[1] != "flags")
3310
-				$selected_country = $selected_country[1];
3311
-			else
3312
-				$selected_country = "Countries";
3314
+			if (isset($selected_country[1]) && $selected_country[1] != "flags") {
3315
+							$selected_country = $selected_country[1];
3316
+			} else {
3317
+							$selected_country = "Countries";
3318
+			}
3313 3319
 			$parent_id         = $row->pl_parent_id;
3314 3320
 			$level             = $row->pl_level;
3315 3321
 			$zoomfactor        = $row->pl_zoom;
@@ -3388,8 +3394,9 @@  discard block
 block discarded – undo
3388 3394
 			} else {
3389 3395
 				echo '<b>', $place_name;
3390 3396
 			}
3391
-			if (count($where_am_i) > 0)
3392
-				echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
3397
+			if (count($where_am_i) > 0) {
3398
+							echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
3399
+			}
3393 3400
 			echo '</b><br>';
3394 3401
 		}
3395 3402
 
@@ -3898,7 +3905,10 @@  discard block
 block discarded – undo
3898 3905
 			}
3899 3906
 
3900 3907
 			function showLocation_level(address) {
3901
-				address += '<?php if ($level > 0) echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))); ?>';
3908
+				address += '<?php if ($level > 0) {
3909
+	echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true)));
3910
+}
3911
+?>';
3902 3912
 				geocoder.geocode({'address': address}, addAddressToMap);
3903 3913
 			}
3904 3914
 
@@ -3959,23 +3969,42 @@  discard block
 block discarded – undo
3959 3969
 						$precision2 = -1;
3960 3970
 					}
3961 3971
 					($precision1 > $precision2) ? ($precision = $precision1) : ($precision = $precision2);
3962
-					if ($precision == -1) ($level > 3) ? ($precision = 3) : ($precision = $level);
3963
-					elseif ($precision > 5) {
3972
+					if ($precision == -1) {
3973
+						($level > 3) ? ($precision = 3) : ($precision = $level);
3974
+					} elseif ($precision > 5) {
3964 3975
 						$precision = 5;
3965 3976
 					}
3966 3977
 				?>
3967 3978
 				<td class="optionbox" colspan="2">
3968
-					<input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_0')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_0'); ?>">
3979
+					<input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_0')) {
3980
+	echo 'checked';
3981
+}
3982
+?> value="<?php echo $this->getSetting('GM_PRECISION_0'); ?>">
3969 3983
 					<label for="new_prec_0"><?php echo I18N::translate('Country'); ?></label>
3970
-					<input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_1')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_1'); ?>">
3984
+					<input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_1')) {
3985
+	echo 'checked';
3986
+}
3987
+?> value="<?php echo $this->getSetting('GM_PRECISION_1'); ?>">
3971 3988
 					<label for="new_prec_1"><?php echo I18N::translate('State'); ?></label>
3972
-					<input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_2')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_2'); ?>">
3989
+					<input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_2')) {
3990
+	echo 'checked';
3991
+}
3992
+?> value="<?php echo $this->getSetting('GM_PRECISION_2'); ?>">
3973 3993
 					<label for="new_prec_2"><?php echo I18N::translate('City'); ?></label>
3974
-					<input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_3')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_3'); ?>">
3994
+					<input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_3')) {
3995
+	echo 'checked';
3996
+}
3997
+?> value="<?php echo $this->getSetting('GM_PRECISION_3'); ?>">
3975 3998
 					<label for="new_prec_3"><?php echo I18N::translate('Neighborhood'); ?></label>
3976
-					<input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_4')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_4'); ?>">
3999
+					<input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_4')) {
4000
+	echo 'checked';
4001
+}
4002
+?> value="<?php echo $this->getSetting('GM_PRECISION_4'); ?>">
3977 4003
 					<label for="new_prec_4"><?php echo I18N::translate('House'); ?></label>
3978
-					<input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision >= $this->getSetting('GM_PRECISION_5')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_5'); ?>">
4004
+					<input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision >= $this->getSetting('GM_PRECISION_5')) {
4005
+	echo 'checked';
4006
+}
4007
+?> value="<?php echo $this->getSetting('GM_PRECISION_5'); ?>">
3979 4008
 					<label for="new_prec_5"><?php echo I18N::translate('Max'); ?></label>
3980 4009
 					<p class="small text-muted">
3981 4010
 						<?php echo I18N::translate('Here you can enter the precision.  Based on this setting the number of digits that will be used in the latitude and longitude is determined.'); ?>
@@ -3987,8 +4016,14 @@  discard block
 block discarded – undo
3987 4016
 				<td class="optionbox" colspan="2">
3988 4017
 					<input type="text" id="NEW_PLACE_LATI" name="NEW_PLACE_LATI" placeholder="<?php echo /* I18N: Measure of latitude/longitude */ I18N::translate('degrees'); ?>" value="<?php echo abs($place_lati); ?>" size="20" onchange="updateMap();">
3989 4018
 					<select name="LATI_CONTROL" onchange="updateMap();">
3990
-						<option value="PL_N" <?php if ($place_lati >= 0) echo "selected"; echo ">", I18N::translate('north'); ?></option>
3991
-						<option value="PL_S" <?php if ($place_lati < 0) echo "selected"; echo ">", I18N::translate('south'); ?></option>
4019
+						<option value="PL_N" <?php if ($place_lati >= 0) {
4020
+	echo "selected";
4021
+}
4022
+echo ">", I18N::translate('north'); ?></option>
4023
+						<option value="PL_S" <?php if ($place_lati < 0) {
4024
+	echo "selected";
4025
+}
4026
+echo ">", I18N::translate('south'); ?></option>
3992 4027
 					</select>
3993 4028
 				</td>
3994 4029
 			</tr>
@@ -3997,8 +4032,14 @@  discard block
 block discarded – undo
3997 4032
 				<td class="optionbox" colspan="2">
3998 4033
 					<input type="text" id="NEW_PLACE_LONG" name="NEW_PLACE_LONG" placeholder="<?php echo I18N::translate('degrees'); ?>" value="<?php echo abs($place_long); ?>" size="20" onchange="updateMap();">
3999 4034
 					<select name="LONG_CONTROL" onchange="updateMap();">
4000
-						<option value="PL_E" <?php if ($place_long >= 0) echo "selected"; echo ">", I18N::translate('east'); ?></option>
4001
-						<option value="PL_W" <?php if ($place_long < 0) echo "selected"; echo ">", I18N::translate('west'); ?></option>
4035
+						<option value="PL_E" <?php if ($place_long >= 0) {
4036
+	echo "selected";
4037
+}
4038
+echo ">", I18N::translate('east'); ?></option>
4039
+						<option value="PL_W" <?php if ($place_long < 0) {
4040
+	echo "selected";
4041
+}
4042
+echo ">", I18N::translate('west'); ?></option>
4002 4043
 					</select>
4003 4044
 				</td>
4004 4045
 			</tr>
@@ -4211,8 +4252,9 @@  discard block
 block discarded – undo
4211 4252
 				$parent    = array_reverse($parent);
4212 4253
 				$parent_id = 0;
4213 4254
 				for ($i = 0; $i < count($parent); $i++) {
4214
-					if (!isset($default_zoom_level[$i]))
4215
-						$default_zoom_level[$i] = $default_zoom_level[$i - 1];
4255
+					if (!isset($default_zoom_level[$i])) {
4256
+											$default_zoom_level[$i] = $default_zoom_level[$i - 1];
4257
+					}
4216 4258
 					$escparent               = $parent[$i];
4217 4259
 					if ($escparent == '') {
4218 4260
 						$escparent = 'Unknown';
@@ -4452,7 +4494,8 @@  discard block
 block discarded – undo
4452 4494
 						Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
4453 4495
 						->execute(array($i, $parent_id, $escparent))
4454 4496
 						->fetchOneRow();
4455
-					if (empty($row)) {       // this name does not yet exist: create entry
4497
+					if (empty($row)) {
4498
+// this name does not yet exist: create entry
4456 4499
 						if (!Filter::postBool('updateonly')) {
4457 4500
 							$highestIndex = $highestIndex + 1;
4458 4501
 							if (($i + 1) == count($parent)) {
@@ -4591,14 +4634,16 @@  discard block
 block discarded – undo
4591 4634
 		echo '<th>', I18N::translate('Icon'), '</th>';
4592 4635
 		echo '<th>';
4593 4636
 		echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>';
4594
-		if (count($placelist) == 0)
4595
-			echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>';
4637
+		if (count($placelist) == 0) {
4638
+					echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>';
4639
+		}
4596 4640
 		foreach ($placelist as $place) {
4597 4641
 			echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">';
4598
-			if ($place['place'] != 'Unknown')
4599
-					echo Filter::escapeHtml($place['place']), '</a></td>';
4600
-				else
4601
-					echo I18N::translate('unknown'), '</a></td>';
4642
+			if ($place['place'] != 'Unknown') {
4643
+								echo Filter::escapeHtml($place['place']), '</a></td>';
4644
+			} else {
4645
+									echo I18N::translate('unknown'), '</a></td>';
4646
+				}
4602 4647
 			echo '<td>', $place['lati'], '</td>';
4603 4648
 			echo '<td>', $place['long'], '</td>';
4604 4649
 			echo '<td>', $place['zoom'], '</td>';
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2015 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2015 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.