Completed
Pull Request — master (#833)
by Rico
13:27
created
app/Controller/LifespanController.php 3 patches
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -506,23 +506,23 @@
 block discarded – undo
506 506
 	 */
507 507
 	public function getCalendarDate($date) {
508 508
 		switch ($this->calendar) {
509
-			case 'julian':
510
-				$caldate = new JulianDate($date);
511
-				break;
512
-			case 'french':
513
-				$caldate = new FrenchDate($date);
514
-				break;
515
-			case 'jewish':
516
-				$caldate = new JewishDate($date);
517
-				break;
518
-			case 'hijri':
519
-				$caldate = new HijriDate($date);
520
-				break;
521
-			case 'jalali':
522
-				$caldate = new JalaliDate($date);
523
-				break;
524
-			default:
525
-				$caldate = new GregorianDate($date);
509
+		case 'julian':
510
+			$caldate = new JulianDate($date);
511
+			break;
512
+		case 'french':
513
+			$caldate = new FrenchDate($date);
514
+			break;
515
+		case 'jewish':
516
+			$caldate = new JewishDate($date);
517
+			break;
518
+		case 'hijri':
519
+			$caldate = new HijriDate($date);
520
+			break;
521
+		case 'jalali':
522
+			$caldate = new JalaliDate($date);
523
+			break;
524
+		default:
525
+			$caldate = new GregorianDate($date);
526 526
 		}
527 527
 
528 528
 		return $caldate;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	// Base color parameters
42 42
 	const RANGE           = 120; // degrees
43 43
 	const SATURATION      = 100; // percent
44
-	const LIGHTNESS       = 30;  // percent
44
+	const LIGHTNESS       = 30; // percent
45 45
 	const ALPHA           = 0.25;
46 46
 	const CHART_TOP       = 10; // pixels
47 47
 	const BAR_SPACING     = 22; // pixels
48 48
 	const YEAR_SPAN       = 10; // Number of years per scale section
49
-	const PIXELS_PER_YEAR = 7;  // Number of pixels to shift per year
49
+	const PIXELS_PER_YEAR = 7; // Number of pixels to shift per year
50 50
 	const SESSION_DATA    = 'lifespan_data';
51 51
 
52 52
 	/** @var string|null Chart parameter */
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 			}
458 458
 			echo
459 459
 				'</div>' . // class="popup"
460
-				'</div>' .  // class="itr"
461
-				'</div>';   // class=$popupclass
460
+				'</div>' . // class="itr"
461
+				'</div>'; // class=$popupclass
462 462
 
463 463
 			$maxY = max($maxY, $Y);
464 464
 		}
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 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) 2016 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\Controller;
17 17
 
18 18
 use Fisharebest\Webtrees\ColorGenerator;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$tmp = strtoupper(strtr($this->calendar,
182 182
 			array('jewish' => 'hebrew',
183
-			      'french' => 'french r',
183
+						'french' => 'french r',
184 184
 			)));
185 185
 		$this->calendarEscape = sprintf('@#D%s@', $tmp);
186 186
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 			$that          = $this; // PHP5.3 cannot access $this inside a closure
396 396
 			$acceptedFacts = array_filter($facts, function (Fact $fact) use ($that) {
397 397
 				return (in_array($fact->getTag(), $that->facts) && $fact->getDate()->isOK()) ||
398
-				       (($that->place_obj || $that->startDate) && $that->checkFact($fact));
398
+							 (($that->place_obj || $that->startDate) && $that->checkFact($fact));
399 399
 			});
400 400
 
401 401
 			$eventList = array();
Please login to merge, or discard this patch.
app/Controller/PedigreeController.php 3 patches
Switch Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -102,26 +102,26 @@  discard block
 block discarded – undo
102 102
 
103 103
 		$this->arrows = new \stdClass();
