Test Failed
Branch master (4a3c5b)
by Greg
12:31
created
app/Query/QueryName.php 1 patch
Switch Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -34,85 +34,85 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	private static function getAlphabetForLocale($locale) {
36 36
 		switch ($locale) {
37
-		case 'ar':
38
-			return [
39
-				'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی',
40
-			];
41
-		case 'cs':
42
-			return [
43
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
44
-			];
45
-		case 'da':
46
-		case 'nb':
47
-		case 'nn':
48
-			return [
49
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å',
50
-			];
51
-		case 'el':
52
-			return [
53
-				'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω',
54
-			];
55
-		case 'es':
56
-			return [
57
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
58
-			];
59
-		case 'et':
60
-			return [
61
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y',
62
-			];
63
-		case 'fi':
64
-		case 'sv':
65
-			return [
66
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö',
67
-			];
68
-		case 'he':
69
-			return [
70
-				'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת',
71
-			];
72
-		case 'hu':
73
-			return [
74
-				'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS',
75
-			];
76
-		case 'lt':
77
-			return [
78
-				'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž',
79
-			];
80
-		case 'nl':
81
-			return [
82
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ',
83
-			];
84
-		case 'pl':
85
-			return [
86
-				'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż',
87
-			];
88
-		case 'ro':
89
-			return [
90
-				'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z',
91
-			];
92
-		case 'ru':
93
-			return [
94
-				'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я',
95
-			];
96
-		case 'sk':
97
-			return [
98
-				'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž',
99
-			];
100
-		case 'sl':
101
-			return [
102
-				'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž',
103
-			];
104
-		case 'sr':
105
-			return [
106
-				'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž',
107
-			];
108
-		case 'tr':
109
-			return [
110
-				'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z',
111
-			];
112
-		default:
113
-			return [
114
-				'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
115
-			];
37
+			case 'ar':
38
+				return [
39
+					'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی',
40
+				];
41
+			case 'cs':
42
+				return [
43
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
44
+				];
45
+			case 'da':
46
+			case 'nb':
47
+			case 'nn':
48
+				return [
49
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å',
50
+				];
51
+			case 'el':
52
+				return [
53
+					'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω',
54
+				];
55
+			case 'es':
56
+				return [
57
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
58
+				];
59
+			case 'et':
60
+				return [
61
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y',
62
+				];
63
+			case 'fi':
64
+			case 'sv':
65
+				return [
66
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö',
67
+				];
68
+			case 'he':
69
+				return [
70
+					'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת',
71
+				];
72
+			case 'hu':
73
+				return [
74
+					'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS',
75
+				];
76
+			case 'lt':
77
+				return [
78
+					'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž',
79
+				];
80
+			case 'nl':
81
+				return [
82
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ',
83
+				];
84
+			case 'pl':
85
+				return [
86
+					'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż',
87
+				];
88
+			case 'ro':
89
+				return [
90
+					'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z',
91
+				];
92
+			case 'ru':
93
+				return [
94
+					'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я',
95
+				];
96
+			case 'sk':
97
+				return [
98
+					'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž',
99
+				];
100
+			case 'sl':
101
+				return [
102
+					'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž',
103
+				];
104
+			case 'sr':
105
+				return [
106
+					'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž',
107
+				];
108
+			case 'tr':
109
+				return [
110
+					'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z',
111
+				];
112
+			default:
113
+				return [
114
+					'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
115
+				];
116 116
 		}
117 117
 	}
118 118
 
@@ -126,44 +126,44 @@  discard block
 block discarded – undo
