Completed
Push — 1.7 ( ce7091...0d97cf )
by Greg
14:14 queued 07:41
created
app/SurnameTradition/PortugueseSurnameTradition.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,16 +62,16 @@
 block discarded – undo
62 62
 	public function newParentNames($child_name, $parent_sex) {
63 63
 		if (preg_match(self::REGEX_SURNS, $child_name, $match)) {
64 64
 			switch ($parent_sex) {
65
-			case 'M':
66
-				return array(
67
-					'NAME' => '// /' . $match['SURN1'] . '/',
68
-					'SURN' => $match['SURN1'],
69
-				);
70
-			case 'F':
71
-				return array(
72
-					'NAME' => '// /' . $match['SURN2'] . '/',
73
-					'SURN' => $match['SURN2'],
74
-				);
65
+			    case 'M':
66
+				    return array(
67
+					    'NAME' => '// /' . $match['SURN1'] . '/',
68
+					    'SURN' => $match['SURN1'],
69
+				    );
70
+			    case 'F':
71
+				    return array(
72
+					    'NAME' => '// /' . $match['SURN2'] . '/',
73
+					    'SURN' => $match['SURN2'],
74
+				    );
75 75
 			}
76 76
 		}
77 77
 
Please login to merge, or discard this patch.
app/SurnameTradition/IcelandicSurnameTradition.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@
 block discarded – undo
43 43
 	public function newChildNames($father_name, $mother_name, $child_sex) {
44 44
 		if (preg_match(self::REGEX_GIVN, $father_name, $father_match)) {
45 45
 			switch ($child_sex) {
46
-			case 'M':
47
-				return array(
48
-					'NAME' => $father_match['GIVN'] . 'sson',
49
-				);
50
-			case 'F':
51
-				return array(
52
-					'NAME' => $father_match['GIVN'] . 'sdottir',
53
-				);
46
+			    case 'M':
47
+				    return array(
48
+					    'NAME' => $father_match['GIVN'] . 'sson',
49
+				    );
50
+			    case 'F':
51
+				    return array(
52
+					    'NAME' => $father_match['GIVN'] . 'sdottir',
53
+				    );
54 54
 			}
55 55
 		}
56 56
 
Please login to merge, or discard this patch.
app/Controller/PedigreeController.php 1 patch
Switch Indentation   +87 added lines, -87 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;
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));
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);
186
-					}
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
-						}
197
-					}
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;
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));
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);
186
+					    }
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
+						    }
197
+					    }
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.
app/Controller/LifespanController.php 1 patch
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -509,23 +509,23 @@
 block discarded – undo
509 509
 	 */