104 104
 		switch ($this->orientation) {
105
-			case self::PORTRAIT:
106
-				//drop through
107
-			case self::LANDSCAPE:
108
-				$this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow';
109
-				$this->arrows->menu    = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow';
110
-				$addoffset['x']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
111
-				$addoffset['y']        = 0;
112
-				break;
113
-			case self::OLDEST_AT_TOP:
114
-				$this->arrows->prevGen = 'icon-uarrow';
115
-				$this->arrows->menu    = 'icon-darrow';
116
-				$addoffset['x']        = 0;
117
-				$addoffset['y']        = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0;
118
-				break;
119
-			case self::OLDEST_AT_BOTTOM:
120
-				$this->arrows->prevGen = 'icon-darrow';
121
-				$this->arrows->menu    = 'icon-uarrow';
122
-				$addoffset['x']        = 0;
123
-				$addoffset['y']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
124
-				break;
105
+		case self::PORTRAIT:
106
+			//drop through
107
+		case self::LANDSCAPE:
108
+			$this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow';
109
+			$this->arrows->menu    = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow';
110
+			$addoffset['x']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
111
+			$addoffset['y']        = 0;
112
+			break;
113
+		case self::OLDEST_AT_TOP:
114
+			$this->arrows->prevGen = 'icon-uarrow';
115
+			$this->arrows->menu    = 'icon-darrow';
116
+			$addoffset['x']        = 0;
117
+			$addoffset['y']        = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0;
118
+			break;
119
+		case self::OLDEST_AT_BOTTOM:
120
+			$this->arrows->prevGen = 'icon-darrow';
121
+			$this->arrows->menu    = 'icon-uarrow';
122
+			$addoffset['x']        = 0;
123
+			$addoffset['y']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
124
+			break;
125 125
 		}
126 126
 
127 127
 		// -- this next section will create and position the DIV layers for the pedigree tree
@@ -150,73 +150,73 @@  discard block
 block discarded – undo
150 150
 
151 151
 			// -- calculate the xoffset
152 152
 			switch ($this->orientation) {
153
-				case self::PORTRAIT:
154
-					$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
-					if(!$i && $this->root->getSpouseFamilies()) {
156
-						$xoffset -= self::ARROW_SIZE;
153
+			case self::PORTRAIT:
154
+				$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
+				if(!$i && $this->root->getSpouseFamilies()) {
156
+					$xoffset -= self::ARROW_SIZE;
157
+				}
158
+				// -- compact the tree
159
+				if ($curgen < $this->generations) {
160
+					if ($i % 2 == 0) {
161
+						$yoffset = $yoffset - (($boxspacing / 2) * ($curgen - 1));
162
+					} else {
163
+						$yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1));
157 164
 					}
158
-					// -- compact the tree
159
-					if ($curgen < $this->generations) {
160
-						if ($i % 2 == 0) {
161
-							$yoffset = $yoffset - (($boxspacing / 2) * ($curgen - 1));
165
+					$parent = (int) (($i - 1) / 2);
166
+					$pgen   = $curgen;
167
+					while ($parent > 0) {
168
+						if ($parent % 2 == 0) {
169
+							$yoffset = $yoffset - (($boxspacing / 2) * $pgen);
162 170
 						} else {
163
-							$yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1));
164
-						}
165
-						$parent = (int) (($i - 1) / 2);
166
-						$pgen   = $curgen;
167
-						while ($parent > 0) {
168
-							if ($parent % 2 == 0) {
169
-								$yoffset = $yoffset - (($boxspacing / 2) * $pgen);
170
-							} else {
171
-								$yoffset = $yoffset + (($boxspacing / 2) * $pgen);
172
-							}
173
-							$pgen++;
174
-							if ($pgen > 3) {
175
-								$temp = 0;
176
-								for ($j = 1; $j < ($pgen - 2); $j++) {
177
-									$temp += (pow(2, $j) - 1);
178
-								}
179
-								if ($parent % 2 == 0) {
180
-									$yoffset = $yoffset - (($boxspacing / 2) * $temp);
181
-								} else {
182
-									$yoffset = $yoffset + (($boxspacing / 2) * $temp);
183
-								}
184
-							}
185
-							$parent = (int) (($parent - 1) / 2);
171
+							$yoffset = $yoffset + (($boxspacing / 2) * $pgen);
186 172
 						}
187
-						if ($curgen > 3) {
173
+						$pgen++;
174
+						if ($pgen > 3) {
188 175
 							$temp = 0;
189
-							for ($j = 1; $j < ($curgen - 2); $j++) {
176
+							for ($j = 1; $j < ($pgen - 2); $j++) {
190 177
 								$temp += (pow(2, $j) - 1);
191 178
 							}
192
-							if ($i % 2 == 0) {
179
+							if ($parent % 2 == 0) {
193 180
 								$yoffset = $yoffset - (($boxspacing / 2) * $temp);
194 181
 							} else {
195 182
 								$yoffset = $yoffset + (($boxspacing / 2) * $temp);
196 183
 							}
197 184
 						}
185
+						$parent = (int) (($parent - 1) / 2);
198 186
 					}
199
-					$yoffset -= (($boxspacing / 2) * pow(2, ($this->generations - 2)) - ($boxspacing / 2));
200
-					break;
201
-				case self::LANDSCAPE:
202
-					$xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing);
203
-					if ($curgen == 1) {
204
-						$xoffset += 10;
205
-					}
206
-					break;
207
-				case self::OLDEST_AT_TOP:
208
-					//swap x & y offsets as chart is rotated
209
-					$xoffset = $yoffset;
210
-					$yoffset = $curgen  * ($this->getBoxDimensions()->height + ($byspacing * 4));
211
-					break;
212
-				case self::OLDEST_AT_BOTTOM:
213
-					//swap x & y offsets as chart is rotated
214
-					$xoffset = $yoffset;
215
-					$yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + ($byspacing * 2));
216
-					if ($i && $this->root->getSpouseFamilies()) {
217
-						$yoffset += self::ARROW_SIZE;
187
+					if ($curgen > 3) {
188
+						$temp = 0;
189
+						for ($j = 1; $j < ($curgen - 2); $j++) {
190
+							$temp += (pow(2, $j) - 1);
191
+						}
192
+						if ($i % 2 == 0) {
193
+							$yoffset = $yoffset - (($boxspacing / 2) * $temp);
194
+						} else {
195
+							$yoffset = $yoffset + (($boxspacing / 2) * $temp);
196
+						}
218 197
 					}
219
-					break;
198
+				}
199
+				$yoffset -= (($boxspacing / 2) * pow(2, ($this->generations - 2)) - ($boxspacing / 2));
200
+				break;
201
+			case self::LANDSCAPE:
202
+				$xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing);
203
+				if ($curgen == 1) {
204
+					$xoffset += 10;
205
+				}
206
+				break;
207
+			case self::OLDEST_AT_TOP:
208
+				//swap x & y offsets as chart is rotated
209
+				$xoffset = $yoffset;
210
+				$yoffset = $curgen  * ($this->getBoxDimensions()->height + ($byspacing * 4));
211
+				break;
212
+			case self::OLDEST_AT_BOTTOM:
213
+				//swap x & y offsets as chart is rotated
214
+				$xoffset = $yoffset;
215
+				$yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + ($byspacing * 2));
216
+				if ($i && $this->root->getSpouseFamilies()) {
217
+					$yoffset += self::ARROW_SIZE;
218
+				}
219
+				break;
220 220
 			}