126 126
 	public static function initialLetter($name) {
127 127
 		$name = I18N::strtoupper($name);
128 128
 		switch (WT_LOCALE) {
129
-		case 'cs':
130
-			if (substr($name, 0, 2) == 'CH') {
131
-				return 'CH';
132
-			}
133
-			break;
134
-		case 'da':
135
-		case 'nb':
136
-		case 'nn':
137
-			if (substr($name, 0, 2) == 'AA') {
138
-				return 'Å';
139
-			}
140
-			break;
141
-		case 'hu':
142
-			if (substr($name, 0, 2) == 'CS') {
143
-				return 'CS';
144
-			} elseif (substr($name, 0, 3) == 'DZS') {
145
-				return 'DZS';
146
-			} elseif (substr($name, 0, 2) == 'DZ') {
147
-				return 'DZ';
148
-			} elseif (substr($name, 0, 2) == 'GY') {
149
-				return 'GY';
150
-			} elseif (substr($name, 0, 2) == 'LY') {
151
-				return 'LY';
152
-			} elseif (substr($name, 0, 2) == 'NY') {
153
-				return 'NY';
154
-			} elseif (substr($name, 0, 2) == 'SZ') {
155
-				return 'SZ';
156
-			} elseif (substr($name, 0, 2) == 'TY') {
157
-				return 'TY';
158
-			} elseif (substr($name, 0, 2) == 'ZS') {
159
-				return 'ZS';
160
-			}
161
-			break;
162
-		case 'nl':
163
-			if (substr($name, 0, 2) == 'IJ') {
164
-				return 'IJ';
165
-			}
166
-			break;
129
+			case 'cs':
130
+				if (substr($name, 0, 2) == 'CH') {
131
+					return 'CH';
132
+				}
133
+				break;
134
+			case 'da':
135
+			case 'nb':
136
+			case 'nn':
137
+				if (substr($name, 0, 2) == 'AA') {
138
+					return 'Å';
139
+				}
140
+				break;
141
+			case 'hu':
142
+				if (substr($name, 0, 2) == 'CS') {
143
+					return 'CS';
144
+				} elseif (substr($name, 0, 3) == 'DZS') {
145
+					return 'DZS';
146
+				} elseif (substr($name, 0, 2) == 'DZ') {
147
+					return 'DZ';
148
+				} elseif (substr($name, 0, 2) == 'GY') {
149
+					return 'GY';
150
+				} elseif (substr($name, 0, 2) == 'LY') {
151
+					return 'LY';
152
+				} elseif (substr($name, 0, 2) == 'NY') {
153
+					return 'NY';
154
+				} elseif (substr($name, 0, 2) == 'SZ') {
155
+					return 'SZ';
156
+				} elseif (substr($name, 0, 2) == 'TY') {
157
+					return 'TY';
158
+				} elseif (substr($name, 0, 2) == 'ZS') {
159
+					return 'ZS';
160
+				}
161
+				break;
162
+			case 'nl':
163
+				if (substr($name, 0, 2) == 'IJ') {
164
+					return 'IJ';
165
+				}
166
+				break;
167 167
 		}
168 168
 		// No special rules - just take the first character
169 169
 		return mb_substr($name, 0, 1);
@@ -191,37 +191,37 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	private static function getInitialSql($field, $letter) {
193 193
 		switch (WT_LOCALE) {
194
-		case 'cs':
195
-			switch ($letter) {
196
-			case 'C': return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CH%' COLLATE " . I18N::collation();
197
-			}
194
+			case 'cs':
195
+				switch ($letter) {
196
+					case 'C': return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CH%' COLLATE " . I18N::collation();
197
+				}
198 198
 			break;
199
-		case 'da':
200
-		case 'nb':
201
-		case 'nn':
202
-			switch ($letter) {
203
-			// AA gets listed under Å
204
-			case 'A': return $field . " LIKE 'A%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'AA%' COLLATE " . I18N::collation();
205
-			case 'Å': return "(" . $field . " LIKE 'Å%' COLLATE " . I18N::collation() . " OR " . $field . " LIKE 'AA%' COLLATE " . I18N::collation() . ")";
206
-			}
199
+			case 'da':
200
+			case 'nb':
201
+			case 'nn':
202
+				switch ($letter) {
203
+				// AA gets listed under Å
204
+					case 'A': return $field . " LIKE 'A%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'AA%' COLLATE " . I18N::collation();
205
+					case 'Å': return "(" . $field . " LIKE 'Å%' COLLATE " . I18N::collation() . " OR " . $field . " LIKE 'AA%' COLLATE " . I18N::collation() . ")";
206
+				}
207 207
 			break;
208
-		case 'hu':
209
-			switch ($letter) {
210
-			case 'C':  return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CS%' COLLATE " . I18N::collation();
211
-			case 'D':  return $field . " LIKE 'D%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZ%' COLLATE " . I18N::collation();
212
-			case 'DZ': return $field . " LIKE 'DZ%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZS%' COLLATE " . I18N::collation();
213
-			case 'G':  return $field . " LIKE 'G%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'GY%' COLLATE " . I18N::collation();
214
-			case 'L':  return $field . " LIKE 'L%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'LY%' COLLATE " . I18N::collation();
215
-			case 'N':  return $field . " LIKE 'N%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'NY%' COLLATE " . I18N::collation();
216
-			case 'S':  return $field . " LIKE 'S%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'SZ%' COLLATE " . I18N::collation();
217
-			case 'T':  return $field . " LIKE 'T%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'TY%' COLLATE " . I18N::collation();
218
-			case 'Z':  return $field . " LIKE 'Z%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'ZS%' COLLATE " . I18N::collation();
219
-			}
208
+			case 'hu':
209
+				switch ($letter) {
210
+					case 'C':  return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CS%' COLLATE " . I18N::collation();
211
+					case 'D':  return $field . " LIKE 'D%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZ%' COLLATE " . I18N::collation();
212
+					case 'DZ': return $field . " LIKE 'DZ%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZS%' COLLATE " . I18N::collation();
213
+					case 'G':  return $field . " LIKE 'G%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'GY%' COLLATE " . I18N::collation();
214
+					case 'L':  return $field . " LIKE 'L%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'LY%' COLLATE " . I18N::collation();
215
+					case 'N':  return $field . " LIKE 'N%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'NY%' COLLATE " . I18N::collation();
216
+					case 'S':  return $field . " LIKE 'S%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'SZ%' COLLATE " . I18N::collation();
217
+					case 'T':  return $field . " LIKE 'T%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'TY%' COLLATE " . I18N::collation();
218
+					case 'Z':  return $field . " LIKE 'Z%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'ZS%' COLLATE " . I18N::collation();
219
+				}
220 220
 			break;
221
-		case 'nl':
222
-			switch ($letter) {
223
-			case 'I': return $field . " LIKE 'I%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'IJ%' COLLATE " . I18N::collation();
224
-			}
221
+			case 'nl':
222
+				switch ($letter) {
223
+					case 'I': return $field . " LIKE 'I%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'IJ%' COLLATE " . I18N::collation();
224
+				}
225 225
 			break;
226 226
 		}
227 227
 
Please login to merge, or discard this patch.
app/Report/ReportHtmlImage.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,20 +43,20 @@
 block discarded – undo
43 43
 
44 44
 		// Image alignment
45 45
 		switch ($this->align) {
46
-		case 'L':
47
-			echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
-			echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
49
-			break;
50
-		case 'C':
51
-			echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
-			echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
53
-			break;
54
-		case 'R':
55
-			echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
-			echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
57
-			break;
58
-		default:
59
-			echo '<img src="', $this->file, '" style="position:absolute;', $renderer->alignRTL, ':', $this->x, 'pt;top:', $this->y, 'pt;width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n";
46
+			case 'L':
47
+				echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
+				echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
49
+				break;
50
+			case 'C':
51
+				echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
+				echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
53
+				break;
54
+			case 'R':
55
+				echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
+				echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
57
+				break;
58
+			default:
59
+				echo '<img src="', $this->file, '" style="position:absolute;', $renderer->alignRTL, ':', $this->x, 'pt;top:', $this->y, 'pt;width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n";
60 60
 		}
61 61
 
62 62
 		$lastpicpage   = $renderer->pageNo();
Please login to merge, or discard this patch.
app/Report/ReportParserGenerate.php 1 patch
Switch Indentation   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -933,14 +933,14 @@  discard block
 block discarded – undo
933 933
 				$tags  = preg_split('/[: ]/', $tag);
934 934
 				$value = $this->getGedcomValue($tag, $level, $this->gedrec);
935 935
 				switch (end($tags)) {
936
-				case 'DATE':
937
-					$tmp   = new Date($value);
938
-					$value = $tmp->display();
939
-					break;
940
-				case 'PLAC':
941
-					$tmp   = new Place($value, $WT_TREE);
942
-					$value = $tmp->getShortName();
943
-					break;
936
+					case 'DATE':
937
+						$tmp   = new Date($value);
938
+						$value = $tmp->display();
939
+						break;
940
+					case 'PLAC':
941
+						$tmp   = new Place($value, $WT_TREE);
942
+						$value = $tmp->getShortName();
943
+						break;
944 944
 				}
945 945
 				if ($useBreak == '1') {
946 946
 					// Insert <br> when multiple dates exist.
@@ -1333,22 +1333,22 @@  discard block
 block discarded – undo
1333 1333
 		// Arithmetic functions
1334 1334
 		if (preg_match("/(\d+)\s*([\-\+\*\/])\s*(\d+)/", $value, $match)) {
1335 1335
 			switch ($match[2]) {
1336
-			case '+':
1337
-				$t     = $match[1] + $match[3];
1338
-				$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1339
-				break;
1340
-			case '-':
1341
-				$t     = $match[1] - $match[3];
1342
-				$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1343
-				break;
1344
-			case '*':
1345
-				$t     = $match[1] * $match[3];
1346
-				$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1347
-				break;
1348
-			case '/':
1349
-				$t     = $match[1] / $match[3];
1350
-				$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1351
-				break;
1336
+				case '+':
1337
+					$t     = $match[1] + $match[3];
1338
+					$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1339
+					break;
1340
+				case '-':
1341
+					$t     = $match[1] - $match[3];
1342
+					$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1343
+					break;
1344
+				case '*':
1345
+					$t     = $match[1] * $match[3];
1346
+					$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1347
+					break;
1348
+				case '/':
1349
+					$t     = $match[1] / $match[3];
1350
+					$value = preg_replace('/' . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . '/', $t, $value);
1351
+					break;
1352 1352
 			}
1353 1353
 		}
1354 1354
 		if (strpos($value, '@') !== false) {
@@ -1816,179 +1816,179 @@  discard block
 block discarded – undo
1816 1816
 		}
1817 1817
 		// Some filters/sorts can be applied using SQL, while others require PHP
1818 1818
 		switch ($listname) {
1819
-		case 'pending':
1820
-			$rows = Database::prepare(
1821
-				"SELECT xref, CASE new_gedcom WHEN '' THEN old_gedcom ELSE new_gedcom END AS gedcom" .
1822
-				" FROM `##change`" . " WHERE (xref, change_id) IN (" .
1823
-				"  SELECT xref, MAX(change_id)" .
1824
-				"  FROM `##change`" .
1825
-				"  WHERE status = 'pending' AND gedcom_id = :tree_id" .
1826
-				"  GROUP BY xref" .
1827
-				" )"
1828
-			)->execute([
1829
-				'tree_id' => $WT_TREE->getTreeId(),
1830
-			])->fetchAll();
1831
-			$this->list = [];
1832
-			foreach ($rows as $row) {
1833
-				$this->list[] = GedcomRecord::getInstance($row->xref, $WT_TREE, $row->gedcom);
1834
-			}
1835
-			break;
1836
-		case 'individual':
1837
-			$sql_select   = "SELECT i_id AS xref, i_gedcom AS gedcom FROM `##individuals` ";
1838
-			$sql_join     = "";
1839
-			$sql_where    = " WHERE i_file = :tree_id";
1840
-			$sql_order_by = "";
1841
-			$sql_params   = ['tree_id' => $WT_TREE->getTreeId()];
1842
-			foreach ($attrs as $attr => $value) {
1843
-				if (strpos($attr, 'filter') === 0 && $value) {
1844
-					$value = $this->substituteVars($value, false);
1845
-					// Convert the various filters into SQL
1846
-					if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1847
-						$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=i_file AND {$attr}.d_gid=i_id)";
1848
-						$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1849
-						$sql_params[$attr . 'fact'] = $match[1];
1850
-						$date                       = new Date($match[3]);
1851
-						if ($match[2] == 'LTE') {
1852
-							$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1853
-							$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1854
-						} else {
1855
-							$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1856
-							$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1857
-						}
1858
-						if ($sortby == $match[1]) {
1859
-							$sortby = "";
1860
-							$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1861
-						}
1862
-						unset($attrs[$attr]); // This filter has been fully processed
1863
-					} elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
1864
-						// Do nothing, unless you have to
1865
-						if ($match[1] != '' || $sortby == 'NAME') {
1866
-							$sql_join .= " JOIN `##name` AS {$attr} ON (n_file=i_file AND n_id=i_id)";
1867
-							// Search the DB only if there is any name supplied
1868
-							if ($match[1] != '') {
1869
-								$names = explode(' ', $match[1]);
1870
-								foreach ($names as $n => $name) {
1871
-									$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1872
-									$sql_params[$attr . 'name' . $n] = $name;
1873
-								}
1819
+			case 'pending':
1820
+				$rows = Database::prepare(
1821
+					"SELECT xref, CASE new_gedcom WHEN '' THEN old_gedcom ELSE new_gedcom END AS gedcom" .
1822
+					" FROM `##change`" . " WHERE (xref, change_id) IN (" .
1823
+					"  SELECT xref, MAX(change_id)" .
1824
+					"  FROM `##change`" .
1825
+					"  WHERE status = 'pending' AND gedcom_id = :tree_id" .
1826
+					"  GROUP BY xref" .
1827
+					" )"
1828
+				)->execute([
1829
+					'tree_id' => $WT_TREE->getTreeId(),
1830
+				])->fetchAll();
1831
+				$this->list = [];
1832
+				foreach ($rows as $row) {
1833
+					$this->list[] = GedcomRecord::getInstance($row->xref, $WT_TREE, $row->gedcom);
1834
+				}
1835
+				break;
1836
+			case 'individual':
1837
+				$sql_select   = "SELECT i_id AS xref, i_gedcom AS gedcom FROM `##individuals` ";
1838
+				$sql_join     = "";
1839
+				$sql_where    = " WHERE i_file = :tree_id";
1840
+				$sql_order_by = "";
1841
+				$sql_params   = ['tree_id' => $WT_TREE->getTreeId()];
1842
+				foreach ($attrs as $attr => $value) {
1843
+					if (strpos($attr, 'filter') === 0 && $value) {
1844
+						$value = $this->substituteVars($value, false);
1845
+						// Convert the various filters into SQL
1846
+						if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1847
+							$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=i_file AND {$attr}.d_gid=i_id)";
1848
+							$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1849
+							$sql_params[$attr . 'fact'] = $match[1];
1850
+							$date                       = new Date($match[3]);
1851
+							if ($match[2] == 'LTE') {
1852
+								$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1853
+								$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1854
+							} else {
1855
+								$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1856
+								$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1874 1857
 							}
1875
-							// Let the DB do the name sorting even when no name was entered
1876
-							if ($sortby == 'NAME') {
1877
-								$sortby = '';
1878
-								$sql_order_by .= ($sql_order_by ? ', ' : ' ORDER BY ') . "{$attr}.n_sort";
1858
+							if ($sortby == $match[1]) {
1859
+								$sortby = "";
1860
+								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1879 1861
 							}
1862
+							unset($attrs[$attr]); // This filter has been fully processed
1863
+						} elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
1864
+							// Do nothing, unless you have to
1865
+							if ($match[1] != '' || $sortby == 'NAME') {
1866
+								$sql_join .= " JOIN `##name` AS {$attr} ON (n_file=i_file AND n_id=i_id)";
1867
+								// Search the DB only if there is any name supplied
1868
+								if ($match[1] != '') {
1869
+									$names = explode(' ', $match[1]);
1870
+									foreach ($names as $n => $name) {
1871
+										$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1872
+										$sql_params[$attr . 'name' . $n] = $name;
1873
+									}
1874
+								}
1875
+								// Let the DB do the name sorting even when no name was entered
1876
+								if ($sortby == 'NAME') {
1877
+									$sortby = '';
1878
+									$sql_order_by .= ($sql_order_by ? ', ' : ' ORDER BY ') . "{$attr}.n_sort";
1879
+								}
1880
+							}
1881
+							unset($attrs[$attr]); // This filter has been fully processed
1882
+						} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1883
+							$sql_where .= " AND i_gedcom REGEXP :{$attr}gedcom";
1884
+							// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1885
+							$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1886
+							unset($attrs[$attr]); // This filter has been fully processed
1887
+						} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1888
+							$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file = i_file)";
1889
+							$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file = {$attr}b.pl_file AND {$attr}b.pl_p_id = {$attr}a.p_id AND {$attr}b.pl_gid = i_id)";
1890
+							$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1891
+							$sql_params[$attr . 'place'] = $match[1];
1892
+							// Don't unset this filter. This is just initial filtering
1893
+						} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1894
+							$sql_where .= " AND i_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1895
+							$sql_params[$attr . 'contains1'] = $match[1];
1896
+							$sql_params[$attr . 'contains2'] = $match[2];
1897
+							$sql_params[$attr . 'contains3'] = $match[3];
1898
+							// Don't unset this filter. This is just initial filtering
1880 1899
 						}
1881
-						unset($attrs[$attr]); // This filter has been fully processed
1882
-					} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1883
-						$sql_where .= " AND i_gedcom REGEXP :{$attr}gedcom";
1884
-						// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1885
-						$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1886
-						unset($attrs[$attr]); // This filter has been fully processed
1887
-					} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1888
-						$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file = i_file)";
1889
-						$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file = {$attr}b.pl_file AND {$attr}b.pl_p_id = {$attr}a.p_id AND {$attr}b.pl_gid = i_id)";
1890
-						$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1891
-						$sql_params[$attr . 'place'] = $match[1];
1892
-						// Don't unset this filter. This is just initial filtering
1893
-					} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1894
-						$sql_where .= " AND i_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1895
-						$sql_params[$attr . 'contains1'] = $match[1];
1896
-						$sql_params[$attr . 'contains2'] = $match[2];
1897
-						$sql_params[$attr . 'contains3'] = $match[3];
1898
-						// Don't unset this filter. This is just initial filtering
1899 1900
 					}