510 510
 	public function getCalendarDate($date) {
511 511
 		switch ($this->calendar) {
512
-		case 'julian':
513
-			$caldate = new JulianDate($date);
514
-			break;
515
-		case 'french':
516
-			$caldate = new FrenchDate($date);
517
-			break;
518
-		case 'jewish':
519
-			$caldate = new JewishDate($date);
520
-			break;
521
-		case 'hijri':
522
-			$caldate = new HijriDate($date);
523
-			break;
524
-		case 'jalali':
525
-			$caldate = new JalaliDate($date);
526
-			break;
527
-		default:
528
-			$caldate = new GregorianDate($date);
512
+		    case 'julian':
513
+			    $caldate = new JulianDate($date);
514
+			    break;
515
+		    case 'french':
516
+			    $caldate = new FrenchDate($date);
517
+			    break;
518
+		    case 'jewish':
519
+			    $caldate = new JewishDate($date);
520
+			    break;
521
+		    case 'hijri':
522
+			    $caldate = new HijriDate($date);
523
+			    break;
524
+		    case 'jalali':
525
+			    $caldate = new JalaliDate($date);
526
+			    break;
527
+		    default:
528
+			    $caldate = new GregorianDate($date);
529 529
 		}
530 530
 
531 531
 		return $caldate;
Please login to merge, or discard this patch.
app/Controller/FanchartController.php 1 patch
Switch Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
 					$text .= "\n" . I18N::reverseText($person->getLifeSpan());
248 248
 
249 249
 					switch ($person->getSex()) {
250
-					case 'M':
251
-						$bg = $bgcolorM;
252
-						break;
253
-					case 'F':
254
-						$bg = $bgcolorF;
255
-						break;
256
-					default:
257
-						$bg = $bgcolor;
258
-						break;
250
+					    case 'M':
251
+						    $bg = $bgcolorM;
252
+						    break;
253
+					    case 'F':
254
+						    $bg = $bgcolorF;
255
+						    break;
256
+					    default:
257
+						    $bg = $bgcolor;
258
+						    break;
259 259
 					}
260 260
 
261 261
 					imagefilledarc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
@@ -366,19 +366,19 @@  discard block
 block discarded – undo
366 366
 		$imagemap .= '</map>';
367 367
 
368 368
 		switch ($what) {
369
-		case 'html':
370
-			return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&amp;fan_style=' . $this->fan_style . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . strip_tags($this->getPageTitle()) . '" usemap="#fanmap"></div>';
369
+		    case 'html':
370
+			    return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&amp;fan_style=' . $this->fan_style . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . strip_tags($this->getPageTitle()) . '" usemap="#fanmap"></div>';
371 371
 
372
-		case 'png':
373
-			imagestringup($image, 1, $fanw - 10, $fanh / 3, WT_BASE_URL, $color);
374
-			ob_start();
375
-			imagepng($image);
376
-			imagedestroy($image);
372
+		    case 'png':
373
+			    imagestringup($image, 1, $fanw - 10, $fanh / 3, WT_BASE_URL, $color);
374
+			    ob_start();
375
+			    imagepng($image);
376
+			    imagedestroy($image);
377 377
 
378
-			return ob_get_clean();
378
+			    return ob_get_clean();
379 379
 
380
-		default:
381
-			throw new \InvalidArgumentException(__METHOD__ . ' ' . $what);
380
+		    default:
381
+			    throw new \InvalidArgumentException(__METHOD__ . ' ' . $what);
382 382
 		}
383 383
 	}
384 384
 }
Please login to merge, or discard this patch.
app/Controller/IndividualController.php 1 patch
Switch Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 							$name = str_replace('/', '', $name);
183 183
 							$name = preg_replace('/(\S*)\*/', '<span class="starredname">\\1</span>', $name);
184 184
 							switch ($fact) {
185
-							case 'TYPE':
186
-								echo GedcomCodeName::getValue($name, $this->record);
187
-								break;
188
-							case 'SURN':
189
-								// The SURN field is not necessarily the surname.
190
-								// Where it is not a substring of the real surname, show it after the real surname.
191
-								$surname = Filter::escapeHtml($primary_name['surname']);
192
-								if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
193
-									echo '<span dir="auto">' . $surname . '</span>';
194
-								} else {
195
-									echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>');
196
-								}
197
-								break;
198
-							default:
199
-								echo '<span dir="auto">' . $name . '</span>';
200
-								break;
185
+							    case 'TYPE':
186
+								    echo GedcomCodeName::getValue($name, $this->record);
187
+								    break;
188
+							    case 'SURN':
189
+								    // The SURN field is not necessarily the surname.
190
+								    // Where it is not a substring of the real surname, show it after the real surname.
191
+								    $surname = Filter::escapeHtml($primary_name['surname']);
192
+								    if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
193
+									    echo '<span dir="auto">' . $surname . '</span>';
194
+								    } else {
195
+									    echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>');
196
+								    }
197
+								    break;
198
+							    default:
199
+								    echo '<span dir="auto">' . $name . '</span>';
200
+								    break;
201 201
 							}
202 202
 						}
203 203
 					echo '</dd>';
@@ -232,33 +232,33 @@  discard block
 block discarded – undo
232 232
 			echo 'new ';
233 233
 		}