221 221
 			$this->nodes[$i]["x"] = (int) $xoffset;
222 222
 			$this->nodes[$i]["y"] = (int) $yoffset;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			switch ($this->orientation) {
153 153
 				case self::PORTRAIT:
154 154
 					$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
-					if(!$i && $this->root->getSpouseFamilies()) {
155
+					if (!$i && $this->root->getSpouseFamilies()) {
156 156
 						$xoffset -= self::ARROW_SIZE;
157 157
 					}
158 158
 					// -- compact the tree
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				case self::OLDEST_AT_TOP:
208 208
 					//swap x & y offsets as chart is rotated
209 209
 					$xoffset = $yoffset;
210
-					$yoffset = $curgen  * ($this->getBoxDimensions()->height + ($byspacing * 4));
210
+					$yoffset = $curgen * ($this->getBoxDimensions()->height + ($byspacing * 4));
211 211
 					break;
212 212
 				case self::OLDEST_AT_BOTTOM:
213 213
 					//swap x & y offsets as chart is rotated
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			return $item['y'];
246 246
 		}, $this->nodes));
247 247
 
248
-		$this->chartsize['x'] = $max_xoffset + $bxspacing + $this->getBoxDimensions()->width  + $addoffset['x'];
248
+		$this->chartsize['x'] = $max_xoffset + $bxspacing + $this->getBoxDimensions()->width + $addoffset['x'];
249 249
 		$this->chartsize['y'] = $max_yoffset + $byspacing + $this->getBoxDimensions()->height + $addoffset['y'];
250 250
 	}
251 251
 
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) 2016 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) 2016 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/Controller/RepositoryController.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 		$menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo');
51 51
 