1900 1901
 				}
1901
-			}
1902 1902
 
1903
-			$this->list = [];
1904
-			$rows       = Database::prepare(
1905
-				$sql_select . $sql_join . $sql_where . $sql_order_by
1906
-			)->execute($sql_params)->fetchAll();
1907
-
1908
-			foreach ($rows as $row) {
1909
-				$this->list[$row->xref] = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
1910
-			}
1911
-			break;
1912
-
1913
-		case 'family':
1914
-			$sql_select   = "SELECT f_id AS xref, f_gedcom AS gedcom FROM `##families`";
1915
-			$sql_join     = "";
1916
-			$sql_where    = " WHERE f_file = :tree_id";
1917
-			$sql_order_by = "";
1918
-			$sql_params   = ['tree_id' => $WT_TREE->getTreeId()];
1919
-			foreach ($attrs as $attr => $value) {
1920
-				if (strpos($attr, 'filter') === 0 && $value) {
1921
-					$value = $this->substituteVars($value, false);
1922
-					// Convert the various filters into SQL
1923
-					if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1924
-						$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=f_file AND {$attr}.d_gid=f_id)";
1925
-						$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1926
-						$sql_params[$attr . 'fact'] = $match[1];
1927
-						$date                       = new Date($match[3]);
1928
-						if ($match[2] == 'LTE') {
1929
-							$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1930
-							$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1931
-						} else {
1932
-							$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1933
-							$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1934
-						}
1935
-						if ($sortby == $match[1]) {
1936
-							$sortby = '';
1937
-							$sql_order_by .= ($sql_order_by ? ', ' : ' ORDER BY ') . "{$attr}.d_julianday1";
1938
-						}
1939
-						unset($attrs[$attr]); // This filter has been fully processed
1940
-					} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1941
-						$sql_where .= " AND f_gedcom REGEXP :{$attr}gedcom";
1942
-						// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1943
-						$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1944
-						unset($attrs[$attr]); // This filter has been fully processed
1945
-					} elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
1946
-						// Do nothing, unless you have to
1947
-						if ($match[1] != '' || $sortby == 'NAME') {
1948
-							$sql_join .= " JOIN `##name` AS {$attr} ON n_file = f_file AND n_id IN (f_husb, f_wife)";
1949
-							// Search the DB only if there is any name supplied
1950
-							if ($match[1] != '') {
1951
-								$names = explode(' ', $match[1]);
1952
-								foreach ($names as $n => $name) {
1953
-									$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1954
-									$sql_params[$attr . 'name' . $n] = $name;
1955
-								}
1903
+				$this->list = [];
1904
+				$rows       = Database::prepare(
1905
+					$sql_select . $sql_join . $sql_where . $sql_order_by
1906
+				)->execute($sql_params)->fetchAll();
1907
+
1908
+				foreach ($rows as $row) {
1909
+					$this->list[$row->xref] = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
1910
+				}
1911
+				break;
1912
+
1913
+			case 'family':
1914
+				$sql_select   = "SELECT f_id AS xref, f_gedcom AS gedcom FROM `##families`";
1915
+				$sql_join     = "";
1916
+				$sql_where    = " WHERE f_file = :tree_id";
1917
+				$sql_order_by = "";
1918
+				$sql_params   = ['tree_id' => $WT_TREE->getTreeId()];
1919
+				foreach ($attrs as $attr => $value) {
1920
+					if (strpos($attr, 'filter') === 0 && $value) {
1921
+						$value = $this->substituteVars($value, false);
1922
+						// Convert the various filters into SQL
1923
+						if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1924
+							$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=f_file AND {$attr}.d_gid=f_id)";
1925
+							$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1926
+							$sql_params[$attr . 'fact'] = $match[1];
1927
+							$date                       = new Date($match[3]);
1928
+							if ($match[2] == 'LTE') {
1929
+								$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1930
+								$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1931
+							} else {
1932
+								$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1933
+								$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1956 1934
 							}
1957
-							// Let the DB do the name sorting even when no name was entered
1958
-							if ($sortby == 'NAME') {
1935
+							if ($sortby == $match[1]) {
1959 1936
 								$sortby = '';
1960
-								$sql_order_by .= ($sql_order_by ? ', ' : ' ORDER BY ') . "{$attr}.n_sort";
1937
+								$sql_order_by .= ($sql_order_by ? ', ' : ' ORDER BY ') . "{$attr}.d_julianday1";
1938
+							}
1939
+							unset($attrs[$attr]); // This filter has been fully processed
1940
+						} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1941
+							$sql_where .= " AND f_gedcom REGEXP :{$attr}gedcom";
1942
+							// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1943
+							$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1944
+							unset($attrs[$attr]); // This filter has been fully processed
1945
+						} elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
1946
+							// Do nothing, unless you have to
1947
+							if ($match[1] != '' || $sortby == 'NAME') {
1948
+								$sql_join .= " JOIN `##name` AS {$attr} ON n_file = f_file AND n_id IN (f_husb, f_wife)";
1949
+								// Search the DB only if there is any name supplied
1950
+								if ($match[1] != '') {
1951
+									$names = explode(' ', $match[1]);
1952
+									foreach ($names as $n => $name) {
1953
+										$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1954
+										$sql_params[$attr . 'name' . $n] = $name;
1955
+									}
1956
+								}
1957
+								// Let the DB do the name sorting even when no name was entered
1958
+								if ($sortby == 'NAME') {
1959
+									$sortby = '';
1960
+									$sql_order_by .= ($sql_order_by ? ', ' : ' ORDER BY ') . "{$attr}.n_sort";
1961
+								}
1961 1962
 							}
1963
+							unset($attrs[$attr]); // This filter has been fully processed
1964
+						} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1965
+							$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
1966
+							$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
1967
+							$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1968
+							$sql_params[$attr . 'place'] = $match[1];
1969
+							// Don't unset this filter. This is just initial filtering
1970
+						} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1971
+							$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1972
+							$sql_params[$attr . 'contains1'] = $match[1];
1973
+							$sql_params[$attr . 'contains2'] = $match[2];
1974
+							$sql_params[$attr . 'contains3'] = $match[3];
1975
+							// Don't unset this filter. This is just initial filtering
1962 1976
 						}