234 234
 		switch ($sex) {
235
-		case 'M':
236
-			echo 'male_gender"';
237
-			if ($event->canEdit()) {
238
-				echo ' title="', I18N::translate('Male'), ' - ', I18N::translate('Edit'), '"';
239
-				echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
240
-			 } else {
241
-				echo ' title="', I18N::translate('Male'), '">';
242
-			 }
243
-			break;
244
-		case 'F':
245
-			echo 'female_gender"';
246
-			if ($event->canEdit()) {
247
-				echo ' title="', I18N::translate('Female'), ' - ', I18N::translate('Edit'), '"';
248
-				echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
249
-			 } else {
250
-				echo ' title="', I18N::translate('Female'), '">';
251
-			 }
252
-			break;
253
-		default:
254
-			echo 'unknown_gender"';
255
-			if ($event->canEdit()) {
256
-				echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), ' - ', I18N::translate('Edit'), '"';
257
-				echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
258
-			 } else {
259
-				echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), '">';
260
-			 }
261
-			break;
235
+		    case 'M':
236
+			    echo 'male_gender"';
237
+			    if ($event->canEdit()) {
238
+				    echo ' title="', I18N::translate('Male'), ' - ', I18N::translate('Edit'), '"';
239
+				    echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
240
+			     } else {
241
+				    echo ' title="', I18N::translate('Male'), '">';
242
+			     }
243
+			    break;
244
+		    case 'F':
245
+			    echo 'female_gender"';
246
+			    if ($event->canEdit()) {
247
+				    echo ' title="', I18N::translate('Female'), ' - ', I18N::translate('Edit'), '"';
248
+				    echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
249
+			     } else {
250
+				    echo ' title="', I18N::translate('Female'), '">';
251
+			     }
252
+			    break;
253
+		    default:
254
+			    echo 'unknown_gender"';
255
+			    if ($event->canEdit()) {
256
+				    echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), ' - ', I18N::translate('Edit'), '"';
257
+				    echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
258
+			     } else {
259
+				    echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), '">';
260
+			     }
261
+			    break;
262 262
 		}
263 263
 		echo '</span>';
264 264
 	}