52 52
 		if (Auth::isEditor($this->record->getTree())) {
53
-			$fact    = $this->record->getFirstFact('NAME');
53
+			$fact = $this->record->getFirstFact('NAME');
54 54
 			if ($fact) {
55 55
 				// Edit existing name
56 56
 				$menu->addSubmenu(new Menu(I18N::translate('Edit repository'), '#', 'menu-repo-edit', array(
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 use Fisharebest\Webtrees\I18N;
21 21
 use Fisharebest\Webtrees\Menu;
22 22
 use Fisharebest\Webtrees\Module;
23
-use Fisharebest\Webtrees\Repository;
24 23
 
25 24
 /**
26 25
  * Controller for the repository page
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) 2016 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) 2016 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/File.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 		try {
48 48
 			$fp = fsockopen($scheme . $host, $port, $errno, $errstr, 5);
49 49
 
50
-			fputs($fp, "GET $path?$query HTTP/1.0\r\nHost: $host\r\nConnection: Close\r\n\r\n");
50
+			fputs($fp, "get $path?$query HTTP/1.0\r\nHost: $host\r\nConnection: Close\r\n\r\n");
51 51
 
52 52
 			// The first part of the response include the HTTP headers
53 53
 			$response = fread($fp, 65536);
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) 2016 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) 2016 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/FunctionsDate.php 2 patches
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -32,32 +32,32 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function getAgeAtEvent($age_string, $show_years) {
34 34
 		switch (strtoupper($age_string)) {
35
-			case 'CHILD':
36
-				return I18N::translate('Child');
37
-			case 'INFANT':
38
-				return I18N::translate('Infant');
39
-			case 'STILLBORN':
40
-				return I18N::translate('Stillborn');
41
-			default:
42
-				return preg_replace_callback(
43
-					array(
44
-						'/(\d+)([ymwd])/',
45
-					),
46
-					function ($match) use ($age_string, $show_years) {
47
-						switch ($match[2]) {
48
-							case 'y':
49
-								if ($show_years || preg_match('/[dm]/', $age_string)) {
50
-									return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
51
-								} else {
52
-									return I18N::digits($match[1]);
53
-								}
54
-							case 'm':
55
-								return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
56
-							case 'w':
57
-								return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
58
-							case 'd':
59
-								return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
60
-						}
35
+		case 'CHILD':
36
+			return I18N::translate('Child');
37
+		case 'INFANT':
38
+			return I18N::translate('Infant');
39
+		case 'STILLBORN':
40
+			return I18N::translate('Stillborn');
41
+		default:
42
+			return preg_replace_callback(
43
+				array(
44
+					'/(\d+)([ymwd])/',
45
+				),
46
+				function ($match) use ($age_string, $show_years) {
47
+					switch ($match[2]) {
48
+					case 'y':
49
+					if ($show_years || preg_match('/[dm]/', $age_string)) {
50
+					return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
51
+					} else {
52
+					return I18N::digits($match[1]);
53
+					}
54
+					case 'm':
55
+					return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
56
+					case 'w':
57
+					return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
58
+					case 'd':
59
+					return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
60
+					}
61 61
 					},
62 62
 					$age_string
63 63
 				);
@@ -79,40 +79,40 @@  discard block
 block discarded – undo
79 79
 		preg_match_all('/%[^%]/', $time_fmt, $matches);
80 80
 		foreach ($matches[0] as $match) {
81 81
 			switch ($match) {
82
-				case '%a':
83
-					$t = gmdate('His', $time);
84
-					if ($t == '000000') {
85
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */
86
-							I18N::translate('midnight'), $time_fmt);
87
-					} elseif ($t < '120000') {
88
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */
89
-							I18N::translate('a.m.'), $time_fmt);
90
-					} elseif ($t == '120000') {
91
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */
92
-							I18N::translate('noon'), $time_fmt);
93
-					} else {
94
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */
95
-							I18N::translate('p.m.'), $time_fmt);
96
-					}
97
-					break;
98
-				case '%A':
99
-					$t = gmdate('His', $time);
100
-					if ($t == '000000') {
101
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */
102
-							I18N::translate('Midnight'), $time_fmt);
103
-					} elseif ($t < '120000') {
104
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */
105
-							I18N::translate('A.M.'), $time_fmt);
106
-					} elseif ($t == '120000') {
107
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */
108
-							I18N::translate('Noon'), $time_fmt);
109
-					} else {
110
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */
111
-							I18N::translate('P.M.'), $time_fmt);
112
-					}
113
-					break;
114
-				default:
115
-					$time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
82
+			case '%a':
83
+				$t = gmdate('His', $time);
84
+				if ($t == '000000') {
85
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */
86
+						I18N::translate('midnight'), $time_fmt);
87
+				} elseif ($t < '120000') {
88
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */
89
+						I18N::translate('a.m.'), $time_fmt);
90
+				} elseif ($t == '120000') {
91
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */
92
+						I18N::translate('noon'), $time_fmt);
93
+				} else {
94
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */
95
+						I18N::translate('p.m.'), $time_fmt);
96
+				}
97
+				break;
98
+			case '%A':
99
+				$t = gmdate('His', $time);
100
+				if ($t == '000000') {
101
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */
102
+						I18N::translate('Midnight'), $time_fmt);
103
+				} elseif ($t < '120000') {
104
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */
105
+						I18N::translate('A.M.'), $time_fmt);
106
+				} elseif ($t == '120000') {
107
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */
108
+						I18N::translate('Noon'), $time_fmt);
109
+				} else {
110
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */
111
+						I18N::translate('P.M.'), $time_fmt);
112
+				}
113
+				break;
114
+			default:
115
+				$time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
116 116
 			}