1963
-						unset($attrs[$attr]); // This filter has been fully processed
1964
-					} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1965
-						$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
1966
-						$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
1967
-						$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1968
-						$sql_params[$attr . 'place'] = $match[1];
1969
-						// Don't unset this filter. This is just initial filtering
1970
-					} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1971
-						$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1972
-						$sql_params[$attr . 'contains1'] = $match[1];
1973
-						$sql_params[$attr . 'contains2'] = $match[2];
1974
-						$sql_params[$attr . 'contains3'] = $match[3];
1975
-						// Don't unset this filter. This is just initial filtering
1976 1977
 					}
1977 1978
 				}
1978
-			}
1979 1979
 
1980
-			$this->list = [];
1981
-			$rows       = Database::prepare(
1982
-				$sql_select . $sql_join . $sql_where . $sql_order_by
1983
-			)->execute($sql_params)->fetchAll();
1980
+				$this->list = [];
1981
+				$rows       = Database::prepare(
1982
+					$sql_select . $sql_join . $sql_where . $sql_order_by
1983
+				)->execute($sql_params)->fetchAll();
1984 1984
 
1985
-			foreach ($rows as $row) {
1986
-				$this->list[$row->xref] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
1987
-			}
1988
-			break;
1985
+				foreach ($rows as $row) {
1986
+					$this->list[$row->xref] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
1987
+				}
1988
+				break;
1989 1989
 
1990
-		default:
1991
-			throw new \DomainException('Invalid list name: ' . $listname);
1990
+			default:
1991
+				throw new \DomainException('Invalid list name: ' . $listname);
1992 1992
 		}
1993 1993
 
1994 1994
 		$filters  = [];
@@ -2049,17 +2049,17 @@  discard block
 block discarded – undo
2049 2049
 								$searchstr = '1 ' . $tag;
2050 2050
 							}
2051 2051
 							switch ($expr) {
2052
-							case 'CONTAINS':
2053
-								if ($t == 'PLAC') {
2054
-									$searchstr .= "[^\n]*[, ]*" . $val;
2055
-								} else {
2056
-									$searchstr .= "[^\n]*" . $val;
2057
-								}
2058
-								$filters[] = $searchstr;
2059
-								break;
2060
-							default:
2061
-								$filters2[] = ['tag' => $tag, 'expr' => $expr, 'val' => $val];
2062
-								break;
2052
+								case 'CONTAINS':
2053
+									if ($t == 'PLAC') {
2054
+										$searchstr .= "[^\n]*[, ]*" . $val;
2055
+									} else {
2056
+										$searchstr .= "[^\n]*" . $val;
2057
+									}
2058
+									$filters[] = $searchstr;
2059
+									break;
2060
+								default:
2061
+									$filters2[] = ['tag' => $tag, 'expr' => $expr, 'val' => $val];
2062
+									break;
2063 2063
 							}
2064 2064
 						}
2065 2065
 					}
@@ -2103,31 +2103,31 @@  discard block
 block discarded – undo
2103 2103
 						}
2104 2104
 
2105 2105
 						switch ($expr) {
2106
-						case 'GTE':
2107
-							if ($t == 'DATE') {
2108
-								$date1 = new Date($v);
2109
-								$date2 = new Date($val);
2110
-								$keep  = (Date::compare($date1, $date2) >= 0);
2111
-							} elseif ($val >= $v) {
2112
-								$keep = true;
2113
-							}
2114
-							break;
2115
-						case 'LTE':
2116
-							if ($t == 'DATE') {
2117
-								$date1 = new Date($v);
2118
-								$date2 = new Date($val);
2119
-								$keep  = (Date::compare($date1, $date2) <= 0);
2120
-							} elseif ($val >= $v) {
2121
-								$keep = true;
2122
-							}
2123
-							break;
2124
-						default:
2125
-							if ($v == $val) {
2126
-								$keep = true;
2127
-							} else {
2128
-								$keep = false;
2129
-							}
2130
-							break;
2106
+							case 'GTE':
2107
+								if ($t == 'DATE') {
2108
+									$date1 = new Date($v);
2109
+									$date2 = new Date($val);
2110
+									$keep  = (Date::compare($date1, $date2) >= 0);
2111
+								} elseif ($val >= $v) {
2112
+									$keep = true;
2113
+								}
2114
+								break;
2115
+							case 'LTE':
2116
+								if ($t == 'DATE') {
2117
+									$date1 = new Date($v);
2118
+									$date2 = new Date($val);
2119
+									$keep  = (Date::compare($date1, $date2) <= 0);
2120
+								} elseif ($val >= $v) {
2121
+									$keep = true;
2122
+								}
2123
+								break;
2124
+							default:
2125
+								if ($v == $val) {
2126
+									$keep = true;
2127
+								} else {
2128
+									$keep = false;
2129
+								}
2130
+								break;
2131 2131
 						}
2132 2132
 					}
2133 2133
 				}
@@ -2139,26 +2139,26 @@  discard block
 block discarded – undo
2139 2139
 		}