@@ -324,15 +324,15 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function getPersonStyle($person) {
326 326
 		switch ($person->getSex()) {
327
-		case 'M':
328
-			$class = 'person_box';
329
-			break;
330
-		case 'F':
331
-			$class = 'person_boxF';
332
-			break;
333
-		default:
334
-			$class = 'person_boxNN';
335
-			break;
327
+		    case 'M':
328
+			    $class = 'person_box';
329
+			    break;
330
+		    case 'F':
331
+			    $class = 'person_boxF';
332
+			    break;
333
+		    default:
334
+			    $class = 'person_boxNN';
335
+			    break;
336 336
 		}
337 337
 		if ($person->isPendingDeletion()) {
338 338
 			$class .= ' old';
Please login to merge, or discard this patch.
app/Controller/AdvancedSearchController.php 1 patch
Switch Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -377,108 +377,108 @@  discard block
 block discarded – undo
377 377
 			if ($parts[0] == 'NAME') {
378 378
 				// NAME:*
379 379
 				switch ($parts[1]) {
380
-				case 'GIVN':
381
-					switch ($parts[2]) {
382
-					case 'EXACT':
383
-						$sql .= " AND i_n.n_givn=?";
384
-						$bind[] = $value;
385
-						break;
386
-					case 'BEGINS':
387
-						$sql .= " AND i_n.n_givn LIKE CONCAT(?, '%')";
388
-						$bind[] = $value;
389
-						break;
390
-					case 'CONTAINS':
391
-						$sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')";
392
-						$bind[] = $value;
393
-						break;
394
-					case 'SDX_STD':
395
-						$sdx = Soundex::russell($value);
396
-						if ($sdx !== null) {
397
-							$sdx = explode(':', $sdx);
398
-							foreach ($sdx as $k => $v) {
399
-								$sdx[$k] = "i_n.n_soundex_givn_std LIKE CONCAT('%', ?, '%')";
400
-								$bind[]  = $v;
401
-							}
402
-							$sql .= ' AND (' . implode(' OR ', $sdx) . ')';
403
-						} else {
404
-							// No phonetic content? Use a substring match
405
-							$sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')";
406
-							$bind[] = $value;
407
-						}
408
-						break;
409
-					case 'SDX': // SDX uses DM by default.
410
-					case 'SDX_DM':
411
-						$sdx = Soundex::daitchMokotoff($value);
412
-						if ($sdx !== null) {
413
-							$sdx = explode(':', $sdx);
414
-							foreach ($sdx as $k => $v) {
415
-								$sdx[$k] = "i_n.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')";
416
-								$bind[]  = $v;
417
-							}
418
-							$sql .= ' AND (' . implode(' OR ', $sdx) . ')';
419
-						} else {
420
-							// No phonetic content? Use a substring match
421
-							$sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')";
422
-							$bind[] = $value;
423
-						}
424
-						break;
425
-					}
426
-					break;
427
-				case 'SURN':
428
-					switch ($parts[2]) {
429
-					case 'EXACT':
430
-						$sql .= " AND i_n.n_surname=?";
431
-						$bind[] = $value;
432
-						break;
433
-					case 'BEGINS':
434
-						$sql .= " AND i_n.n_surname LIKE CONCAT(?, '%')";
435
-						$bind[] = $value;
436
-						break;
437
-					case 'CONTAINS':
438
-						$sql .= " AND i_n.n_surname LIKE CONCAT('%', ?, '%')";
439
-						$bind[] = $value;
440
-						break;
441
-					case 'SDX_STD':
442
-						$sdx = Soundex::russell($value);
443
-						if ($sdx !== null) {
444
-							$sdx = explode(':', $sdx);
445
-							foreach ($sdx as $k => $v) {
446
-								$sdx[$k] = "i_n.n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
447
-								$bind[]  = $v;
448
-							}
449
-							$sql .= " AND (" . implode(' OR ', $sdx) . ")";
450
-						} else {
451
-							// No phonetic content? Use a substring match
452
-							$sql .= " AND i_n.n_surn LIKE CONCAT('%', ?, '%')";
453
-							$bind[] = $value;
454
-						}
455
-						break;
456
-					case 'SDX': // SDX uses DM by default.
457
-					case 'SDX_DM':
458
-						$sdx = Soundex::daitchMokotoff($value);
459
-						if ($sdx !== null) {
460
-							$sdx = explode(':', $sdx);
461
-							foreach ($sdx as $k => $v) {
462
-								$sdx[$k] = "i_n.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
463
-								$bind[]  = $v;
464
-							}
465
-							$sql .= " AND (" . implode(' OR ', $sdx) . ")";
466
-							break;
467
-						} else {
468
-							// No phonetic content? Use a substring match
469
-							$sql .= " AND i_n.n_surn LIKE CONCAT('%', ?, '%')";
470
-							$bind[] = $value;
471
-						}
472
-					}
380
+				    case 'GIVN':
381
+					    switch ($parts[2]) {
382
+					        case 'EXACT':
383
+						        $sql .= " AND i_n.n_givn=?";
384
+						        $bind[] = $value;
385
+						        break;
386
+					        case 'BEGINS':
387
+						        $sql .= " AND i_n.n_givn LIKE CONCAT(?, '%')";
388
+						        $bind[] = $value;
389
+						        break;
390
+					        case 'CONTAINS':
391
+						        $sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')";
392
+						        $bind[] = $value;
393
+						        break;
394
+					        case 'SDX_STD':
395
+						        $sdx = Soundex::russell($value);
396
+						        if ($sdx !== null) {
397
+							        $sdx = explode(':', $sdx);
398
+							        foreach ($sdx as $k => $v) {
399
+								        $sdx[$k] = "i_n.n_soundex_givn_std LIKE CONCAT('%', ?, '%')";
400
+								        $bind[]  = $v;
401
+							        }
402
+							        $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
403
+						        } else {
404
+							        // No phonetic content? Use a substring match
405
+							        $sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')";
406
+							        $bind[] = $value;
407
+						        }
408
+						        break;
409
+					        case 'SDX': // SDX uses DM by default.
410
+					        case 'SDX_DM':
411
+						        $sdx = Soundex::daitchMokotoff($value);
412
+						        if ($sdx !== null) {
413
+							        $sdx = explode(':', $sdx);
414
+							        foreach ($sdx as $k => $v) {
415
+								        $sdx[$k] = "i_n.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')";
416
+								        $bind[]  = $v;
417
+							        }
418
+							        $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
419
+						        } else {
420
+							        // No phonetic content? Use a substring match
421
+							        $sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')";
422
+							        $bind[] = $value;
423
+						        }
424
+						        break;
425
+					    }
473 426
 					break;
474
-				case 'NICK':
475
-				case '_MARNM':
476
-				case '_HEB':
477
-				case '_AKA':
478
-					$sql .= " AND i_n.n_type=? AND i_n.n_full LIKE CONCAT('%', ?, '%')";
479
-					$bind[] = $parts[1];
480
-					$bind[] = $value;
427
+				    case 'SURN':
428
+					    switch ($parts[2]) {
429
+					        case 'EXACT':
430
+						        $sql .= " AND i_n.n_surname=?";
431
+						        $bind[] = $value;
432
+						        break;
433
+					        case 'BEGINS':
434
+						        $sql .= " AND i_n.n_surname LIKE CONCAT(?, '%')";
435
+						        $bind[] = $value;
436
+						        break;
437
+					        case 'CONTAINS':
438
+						        $sql .= " AND i_n.n_surname LIKE CONCAT('%', ?, '%')";
439
+						        $bind[] = $value;
440
+						        break;
441
+					        case 'SDX_STD':
442
+						        $sdx = Soundex::russell($value);
443
+						        if ($sdx !== null) {
444
+							        $sdx = explode(':', $sdx);
445
+							        foreach ($sdx as $k => $v) {
446
+								        $sdx[$k] = "i_n.n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
447
+								        $bind[]  = $v;
448
+							        }
449
+							        $sql .= " AND (" . implode(' OR ', $sdx) . ")";
450
+						        } else {
451
+							        // No phonetic content? Use a substring match
452
+							        $sql .= " AND i_n.n_surn LIKE CONCAT('%', ?, '%')";
453
+							        $bind[] = $value;
454
+						        }
455
+						        break;
456
+					        case 'SDX': // SDX uses DM by default.
457
+					        case 'SDX_DM':
458
+						        $sdx = Soundex::daitchMokotoff($value);
459
+						        if ($sdx !== null) {
460
+							        $sdx = explode(':', $sdx);
461
+							        foreach ($sdx as $k => $v) {
462
+								        $sdx[$k] = "i_n.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
463
+								        $bind[]  = $v;
464
+							        }
465
+							        $sql .= " AND (" . implode(' OR ', $sdx) . ")";
466
+							        break;
467
+						        } else {
468
+							        // No phonetic content? Use a substring match
469
+							        $sql .= " AND i_n.n_surn LIKE CONCAT('%', ?, '%')";
470
+							        $bind[] = $value;
471
+						        }
472
+					    }
481 473
 					break;
474
+				    case 'NICK':
475
+				    case '_MARNM':
476
+				    case '_HEB':
477
+				    case '_AKA':
478
+					    $sql .= " AND i_n.n_type=? AND i_n.n_full LIKE CONCAT('%', ?, '%')";
479
+					    $bind[] = $parts[1];
480
+					    $bind[] = $value;
481
+					    break;
482 482
 				}
483 483
 			} elseif ($parts[1] == 'DATE') {
484 484
 				// *:DATE
@@ -526,99 +526,99 @@  discard block
 block discarded – undo
526 526
 				$table = $parts[1] == 'HUSB' ? 'f_n' : 'm_n';
527 527
 				// NAME:*
528 528
 				switch ($parts[3]) {
529
-				case 'GIVN':
530
-					switch ($parts[4]) {
531
-					case 'EXACT':
532
-						$sql .= " AND {$table}.n_givn=?";
533
-						$bind[] = $value;
534
-						break;
535
-					case 'BEGINS':
536
-						$sql .= " AND {$table}.n_givn LIKE CONCAT(?, '%')";
537
-						$bind[] = $value;
538
-						break;
539
-					case 'CONTAINS':
540
-						$sql .= " AND {$table}.n_givn LIKE CONCAT('%', ?, '%')";
541
-						$bind[] = $value;
542
-						break;
543
-					case 'SDX_STD':
544
-						$sdx = Soundex::russell($value);
545
-						if ($sdx !== null) {
546
-							$sdx = explode(':', $sdx);
547
-							foreach ($sdx as $k => $v) {
548
-								$sdx[$k] = "{$table}.n_soundex_givn_std LIKE CONCAT('%', ?, '%')";
549
-								$bind[]  = $v;
550
-							}
551
-							$sql .= ' AND (' . implode(' OR ', $sdx) . ')';
552
-						} else {
553
-							// No phonetic content? Use a substring match
554
-							$sql .= " AND {$table}.n_givn = LIKE CONCAT('%', ?, '%')";
555
-							$bind[] = $value;
556
-						}
557
-						break;
558
-					case 'SDX': // SDX uses DM by default.
559
-					case 'SDX_DM':
560
-						$sdx = Soundex::daitchMokotoff($value);
561
-						if ($sdx !== null) {
562
-							$sdx = explode(':', $sdx);
563
-							foreach ($sdx as $k => $v) {
564
-								$sdx[$k] = "{$table}.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')";
565
-								$bind[]  = $v;
566
-							}
567
-							$sql .= ' AND (' . implode(' OR ', $sdx) . ')';
568
-							break;
569
-						} else {
570
-							// No phonetic content? Use a substring match
571
-							$sql .= " AND {$table}.n_givn = LIKE CONCAT('%', ?, '%')";
572
-							$bind[] = $value;
573
-						}
574
-					}
529
+				    case 'GIVN':
530
+					    switch ($parts[4]) {
531
+					        case 'EXACT':
532
+						        $sql .= " AND {$table}.n_givn=?";
533
+						        $bind[] = $value;
534
+						        break;
535
+					        case 'BEGINS':
536
+						        $sql .= " AND {$table}.n_givn LIKE CONCAT(?, '%')";
537
+						        $bind[] = $value;
538
+						        break;
539
+					        case 'CONTAINS':
540
+						        $sql .= " AND {$table}.n_givn LIKE CONCAT('%', ?, '%')";
541
+						        $bind[] = $value;
542
+						        break;
543
+					        case 'SDX_STD':
544
+						        $sdx = Soundex::russell($value);
545
+						        if ($sdx !== null) {
546
+							        $sdx = explode(':', $sdx);
547
+							        foreach ($sdx as $k => $v) {
548
+								        $sdx[$k] = "{$table}.n_soundex_givn_std LIKE CONCAT('%', ?, '%')";
549
+								        $bind[]  = $v;
550
+							        }
551
+							        $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
552
+						        } else {
553
+							        // No phonetic content? Use a substring match
554
+							        $sql .= " AND {$table}.n_givn = LIKE CONCAT('%', ?, '%')";
555
+							        $bind[] = $value;
556
+						        }
557
+						        break;
558
+					        case 'SDX': // SDX uses DM by default.
559
+					        case 'SDX_DM':
560
+						        $sdx = Soundex::daitchMokotoff($value);
561
+						        if ($sdx !== null) {
562
+							        $sdx = explode(':', $sdx);
563
+							        foreach ($sdx as $k => $v) {
564
+								        $sdx[$k] = "{$table}.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')";
565
+								        $bind[]  = $v;
566
+							        }
567
+							        $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
568
+							        break;
569
+						        } else {
570
+							        // No phonetic content? Use a substring match
571
+							        $sql .= " AND {$table}.n_givn = LIKE CONCAT('%', ?, '%')";
572
+							        $bind[] = $value;
573
+						        }
574
+					    }
575 575
 					break;
576
-				case 'SURN':
577
-					switch ($parts[4]) {
578
-					case 'EXACT':
579
-						$sql .= " AND {$table}.n_surname=?";
580
-						$bind[] = $value;
581
-						break;
582
-					case 'BEGINS':
583
-						$sql .= " AND {$table}.n_surname LIKE CONCAT(?, '%')";
584
-						$bind[] = $value;
585
-						break;
586
-					case 'CONTAINS':
587
-						$sql .= " AND {$table}.n_surname LIKE CONCAT('%', ?, '%')";
588
-						$bind[] = $value;
589
-						break;
590
-					case 'SDX_STD':
591
-						$sdx = Soundex::russell($value);
592
-						if ($sdx !== null) {
593
-							$sdx = explode(':', $sdx);
594
-							foreach ($sdx as $k => $v) {
595
-								$sdx[$k] = "{$table}.n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
596
-								$bind[]  = $v;
597
-							}
598
-							$sql .= ' AND (' . implode(' OR ', $sdx) . ')';
599
-						} else {
600
-							// No phonetic content? Use a substring match
601
-							$sql .= " AND {$table}.n_surn = LIKE CONCAT('%', ?, '%')";
602
-							$bind[] = $value;
603
-						}
604
-						break;
605
-					case 'SDX': // SDX uses DM by default.
606
-					case 'SDX_DM':
607
-						$sdx = Soundex::daitchMokotoff($value);
608
-						if ($sdx !== null) {
609
-							$sdx = explode(':', $sdx);
610
-							foreach ($sdx as $k => $v) {
611
-								$sdx[$k] = "{$table}.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
612
-								$bind[]  = $v;
613
-							}
614
-							$sql .= ' AND (' . implode(' OR ', $sdx) . ')';
615
-						} else {
616
-							// No phonetic content? Use a substring match
617
-							$sql .= " AND {$table}.n_surn = LIKE CONCAT('%', ?, '%')";
618
-							$bind[] = $value;
619
-						}
620
-						break;
621
-					}
576
+				    case 'SURN':
577
+					    switch ($parts[4]) {
578
+					        case 'EXACT':
579
+						        $sql .= " AND {$table}.n_surname=?";
580
+						        $bind[] = $value;
581
+						        break;
582
+					        case 'BEGINS':
583
+						        $sql .= " AND {$table}.n_surname LIKE CONCAT(?, '%')";
584
+						        $bind[] = $value;
585
+						        break;
586
+					        case 'CONTAINS':
587
+						        $sql .= " AND {$table}.n_surname LIKE CONCAT('%', ?, '%')";
588
+						        $bind[] = $value;
589
+						        break;
590
+					        case 'SDX_STD':
591
+						        $sdx = Soundex::russell($value);
592
+						        if ($sdx !== null) {
593
+							        $sdx = explode(':', $sdx);
594
+							        foreach ($sdx as $k => $v) {
595
+								        $sdx[$k] = "{$table}.n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
596
+								        $bind[]  = $v;
597
+							        }
598
+							        $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
599
+						        } else {
600
+							        // No phonetic content? Use a substring match
601
+							        $sql .= " AND {$table}.n_surn = LIKE CONCAT('%', ?, '%')";
602
+							        $bind[] = $value;
603
+						        }
604
+						        break;
605
+					        case 'SDX': // SDX uses DM by default.
606
+					        case 'SDX_DM':
607
+						        $sdx = Soundex::daitchMokotoff($value);
608
+						        if ($sdx !== null) {
609
+							        $sdx = explode(':', $sdx);
610
+							        foreach ($sdx as $k => $v) {
611
+								        $sdx[$k] = "{$table}.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
612
+								        $bind[]  = $v;
613
+							        }
614
+							        $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
615
+						        } else {
616
+							        // No phonetic content? Use a substring match
617
+							        $sql .= " AND {$table}.n_surn = LIKE CONCAT('%', ?, '%')";
618
+							        $bind[] = $value;
619
+						        }
620
+						        break;
621
+					    }
622 622
 					break;
623 623
 				}
624 624
 			} elseif ($parts[0] === 'FAMS') {
Please login to merge, or discard this patch.
app/Controller/SearchController.php 1 patch
Switch Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -170,46 +170,46 @@
 block discarded – undo
170 170
 
171 171
 		// If we want to show associated persons, build the list
172 172
 		switch ($this->action) {
173
-		case 'header':
174
-			// We can type in an XREF into the header search, and jump straight to it.
175
-			// Otherwise, the header search is the same as the general search
176
-			if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) {
177
-				$record = GedcomRecord::getInstance($this->query, $WT_TREE);
178
-				if ($record && $record->canShowName()) {
179
-					header('Location: ' . WT_BASE_URL . $record->getRawUrl());
180
-					exit;
181
-				}
182
-			}
183
-			$this->action = 'general';
184
-			$this->srindi = 'checked';
185
-			$this->srfams = 'checked';
186
-			$this->srsour = 'checked';
187
-			$this->srnote = 'checked';
188
-			$this->setPageTitle(I18N::translate('General search'));
189
-			$this->generalSearch();
190
-			break;
191
-		case 'general':
192
-			$this->setPageTitle(I18N::translate('General search'));
193
-			$this->generalSearch();
194
-			break;
195
-		case 'soundex':
196
-			// Create a dummy search query to use as a title to the results list
197
-			$this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place);
198
-			$this->setPageTitle(I18N::translate('Phonetic search'));
199
-			$this->soundexSearch();
200
-			break;
201
-		case 'replace':
202
-			$this->setPageTitle(I18N::translate('Search and replace'));
203
-			$this->search_trees = array($WT_TREE);
204
-			$this->srindi       = 'checked';
205
-			$this->srfams       = 'checked';
206
-			$this->srsour       = 'checked';
207
-			$this->srnote       = 'checked';
208
-			if (Filter::post('query')) {
209
-				$this->searchAndReplace($WT_TREE);
210
-				header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord);
211
-				exit;
212
-			}
173
+		    case 'header':
174
+			    // We can type in an XREF into the header search, and jump straight to it.
175
+			    // Otherwise, the header search is the same as the general search
176
+			    if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) {
177
+				    $record = GedcomRecord::getInstance($this->query, $WT_TREE);
178
+				    if ($record && $record->canShowName()) {
179
+					    header('Location: ' . WT_BASE_URL . $record->getRawUrl());
180
+					    exit;
181
+				    }
182
+			    }
183
+			    $this->action = 'general';
184
+			    $this->srindi = 'checked';
185
+			    $this->srfams = 'checked';
186
+			    $this->srsour = 'checked';
187
+			    $this->srnote = 'checked';
188
+			    $this->setPageTitle(I18N::translate('General search'));
189
+			    $this->generalSearch();
190
+			    break;
191
+		    case 'general':
192
+			    $this->setPageTitle(I18N::translate('General search'));
193
+			    $this->generalSearch();
194
+			    break;
195
+		    case 'soundex':
196
+			    // Create a dummy search query to use as a title to the results list
197
+			    $this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place);
198
+			    $this->setPageTitle(I18N::translate('Phonetic search'));
199
+			    $this->soundexSearch();
200
+			    break;
201
+		    case 'replace':
202
+			    $this->setPageTitle(I18N::translate('Search and replace'));
203
+			    $this->search_trees = array($WT_TREE);
204
+			    $this->srindi       = 'checked';
205
+			    $this->srfams       = 'checked';
206
+			    $this->srsour       = 'checked';
207
+			    $this->srnote       = 'checked';
208
+			    if (Filter::post('query')) {
209
+				    $this->searchAndReplace($WT_TREE);
210
+				    header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord);
211
+				    exit;
212
+			    }
213 213
 		}