117 117
 		}
118 118
 
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) 2016 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) 2016 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/FunctionsDb.php 2 patches
Switch Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -248,18 +248,18 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public static function searchIndividualsPhonetic($soundex, $lastname, $firstname, $place, array $trees) {
250 250
 		switch ($soundex) {
251
-			case 'Russell':
252
-				$givn_sdx = Soundex::russell($firstname);
253
-				$surn_sdx = Soundex::russell($lastname);
254
-				$plac_sdx = Soundex::russell($place);
255
-				break;
256
-			case 'DaitchM':
257
-				$givn_sdx = Soundex::daitchMokotoff($firstname);
258
-				$surn_sdx = Soundex::daitchMokotoff($lastname);
259
-				$plac_sdx = Soundex::daitchMokotoff($place);
260
-				break;
261
-			default:
262
-				throw new \DomainException('soundex: ' . $soundex);
251
+		case 'Russell':
252
+			$givn_sdx = Soundex::russell($firstname);
253
+			$surn_sdx = Soundex::russell($lastname);
254
+			$plac_sdx = Soundex::russell($place);
255
+			break;
256
+		case 'DaitchM':
257
+			$givn_sdx = Soundex::daitchMokotoff($firstname);
258
+			$surn_sdx = Soundex::daitchMokotoff($lastname);
259
+			$plac_sdx = Soundex::daitchMokotoff($place);
260
+			break;
261
+		default:
262
+			throw new \DomainException('soundex: ' . $soundex);
263 263
 		}
264 264
 
265 265
 		// Nothing to search for?  Return nothing.
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 			foreach ($givn_sdx as $n => $sdx) {
292 292
 				$sql .= $n ? " OR " : "";
293 293
 				switch ($soundex) {
294
-					case 'Russell':
295
-						$sql .= "n_soundex_givn_std LIKE CONCAT('%', :given_name_" . $n . ", '%')";
296
-						break;
297
-					case 'DaitchM':
298
-						$sql .= "n_soundex_givn_dm LIKE CONCAT('%', :given_name_" . $n . ", '%')";
299
-						break;
294
+				case 'Russell':
295
+					$sql .= "n_soundex_givn_std LIKE CONCAT('%', :given_name_" . $n . ", '%')";
296
+					break;
297
+				case 'DaitchM':
298
+					$sql .= "n_soundex_givn_dm LIKE CONCAT('%', :given_name_" . $n . ", '%')";
299
+					break;
300 300
 				}
301 301
 				$args['given_name_' . $n] = $sdx;
302 302
 			}
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
 			foreach ($surn_sdx as $n => $sdx) {
310 310
 				$sql .= $n ? " OR " : "";
311 311
 				switch ($soundex) {
312
-					case 'Russell':
313
-						$sql .= "n_soundex_surn_std LIKE CONCAT('%', :surname_" . $n . ", '%')";
314
-						break;
315
-					case 'DaitchM':
316
-						$sql .= "n_soundex_surn_dm LIKE CONCAT('%', :surname_" . $n . ", '%')";
317
-						break;
312
+				case 'Russell':
313
+					$sql .= "n_soundex_surn_std LIKE CONCAT('%', :surname_" . $n . ", '%')";
314
+					break;
315
+				case 'DaitchM':
316
+					$sql .= "n_soundex_surn_dm LIKE CONCAT('%', :surname_" . $n . ", '%')";
317
+					break;
318 318
 				}
319 319
 				$args['surname_' . $n] = $sdx;
320 320
 			}
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 			foreach ($plac_sdx as $n => $sdx) {
328 328
 				$sql .= $n ? " OR " : "";
329 329
 				switch ($soundex) {
330
-					case 'Russell':
331
-						$sql .= "p_std_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
332
-						break;
333
-					case 'DaitchM':
334
-						$sql .= "p_dm_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
335
-						break;
330
+				case 'Russell':
331
+					$sql .= "p_std_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
332
+					break;
333
+				case 'DaitchM':
334
+					$sql .= "p_dm_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
335
+					break;
336 336
 				}
337 337
 				$args['place_' . $n] = $sdx;
338 338
 			}
@@ -790,82 +790,82 @@  discard block
 block discarded – undo
790 790
 			} else {
791 791
 				// SPECIAL CASES:
792 792
 				switch ($anniv->m) {
793
-					case 2:
794
-						// 29 CSH does not include 30 CSH (but would include an invalid 31 CSH if there were no 30 CSH)
795
-						if ($anniv->d === 1) {
796
-							$where .= " AND d_day <= 1 AND d_mon = 2";
797
-						} elseif ($anniv->d === 30) {
798
-							$where .= " AND d_day >= 30 AND d_mon = 2";
799
-						} elseif ($anniv->d === 29 && $anniv->daysInMonth() === 29) {
800
-							$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 2";
801
-						} else {
802
-							$where .= " AND d_day = :day AND d_mon = 2";
803
-							$args['day'] = $anniv->d;
804
-						}
805
-						break;
806
-					case 3:
807
-						// 1 KSL includes 30 CSH (if this year didn’t have 30 CSH)
808
-						// 29 KSL does not include 30 KSL (but would include an invalid 31 KSL if there were no 30 KSL)
809
-						if ($anniv->d === 1) {
810
-							$tmp = new JewishDate(array($anniv->y, 'CSH', 1));
811
-							if ($tmp->daysInMonth() === 29) {
812
-								$where .= " AND (d_day <= 1 AND d_mon = 3 OR d_day = 30 AND d_mon = 2)";
813
-							} else {
814
-								$where .= " AND d_day <= 1 AND d_mon = 3";
815
-							}
816
-						} elseif ($anniv->d === 30) {
817
-							$where .= " AND d_day >= 30 AND d_mon = 3";
818
-						} elseif ($anniv->d == 29 && $anniv->daysInMonth() === 29) {
819
-							$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 3";
820
-						} else {
821
-							$where .= " AND d_day = :day AND d_mon = 3";
822
-							$args['day'] = $anniv->d;
823
-						}
824
-						break;
825
-					case 4:
826
-						// 1 TVT includes 30 KSL (if this year didn’t have 30 KSL)
827
-						if ($anniv->d === 1) {
828
-							$tmp = new JewishDate(array($anniv->y, 'KSL', 1));
829
-							if ($tmp->daysInMonth() === 29) {
830
-								$where .= " AND (d_day <=1 AND d_mon = 4 OR d_day = 30 AND d_mon = 3)";
831
-							} else {
832
-								$where .= " AND d_day <= 1 AND d_mon = 4";
833
-							}
834
-						} elseif ($anniv->d === $anniv->daysInMonth()) {
835
-							$where .= " AND d_day >= :day AND d_mon=4";
836
-							$args['day'] = $anniv->d;
793
+				case 2:
794
+					// 29 CSH does not include 30 CSH (but would include an invalid 31 CSH if there were no 30 CSH)
795
+					if ($anniv->d === 1) {
796
+						$where .= " AND d_day <= 1 AND d_mon = 2";
797
+					} elseif ($anniv->d === 30) {
798
+						$where .= " AND d_day >= 30 AND d_mon = 2";
799
+					} elseif ($anniv->d === 29 && $anniv->daysInMonth() === 29) {
800
+						$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 2";
801
+					} else {
802
+						$where .= " AND d_day = :day AND d_mon = 2";
803
+						$args['day'] = $anniv->d;
804
+					}
805
+					break;
806
+				case 3:
807
+					// 1 KSL includes 30 CSH (if this year didn’t have 30 CSH)
808
+					// 29 KSL does not include 30 KSL (but would include an invalid 31 KSL if there were no 30 KSL)
809
+					if ($anniv->d === 1) {
810
+						$tmp = new JewishDate(array($anniv->y, 'CSH', 1));
811
+						if ($tmp->daysInMonth() === 29) {
812
+							$where .= " AND (d_day <= 1 AND d_mon = 3 OR d_day = 30 AND d_mon = 2)";
837 813
 						} else {
838
-							$where .= " AND d_day = :day AND d_mon=4";
839
-							$args['day'] = $anniv->d;
814
+							$where .= " AND d_day <= 1 AND d_mon = 3";
840 815
 						}
841
-						break;
842
-					case 7: // ADS includes ADR (non-leap)
843
-						if ($anniv->d === 1) {
844
-							$where .= " AND d_day <= 1";
845
-						} elseif ($anniv->d === $anniv->daysInMonth()) {
846
-							$where .= " AND d_day >= :day";
847
-							$args['day'] = $anniv->d;
816
+					} elseif ($anniv->d === 30) {
817
+						$where .= " AND d_day >= 30 AND d_mon = 3";
818
+					} elseif ($anniv->d == 29 && $anniv->daysInMonth() === 29) {
819
+						$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 3";
820
+					} else {
821
+						$where .= " AND d_day = :day AND d_mon = 3";
822
+						$args['day'] = $anniv->d;
823
+					}
824
+					break;
825
+				case 4:
826
+					// 1 TVT includes 30 KSL (if this year didn’t have 30 KSL)
827
+					if ($anniv->d === 1) {
828
+						$tmp = new JewishDate(array($anniv->y, 'KSL', 1));
829
+						if ($tmp->daysInMonth() === 29) {
830
+							$where .= " AND (d_day <=1 AND d_mon = 4 OR d_day = 30 AND d_mon = 3)";
848 831
 						} else {
849
-							$where .= " AND d_day = :day";
850
-							$args['day'] = $anniv->d;
832
+							$where .= " AND d_day <= 1 AND d_mon = 4";
851 833
 						}
852
-						$where .= " AND (d_mon = 6 AND MOD(7 * d_year + 1, 19) >= 7 OR d_mon = 7)";
853
-						break;
854
-					case 8: // 1 NSN includes 30 ADR, if this year is non-leap
855
-						if ($anniv->d === 1) {
856
-							if ($anniv->isLeapYear()) {
857
-								$where .= " AND d_day <= 1 AND d_mon = 8";
858
-							} else {
859
-								$where .= " AND (d_day <= 1 AND d_mon = 8 OR d_day = 30 AND d_mon = 6)";
860
-							}
861
-						} elseif ($anniv->d === $anniv->daysInMonth()) {
862
-							$where .= " AND d_day >= :day AND d_mon = 8";
863
-							$args['day'] = $anniv->d;
834
+					} elseif ($anniv->d === $anniv->daysInMonth()) {
835
+						$where .= " AND d_day >= :day AND d_mon=4";
836
+						$args['day'] = $anniv->d;
837
+					} else {
838
+						$where .= " AND d_day = :day AND d_mon=4";
839
+						$args['day'] = $anniv->d;
840
+					}
841
+					break;
842
+				case 7: // ADS includes ADR (non-leap)
843
+					if ($anniv->d === 1) {
844
+						$where .= " AND d_day <= 1";
845
+					} elseif ($anniv->d === $anniv->daysInMonth()) {
846
+						$where .= " AND d_day >= :day";
847
+						$args['day'] = $anniv->d;
848
+					} else {
849
+						$where .= " AND d_day = :day";
850
+						$args['day'] = $anniv->d;
851
+					}
852
+					$where .= " AND (d_mon = 6 AND MOD(7 * d_year + 1, 19) >= 7 OR d_mon = 7)";
853
+					break;
854
+				case 8: // 1 NSN includes 30 ADR, if this year is non-leap
855
+					if ($anniv->d === 1) {
856
+						if ($anniv->isLeapYear()) {
857
+							$where .= " AND d_day <= 1 AND d_mon = 8";
864 858
 						} else {
865
-							$where .= " AND d_day = :day AND d_mon = 8";
866
-							$args['day'] = $anniv->d;
859
+							$where .= " AND (d_day <= 1 AND d_mon = 8 OR d_day = 30 AND d_mon = 6)";
867 860
 						}
868
-						break;
861
+					} elseif ($anniv->d === $anniv->daysInMonth()) {
862
+						$where .= " AND d_day >= :day AND d_mon = 8";
863
+						$args['day'] = $anniv->d;
864
+					} else {
865
+						$where .= " AND d_day = :day AND d_mon = 8";
866
+						$args['day'] = $anniv->d;
867
+					}
868
+					break;
869 869
 				}
870 870
 			}
871 871
 			// Only events in the past (includes dates without a year)
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 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) 2016 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\Functions;
17 17
 
18 18
 use Fisharebest\Webtrees\Auth;
@@ -749,13 +749,13 @@  discard block
 block discarded – undo
749 749
 	public static function getAnniversaryEvents($jd, $facts, Tree $tree) {
750 750
 		$found_facts = array();
751 751
 		foreach (array(
752
-			         new GregorianDate($jd),
753
-			         new JulianDate($jd),
754
-			         new FrenchDate($jd),
755
-			         new JewishDate($jd),
756
-			         new HijriDate($jd),
757
-			         new JalaliDate($jd),
758
-		         ) as $anniv) {
752
+							 new GregorianDate($jd),
753
+							 new JulianDate($jd),
754
+							 new FrenchDate($jd),
755
+							 new JewishDate($jd),
756
+							 new HijriDate($jd),
757
+							 new JalaliDate($jd),
758
+						 ) as $anniv) {
759 759
 			// Build a SQL where clause to match anniversaries in the appropriate calendar.
760 760
 			$ind_sql =
761 761
 				"SELECT DISTINCT i_id AS xref, i_gedcom AS gedcom, d_type, d_day, d_month, d_year, d_fact" .
Please login to merge, or discard this patch.
app/Functions/FunctionsExport.php 2 patches
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public static function exportGedcom(Tree $tree, $gedout, $exportOptions) {
185 185
 		switch ($exportOptions['privatize']) {
186
-			case 'gedadmin':
187
-				$access_level = Auth::PRIV_NONE;
188
-				break;
189
-			case 'user':
190
-				$access_level = Auth::PRIV_USER;
191
-				break;
192
-			case 'visitor':
193
-				$access_level = Auth::PRIV_PRIVATE;
194
-				break;
195
-			case 'none':
196
-				$access_level = Auth::PRIV_HIDE;
197
-				break;
186
+		case 'gedadmin':
187
+			$access_level = Auth::PRIV_NONE;
188
+			break;
189
+		case 'user':
190
+			$access_level = Auth::PRIV_USER;
191
+			break;
192
+		case 'visitor':
193
+			$access_level = Auth::PRIV_PRIVATE;
194
+			break;
195
+		case 'none':
196
+			$access_level = Auth::PRIV_HIDE;
197
+			break;
198 198
 		}
199 199
 
200 200
 		$head = self::gedcomHeader($tree);
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 
252 252
 		foreach ($rows as $row) {
253 253
 			switch ($row->type) {
254
-				case 'NOTE':
255
-					$record = Note::getInstance($row->xref, $tree, $row->gedcom);
256
-					break;
257
-				case 'REPO':
258
-					$record = Repository::getInstance($row->xref, $tree, $row->gedcom);
259
-					break;
260
-				default:
261
-					$record = GedcomRecord::getInstance($row->xref, $tree, $row->gedcom);
262
-					break;
254
+			case 'NOTE':
255
+				$record = Note::getInstance($row->xref, $tree, $row->gedcom);
256
+				break;
257
+			case 'REPO':
258
+				$record = Repository::getInstance($row->xref, $tree, $row->gedcom);
259
+				break;
260
+			default:
261
+				$record = GedcomRecord::getInstance($row->xref, $tree, $row->gedcom);
262
+				break;
263 263
 			}
264 264
 
265 265
 			$rec = $record->privatizeGedcom($access_level);
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) 2016 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) 2016 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/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) 2016 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) 2016 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) 2016 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) 2016 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.