2140 2140
 
2141 2141
 		switch ($sortby) {
2142
-		case 'NAME':
2143
-			uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2144
-			break;
2145
-		case 'CHAN':
2146
-			uasort($this->list, function (GedcomRecord $x, GedcomRecord $y) {
2147
-				return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true);
2148
-			});
2149
-			break;
2150
-		case 'BIRT:DATE':
2151
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2152
-			break;
2153
-		case 'DEAT:DATE':
2154
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2155
-			break;
2156
-		case 'MARR:DATE':
2157
-			uasort($this->list, '\Fisharebest\Webtrees\Family::compareMarrDate');
2158
-			break;
2159
-		default:
2160
-			// unsorted or already sorted by SQL
2161
-			break;
2142
+			case 'NAME':
2143
+				uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2144
+				break;
2145
+			case 'CHAN':
2146
+				uasort($this->list, function (GedcomRecord $x, GedcomRecord $y) {
2147
+					return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true);
2148
+				});
2149
+				break;
2150
+			case 'BIRT:DATE':
2151
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2152
+				break;
2153
+			case 'DEAT:DATE':
2154
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2155
+				break;
2156
+			case 'MARR:DATE':
2157
+				uasort($this->list, '\Fisharebest\Webtrees\Family::compareMarrDate');
2158
+				break;
2159
+			default:
2160
+				// unsorted or already sorted by SQL
2161
+				break;
2162 2162
 		}
2163 2163
 
2164 2164
 		array_push($this->repeats_stack, [$this->repeats, $this->repeat_bytes]);
@@ -2309,88 +2309,88 @@  discard block
 block discarded – undo