214 214
 	}
215 215
 
Please login to merge, or discard this patch.
app/Individual.php 1 patch
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -879,33 +879,33 @@
 block discarded – undo
879 879
 	public function getPrimaryChildFamily() {
880 880
 		$families = $this->getChildFamilies();
881 881
 		switch (count($families)) {
882
-		case 0:
883
-			return null;
884
-		case 1:
885
-			return reset($families);
886
-		default:
887
-			// If there is more than one FAMC record, choose the preferred parents:
888
-			// a) records with '2 _PRIMARY'
889
-			foreach ($families as $famid => $fam) {
890
-				if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 _PRIMARY Y)/", $this->getGedcom())) {
891
-					return $fam;
892
-				}
893
-			}
894
-			// b) records with '2 PEDI birt'
895
-			foreach ($families as $famid => $fam) {
896
-				if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI birth)/", $this->getGedcom())) {
897
-					return $fam;
898
-				}
899
-			}
900
-			// c) records with no '2 PEDI'
901
-			foreach ($families as $famid => $fam) {
902
-				if (!preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI)/", $this->getGedcom())) {
903
-					return $fam;
904
-				}
905
-			}
906
-
907
-			// d) any record
908
-			return reset($families);
882
+		    case 0:
883
+			    return null;
884
+		    case 1:
885
+			    return reset($families);
886
+		    default:
887
+			    // If there is more than one FAMC record, choose the preferred parents:
888
+			    // a) records with '2 _PRIMARY'
889
+			    foreach ($families as $famid => $fam) {
890
+				    if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 _PRIMARY Y)/", $this->getGedcom())) {
891
+					    return $fam;
892
+				    }
893
+			    }
894
+			    // b) records with '2 PEDI birt'
895
+			    foreach ($families as $famid => $fam) {
896
+				    if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI birth)/", $this->getGedcom())) {
897
+					    return $fam;
898
+				    }
899
+			    }
900
+			    // c) records with no '2 PEDI'
901
+			    foreach ($families as $famid => $fam) {
902
+				    if (!preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI)/", $this->getGedcom())) {
903
+					    return $fam;
904
+				    }
905
+			    }
906
+
907
+			    // d) any record
908
+			    return reset($families);
909 909
 		}
910 910
 	}
911 911
 
Please login to merge, or discard this patch.