2309 2309
 		if (!empty($person)) {
2310 2310
 			$this->list[$id] = $person;
2311 2311
 			switch ($group) {
2312
-			case 'child-family':
2313
-				foreach ($person->getChildFamilies() as $family) {
2314
-					$husband = $family->getHusband();
2315
-					$wife    = $family->getWife();
2316
-					if (!empty($husband)) {
2317
-						$this->list[$husband->getXref()] = $husband;
2318
-					}
2319
-					if (!empty($wife)) {
2320
-						$this->list[$wife->getXref()] = $wife;
2321
-					}
2322
-					$children = $family->getChildren();
2323
-					foreach ($children as $child) {
2324
-						if (!empty($child)) {
2325
-							$this->list[$child->getXref()] = $child;
2312
+				case 'child-family':
2313
+					foreach ($person->getChildFamilies() as $family) {
2314
+						$husband = $family->getHusband();
2315
+						$wife    = $family->getWife();
2316
+						if (!empty($husband)) {
2317
+							$this->list[$husband->getXref()] = $husband;
2318
+						}
2319
+						if (!empty($wife)) {
2320
+							$this->list[$wife->getXref()] = $wife;
2321
+						}
2322
+						$children = $family->getChildren();
2323
+						foreach ($children as $child) {
2324
+							if (!empty($child)) {
2325
+								$this->list[$child->getXref()] = $child;
2326
+							}
2326 2327
 						}
2327 2328
 					}
2328
-				}
2329
-				break;
2330
-			case 'spouse-family':
2331
-				foreach ($person->getSpouseFamilies() as $family) {
2332
-					$husband = $family->getHusband();
2333
-					$wife    = $family->getWife();
2334
-					if (!empty($husband)) {
2335
-						$this->list[$husband->getXref()] = $husband;
2336
-					}
2337
-					if (!empty($wife)) {
2338
-						$this->list[$wife->getXref()] = $wife;
2339
-					}
2340
-					$children = $family->getChildren();
2341
-					foreach ($children as $child) {
2342
-						if (!empty($child)) {
2343
-							$this->list[$child->getXref()] = $child;
2329
+					break;
2330
+				case 'spouse-family':
2331
+					foreach ($person->getSpouseFamilies() as $family) {
2332
+						$husband = $family->getHusband();
2333
+						$wife    = $family->getWife();
2334
+						if (!empty($husband)) {
2335
+							$this->list[$husband->getXref()] = $husband;
2336
+						}
2337
+						if (!empty($wife)) {
2338
+							$this->list[$wife->getXref()] = $wife;
2339
+						}
2340
+						$children = $family->getChildren();
2341
+						foreach ($children as $child) {
2342
+							if (!empty($child)) {
2343
+								$this->list[$child->getXref()] = $child;
2344
+							}
2344 2345
 						}
2345 2346
 					}
2346
-				}
2347
-				break;
2348
-			case 'direct-ancestors':
2349
-				$this->addAncestors($this->list, $id, false, $maxgen);
2350
-				break;
2351
-			case 'ancestors':
2352
-				$this->addAncestors($this->list, $id, true, $maxgen);
2353
-				break;
2354
-			case 'descendants':
2355
-				$this->list[$id]->generation = 1;
2356
-				$this->addDescendancy($this->list, $id, false, $maxgen);
2357
-				break;
2358
-			case 'all':
2359
-				$this->addAncestors($this->list, $id, true, $maxgen);
2360
-				$this->addDescendancy($this->list, $id, true, $maxgen);
2361
-				break;
2347
+					break;
2348
+				case 'direct-ancestors':
2349
+					$this->addAncestors($this->list, $id, false, $maxgen);
2350
+					break;
2351
+				case 'ancestors':
2352
+					$this->addAncestors($this->list, $id, true, $maxgen);
2353
+					break;
2354
+				case 'descendants':
2355
+					$this->list[$id]->generation = 1;
2356
+					$this->addDescendancy($this->list, $id, false, $maxgen);
2357
+					break;
2358
+				case 'all':
2359
+					$this->addAncestors($this->list, $id, true, $maxgen);
2360
+					$this->addDescendancy($this->list, $id, true, $maxgen);
2361
+					break;
2362 2362
 			}
2363 2363
 		}
2364 2364
 
2365 2365
 		switch ($sortby) {
2366
-		case 'NAME':
2367
-			uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2368
-			break;
2369
-		case 'BIRT:DATE':
2370
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2371
-			break;
2372
-		case 'DEAT:DATE':
2373
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2374
-			break;
2375
-		case 'generation':
2376
-			$newarray = [];
2377
-			reset($this->list);
2378
-			$genCounter = 1;
2379
-			while (count($newarray) < count($this->list)) {
2380
-				foreach ($this->list as $key => $value) {
2381
-					$this->generation = $value->generation;
2382
-					if ($this->generation == $genCounter) {
2383
-						$newarray[$key]             = new \stdClass;
2384
-						$newarray[$key]->generation = $this->generation;
2366
+			case 'NAME':
2367
+				uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2368
+				break;
2369
+			case 'BIRT:DATE':
2370
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2371
+				break;
2372
+			case 'DEAT:DATE':
2373
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2374
+				break;
2375
+			case 'generation':
2376
+				$newarray = [];
2377
+				reset($this->list);
2378
+				$genCounter = 1;
2379
+				while (count($newarray) < count($this->list)) {
2380
+					foreach ($this->list as $key => $value) {
2381
+						$this->generation = $value->generation;
2382
+						if ($this->generation == $genCounter) {
2383
+							$newarray[$key]             = new \stdClass;
2384
+							$newarray[$key]->generation = $this->generation;
2385
+						}
2385 2386
 					}
2387
+					$genCounter++;
2386 2388
 				}
2387
-				$genCounter++;
2388
-			}
2389
-			$this->list = $newarray;
2390
-			break;
2391
-		default:
2392
-			// unsorted
2393
-			break;
2389
+				$this->list = $newarray;
2390
+				break;
2391
+			default:
2392
+				// unsorted
2393
+				break;
2394 2394
 		}
2395 2395
 		array_push($this->repeats_stack, [$this->repeats, $this->repeat_bytes]);
2396 2396
 		$this->repeat_bytes = xml_get_current_line_number($this->parser) + 1;
Please login to merge, or discard this patch.
app/Report/ReportBase.php 1 patch
Switch Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -139,258 +139,258 @@
 block discarded – undo
139 139
 			 */
140 140
 			switch ($this->pageFormat) {
141 141
 				// ISO A series
142
-			case '4A0': // ISO 216, 1682 mm x 2378 mm
143
-				$sizes = [4767.86, 6740.79];
144
-				break;
145
-			case '2A0': // ISO 216, 1189 mm x 1682 mm
146
-				$sizes = [3370.39, 4767.86];
147
-				break;
148
-			case 'A0': // ISO 216, 841 mm x 1189mm
149
-				$sizes = [2383.94, 3370.39];
150
-				break;
151
-			case 'A1': // ISO 216, 594 mm x 841 mm
152
-				$sizes = [1683.78, 2383.94];
153
-				break;
154
-			case 'A2': // ISO 216, 420 mm x 594 mm
155
-				$sizes = [1190.55, 1683.78];
156
-				break;
157
-			case 'A3': // ISO 216, 297 mm x 420 mm
158
-				$sizes = [841.89, 1190.55];
159
-				break;
160
-			case 'A4': // ISO 216, 210 mm 297 mm
161
-				$sizes = [595.28, 841.89];
162
-				break;
163
-			case 'A5': // ISO 216, 148 mm x 210 mm
164
-				$sizes = [419.53, 595.28];
165
-				break;
166
-			case 'A6': // ISO 216, 105 mm x 148 mm
167
-				$sizes = [297.64, 419.53];
168
-				break;
169
-			case 'A7': // ISO 216, 74 mm x 105 mm
170
-				$sizes = [209.76, 297.64];
171
-				break;
172
-			case 'A8': // ISO 216, 52 mm x 74 mm
173
-				$sizes = [147.40, 209.76];
174
-				break;
175
-			case 'A9': // ISO 216, 37 mm x 52 mm
176
-				$sizes = [104.88, 147.40];
177
-				break;
178
-			case 'A10': // ISO 216, 26 mm x 37 mm
179
-				$sizes = [73.70, 104.88];
180
-				break;
181
-
182
-			// ISO B series
183
-			case 'B0': // ISO 216, 1000 mm x 1414 mm
184
-				$sizes = [2834.65, 4008.19];
185
-				break;
186
-			case 'B1': // ISO 216, 707 mm x 1000 mm
187
-				$sizes = [2004.09, 2834.65];
188
-				break;
189
-			case 'B2': // ISO 216, 500 mm x 707 mm
190
-				$sizes = [1417.32, 2004.09];
191
-				break;
192
-			case 'B3': // ISO 216, 353 mm x 500 mm
193
-				$sizes = [1000.63, 1417.32];
194
-				break;
195
-			case 'B4': // ISO 216, 250 mm x 353 mm
196
-				$sizes = [708.66, 1000.63];
197
-				break;
198
-			case 'B5': // ISO 216, 176 mm x 250 mm
199
-				$sizes = [498.90, 708.66];
200
-				break;
201
-			case 'B6': // ISO 216, 125 mm x 176 mm
202
-				$sizes = [354.33, 498.90];
203
-				break;
204
-			case 'B7': // ISO 216, 88 mm x 125 mm
205
-				$sizes = [249.45, 354.33];
206
-				break;
207
-			case 'B8': // ISO 216, 62 mm x 88 mm
208
-				$sizes = [175.75, 249.45];
209
-				break;
210
-			case 'B9': // ISO 216, 44 mm x 62 mm
211
-				$sizes = [124.72, 175.75];
212
-				break;
213
-			case 'B10': // ISO 216, 31 mm x 44 mm
214
-				$sizes = [87.87, 124.72];
215
-				break;
216
-
217
-			// ISO C series, Envelope
218
-			case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
-				$sizes = [2599.37, 3676.54];
220
-				break;
221
-			case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
-				$sizes = [1836.85, 2599.37];
223
-				break;
224
-			case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
-				$sizes = [1298.27, 1836.85];
226
-				break;
227
-			case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
-				$sizes = [918.43, 1298.27];
229
-				break;
230
-			case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
-				$sizes = [649.13, 918.43];
232
-				break;
233
-			case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
-				$sizes = [459.21, 649.13];
235
-				break;
236
-			case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
-				$sizes = [323.15, 649.13];
238
-				break;
239
-			case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
-				$sizes = [323.15, 459.21];
241
-				break;
242
-			case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
-				$sizes = [229.61, 459.21];
244
-				break;
245
-			case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
-				$sizes = [229.61, 323.15];
247
-				break;
248
-			case 'C8': // ISO 269, 57 mm x 81 mm
249
-				$sizes = [161.57, 229.61];
250
-				break;
251
-			case 'C9': // ISO 269, 40 mm x 57 mm
252
-				$sizes = [113.39, 161.57];
253
-				break;
254
-			case 'C10': // ISO 269, 28 mm x 40 mm
255
-				$sizes = [79.37, 113.39];
256
-				break;
257
-			case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
-				$sizes = [311.81, 623.62];
259
-				break;
260
-
261
-			// Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
-			case 'RA0': // ISO 478, 860 mm x 1220 mm
263
-				$sizes = [2437.80, 3458.27];
264
-				break;
265
-			case 'RA1': // ISO 478, 610 mm x 860 mm
266
-				$sizes = [1729.13, 2437.80];
267
-				break;
268
-			case 'RA2': // ISO 478, 430 mm x 610 mm
269
-				$sizes = [1218.90, 1729.13];
270
-				break;
271
-			case 'RA3': // ISO 478, 305 mm x 430 mm
272
-				$sizes = [864.57, 1218.90];
273
-				break;
274
-			case 'RA4': // ISO 478, 215 mm x 305 mm
275
-				$sizes = [609.45, 864.57];
276
-				break;
277
-
278
-			// Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
-			case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
-				$sizes = [2551.18, 3628.35];
281
-				break;
282
-			case 'SRA1': // ISO 593, 640 mm x 900 mm
283
-				$sizes = [1814.17, 2551.18];
284
-				break;
285
-			case 'SRA2': // ISO 593, 450 mm x 640 mm
286
-				$sizes = [1275.59, 1814.17];
287
-				break;
288
-			case 'SRA3': // ISO 593, 320 mm x 450 mm
289
-				$sizes = [907.09, 1275.59];
290
-				break;
291
-			case 'SRA4': // ISO 593, 225 mm x 320 mm
292
-				$sizes = [637.80, 907.09];
293
-				break;
294
-
295
-			// ISO size variations
296
-			case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
-				$sizes = [1261.42, 1754.65];
298
-				break;
299
-			case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
-				$sizes = [864.57, 1440.00];
301
-				break;
302
-			case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
-				$sizes = [912.76, 1261.42];
304
-				break;
305
-			case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
-				$sizes = [864.57, 1380.47];
307
-				break;
308
-			case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
-				$sizes = [666.14, 912.76];
310
-				break;
311
-			case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
-				$sizes = [595.28, 986.46];
313
-				break;
314
-			case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
-				$sizes = [649.13, 912.76];
316
-				break;
317
-			case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
-				$sizes = [643.46, 1009.13];
319
-				break;
320
-			case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
-				$sizes = [490.39, 666.14];
322
-				break;
323
-			case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
-				$sizes = [572.60, 782.36];
325
-				break;
326
-
327
-			// Japanese version of the ISO 216 B series
328
-			case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
-				$sizes = [2919.69, 4127.24];
330
-				break;
331
-			case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
-				$sizes = [2063.62, 2919.69];
333
-				break;
334
-			case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
-				$sizes = [1459.84, 2063.62];
336
-				break;
337
-			case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
-				$sizes = [1031.81, 1459.84];
339
-				break;
340
-			case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
-				$sizes = [728.50, 1031.81];
342
-				break;
343
-			case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
-				$sizes = [515.91, 728.50];
345
-				break;
346
-			case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
-				$sizes = [362.83, 515.91];
348
-				break;
349
-			case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
-				$sizes = [257.95, 362.83];
351
-				break;
352
-			case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
-				$sizes = [181.42, 257.95];
354
-				break;
355
-			case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
-				$sizes = [127.56, 181.42];
357
-				break;
358
-			case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
-				$sizes = [90.71, 127.56];
360
-				break;
361
-
362
-			// US pages
363
-			case 'EXECUTIVE': // 7.25 in x 10.5 in
364
-				$sizes = [522.00, 756.00];
365
-				break;
366
-			case 'FOLIO': // 8.5 in x 13 in
367
-				$sizes = [612.00, 936.00];
368
-				break;
369
-			case 'FOOLSCAP': // 13.5 in x 17 in
370
-				$sizes = [972.00, 1224.00];
371
-				break;
372
-			case 'LEDGER': // 11 in x 17 in
373
-				$sizes = [792.00, 1224.00];
374
-				break;
375
-			case 'LEGAL': // 8.5 in x 14 in
376
-				$sizes = [612.00, 1008.00];
377
-				break;
378
-			case 'LETTER': // 8.5 in x 11 in
379
-				$sizes = [612.00, 792.00];
380
-				break;
381
-			case 'QUARTO': // 8.46 in x 10.8 in
382
-				$sizes = [609.12, 777.50];
383
-				break;
384
-			case 'STATEMENT': // 5.5 in x 8.5 in
385
-				$sizes = [396.00, 612.00];
386
-				break;
387
-			case 'USGOVT': // 8 in x 11 in
388
-				$sizes = [576.00, 792.00];
389
-				break;
390
-			default:
391
-				$this->pageFormat = 'A4';
392
-				$sizes            = [595.28, 841.89];
393
-				break;
142
+				case '4A0': // ISO 216, 1682 mm x 2378 mm
143
+					$sizes = [4767.86, 6740.79];
144
+					break;
145
+				case '2A0': // ISO 216, 1189 mm x 1682 mm
146
+					$sizes = [3370.39, 4767.86];
147
+					break;
148
+				case 'A0': // ISO 216, 841 mm x 1189mm
149
+					$sizes = [2383.94, 3370.39];
150
+					break;
151
+				case 'A1': // ISO 216, 594 mm x 841 mm
152
+					$sizes = [1683.78, 2383.94];
153
+					break;
154
+				case 'A2': // ISO 216, 420 mm x 594 mm
155
+					$sizes = [1190.55, 1683.78];
156
+					break;
157
+				case 'A3': // ISO 216, 297 mm x 420 mm
158
+					$sizes = [841.89, 1190.55];
159
+					break;
160
+				case 'A4': // ISO 216, 210 mm 297 mm
161
+					$sizes = [595.28, 841.89];
162
+					break;
163
+				case 'A5': // ISO 216, 148 mm x 210 mm
164
+					$sizes = [419.53, 595.28];
165
+					break;
166
+				case 'A6': // ISO 216, 105 mm x 148 mm
167
+					$sizes = [297.64, 419.53];
168
+					break;
169
+				case 'A7': // ISO 216, 74 mm x 105 mm
170
+					$sizes = [209.76, 297.64];
171
+					break;
172
+				case 'A8': // ISO 216, 52 mm x 74 mm
173
+					$sizes = [147.40, 209.76];
174
+					break;
175
+				case 'A9': // ISO 216, 37 mm x 52 mm
176
+					$sizes = [104.88, 147.40];
177
+					break;
178
+				case 'A10': // ISO 216, 26 mm x 37 mm
179
+					$sizes = [73.70, 104.88];
180
+					break;
181
+
182
+				// ISO B series
183
+				case 'B0': // ISO 216, 1000 mm x 1414 mm
184
+					$sizes = [2834.65, 4008.19];
185
+					break;
186
+				case 'B1': // ISO 216, 707 mm x 1000 mm
187
+					$sizes = [2004.09, 2834.65];
188
+					break;
189
+				case 'B2': // ISO 216, 500 mm x 707 mm
190
+					$sizes = [1417.32, 2004.09];
191
+					break;
192
+				case 'B3': // ISO 216, 353 mm x 500 mm
193
+					$sizes = [1000.63, 1417.32];
194
+					break;
195
+				case 'B4': // ISO 216, 250 mm x 353 mm
196
+					$sizes = [708.66, 1000.63];
197
+					break;
198
+				case 'B5': // ISO 216, 176 mm x 250 mm
199
+					$sizes = [498.90, 708.66];
200
+					break;
201
+				case 'B6': // ISO 216, 125 mm x 176 mm
202
+					$sizes = [354.33, 498.90];
203
+					break;
204
+				case 'B7': // ISO 216, 88 mm x 125 mm
205
+					$sizes = [249.45, 354.33];
206
+					break;
207
+				case 'B8': // ISO 216, 62 mm x 88 mm
208
+					$sizes = [175.75, 249.45];
209
+					break;
210
+				case 'B9': // ISO 216, 44 mm x 62 mm
211
+					$sizes = [124.72, 175.75];
212
+					break;
213
+				case 'B10': // ISO 216, 31 mm x 44 mm
214
+					$sizes = [87.87, 124.72];
215
+					break;
216
+
217
+				// ISO C series, Envelope
218
+				case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
+					$sizes = [2599.37, 3676.54];
220
+					break;
221
+				case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
+					$sizes = [1836.85, 2599.37];
223
+					break;
224
+				case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
+					$sizes = [1298.27, 1836.85];
226
+					break;
227
+				case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
+					$sizes = [918.43, 1298.27];
229
+					break;
230
+				case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
+					$sizes = [649.13, 918.43];
232
+					break;
233
+				case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
+					$sizes = [459.21, 649.13];
235
+					break;
236
+				case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
+					$sizes = [323.15, 649.13];
238
+					break;
239
+				case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
+					$sizes = [323.15, 459.21];
241
+					break;
242
+				case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
+					$sizes = [229.61, 459.21];
244
+					break;
245
+				case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
+					$sizes = [229.61, 323.15];
247
+					break;
248
+				case 'C8': // ISO 269, 57 mm x 81 mm
249
+					$sizes = [161.57, 229.61];
250
+					break;
251
+				case 'C9': // ISO 269, 40 mm x 57 mm
252
+					$sizes = [113.39, 161.57];
253
+					break;
254
+				case 'C10': // ISO 269, 28 mm x 40 mm
255
+					$sizes = [79.37, 113.39];
256
+					break;
257
+				case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
+					$sizes = [311.81, 623.62];
259
+					break;
260
+
261
+				// Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
+				case 'RA0': // ISO 478, 860 mm x 1220 mm
263
+					$sizes = [2437.80, 3458.27];
264
+					break;
265
+				case 'RA1': // ISO 478, 610 mm x 860 mm
266
+					$sizes = [1729.13, 2437.80];
267
+					break;
268
+				case 'RA2': // ISO 478, 430 mm x 610 mm
269
+					$sizes = [1218.90, 1729.13];
270
+					break;
271
+				case 'RA3': // ISO 478, 305 mm x 430 mm
272
+					$sizes = [864.57, 1218.90];
273
+					break;
274
+				case 'RA4': // ISO 478, 215 mm x 305 mm
275
+					$sizes = [609.45, 864.57];
276
+					break;
277
+
278
+				// Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
+				case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
+					$sizes = [2551.18, 3628.35];
281
+					break;
282
+				case 'SRA1': // ISO 593, 640 mm x 900 mm
283
+					$sizes = [1814.17, 2551.18];
284
+					break;
285
+				case 'SRA2': // ISO 593, 450 mm x 640 mm
286
+					$sizes = [1275.59, 1814.17];
287
+					break;
288
+				case 'SRA3': // ISO 593, 320 mm x 450 mm
289
+					$sizes = [907.09, 1275.59];
290
+					break;
291
+				case 'SRA4': // ISO 593, 225 mm x 320 mm
292
+					$sizes = [637.80, 907.09];
293
+					break;
294
+
295
+				// ISO size variations
296
+				case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
+					$sizes = [1261.42, 1754.65];
298
+					break;
299
+				case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
+					$sizes = [864.57, 1440.00];
301
+					break;
302
+				case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
+					$sizes = [912.76, 1261.42];
304
+					break;
305
+				case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
+					$sizes = [864.57, 1380.47];
307
+					break;
308
+				case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
+					$sizes = [666.14, 912.76];
310
+					break;
311
+				case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
+					$sizes = [595.28, 986.46];
313
+					break;
314
+				case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
+					$sizes = [649.13, 912.76];
316
+					break;
317
+				case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
+					$sizes = [643.46, 1009.13];
319
+					break;
320
+				case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
+					$sizes = [490.39, 666.14];
322
+					break;
323
+				case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
+					$sizes = [572.60, 782.36];
325
+					break;
326
+
327
+				// Japanese version of the ISO 216 B series
328
+				case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
+					$sizes = [2919.69, 4127.24];
330
+					break;
331
+				case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
+					$sizes = [2063.62, 2919.69];
333
+					break;
334
+				case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
+					$sizes = [1459.84, 2063.62];
336
+					break;
337
+				case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
+					$sizes = [1031.81, 1459.84];
339
+					break;
340
+				case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
+					$sizes = [728.50, 1031.81];
342
+					break;
343
+				case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
+					$sizes = [515.91, 728.50];
345
+					break;
346
+				case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
+					$sizes = [362.83, 515.91];
348
+					break;
349
+				case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
+					$sizes = [257.95, 362.83];
351
+					break;
352
+				case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
+					$sizes = [181.42, 257.95];
354
+					break;
355
+				case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
+					$sizes = [127.56, 181.42];
357
+					break;
358
+				case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
+					$sizes = [90.71, 127.56];
360
+					break;
361
+
362
+				// US pages
363
+				case 'EXECUTIVE': // 7.25 in x 10.5 in
364
+					$sizes = [522.00, 756.00];
365
+					break;
366
+				case 'FOLIO': // 8.5 in x 13 in
367
+					$sizes = [612.00, 936.00];
368
+					break;
369
+				case 'FOOLSCAP': // 13.5 in x 17 in
370
+					$sizes = [972.00, 1224.00];
371
+					break;
372
+				case 'LEDGER': // 11 in x 17 in
373
+					$sizes = [792.00, 1224.00];
374
+					break;
375
+				case 'LEGAL': // 8.5 in x 14 in
376
+					$sizes = [612.00, 1008.00];
377
+					break;
378
+				case 'LETTER': // 8.5 in x 11 in
379
+					$sizes = [612.00, 792.00];
380
+					break;
381
+				case 'QUARTO': // 8.46 in x 10.8 in
382
+					$sizes = [609.12, 777.50];
383
+					break;
384
+				case 'STATEMENT': // 5.5 in x 8.5 in
385
+					$sizes = [396.00, 612.00];
386
+					break;
387
+				case 'USGOVT': // 8 in x 11 in
388
+					$sizes = [576.00, 792.00];
389
+					break;
390
+				default:
391
+					$this->pageFormat = 'A4';
392
+					$sizes            = [595.28, 841.89];
393
+					break;
394 394
 			}
395 395
 			$this->pagew = $sizes[0];
396 396
 			$this->pageh = $sizes[1];
Please login to merge, or discard this patch.
app/Report/ReportHtmlCell.php 1 patch
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -147,15 +147,15 @@
 block discarded – undo
147 147
 
148 148
 		// Text alignment
149 149
 		switch ($this->align) {
150
-		case 'C':
151
-			echo ' text-align:center;';
152
-			break;
153
-		case 'L':
154
-			echo ' text-align:left;';
155
-			break;
156
-		case 'R':
157
-			echo ' text-align:right;';
158
-			break;
150
+			case 'C':
151
+				echo ' text-align:center;';
152
+				break;
153
+			case 'L':
154
+				echo ' text-align:left;';
155
+				break;
156
+			case 'R':
157
+				echo ' text-align:right;';
158
+				break;
159 159
 		}
160 160
 
161 161
 		// Print the collected HTML code
Please login to merge, or discard this patch.
app/Tree.php 1 patch
Switch Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -457,25 +457,25 @@
 block discarded – undo
457 457
 		$tree->setPreference('WEBMASTER_USER_ID', Auth::id());
458 458
 		$tree->setPreference('LANGUAGE', WT_LOCALE); // Default to the current admin’s language
459 459
 		switch (WT_LOCALE) {
460
-		case 'es':
461
-			$tree->setPreference('SURNAME_TRADITION', 'spanish');
462
-			break;
463
-		case 'is':
464
-			$tree->setPreference('SURNAME_TRADITION', 'icelandic');
465
-			break;
466
-		case 'lt':
467
-			$tree->setPreference('SURNAME_TRADITION', 'lithuanian');
468
-			break;
469
-		case 'pl':
470
-			$tree->setPreference('SURNAME_TRADITION', 'polish');
471
-			break;
472
-		case 'pt':
473
-		case 'pt-BR':
474
-			$tree->setPreference('SURNAME_TRADITION', 'portuguese');
475
-			break;
476
-		default:
477
-			$tree->setPreference('SURNAME_TRADITION', 'paternal');
478
-			break;
460
+			case 'es':
461
+				$tree->setPreference('SURNAME_TRADITION', 'spanish');
462
+				break;
463
+			case 'is':
464
+				$tree->setPreference('SURNAME_TRADITION', 'icelandic');
465
+				break;
466
+			case 'lt':
467
+				$tree->setPreference('SURNAME_TRADITION', 'lithuanian');
468
+				break;
469
+			case 'pl':
470
+				$tree->setPreference('SURNAME_TRADITION', 'polish');
471
+				break;
472
+			case 'pt':
473
+			case 'pt-BR':
474
+				$tree->setPreference('SURNAME_TRADITION', 'portuguese');
475
+				break;
476
+			default:
477
+				$tree->setPreference('SURNAME_TRADITION', 'paternal');
478
+				break;
479 479
 		}
480 480
 
481 481
 		// Genealogy data
Please login to merge, or discard this patch.
app/Individual.php 1 patch
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -853,33 +853,33 @@
 block discarded – undo
853 853
 	public function getPrimaryChildFamily() {
854 854
 		$families = $this->getChildFamilies();
855 855
 		switch (count($families)) {
856
-		case 0:
857
-			return null;
858
-		case 1:
859
-			return $families[0];
860
-		default:
861
-			// If there is more than one FAMC record, choose the preferred parents:
862
-			// a) records with '2 _PRIMARY'
863
-			foreach ($families as $famid => $fam) {
864
-				if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 _PRIMARY Y)/", $this->getGedcom())) {
865
-					return $fam;
856
+			case 0:
857
+				return null;
858
+			case 1:
859
+				return $families[0];
860
+			default:
861
+				// If there is more than one FAMC record, choose the preferred parents:
862
+				// a) records with '2 _PRIMARY'
863
+				foreach ($families as $famid => $fam) {
864
+					if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 _PRIMARY Y)/", $this->getGedcom())) {
865
+						return $fam;
866
+					}
866 867
 				}
867
-			}
868
-			// b) records with '2 PEDI birt'
869
-			foreach ($families as $famid => $fam) {
870
-				if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI birth)/", $this->getGedcom())) {
871
-					return $fam;
868
+				// b) records with '2 PEDI birt'
869
+				foreach ($families as $famid => $fam) {
870
+					if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI birth)/", $this->getGedcom())) {
871
+						return $fam;
872
+					}
872 873
 				}
873
-			}
874
-			// c) records with no '2 PEDI'
875
-			foreach ($families as $famid => $fam) {
876
-				if (!preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI)/", $this->getGedcom())) {
877
-					return $fam;
874
+				// c) records with no '2 PEDI'
875
+				foreach ($families as $famid => $fam) {
876
+					if (!preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI)/", $this->getGedcom())) {
877
+						return $fam;
878
+					}
878 879
 				}
879
-			}
880 880
 
881
-			// d) any record
882
-			return $families[0];
881
+				// d) any record
882
+				return $families[0];
883 883
 		}
884 884
 	}
885 885
 
Please login to merge, or discard this patch.
app/Note.php 1 patch
Switch Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@
 block discarded – undo
97 97
 
98 98
 		if ($text) {
99 99
 			switch ($this->getTree()->getPreference('FORMAT_TEXT')) {
100
-			case 'markdown':
101
-				$text = Filter::markdown($text, $this->getTree());
102
-				$text = strip_tags($text);
103
-				$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
104
-				break;
100
+				case 'markdown':
101
+					$text = Filter::markdown($text, $this->getTree());
102
+					$text = strip_tags($text);
103
+					$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
104
+					break;
105 105
 			}
106 106
 
107 107
 			list($text) = explode("\n", $text);
Please login to merge, or discard this patch.
app/Filter.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@
 block discarded – undo
50 50
 	 */
51 51
 	public static function formatText($text, Tree $WT_TREE) {
52 52
 		switch ($WT_TREE->getPreference('FORMAT_TEXT')) {
53
-		case 'markdown':
54
-			return '<div class="markdown" dir="auto">' . self::markdown($text, $WT_TREE) . '</div>';
55
-		default:
56
-			return '<div class="markdown" style="white-space: pre-wrap;" dir="auto">' . self::expandUrls($text, $WT_TREE) . '</div>';
53
+			case 'markdown':
54
+				return '<div class="markdown" dir="auto">' . self::markdown($text, $WT_TREE) . '</div>';
55
+			default:
56
+				return '<div class="markdown" style="white-space: pre-wrap;" dir="auto">' . self::expandUrls($text, $WT_TREE) . '</div>';
57 57
 		}
58 58
 	}
59 59
 
Please login to merge, or discard this patch.