@@ -124,227 +124,227 @@ discard block |
||
124 | 124 | $closeParIndex = strpos(self::CLOSE_PARENTHESES, $currentLetter); // Which closing parenthesis is this? |
125 | 125 | |
126 | 126 | switch ($currentLetter) { |
127 | - case '<': |
|
128 | - // Assume this '<' starts an HTML element |
|
129 | - $endPos = strpos($workingText, '>'); // look for the terminating '>' |
|
130 | - if ($endPos === false) { |
|
131 | - $endPos = 0; |
|
132 | - } |
|
133 | - $currentLen += $endPos; |
|
134 | - $element = substr($workingText, 0, $currentLen); |
|
135 | - $temp = strtolower(substr($element, 0, 3)); |
|
136 | - if (strlen($element) < 7 && $temp == '<br') { |
|
137 | - if ($numberState) { |
|
138 | - $numberState = false; |
|
139 | - if (self::$currentState == 'RTL') { |
|
140 | - self::$waitingText .= WT_UTF8_PDF; |
|
127 | + case '<': |
|
128 | + // Assume this '<' starts an HTML element |
|
129 | + $endPos = strpos($workingText, '>'); // look for the terminating '>' |
|
130 | + if ($endPos === false) { |
|
131 | + $endPos = 0; |
|
132 | + } |
|
133 | + $currentLen += $endPos; |
|
134 | + $element = substr($workingText, 0, $currentLen); |
|
135 | + $temp = strtolower(substr($element, 0, 3)); |
|
136 | + if (strlen($element) < 7 && $temp == '<br') { |
|
137 | + if ($numberState) { |
|
138 | + $numberState = false; |
|
139 | + if (self::$currentState == 'RTL') { |
|
140 | + self::$waitingText .= WT_UTF8_PDF; |
|
141 | + } |
|
141 | 142 | } |
143 | + self::breakCurrentSpan($result); |
|
144 | + } elseif (self::$waitingText == '') { |
|
145 | + $result .= $element; |
|
146 | + } else { |
|
147 | + self::$waitingText .= $element; |
|
142 | 148 | } |
143 | - self::breakCurrentSpan($result); |
|
144 | - } elseif (self::$waitingText == '') { |
|
145 | - $result .= $element; |
|
146 | - } else { |
|
147 | - self::$waitingText .= $element; |
|
148 | - } |
|
149 | - $workingText = substr($workingText, $currentLen); |
|
150 | - break; |
|
151 | - case '&': |
|
152 | - // Assume this '&' starts an HTML entity |
|
153 | - $endPos = strpos($workingText, ';'); // look for the terminating ';' |
|
154 | - if ($endPos === false) { |
|
155 | - $endPos = 0; |
|
156 | - } |
|
157 | - $currentLen += $endPos; |
|
158 | - $entity = substr($workingText, 0, $currentLen); |
|
159 | - if (strtolower($entity) == ' ') { |
|
160 | - $entity .= ' '; // Ensure consistent case for this entity |
|
161 | - } |
|
162 | - if (self::$waitingText == '') { |
|
163 | - $result .= $entity; |
|
164 | - } else { |
|
165 | - self::$waitingText .= $entity; |
|
166 | - } |
|
167 | - $workingText = substr($workingText, $currentLen); |
|
168 | - break; |
|
169 | - case '{': |
|
170 | - if (substr($workingText, 1, 1) == '{') { |
|
171 | - // Assume this '{{' starts a TCPDF directive |
|
172 | - $endPos = strpos($workingText, '}}'); // look for the terminating '}}' |
|
149 | + $workingText = substr($workingText, $currentLen); |
|
150 | + break; |
|
151 | + case '&': |
|
152 | + // Assume this '&' starts an HTML entity |
|
153 | + $endPos = strpos($workingText, ';'); // look for the terminating ';' |
|
173 | 154 | if ($endPos === false) { |
174 | 155 | $endPos = 0; |
175 | 156 | } |
176 | - $currentLen = $endPos + 2; |
|
177 | - $directive = substr($workingText, 0, $currentLen); |
|
178 | - $workingText = substr($workingText, $currentLen); |
|
179 | - $result = $result . self::$waitingText . $directive; |
|
180 | - self::$waitingText = ''; |
|
157 | + $currentLen += $endPos; |
|
158 | + $entity = substr($workingText, 0, $currentLen); |
|
159 | + if (strtolower($entity) == ' ') { |
|
160 | + $entity .= ' '; // Ensure consistent case for this entity |
|
161 | + } |
|
162 | + if (self::$waitingText == '') { |
|
163 | + $result .= $entity; |
|
164 | + } else { |
|
165 | + self::$waitingText .= $entity; |
|
166 | + } |
|
167 | + $workingText = substr($workingText, $currentLen); |
|
181 | 168 | break; |
182 | - } |
|
183 | - default: |
|
184 | - // Look for strings of numbers with optional leading or trailing + or - |
|
185 | - // and with optional embedded numeric punctuation |
|
186 | - if ($numberState) { |
|
187 | - // If we're inside a numeric string, look for reasons to end it |
|
188 | - $offset = 0; // Be sure to look at the current character first |
|
189 | - $charArray = self::getChar($workingText . "\n", $offset); |
|
190 | - if (strpos(self::NUMBERS, $charArray['letter']) === false) { |
|
191 | - // This is not a digit. Is it numeric punctuation? |
|
192 | - if (substr($workingText . "\n", $offset, 6) == ' ') { |
|
193 | - $offset += 6; // This could be numeric punctuation |
|
194 | - } elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) { |
|
195 | - $offset += $charArray['length']; // This could be numeric punctuation |
|
169 | + case '{': |
|
170 | + if (substr($workingText, 1, 1) == '{') { |
|
171 | + // Assume this '{{' starts a TCPDF directive |
|
172 | + $endPos = strpos($workingText, '}}'); // look for the terminating '}}' |
|
173 | + if ($endPos === false) { |
|
174 | + $endPos = 0; |
|
196 | 175 | } |
197 | - // If the next character is a digit, the current character is numeric punctuation |
|
176 | + $currentLen = $endPos + 2; |
|
177 | + $directive = substr($workingText, 0, $currentLen); |
|
178 | + $workingText = substr($workingText, $currentLen); |
|
179 | + $result = $result . self::$waitingText . $directive; |
|
180 | + self::$waitingText = ''; |
|
181 | + break; |
|
182 | + } |
|
183 | + default: |
|
184 | + // Look for strings of numbers with optional leading or trailing + or - |
|
185 | + // and with optional embedded numeric punctuation |
|
186 | + if ($numberState) { |
|
187 | + // If we're inside a numeric string, look for reasons to end it |
|
188 | + $offset = 0; // Be sure to look at the current character first |
|
198 | 189 | $charArray = self::getChar($workingText . "\n", $offset); |
199 | 190 | if (strpos(self::NUMBERS, $charArray['letter']) === false) { |
200 | - // This is not a digit. End the run of digits and punctuation. |
|
201 | - $numberState = false; |
|
202 | - if (self::$currentState == 'RTL') { |
|
203 | - if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) { |
|
204 | - $currentLetter = WT_UTF8_PDF . $currentLetter; |
|
205 | - } else { |
|
206 | - $currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run |
|
191 | + // This is not a digit. Is it numeric punctuation? |
|
192 | + if (substr($workingText . "\n", $offset, 6) == ' ') { |
|
193 | + $offset += 6; // This could be numeric punctuation |
|
194 | + } elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) { |
|
195 | + $offset += $charArray['length']; // This could be numeric punctuation |
|
196 | + } |
|
197 | + // If the next character is a digit, the current character is numeric punctuation |
|
198 | + $charArray = self::getChar($workingText . "\n", $offset); |
|
199 | + if (strpos(self::NUMBERS, $charArray['letter']) === false) { |
|
200 | + // This is not a digit. End the run of digits and punctuation. |
|
201 | + $numberState = false; |
|
202 | + if (self::$currentState == 'RTL') { |
|
203 | + if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) { |
|
204 | + $currentLetter = WT_UTF8_PDF . $currentLetter; |
|
205 | + } else { |
|
206 | + $currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run |
|
207 | + } |
|
207 | 208 | } |
208 | 209 | } |
209 | 210 | } |
210 | - } |
|
211 | - } else { |
|
212 | - // If we're outside a numeric string, look for reasons to start it |
|
213 | - if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) { |
|
214 | - // This might be a number lead-in |
|
215 | - $offset = $currentLen; |
|
216 | - $nextChar = substr($workingText . "\n", $offset, 1); |
|
217 | - if (strpos(self::NUMBERS, $nextChar) !== false) { |
|
218 | - $numberState = true; // We found a digit: the lead-in is therefore numeric |
|
211 | + } else { |
|
212 | + // If we're outside a numeric string, look for reasons to start it |
|
213 | + if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) { |
|
214 | + // This might be a number lead-in |
|
215 | + $offset = $currentLen; |
|
216 | + $nextChar = substr($workingText . "\n", $offset, 1); |
|
217 | + if (strpos(self::NUMBERS, $nextChar) !== false) { |
|
218 | + $numberState = true; // We found a digit: the lead-in is therefore numeric |
|
219 | + if (self::$currentState == 'RTL') { |
|
220 | + $currentLetter = WT_UTF8_LRE . $currentLetter; |
|
221 | + } |
|
222 | + } |
|
223 | + } elseif (strpos(self::NUMBERS, $currentLetter) !== false) { |
|
224 | + $numberState = true; // The current letter is a digit |
|
219 | 225 | if (self::$currentState == 'RTL') { |
220 | 226 | $currentLetter = WT_UTF8_LRE . $currentLetter; |
221 | 227 | } |
222 | 228 | } |
223 | - } elseif (strpos(self::NUMBERS, $currentLetter) !== false) { |
|
224 | - $numberState = true; // The current letter is a digit |
|
225 | - if (self::$currentState == 'RTL') { |
|
226 | - $currentLetter = WT_UTF8_LRE . $currentLetter; |
|
227 | - } |
|
228 | 229 | } |
229 | - } |
|
230 | - |
|
231 | - // Determine the directionality of the current UTF-8 character |
|
232 | - $newState = self::$currentState; |
|
233 | - while (true) { |
|
234 | - if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') { |
|
235 | - if (self::$currentState == '') { |
|
236 | - $newState = 'RTL'; |
|
237 | - break; |
|
238 | - } |
|
239 | 230 | |
240 | - if (self::$currentState == 'RTL') { |
|
241 | - break; |
|
242 | - } |
|
243 | - // Switch to RTL only if this isn't a solitary RTL letter |
|
244 | - $tempText = substr($workingText, $currentLen); |
|
245 | - while ($tempText != '') { |
|
246 | - $nextCharArray = self::getChar($tempText, 0); |
|
247 | - $nextLetter = $nextCharArray['letter']; |
|
248 | - $nextLen = $nextCharArray['length']; |
|
249 | - $tempText = substr($tempText, $nextLen); |
|
250 | - |
|
251 | - if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') { |
|
231 | + // Determine the directionality of the current UTF-8 character |
|
232 | + $newState = self::$currentState; |
|
233 | + while (true) { |
|
234 | + if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') { |
|
235 | + if (self::$currentState == '') { |
|
252 | 236 | $newState = 'RTL'; |
253 | - break 2; |
|
237 | + break; |
|
254 | 238 | } |
255 | 239 | |
256 | - if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) { |
|
257 | - $newState = 'RTL'; |
|
258 | - break 2; |
|
240 | + if (self::$currentState == 'RTL') { |
|
241 | + break; |
|
259 | 242 | } |
243 | + // Switch to RTL only if this isn't a solitary RTL letter |
|
244 | + $tempText = substr($workingText, $currentLen); |
|
245 | + while ($tempText != '') { |
|
246 | + $nextCharArray = self::getChar($tempText, 0); |
|
247 | + $nextLetter = $nextCharArray['letter']; |
|
248 | + $nextLen = $nextCharArray['length']; |
|
249 | + $tempText = substr($tempText, $nextLen); |
|
250 | + |
|
251 | + if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') { |
|
252 | + $newState = 'RTL'; |
|
253 | + break 2; |
|
254 | + } |
|
260 | 255 | |
261 | - if ($nextLetter === ' ') { |
|
262 | - break; |
|
256 | + if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) { |
|
257 | + $newState = 'RTL'; |
|
258 | + break 2; |
|
259 | + } |
|
260 | + |
|
261 | + if ($nextLetter === ' ') { |
|
262 | + break; |
|
263 | + } |
|
264 | + $nextLetter .= substr($tempText . "\n", 0, 5); |
|
265 | + if ($nextLetter === ' ') { |
|
266 | + break; |
|
267 | + } |
|
263 | 268 | } |
264 | - $nextLetter .= substr($tempText . "\n", 0, 5); |
|
265 | - if ($nextLetter === ' ') { |
|
266 | - break; |
|
269 | + // This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality |
|
270 | + $currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF; |
|
271 | + $newState = 'LTR'; |
|
272 | + break; |
|
273 | + } |
|
274 | + if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) { |
|
275 | + // Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR |
|
276 | + $newState = 'LTR'; |
|
277 | + break; |
|
278 | + } |
|
279 | + if ($closeParIndex !== false) { |
|
280 | + // This closing parenthesis has to inherit the matching opening parenthesis' directionality |
|
281 | + if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') { |
|
282 | + $newState = $openParDirection[$closeParIndex]; |
|
267 | 283 | } |
284 | + $openParDirection[$closeParIndex] = ''; |
|
285 | + break; |
|
268 | 286 | } |
269 | - // This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality |
|
270 | - $currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF; |
|
271 | - $newState = 'LTR'; |
|
272 | - break; |
|
273 | - } |
|
274 | - if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) { |
|
275 | - // Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR |
|
276 | - $newState = 'LTR'; |
|
277 | - break; |
|
278 | - } |
|
279 | - if ($closeParIndex !== false) { |
|
280 | - // This closing parenthesis has to inherit the matching opening parenthesis' directionality |
|
281 | - if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') { |
|
282 | - $newState = $openParDirection[$closeParIndex]; |
|
287 | + if ($openParIndex !== false) { |
|
288 | + // Opening parentheses always inherit the following directionality |
|
289 | + self::$waitingText .= $currentLetter; |
|
290 | + $workingText = substr($workingText, $currentLen); |
|
291 | + while (true) { |
|
292 | + if ($workingText === '') { |
|
293 | + break; |
|
294 | + } |
|
295 | + if (substr($workingText, 0, 1) === ' ') { |
|
296 | + // Spaces following this left parenthesis inherit the following directionality too |
|
297 | + self::$waitingText .= ' '; |
|
298 | + $workingText = substr($workingText, 1); |
|
299 | + continue; |
|
300 | + } |
|
301 | + if (substr($workingText, 0, 6) === ' ') { |
|
302 | + // Spaces following this left parenthesis inherit the following directionality too |
|
303 | + self::$waitingText .= ' '; |
|
304 | + $workingText = substr($workingText, 6); |
|
305 | + continue; |
|
306 | + } |
|
307 | + break; |
|
308 | + } |
|
309 | + $openParDirection[$openParIndex] = '?'; |
|
310 | + break 2; // double break because we're waiting for more information |
|
283 | 311 | } |
284 | - $openParDirection[$closeParIndex] = ''; |
|
285 | - break; |
|
286 | - } |
|
287 | - if ($openParIndex !== false) { |
|
288 | - // Opening parentheses always inherit the following directionality |
|
312 | + |
|
313 | + // We have a digit or a "normal" special character. |
|
314 | + // |
|
315 | + // When this character is not at the start of the input string, it inherits the preceding directionality; |
|
316 | + // at the start of the input string, it assumes the following directionality. |
|
317 | + // |
|
318 | + // Exceptions to this rule will be handled later during final clean-up. |
|
319 | + // |
|
289 | 320 | self::$waitingText .= $currentLetter; |
290 | 321 | $workingText = substr($workingText, $currentLen); |
291 | - while (true) { |
|
292 | - if ($workingText === '') { |
|
293 | - break; |
|
294 | - } |
|
295 | - if (substr($workingText, 0, 1) === ' ') { |
|
296 | - // Spaces following this left parenthesis inherit the following directionality too |
|
297 | - self::$waitingText .= ' '; |
|
298 | - $workingText = substr($workingText, 1); |
|
299 | - continue; |
|
300 | - } |
|
301 | - if (substr($workingText, 0, 6) === ' ') { |
|
302 | - // Spaces following this left parenthesis inherit the following directionality too |
|
303 | - self::$waitingText .= ' '; |
|
304 | - $workingText = substr($workingText, 6); |
|
305 | - continue; |
|
306 | - } |
|
307 | - break; |
|
322 | + if (self::$currentState != '') { |
|
323 | + $result .= self::$waitingText; |
|
324 | + self::$waitingText = ''; |
|
308 | 325 | } |
309 | - $openParDirection[$openParIndex] = '?'; |
|
310 | 326 | break 2; // double break because we're waiting for more information |
311 | 327 | } |
312 | - |
|
313 | - // We have a digit or a "normal" special character. |
|
314 | - // |
|
315 | - // When this character is not at the start of the input string, it inherits the preceding directionality; |
|
316 | - // at the start of the input string, it assumes the following directionality. |
|
317 | - // |
|
318 | - // Exceptions to this rule will be handled later during final clean-up. |
|
319 | - // |
|
328 | + if ($newState != self::$currentState) { |
|
329 | + // A direction change has occurred |
|
330 | + self::finishCurrentSpan($result, false); |
|
331 | + self::$previousState = self::$currentState; |
|
332 | + self::$currentState = $newState; |
|
333 | + self::beginCurrentSpan($result); |
|
334 | + } |
|
320 | 335 | self::$waitingText .= $currentLetter; |
321 | 336 | $workingText = substr($workingText, $currentLen); |
322 | - if (self::$currentState != '') { |
|
323 | - $result .= self::$waitingText; |
|
324 | - self::$waitingText = ''; |
|
325 | - } |
|
326 | - break 2; // double break because we're waiting for more information |
|
327 | - } |
|
328 | - if ($newState != self::$currentState) { |
|
329 | - // A direction change has occurred |
|
330 | - self::finishCurrentSpan($result, false); |
|
331 | - self::$previousState = self::$currentState; |
|
332 | - self::$currentState = $newState; |
|
333 | - self::beginCurrentSpan($result); |
|
334 | - } |
|
335 | - self::$waitingText .= $currentLetter; |
|
336 | - $workingText = substr($workingText, $currentLen); |
|
337 | - $result .= self::$waitingText; |
|
338 | - self::$waitingText = ''; |
|
337 | + $result .= self::$waitingText; |
|
338 | + self::$waitingText = ''; |
|
339 | 339 | |
340 | - foreach ($openParDirection as $index => $value) { |
|
341 | - // Since we now know the proper direction, remember it for all waiting opening parentheses |
|
342 | - if ($value === '?') { |
|
343 | - $openParDirection[$index] = self::$currentState; |
|
340 | + foreach ($openParDirection as $index => $value) { |
|
341 | + // Since we now know the proper direction, remember it for all waiting opening parentheses |
|
342 | + if ($value === '?') { |
|
343 | + $openParDirection[$index] = self::$currentState; |
|
344 | + } |
|
344 | 345 | } |
345 | - } |
|
346 | 346 | |
347 | - break; |
|
347 | + break; |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -461,34 +461,34 @@ discard block |
||
461 | 461 | |
462 | 462 | // Finally, correct '<LTR>', '</LTR>', '<RTL>', and '</RTL>' |
463 | 463 | switch ($direction) { |
464 | - case 'BOTH': |
|
465 | - case 'both': |
|
466 | - // LTR text: <span dir="ltr"> text </span> |
|
467 | - // RTL text: <span dir="rtl"> text </span> |
|
468 | - $sLTR = '<span dir="ltr" ' . $class . '>' . $nothing; |
|
469 | - $eLTR = $nothing . '</span>'; |
|
470 | - $sRTL = '<span dir="rtl" ' . $class . '>' . $nothing; |
|
471 | - $eRTL = $nothing . '</span>'; |
|
472 | - break; |
|
473 | - case 'LTR': |
|
474 | - case 'ltr': |
|
475 | - // LTR text: <span dir="ltr"> text </span> |
|
476 | - // RTL text: text |
|
477 | - $sLTR = '<span dir="ltr" ' . $class . '>' . $nothing; |
|
478 | - $eLTR = $nothing . '</span>'; |
|
479 | - $sRTL = ''; |
|
480 | - $eRTL = ''; |
|
481 | - break; |
|
482 | - case 'RTL': |
|
483 | - case 'rtl': |
|
484 | - default: |
|
485 | - // LTR text: text |
|
486 | - // RTL text: <span dir="rtl"> text </span> |
|
487 | - $sLTR = ''; |
|
488 | - $eLTR = ''; |
|
489 | - $sRTL = '<span dir="rtl" ' . $class . '>' . $nothing; |
|
490 | - $eRTL = $nothing . '</span>'; |
|
491 | - break; |
|
464 | + case 'BOTH': |
|
465 | + case 'both': |
|
466 | + // LTR text: <span dir="ltr"> text </span> |
|
467 | + // RTL text: <span dir="rtl"> text </span> |
|
468 | + $sLTR = '<span dir="ltr" ' . $class . '>' . $nothing; |
|
469 | + $eLTR = $nothing . '</span>'; |
|
470 | + $sRTL = '<span dir="rtl" ' . $class . '>' . $nothing; |
|
471 | + $eRTL = $nothing . '</span>'; |
|
472 | + break; |
|
473 | + case 'LTR': |
|
474 | + case 'ltr': |
|
475 | + // LTR text: <span dir="ltr"> text </span> |
|
476 | + // RTL text: text |
|
477 | + $sLTR = '<span dir="ltr" ' . $class . '>' . $nothing; |
|
478 | + $eLTR = $nothing . '</span>'; |
|
479 | + $sRTL = ''; |
|
480 | + $eRTL = ''; |
|
481 | + break; |
|
482 | + case 'RTL': |
|
483 | + case 'rtl': |
|
484 | + default: |
|
485 | + // LTR text: text |
|
486 | + // RTL text: <span dir="rtl"> text </span> |
|
487 | + $sLTR = ''; |
|
488 | + $eLTR = ''; |
|
489 | + $sRTL = '<span dir="rtl" ' . $class . '>' . $nothing; |
|
490 | + $eRTL = $nothing . '</span>'; |
|
491 | + break; |
|
492 | 492 | } |
493 | 493 | $result = str_replace(array(self::$startLTR, self::$endLTR, self::$startRTL, self::$endRTL), array($sLTR, $eLTR, $sRTL, $eRTL), $result); |
494 | 494 |
@@ -31,28 +31,28 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function getAgeAtEvent($age_string) { |
33 | 33 | switch (strtoupper($age_string)) { |
34 | - case 'CHILD': |
|
35 | - return I18N::translate('Child'); |
|
36 | - case 'INFANT': |
|
37 | - return I18N::translate('Infant'); |
|
38 | - case 'STILLBORN': |
|
39 | - return I18N::translate('Stillborn'); |
|
40 | - default: |
|
41 | - return preg_replace_callback( |
|
42 | - array( |
|
43 | - '/(\d+)([ymwd])/', |
|
44 | - ), |
|
45 | - function ($match) { |
|
46 | - switch ($match[2]) { |
|
47 | - case 'y': |
|
48 | - return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1])); |
|
49 | - case 'm': |
|
50 | - return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1])); |
|
51 | - case 'w': |
|
52 | - return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1])); |
|
53 | - case 'd': |
|
54 | - return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1])); |
|
55 | - } |
|
34 | + case 'CHILD': |
|
35 | + return I18N::translate('Child'); |
|
36 | + case 'INFANT': |
|
37 | + return I18N::translate('Infant'); |
|
38 | + case 'STILLBORN': |
|
39 | + return I18N::translate('Stillborn'); |
|
40 | + default: |
|
41 | + return preg_replace_callback( |
|
42 | + array( |
|
43 | + '/(\d+)([ymwd])/', |
|
44 | + ), |
|
45 | + function ($match) { |
|
46 | + switch ($match[2]) { |
|
47 | + case 'y': |
|
48 | + return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1])); |
|
49 | + case 'm': |
|
50 | + return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1])); |
|
51 | + case 'w': |
|
52 | + return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1])); |
|
53 | + case 'd': |
|
54 | + return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1])); |
|
55 | + } |
|
56 | 56 | }, |
57 | 57 | $age_string |
58 | 58 | ); |
@@ -74,40 +74,40 @@ discard block |
||
74 | 74 | preg_match_all('/%[^%]/', $time_fmt, $matches); |
75 | 75 | foreach ($matches[0] as $match) { |
76 | 76 | switch ($match) { |
77 | - case '%a': |
|
78 | - $t = gmdate('His', $time); |
|
79 | - if ($t == '000000') { |
|
80 | - $time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */ |
|
81 | - I18N::translate('midnight'), $time_fmt); |
|
82 | - } elseif ($t < '120000') { |
|
83 | - $time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */ |
|
84 | - I18N::translate('a.m.'), $time_fmt); |
|
85 | - } elseif ($t == '120000') { |
|
86 | - $time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */ |
|
87 | - I18N::translate('noon'), $time_fmt); |
|
88 | - } else { |
|
89 | - $time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */ |
|
90 | - I18N::translate('p.m.'), $time_fmt); |
|
91 | - } |
|
92 | - break; |
|
93 | - case '%A': |
|
94 | - $t = gmdate('His', $time); |
|
95 | - if ($t == '000000') { |
|
96 | - $time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */ |
|
97 | - I18N::translate('Midnight'), $time_fmt); |
|
98 | - } elseif ($t < '120000') { |
|
99 | - $time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */ |
|
100 | - I18N::translate('A.M.'), $time_fmt); |
|
101 | - } elseif ($t == '120000') { |
|
102 | - $time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */ |
|
103 | - I18N::translate('Noon'), $time_fmt); |
|
104 | - } else { |
|
105 | - $time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */ |
|
106 | - I18N::translate('P.M.'), $time_fmt); |
|
107 | - } |
|
108 | - break; |
|
109 | - default: |
|
110 | - $time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt); |
|
77 | + case '%a': |
|
78 | + $t = gmdate('His', $time); |
|
79 | + if ($t == '000000') { |
|
80 | + $time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */ |
|
81 | + I18N::translate('midnight'), $time_fmt); |
|
82 | + } elseif ($t < '120000') { |
|
83 | + $time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */ |
|
84 | + I18N::translate('a.m.'), $time_fmt); |
|
85 | + } elseif ($t == '120000') { |
|
86 | + $time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */ |
|
87 | + I18N::translate('noon'), $time_fmt); |
|
88 | + } else { |
|
89 | + $time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */ |
|
90 | + I18N::translate('p.m.'), $time_fmt); |
|
91 | + } |
|
92 | + break; |
|
93 | + case '%A': |
|
94 | + $t = gmdate('His', $time); |
|
95 | + if ($t == '000000') { |
|
96 | + $time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */ |
|
97 | + I18N::translate('Midnight'), $time_fmt); |
|
98 | + } elseif ($t < '120000') { |
|
99 | + $time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */ |
|
100 | + I18N::translate('A.M.'), $time_fmt); |
|
101 | + } elseif ($t == '120000') { |
|
102 | + $time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */ |
|
103 | + I18N::translate('Noon'), $time_fmt); |
|
104 | + } else { |
|
105 | + $time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */ |
|
106 | + I18N::translate('P.M.'), $time_fmt); |
|
107 | + } |
|
108 | + break; |
|
109 | + default: |
|
110 | + $time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function statusCodes($tag) { |
32 | 32 | switch ($tag) { |
33 | - case 'BAPL': |
|
34 | - case 'CONL': |
|
35 | - // LDS_BAPTISM_DATE_STATUS |
|
36 | - return array('CHILD', 'COMPLETED', 'EXCLUDED', 'INFANT', 'PRE-1970', 'STILLBORN', 'SUBMITTED', 'UNCLEARED'); |
|
37 | - case 'ENDL': |
|
38 | - // LDS_ENDOWMENT_DATE_STATUS |
|
39 | - return array('CHILD', 'COMPLETED', 'EXCLUDED', 'INFANT', 'PRE-1970', 'STILLBORN', 'SUBMITTED', 'UNCLEARED'); |
|
40 | - case 'SLGC': |
|
41 | - // LDS_CHILD_SEALING_DATE_STATUS |
|
42 | - return array('BIC', 'COMPLETED', 'EXCLUDED', 'PRE-1970', 'STILLBORN', 'SUBMITTED', 'UNCLEARED'); |
|
43 | - case 'SLGS': |
|
44 | - // LDS_SPOUSE_SEALING_DATE_STATUS |
|
45 | - return array('CANCELED', 'COMPLETED', 'DNS', 'DNS/CAN', 'EXCLUDED', 'PRE-1970', 'SUBMITTED', 'UNCLEARED'); |
|
46 | - default: |
|
47 | - throw new \InvalidArgumentException('Internal error - bad argument to GedcomCodeStat::statusCodes("' . $tag . '")'); |
|
33 | + case 'BAPL': |
|
34 | + case 'CONL': |
|
35 | + // LDS_BAPTISM_DATE_STATUS |
|
36 | + return array('CHILD', 'COMPLETED', 'EXCLUDED', 'INFANT', 'PRE-1970', 'STILLBORN', 'SUBMITTED', 'UNCLEARED'); |
|
37 | + case 'ENDL': |
|
38 | + // LDS_ENDOWMENT_DATE_STATUS |
|
39 | + return array('CHILD', 'COMPLETED', 'EXCLUDED', 'INFANT', 'PRE-1970', 'STILLBORN', 'SUBMITTED', 'UNCLEARED'); |
|
40 | + case 'SLGC': |
|
41 | + // LDS_CHILD_SEALING_DATE_STATUS |
|
42 | + return array('BIC', 'COMPLETED', 'EXCLUDED', 'PRE-1970', 'STILLBORN', 'SUBMITTED', 'UNCLEARED'); |
|
43 | + case 'SLGS': |
|
44 | + // LDS_SPOUSE_SEALING_DATE_STATUS |
|
45 | + return array('CANCELED', 'COMPLETED', 'DNS', 'DNS/CAN', 'EXCLUDED', 'PRE-1970', 'SUBMITTED', 'UNCLEARED'); |
|
46 | + default: |
|
47 | + throw new \InvalidArgumentException('Internal error - bad argument to GedcomCodeStat::statusCodes("' . $tag . '")'); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -57,61 +57,61 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function statusName($status_code) { |
59 | 59 | switch ($status_code) { |
60 | - case 'BIC': |
|
61 | - return |
|
62 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
63 | - I18N::translate('Born in the covenant'); |
|
64 | - case 'CANCELED': |
|
65 | - return |
|
66 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
67 | - I18N::translate('Sealing canceled (divorce)'); |
|
68 | - case 'CHILD': |
|
69 | - return |
|
70 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
71 | - I18N::translate('Died as a child: exempt'); |
|
72 | - case 'CLEARED': |
|
73 | - // This status appears in PhpGedView, but not in the GEDCOM 5.5.1 specification. |
|
74 | - return |
|
75 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
76 | - I18N::translate('Cleared but not yet completed'); |
|
77 | - case 'COMPLETED': |
|
78 | - return |
|
79 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
80 | - I18N::translate('Completed; date unknown'); |
|
81 | - case 'DNS': |
|
82 | - return |
|
83 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
84 | - I18N::translate('Do not seal: unauthorized'); |
|
85 | - case 'DNS/CAN': |
|
86 | - return |
|
87 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
88 | - I18N::translate('Do not seal, previous sealing canceled'); |
|
89 | - case 'EXCLUDED': |
|
90 | - return |
|
91 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
92 | - I18N::translate('Excluded from this submission'); |
|
93 | - case 'INFANT': |
|
94 | - return |
|
95 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
96 | - I18N::translate('Died as an infant: exempt'); |
|
97 | - case 'PRE-1970': |
|
98 | - return |
|
99 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
100 | - I18N::translate('Completed before 1970; date not available'); |
|
101 | - case 'STILLBORN': |
|
102 | - return |
|
103 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
104 | - I18N::translate('Stillborn: exempt'); |
|
105 | - case 'SUBMITTED': |
|
106 | - return |
|
107 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
108 | - I18N::translate('Submitted but not yet cleared'); |
|
109 | - case 'UNCLEARED': |
|
110 | - return |
|
111 | - /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
112 | - I18N::translate('Uncleared: insufficient data'); |
|
113 | - default: |
|
114 | - return $status_code; |
|
60 | + case 'BIC': |
|
61 | + return |
|
62 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
63 | + I18N::translate('Born in the covenant'); |
|
64 | + case 'CANCELED': |
|
65 | + return |
|
66 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
67 | + I18N::translate('Sealing canceled (divorce)'); |
|
68 | + case 'CHILD': |
|
69 | + return |
|
70 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
71 | + I18N::translate('Died as a child: exempt'); |
|
72 | + case 'CLEARED': |
|
73 | + // This status appears in PhpGedView, but not in the GEDCOM 5.5.1 specification. |
|
74 | + return |
|
75 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
76 | + I18N::translate('Cleared but not yet completed'); |
|
77 | + case 'COMPLETED': |
|
78 | + return |
|
79 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
80 | + I18N::translate('Completed; date unknown'); |
|
81 | + case 'DNS': |
|
82 | + return |
|
83 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
84 | + I18N::translate('Do not seal: unauthorized'); |
|
85 | + case 'DNS/CAN': |
|
86 | + return |
|
87 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
88 | + I18N::translate('Do not seal, previous sealing canceled'); |
|
89 | + case 'EXCLUDED': |
|
90 | + return |
|
91 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
92 | + I18N::translate('Excluded from this submission'); |
|
93 | + case 'INFANT': |
|
94 | + return |
|
95 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
96 | + I18N::translate('Died as an infant: exempt'); |
|
97 | + case 'PRE-1970': |
|
98 | + return |
|
99 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
100 | + I18N::translate('Completed before 1970; date not available'); |
|
101 | + case 'STILLBORN': |
|
102 | + return |
|
103 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
104 | + I18N::translate('Stillborn: exempt'); |
|
105 | + case 'SUBMITTED': |
|
106 | + return |
|
107 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
108 | + I18N::translate('Submitted but not yet cleared'); |
|
109 | + case 'UNCLEARED': |
|
110 | + return |
|
111 | + /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ |
|
112 | + I18N::translate('Uncleared: insufficient data'); |
|
113 | + default: |
|
114 | + return $status_code; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 |
@@ -190,17 +190,17 @@ discard block |
||
190 | 190 | if (FunctionsMedia::hasMemoryForImage($main_file)) { |
191 | 191 | try { |
192 | 192 | switch ($imgsize['mime']) { |
193 | - case 'image/png': |
|
194 | - $main_image = imagecreatefrompng($main_file); |
|
195 | - break; |
|
196 | - case 'image/gif': |
|
197 | - $main_image = imagecreatefromgif($main_file); |
|
198 | - break; |
|
199 | - case 'image/jpeg': |
|
200 | - $main_image = imagecreatefromjpeg($main_file); |
|
201 | - break; |
|
202 | - default: |
|
203 | - return $file; // Nothing else we can do :-( |
|
193 | + case 'image/png': |
|
194 | + $main_image = imagecreatefrompng($main_file); |
|
195 | + break; |
|
196 | + case 'image/gif': |
|
197 | + $main_image = imagecreatefromgif($main_file); |
|
198 | + break; |
|
199 | + case 'image/jpeg': |
|
200 | + $main_image = imagecreatefromjpeg($main_file); |
|
201 | + break; |
|
202 | + default: |
|
203 | + return $file; // Nothing else we can do :-( |
|
204 | 204 | } |
205 | 205 | if ($main_image) { |
206 | 206 | // How big should the thumbnail be? |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | // Shrink the image |
214 | 214 | imagecopyresampled($thumb_image, $main_image, 0, 0, 0, 0, $width, $height, $imgsize[0], $imgsize[1]); |
215 | 215 | switch ($imgsize['mime']) { |
216 | - case 'image/png': |
|
217 | - imagepng($thumb_image, $file); |
|
218 | - break; |
|
219 | - case 'image/gif': |
|
220 | - imagegif($thumb_image, $file); |
|
221 | - break; |
|
222 | - case 'image/jpeg': |
|
223 | - imagejpeg($thumb_image, $file); |
|
224 | - break; |
|
216 | + case 'image/png': |
|
217 | + imagepng($thumb_image, $file); |
|
218 | + break; |
|
219 | + case 'image/gif': |
|
220 | + imagegif($thumb_image, $file); |
|
221 | + break; |
|
222 | + case 'image/jpeg': |
|
223 | + imagejpeg($thumb_image, $file); |
|
224 | + break; |
|
225 | 225 | } |
226 | 226 | imagedestroy($main_image); |
227 | 227 | imagedestroy($thumb_image); |
@@ -490,54 +490,54 @@ discard block |
||
490 | 490 | public function mimeType() { |
491 | 491 | // Themes contain icon definitions for some/all of these mime-types |
492 | 492 | switch ($this->extension()) { |
493 | - case 'bmp': |
|
494 | - return 'image/bmp'; |
|
495 | - case 'doc': |
|
496 | - return 'application/msword'; |
|
497 | - case 'docx': |
|
498 | - return 'application/msword'; |
|
499 | - case 'ged': |
|
500 | - return 'text/x-gedcom'; |
|
501 | - case 'gif': |
|
502 | - return 'image/gif'; |
|
503 | - case 'htm': |
|
504 | - return 'text/html'; |
|
505 | - case 'html': |
|
506 | - return 'text/html'; |
|
507 | - case 'jpeg': |
|
508 | - return 'image/jpeg'; |
|
509 | - case 'jpg': |
|
510 | - return 'image/jpeg'; |
|
511 | - case 'mov': |
|
512 | - return 'video/quicktime'; |
|
513 | - case 'mp3': |
|
514 | - return 'audio/mpeg'; |
|
515 | - case 'ogv': |
|
516 | - return 'video/ogg'; |
|
517 | - case 'pdf': |
|
518 | - return 'application/pdf'; |
|
519 | - case 'png': |
|
520 | - return 'image/png'; |
|
521 | - case 'rar': |
|
522 | - return 'application/x-rar-compressed'; |
|
523 | - case 'swf': |
|
524 | - return 'application/x-shockwave-flash'; |
|
525 | - case 'svg': |
|
526 | - return 'image/svg'; |
|
527 | - case 'tif': |
|
528 | - return 'image/tiff'; |
|
529 | - case 'tiff': |
|
530 | - return 'image/tiff'; |
|
531 | - case 'xls': |
|
532 | - return 'application/vnd-ms-excel'; |
|
533 | - case 'xlsx': |
|
534 | - return 'application/vnd-ms-excel'; |
|
535 | - case 'wmv': |
|
536 | - return 'video/x-ms-wmv'; |
|
537 | - case 'zip': |
|
538 | - return 'application/zip'; |
|
539 | - default: |
|
540 | - return 'application/octet-stream'; |
|
493 | + case 'bmp': |
|
494 | + return 'image/bmp'; |
|
495 | + case 'doc': |
|
496 | + return 'application/msword'; |
|
497 | + case 'docx': |
|
498 | + return 'application/msword'; |
|
499 | + case 'ged': |
|
500 | + return 'text/x-gedcom'; |
|
501 | + case 'gif': |
|
502 | + return 'image/gif'; |
|
503 | + case 'htm': |
|
504 | + return 'text/html'; |
|
505 | + case 'html': |
|
506 | + return 'text/html'; |
|
507 | + case 'jpeg': |
|
508 | + return 'image/jpeg'; |
|
509 | + case 'jpg': |
|
510 | + return 'image/jpeg'; |
|
511 | + case 'mov': |
|
512 | + return 'video/quicktime'; |
|
513 | + case 'mp3': |
|
514 | + return 'audio/mpeg'; |
|
515 | + case 'ogv': |
|
516 | + return 'video/ogg'; |
|
517 | + case 'pdf': |
|
518 | + return 'application/pdf'; |
|
519 | + case 'png': |
|
520 | + return 'image/png'; |
|
521 | + case 'rar': |
|
522 | + return 'application/x-rar-compressed'; |
|
523 | + case 'swf': |
|
524 | + return 'application/x-shockwave-flash'; |
|
525 | + case 'svg': |
|
526 | + return 'image/svg'; |
|
527 | + case 'tif': |
|
528 | + return 'image/tiff'; |
|
529 | + case 'tiff': |
|
530 | + return 'image/tiff'; |
|
531 | + case 'xls': |
|
532 | + return 'application/vnd-ms-excel'; |
|
533 | + case 'xlsx': |
|
534 | + return 'application/vnd-ms-excel'; |
|
535 | + case 'wmv': |
|
536 | + return 'video/x-ms-wmv'; |
|
537 | + case 'zip': |
|
538 | + return 'application/zip'; |
|
539 | + default: |
|
540 | + return 'application/octet-stream'; |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | public static function collation() { |
142 | 142 | $collation = self::$locale->collation(); |
143 | 143 | switch ($collation) { |
144 | - case 'croatian_ci': |
|
145 | - case 'german2_ci': |
|
146 | - case 'vietnamese_ci': |
|
147 | - // Only available in MySQL 5.6 |
|
148 | - return 'utf8_unicode_ci'; |
|
149 | - default: |
|
150 | - return 'utf8_' . $collation; |
|
144 | + case 'croatian_ci': |
|
145 | + case 'german2_ci': |
|
146 | + case 'vietnamese_ci': |
|
147 | + // Only available in MySQL 5.6 |
|
148 | + return 'utf8_unicode_ci'; |
|
149 | + default: |
|
150 | + return 'utf8_' . $collation; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public static function gedcomAge($string) { |
285 | 285 | switch ($string) { |
286 | - case 'STILLBORN': |
|
287 | - // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (stillborn) |
|
288 | - return self::translate('(stillborn)'); |
|
289 | - case 'INFANT': |
|
290 | - // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in infancy) |
|
291 | - return self::translate('(in infancy)'); |
|
292 | - case 'CHILD': |
|
293 | - // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in childhood) |
|
294 | - return self::translate('(in childhood)'); |
|
286 | + case 'STILLBORN': |
|
287 | + // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (stillborn) |
|
288 | + return self::translate('(stillborn)'); |
|
289 | + case 'INFANT': |
|
290 | + // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in infancy) |
|
291 | + return self::translate('(in infancy)'); |
|
292 | + case 'CHILD': |
|
293 | + // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in childhood) |
|
294 | + return self::translate('(in childhood)'); |
|
295 | 295 | } |
296 | 296 | $age = array(); |
297 | 297 | if (preg_match('/(\d+)y/', $string, $match)) { |
@@ -591,13 +591,13 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public static function scriptDirection($script) { |
593 | 593 | switch ($script) { |
594 | - case 'Arab': |
|
595 | - case 'Hebr': |
|
596 | - case 'Mong': |
|
597 | - case 'Thaa': |
|
598 | - return 'rtl'; |
|
599 | - default: |
|
600 | - return 'ltr'; |
|
594 | + case 'Arab': |
|
595 | + case 'Hebr': |
|
596 | + case 'Mong': |
|
597 | + case 'Thaa': |
|
598 | + return 'rtl'; |
|
599 | + default: |
|
600 | + return 'ltr'; |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -878,15 +878,15 @@ discard block |
||
878 | 878 | */ |
879 | 879 | public static function defaultCalendar() { |
880 | 880 | switch (self::$locale->languageTag()) { |
881 | - case 'ar': |
|
882 | - return new ArabicCalendar; |
|
883 | - case 'fa': |
|
884 | - return new PersianCalendar; |
|
885 | - case 'he': |
|
886 | - case 'yi': |
|
887 | - return new JewishCalendar; |
|
888 | - default: |
|
889 | - return new GregorianCalendar; |
|
881 | + case 'ar': |
|
882 | + return new ArabicCalendar; |
|
883 | + case 'fa': |
|
884 | + return new PersianCalendar; |
|
885 | + case 'he': |
|
886 | + case 'yi': |
|
887 | + return new JewishCalendar; |
|
888 | + default: |
|
889 | + return new GregorianCalendar; |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | } |
@@ -879,33 +879,33 @@ |
||
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; |
|
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 | + } |
|
892 | 893 | } |
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; |
|
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 | + } |
|
898 | 899 | } |
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; |
|
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 | + } |
|
904 | 905 | } |
905 | - } |
|
906 | 906 | |
907 | - // d) any record |
|
908 | - return reset($families); |
|
907 | + // d) any record |
|
908 | + return reset($families); |
|
909 | 909 | } |
910 | 910 | } |
911 | 911 |
@@ -37,12 +37,12 @@ |
||
37 | 37 | */ |
38 | 38 | public function generate(Individual $individual, Individual $head = null) { |
39 | 39 | switch ($individual->getSex()) { |
40 | - case 'M': |
|
41 | - return $this->male; |
|
42 | - case 'F': |
|
43 | - return $this->female; |
|
44 | - default: |
|
45 | - return ''; |
|
40 | + case 'M': |
|
41 | + return $this->male; |
|
42 | + case 'F': |
|
43 | + return $this->female; |
|
44 | + default: |
|
45 | + return ''; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function getPercentage($total, $type) { |
305 | 305 | switch ($type) { |
306 | - case 'individual': |
|
307 | - $type = $this->totalIndividualsQuery(); |
|
308 | - break; |
|
309 | - case 'family': |
|
310 | - $type = $this->totalFamiliesQuery(); |
|
311 | - break; |
|
312 | - case 'source': |
|
313 | - $type = $this->totalSourcesQuery(); |
|
314 | - break; |
|
315 | - case 'note': |
|
316 | - $type = $this->totalNotesQuery(); |
|
317 | - break; |
|
318 | - case 'all': |
|
319 | - default: |
|
320 | - $type = $this->totalIndividualsQuery() + $this->totalFamiliesQuery() + $this->totalSourcesQuery(); |
|
321 | - break; |
|
306 | + case 'individual': |
|
307 | + $type = $this->totalIndividualsQuery(); |
|
308 | + break; |
|
309 | + case 'family': |
|
310 | + $type = $this->totalFamiliesQuery(); |
|
311 | + break; |
|
312 | + case 'source': |
|
313 | + $type = $this->totalSourcesQuery(); |
|
314 | + break; |
|
315 | + case 'note': |
|
316 | + $type = $this->totalNotesQuery(); |
|
317 | + break; |
|
318 | + case 'all': |
|
319 | + default: |
|
320 | + $type = $this->totalIndividualsQuery() + $this->totalFamiliesQuery() + $this->totalSourcesQuery(); |
|
321 | + break; |
|
322 | 322 | } |
323 | 323 | if ($type == 0) { |
324 | 324 | return I18N::percentage(0, 1); |
@@ -1444,29 +1444,29 @@ discard block |
||
1444 | 1444 | $row = $rows[0]; |
1445 | 1445 | $record = GedcomRecord::getInstance($row['d_gid'], $this->tree); |
1446 | 1446 | switch ($type) { |
1447 | - default: |
|
1448 | - case 'full': |
|
1449 | - if ($record->canShow()) { |
|
1450 | - $result = $record->formatList('span', false, $record->getFullName()); |
|
1451 | - } else { |
|
1452 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
1453 | - } |
|
1454 | - break; |
|
1455 | - case 'year': |
|
1456 | - $date = new Date($row['d_type'] . ' ' . $row['d_year']); |
|
1457 | - $result = $date->display(); |
|
1458 | - break; |
|
1459 | - case 'name': |
|
1460 | - $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
1461 | - break; |
|
1462 | - case 'place': |
|
1463 | - $fact = GedcomRecord::getInstance($row['d_gid'], $this->tree)->getFirstFact($row['d_fact']); |
|
1464 | - if ($fact) { |
|
1465 | - $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
1466 | - } else { |
|
1467 | - $result = I18N::translate('Private'); |
|
1468 | - } |
|
1469 | - break; |
|
1447 | + default: |
|
1448 | + case 'full': |
|
1449 | + if ($record->canShow()) { |
|
1450 | + $result = $record->formatList('span', false, $record->getFullName()); |
|
1451 | + } else { |
|
1452 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
1453 | + } |
|
1454 | + break; |
|
1455 | + case 'year': |
|
1456 | + $date = new Date($row['d_type'] . ' ' . $row['d_year']); |
|
1457 | + $result = $date->display(); |
|
1458 | + break; |
|
1459 | + case 'name': |
|
1460 | + $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
1461 | + break; |
|
1462 | + case 'place': |
|
1463 | + $fact = GedcomRecord::getInstance($row['d_gid'], $this->tree)->getFirstFact($row['d_fact']); |
|
1464 | + if ($fact) { |
|
1465 | + $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
1466 | + } else { |
|
1467 | + $result = I18N::translate('Private'); |
|
1468 | + } |
|
1469 | + break; |
|
1470 | 1470 | } |
1471 | 1471 | |
1472 | 1472 | return $result; |
@@ -1631,96 +1631,96 @@ discard block |
||
1631 | 1631 | } |
1632 | 1632 | I18N::init(WT_LOCALE); |
1633 | 1633 | switch ($chart_type) { |
1634 | - case 'surname_distribution_chart': |
|
1635 | - if ($surname == "") { |
|
1636 | - $surname = $this->getCommonSurname(); |
|
1637 | - } |
|
1638 | - $chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname; |
|
1639 | - // Count how many people are events in each country |
|
1640 | - $surn_countries = array(); |
|
1641 | - $indis = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false); |
|
1642 | - foreach ($indis as $person) { |
|
1643 | - if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) { |
|
1644 | - // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1645 | - foreach ($matches[1] as $country) { |
|
1646 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1647 | - if (array_key_exists($country_to_iso3166[$country], $surn_countries)) { |
|
1648 | - $surn_countries[$country_to_iso3166[$country]]++; |
|
1649 | - } else { |
|
1650 | - $surn_countries[$country_to_iso3166[$country]] = 1; |
|
1634 | + case 'surname_distribution_chart': |
|
1635 | + if ($surname == "") { |
|
1636 | + $surname = $this->getCommonSurname(); |
|
1637 | + } |
|
1638 | + $chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname; |
|
1639 | + // Count how many people are events in each country |
|
1640 | + $surn_countries = array(); |
|
1641 | + $indis = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false); |
|
1642 | + foreach ($indis as $person) { |
|
1643 | + if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) { |
|
1644 | + // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1645 | + foreach ($matches[1] as $country) { |
|
1646 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1647 | + if (array_key_exists($country_to_iso3166[$country], $surn_countries)) { |
|
1648 | + $surn_countries[$country_to_iso3166[$country]]++; |
|
1649 | + } else { |
|
1650 | + $surn_countries[$country_to_iso3166[$country]] = 1; |
|
1651 | + } |
|
1651 | 1652 | } |
1652 | 1653 | } |
1653 | 1654 | } |
1654 | - } |
|
1655 | - }; |
|
1656 | - break; |
|
1657 | - case 'birth_distribution_chart': |
|
1658 | - $chart_title = I18N::translate('Birth by country'); |
|
1659 | - // Count how many people were born in each country |
|
1660 | - $surn_countries = array(); |
|
1661 | - $b_countries = $this->statsPlaces('INDI', 'BIRT', 0, true); |
|
1662 | - foreach ($b_countries as $place => $count) { |
|
1663 | - $country = $place; |
|
1664 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1665 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1666 | - $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1667 | - } else { |
|
1668 | - $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1655 | + }; |
|
1656 | + break; |
|
1657 | + case 'birth_distribution_chart': |
|
1658 | + $chart_title = I18N::translate('Birth by country'); |
|
1659 | + // Count how many people were born in each country |
|
1660 | + $surn_countries = array(); |
|
1661 | + $b_countries = $this->statsPlaces('INDI', 'BIRT', 0, true); |
|
1662 | + foreach ($b_countries as $place => $count) { |
|
1663 | + $country = $place; |
|
1664 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1665 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1666 | + $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1667 | + } else { |
|
1668 | + $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1669 | + } |
|
1669 | 1670 | } |
1670 | 1671 | } |
1671 | - } |
|
1672 | - break; |
|
1673 | - case 'death_distribution_chart': |
|
1674 | - $chart_title = I18N::translate('Death by country'); |
|
1675 | - // Count how many people were death in each country |
|
1676 | - $surn_countries = array(); |
|
1677 | - $d_countries = $this->statsPlaces('INDI', 'DEAT', 0, true); |
|
1678 | - foreach ($d_countries as $place => $count) { |
|
1679 | - $country = $place; |
|
1680 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1681 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1682 | - $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1683 | - } else { |
|
1684 | - $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1672 | + break; |
|
1673 | + case 'death_distribution_chart': |
|
1674 | + $chart_title = I18N::translate('Death by country'); |
|
1675 | + // Count how many people were death in each country |
|
1676 | + $surn_countries = array(); |
|
1677 | + $d_countries = $this->statsPlaces('INDI', 'DEAT', 0, true); |
|
1678 | + foreach ($d_countries as $place => $count) { |
|
1679 | + $country = $place; |
|
1680 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1681 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1682 | + $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1683 | + } else { |
|
1684 | + $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1685 | + } |
|
1685 | 1686 | } |
1686 | 1687 | } |
1687 | - } |
|
1688 | - break; |
|
1689 | - case 'marriage_distribution_chart': |
|
1690 | - $chart_title = I18N::translate('Marriage by country'); |
|
1691 | - // Count how many families got marriage in each country |
|
1692 | - $surn_countries = array(); |
|
1693 | - $m_countries = $this->statsPlaces('FAM'); |
|
1694 | - // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1695 | - foreach ($m_countries as $place) { |
|
1696 | - $country = $place['country']; |
|
1697 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1698 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1699 | - $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1700 | - } else { |
|
1701 | - $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1688 | + break; |
|
1689 | + case 'marriage_distribution_chart': |
|
1690 | + $chart_title = I18N::translate('Marriage by country'); |
|
1691 | + // Count how many families got marriage in each country |
|
1692 | + $surn_countries = array(); |
|
1693 | + $m_countries = $this->statsPlaces('FAM'); |
|
1694 | + // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1695 | + foreach ($m_countries as $place) { |
|
1696 | + $country = $place['country']; |
|
1697 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1698 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1699 | + $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1700 | + } else { |
|
1701 | + $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1702 | + } |
|
1702 | 1703 | } |
1703 | 1704 | } |
1704 | - } |
|
1705 | - break; |
|
1706 | - case 'indi_distribution_chart': |
|
1707 | - default: |
|
1708 | - $chart_title = I18N::translate('Individual distribution chart'); |
|
1709 | - // Count how many people have events in each country |
|
1710 | - $surn_countries = array(); |
|
1711 | - $a_countries = $this->statsPlaces('INDI'); |
|
1712 | - // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1713 | - foreach ($a_countries as $place) { |
|
1714 | - $country = $place['country']; |
|
1715 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1716 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1717 | - $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1718 | - } else { |
|
1719 | - $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1705 | + break; |
|
1706 | + case 'indi_distribution_chart': |
|
1707 | + default: |
|
1708 | + $chart_title = I18N::translate('Individual distribution chart'); |
|
1709 | + // Count how many people have events in each country |
|
1710 | + $surn_countries = array(); |
|
1711 | + $a_countries = $this->statsPlaces('INDI'); |
|
1712 | + // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1713 | + foreach ($a_countries as $place) { |
|
1714 | + $country = $place['country']; |
|
1715 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1716 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1717 | + $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1718 | + } else { |
|
1719 | + $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1720 | + } |
|
1720 | 1721 | } |
1721 | 1722 | } |
1722 | - } |
|
1723 | - break; |
|
1723 | + break; |
|
1724 | 1724 | } |
1725 | 1725 | $chart_url = "https://chart.googleapis.com/chart?cht=t&chtm=" . $chart_shows; |
1726 | 1726 | $chart_url .= "&chco=" . $WT_STATS_CHART_COLOR1 . "," . $WT_STATS_CHART_COLOR3 . "," . $WT_STATS_CHART_COLOR2; // country colours |
@@ -2259,20 +2259,20 @@ discard block |
||
2259 | 2259 | $row = $rows[0]; |
2260 | 2260 | $person = Individual::getInstance($row['id'], $this->tree); |
2261 | 2261 | switch ($type) { |
2262 | - default: |
|
2263 | - case 'full': |
|
2264 | - if ($person->canShowName()) { |
|
2265 | - $result = $person->formatList('span', false, $person->getFullName()); |
|
2266 | - } else { |
|
2267 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
2268 | - } |
|
2269 | - break; |
|
2270 | - case 'age': |
|
2271 | - $result = I18N::number((int) ($row['age'] / 365.25)); |
|
2272 | - break; |
|
2273 | - case 'name': |
|
2274 | - $result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>"; |
|
2275 | - break; |
|
2262 | + default: |
|
2263 | + case 'full': |
|
2264 | + if ($person->canShowName()) { |
|
2265 | + $result = $person->formatList('span', false, $person->getFullName()); |
|
2266 | + } else { |
|
2267 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
2268 | + } |
|
2269 | + break; |
|
2270 | + case 'age': |
|
2271 | + $result = I18N::number((int) ($row['age'] / 365.25)); |
|
2272 | + break; |
|
2273 | + case 'name': |
|
2274 | + $result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>"; |
|
2275 | + break; |
|
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | return $result; |
@@ -2942,36 +2942,36 @@ discard block |
||
2942 | 2942 | $row = $rows[0]; |
2943 | 2943 | $record = GedcomRecord::getInstance($row['id'], $this->tree); |
2944 | 2944 | switch ($type) { |
2945 | - default: |
|
2946 | - case 'full': |
|
2947 | - if ($record->canShow()) { |
|
2948 | - $result = $record->formatList('span', false, $record->getFullName()); |
|
2949 | - } else { |
|
2950 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
2951 | - } |
|
2952 | - break; |
|
2953 | - case 'year': |
|
2954 | - $date = new Date($row['type'] . ' ' . $row['year']); |
|
2955 | - $result = $date->display(); |
|
2956 | - break; |
|
2957 | - case 'type': |
|
2958 | - if (isset($eventTypes[$row['fact']])) { |
|
2959 | - $result = $eventTypes[$row['fact']]; |
|
2960 | - } else { |
|
2961 | - $result = GedcomTag::getLabel($row['fact']); |
|
2962 | - } |
|
2963 | - break; |
|
2964 | - case 'name': |
|
2965 | - $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
2966 | - break; |
|
2967 | - case 'place': |
|
2968 | - $fact = $record->getFirstFact($row['fact']); |
|
2969 | - if ($fact) { |
|
2970 | - $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
2971 | - } else { |
|
2972 | - $result = I18N::translate('Private'); |
|
2973 | - } |
|
2974 | - break; |
|
2945 | + default: |
|
2946 | + case 'full': |
|
2947 | + if ($record->canShow()) { |
|
2948 | + $result = $record->formatList('span', false, $record->getFullName()); |
|
2949 | + } else { |
|
2950 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
2951 | + } |
|
2952 | + break; |
|
2953 | + case 'year': |
|
2954 | + $date = new Date($row['type'] . ' ' . $row['year']); |
|
2955 | + $result = $date->display(); |
|
2956 | + break; |
|
2957 | + case 'type': |
|
2958 | + if (isset($eventTypes[$row['fact']])) { |
|
2959 | + $result = $eventTypes[$row['fact']]; |
|
2960 | + } else { |
|
2961 | + $result = GedcomTag::getLabel($row['fact']); |
|
2962 | + } |
|
2963 | + break; |
|
2964 | + case 'name': |
|
2965 | + $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
2966 | + break; |
|
2967 | + case 'place': |
|
2968 | + $fact = $record->getFirstFact($row['fact']); |
|
2969 | + if ($fact) { |
|
2970 | + $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
2971 | + } else { |
|
2972 | + $result = I18N::translate('Private'); |
|
2973 | + } |
|
2974 | + break; |
|
2975 | 2975 | } |
2976 | 2976 | |
2977 | 2977 | return $result; |
@@ -3116,32 +3116,32 @@ discard block |
||
3116 | 3116 | $person = Individual::getInstance($row['i_id'], $this->tree); |
3117 | 3117 | } |
3118 | 3118 | switch ($type) { |
3119 | - default: |
|
3120 | - case 'full': |
|
3121 | - if ($family->canShow()) { |
|
3122 | - $result = $family->formatList('span', false, $person->getFullName()); |
|
3123 | - } else { |
|
3124 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
3125 | - } |
|
3126 | - break; |
|
3127 | - case 'name': |
|
3128 | - $result = '<a href="' . $family->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3129 | - break; |
|
3130 | - case 'age': |
|
3131 | - $age = $row['age']; |
|
3132 | - if ($show_years) { |
|
3133 | - if ((int) ($age / 365.25) > 0) { |
|
3134 | - $age = (int) ($age / 365.25) . 'y'; |
|
3135 | - } elseif ((int) ($age / 30.4375) > 0) { |
|
3136 | - $age = (int) ($age / 30.4375) . 'm'; |
|
3119 | + default: |
|
3120 | + case 'full': |
|
3121 | + if ($family->canShow()) { |
|
3122 | + $result = $family->formatList('span', false, $person->getFullName()); |
|
3137 | 3123 | } else { |
3138 | - $age = $age . 'd'; |
|
3124 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
3139 | 3125 | } |
3140 | - $result = FunctionsDate::getAgeAtEvent($age); |
|
3141 | - } else { |
|
3142 | - $result = I18N::number((int) ($age / 365.25)); |
|
3143 | - } |
|
3144 | - break; |
|
3126 | + break; |
|
3127 | + case 'name': |
|
3128 | + $result = '<a href="' . $family->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3129 | + break; |
|
3130 | + case 'age': |
|
3131 | + $age = $row['age']; |
|
3132 | + if ($show_years) { |
|
3133 | + if ((int) ($age / 365.25) > 0) { |
|
3134 | + $age = (int) ($age / 365.25) . 'y'; |
|
3135 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3136 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3137 | + } else { |
|
3138 | + $age = $age . 'd'; |
|
3139 | + } |
|
3140 | + $result = FunctionsDate::getAgeAtEvent($age); |
|
3141 | + } else { |
|
3142 | + $result = I18N::number((int) ($age / 365.25)); |
|
3143 | + } |
|
3144 | + break; |
|
3145 | 3145 | } |
3146 | 3146 | |
3147 | 3147 | return $result; |
@@ -3414,32 +3414,32 @@ discard block |
||
3414 | 3414 | $person = Individual::getInstance($row['id'], $this->tree); |
3415 | 3415 | } |
3416 | 3416 | switch ($type) { |
3417 | - default: |
|
3418 | - case 'full': |
|
3419 | - if ($person->canShow()) { |
|
3420 | - $result = $person->formatList('span', false, $person->getFullName()); |
|
3421 | - } else { |
|
3422 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
3423 | - } |
|
3424 | - break; |
|
3425 | - case 'name': |
|
3426 | - $result = '<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3427 | - break; |
|
3428 | - case 'age': |
|
3429 | - $age = $row['age']; |
|
3430 | - if ($show_years) { |
|
3431 | - if ((int) ($age / 365.25) > 0) { |
|
3432 | - $age = (int) ($age / 365.25) . 'y'; |
|
3433 | - } elseif ((int) ($age / 30.4375) > 0) { |
|
3434 | - $age = (int) ($age / 30.4375) . 'm'; |
|
3417 | + default: |
|
3418 | + case 'full': |
|
3419 | + if ($person->canShow()) { |
|
3420 | + $result = $person->formatList('span', false, $person->getFullName()); |
|
3435 | 3421 | } else { |
3436 | - $age = $age . 'd'; |
|
3422 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
3437 | 3423 | } |
3438 | - $result = FunctionsDate::getAgeAtEvent($age); |
|
3439 | - } else { |
|
3440 | - $result = (int) ($age / 365.25); |
|
3441 | - } |
|
3442 | - break; |
|
3424 | + break; |
|
3425 | + case 'name': |
|
3426 | + $result = '<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3427 | + break; |
|
3428 | + case 'age': |
|
3429 | + $age = $row['age']; |
|
3430 | + if ($show_years) { |
|
3431 | + if ((int) ($age / 365.25) > 0) { |
|
3432 | + $age = (int) ($age / 365.25) . 'y'; |
|
3433 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3434 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3435 | + } else { |
|
3436 | + $age = $age . 'd'; |
|
3437 | + } |
|
3438 | + $result = FunctionsDate::getAgeAtEvent($age); |
|
3439 | + } else { |
|
3440 | + $result = (int) ($age / 365.25); |
|
3441 | + } |
|
3442 | + break; |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | 3445 | return $result; |
@@ -4397,20 +4397,20 @@ discard block |
||
4397 | 4397 | $row = $rows[0]; |
4398 | 4398 | $family = Family::getInstance($row['id'], $this->tree); |
4399 | 4399 | switch ($type) { |
4400 | - default: |
|
4401 | - case 'full': |
|
4402 | - if ($family->canShow()) { |
|
4403 | - $result = $family->formatList('span', false, $family->getFullName()); |
|
4404 | - } else { |
|
4405 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
4406 | - } |
|
4407 | - break; |
|
4408 | - case 'size': |
|
4409 | - $result = I18N::number($row['tot']); |
|
4410 | - break; |
|
4411 | - case 'name': |
|
4412 | - $result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>'; |
|
4413 | - break; |
|
4400 | + default: |
|
4401 | + case 'full': |
|
4402 | + if ($family->canShow()) { |
|
4403 | + $result = $family->formatList('span', false, $family->getFullName()); |
|
4404 | + } else { |
|
4405 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
4406 | + } |
|
4407 | + break; |
|
4408 | + case 'size': |
|
4409 | + $result = I18N::number($row['tot']); |
|
4410 | + break; |
|
4411 | + case 'name': |
|
4412 | + $result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>'; |
|
4413 | + break; |
|
4414 | 4414 | } |
4415 | 4415 | |
4416 | 4416 | return $result; |
@@ -4689,43 +4689,43 @@ discard block |
||
4689 | 4689 | foreach ($rows as $values) { |
4690 | 4690 | $counts[] = round(100 * $values['total'] / $tot, 0); |
4691 | 4691 | switch ($values['d_month']) { |
4692 | - default: |
|
4693 | - case 'JAN': |
|
4694 | - $values['d_month'] = 1; |
|
4695 | - break; |
|
4696 | - case 'FEB': |
|
4697 | - $values['d_month'] = 2; |
|
4698 | - break; |
|
4699 | - case 'MAR': |
|
4700 | - $values['d_month'] = 3; |
|
4701 | - break; |
|
4702 | - case 'APR': |
|
4703 | - $values['d_month'] = 4; |
|
4704 | - break; |
|
4705 | - case 'MAY': |
|
4706 | - $values['d_month'] = 5; |
|
4707 | - break; |
|
4708 | - case 'JUN': |
|
4709 | - $values['d_month'] = 6; |
|
4710 | - break; |
|
4711 | - case 'JUL': |
|
4712 | - $values['d_month'] = 7; |
|
4713 | - break; |
|
4714 | - case 'AUG': |
|
4715 | - $values['d_month'] = 8; |
|
4716 | - break; |
|
4717 | - case 'SEP': |
|
4718 | - $values['d_month'] = 9; |
|
4719 | - break; |
|
4720 | - case 'OCT': |
|
4721 | - $values['d_month'] = 10; |
|
4722 | - break; |
|
4723 | - case 'NOV': |
|
4724 | - $values['d_month'] = 11; |
|
4725 | - break; |
|
4726 | - case 'DEC': |
|
4727 | - $values['d_month'] = 12; |
|
4728 | - break; |
|
4692 | + default: |
|
4693 | + case 'JAN': |
|
4694 | + $values['d_month'] = 1; |
|
4695 | + break; |
|
4696 | + case 'FEB': |
|
4697 | + $values['d_month'] = 2; |
|
4698 | + break; |
|
4699 | + case 'MAR': |
|
4700 | + $values['d_month'] = 3; |
|
4701 | + break; |
|
4702 | + case 'APR': |
|
4703 | + $values['d_month'] = 4; |
|
4704 | + break; |
|
4705 | + case 'MAY': |
|
4706 | + $values['d_month'] = 5; |
|
4707 | + break; |
|
4708 | + case 'JUN': |
|
4709 | + $values['d_month'] = 6; |
|
4710 | + break; |
|
4711 | + case 'JUL': |
|
4712 | + $values['d_month'] = 7; |
|
4713 | + break; |
|
4714 | + case 'AUG': |
|
4715 | + $values['d_month'] = 8; |
|
4716 | + break; |
|
4717 | + case 'SEP': |
|
4718 | + $values['d_month'] = 9; |
|
4719 | + break; |
|
4720 | + case 'OCT': |
|
4721 | + $values['d_month'] = 10; |
|
4722 | + break; |
|
4723 | + case 'NOV': |
|
4724 | + $values['d_month'] = 11; |
|
4725 | + break; |
|
4726 | + case 'DEC': |
|
4727 | + $values['d_month'] = 12; |
|
4728 | + break; |
|
4729 | 4729 | } |
4730 | 4730 | $text .= I18N::translate(ucfirst(strtolower(($values['d_month'])))) . ' - ' . $values['total'] . '|'; |
4731 | 4731 | } |
@@ -5316,16 +5316,16 @@ discard block |
||
5316 | 5316 | } |
5317 | 5317 | |
5318 | 5318 | switch ($sorting) { |
5319 | - default: |
|
5320 | - case 'alpha': |
|
5321 | - uksort($surname_list, '\Fisharebest\Webtrees\I18N::strcasecmp'); |
|
5322 | - break; |
|
5323 | - case 'count': |
|
5324 | - asort($surname_list); |
|
5325 | - break; |
|
5326 | - case 'rcount': |
|
5327 | - arsort($surname_list); |
|
5328 | - break; |
|
5319 | + default: |
|
5320 | + case 'alpha': |
|
5321 | + uksort($surname_list, '\Fisharebest\Webtrees\I18N::strcasecmp'); |
|
5322 | + break; |
|
5323 | + case 'count': |
|
5324 | + asort($surname_list); |
|
5325 | + break; |
|
5326 | + case 'rcount': |
|
5327 | + arsort($surname_list); |
|
5328 | + break; |
|
5329 | 5329 | } |
5330 | 5330 | |
5331 | 5331 | // Note that we count/display SPFX SURN, but sort/group under just SURN |
@@ -5439,9 +5439,9 @@ discard block |
||
5439 | 5439 | } |
5440 | 5440 | } |
5441 | 5441 | switch ($SURNAME_TRADITION) { |
5442 | - case 'polish': |
|
5443 | - // most common surname should be in male variant (Kowalski, not Kowalska) |
|
5444 | - $top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name); |
|
5442 | + case 'polish': |
|
5443 | + // most common surname should be in male variant (Kowalski, not Kowalska) |
|
5444 | + $top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name); |
|
5445 | 5445 | } |
5446 | 5446 | $per = round(100 * $count_per / $tot_indi, 0); |
5447 | 5447 | $chd .= $this->arrayToExtendedEncoding(array($per)); |
@@ -5481,19 +5481,19 @@ discard block |
||
5481 | 5481 | } |
5482 | 5482 | |
5483 | 5483 | switch ($sex) { |
5484 | - case 'M': |
|
5485 | - $sex_sql = "i_sex='M'"; |
|
5486 | - break; |
|
5487 | - case 'F': |
|
5488 | - $sex_sql = "i_sex='F'"; |
|
5489 | - break; |
|
5490 | - case 'U': |
|
5491 | - $sex_sql = "i_sex='U'"; |
|
5492 | - break; |
|
5493 | - case 'B': |
|
5494 | - default: |
|
5495 | - $sex_sql = "i_sex<>'U'"; |
|
5496 | - break; |
|
5484 | + case 'M': |
|
5485 | + $sex_sql = "i_sex='M'"; |
|
5486 | + break; |
|
5487 | + case 'F': |
|
5488 | + $sex_sql = "i_sex='F'"; |
|
5489 | + break; |
|
5490 | + case 'U': |
|
5491 | + $sex_sql = "i_sex='U'"; |
|
5492 | + break; |
|
5493 | + case 'B': |
|
5494 | + default: |
|
5495 | + $sex_sql = "i_sex<>'U'"; |
|
5496 | + break; |
|
5497 | 5497 | } |
5498 | 5498 | $ged_id = $this->tree->getTreeId(); |
5499 | 5499 | |
@@ -5538,25 +5538,25 @@ discard block |
||
5538 | 5538 | $tot = ''; |
5539 | 5539 | } |
5540 | 5540 | switch ($type) { |
5541 | - case 'table': |
|
5542 | - $common[] = '<tr><td>' . $given . '</td><td>' . I18N::number($total) . '</td><td>' . $total . '</td></tr>'; |
|
5543 | - break; |
|
5544 | - case 'list': |
|
5545 | - $common[] = '<li><span dir="auto">' . $given . '</span>' . $tot . '</li>'; |
|
5546 | - break; |
|
5547 | - case 'nolist': |
|
5548 | - $common[] = '<span dir="auto">' . $given . '</span>' . $tot; |
|
5549 | - break; |
|
5541 | + case 'table': |
|
5542 | + $common[] = '<tr><td>' . $given . '</td><td>' . I18N::number($total) . '</td><td>' . $total . '</td></tr>'; |
|
5543 | + break; |
|
5544 | + case 'list': |
|
5545 | + $common[] = '<li><span dir="auto">' . $given . '</span>' . $tot . '</li>'; |
|
5546 | + break; |
|
5547 | + case 'nolist': |
|
5548 | + $common[] = '<span dir="auto">' . $given . '</span>' . $tot; |
|
5549 | + break; |
|
5550 | 5550 | } |
5551 | 5551 | } |
5552 | 5552 | if ($common) { |
5553 | 5553 | switch ($type) { |
5554 | - case 'table': |
|
5555 | - global $controller; |
|
5556 | - $table_id = Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page |
|
5557 | - $controller |
|
5558 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
5559 | - ->addInlineJavascript(' |
|
5554 | + case 'table': |
|
5555 | + global $controller; |
|
5556 | + $table_id = Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page |
|
5557 | + $controller |
|
5558 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
5559 | + ->addInlineJavascript(' |
|
5560 | 5560 | jQuery("#' . $table_id . '").dataTable({ |
5561 | 5561 | dom: \'t\', |
5562 | 5562 | autoWidth: false, |
@@ -5574,15 +5574,15 @@ discard block |
||
5574 | 5574 | }); |
5575 | 5575 | jQuery("#' . $table_id . '").css("visibility", "visible"); |
5576 | 5576 | '); |
5577 | - $lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All')); |
|
5577 | + $lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All')); |
|
5578 | 5578 | |
5579 | - return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>'; |
|
5580 | - case 'list': |
|
5581 | - return '<ul>' . implode('', $common) . '</ul>'; |
|
5582 | - case 'nolist': |
|
5583 | - return implode(I18N::$list_separator, $common); |
|
5584 | - default: |
|
5585 | - return ''; |
|
5579 | + return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>'; |
|
5580 | + case 'list': |
|
5581 | + return '<ul>' . implode('', $common) . '</ul>'; |
|
5582 | + case 'nolist': |
|
5583 | + return implode(I18N::$list_separator, $common); |
|
5584 | + default: |
|
5585 | + return ''; |
|
5586 | 5586 | } |
5587 | 5587 | } else { |
5588 | 5588 | return ''; |
@@ -6069,42 +6069,42 @@ discard block |
||
6069 | 6069 | } |
6070 | 6070 | |
6071 | 6071 | switch ($type) { |
6072 | - default: |
|
6073 | - case 'userid': |
|
6074 | - return $user->getUserId(); |
|
6075 | - case 'username': |
|
6076 | - return Filter::escapeHtml($user->getUserName()); |
|
6077 | - case 'fullname': |
|
6078 | - return $user->getRealNameHtml(); |
|
6079 | - case 'regdate': |
|
6080 | - if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6081 | - $datestamp = $params[0]; |
|
6082 | - } else { |
|
6083 | - $datestamp = I18N::dateFormat(); |
|
6084 | - } |
|
6072 | + default: |
|
6073 | + case 'userid': |
|
6074 | + return $user->getUserId(); |
|
6075 | + case 'username': |
|
6076 | + return Filter::escapeHtml($user->getUserName()); |
|
6077 | + case 'fullname': |
|
6078 | + return $user->getRealNameHtml(); |
|
6079 | + case 'regdate': |
|
6080 | + if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6081 | + $datestamp = $params[0]; |
|
6082 | + } else { |
|
6083 | + $datestamp = I18N::dateFormat(); |
|
6084 | + } |
|
6085 | 6085 | |
6086 | - return FunctionsDate::timestampToGedcomDate($user->getPreference('reg_timestamp'))->display(false, $datestamp); |
|
6087 | - case 'regtime': |
|
6088 | - if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6089 | - $datestamp = $params[0]; |
|
6090 | - } else { |
|
6091 | - $datestamp = str_replace('%', '', I18N::timeFormat()); |
|
6092 | - } |
|
6086 | + return FunctionsDate::timestampToGedcomDate($user->getPreference('reg_timestamp'))->display(false, $datestamp); |
|
6087 | + case 'regtime': |
|
6088 | + if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6089 | + $datestamp = $params[0]; |
|
6090 | + } else { |
|
6091 | + $datestamp = str_replace('%', '', I18N::timeFormat()); |
|
6092 | + } |
|
6093 | 6093 | |
6094 | - return date($datestamp, $user->getPreference('reg_timestamp')); |
|
6095 | - case 'loggedin': |
|
6096 | - if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6097 | - $yes = $params[0]; |
|
6098 | - } else { |
|
6099 | - $yes = I18N::translate('yes'); |
|
6100 | - } |
|
6101 | - if (is_array($params) && isset($params[1]) && $params[1] != '') { |
|
6102 | - $no = $params[1]; |
|
6103 | - } else { |
|
6104 | - $no = I18N::translate('no'); |
|
6105 | - } |
|
6094 | + return date($datestamp, $user->getPreference('reg_timestamp')); |
|
6095 | + case 'loggedin': |
|
6096 | + if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6097 | + $yes = $params[0]; |
|
6098 | + } else { |
|
6099 | + $yes = I18N::translate('yes'); |
|
6100 | + } |
|
6101 | + if (is_array($params) && isset($params[1]) && $params[1] != '') { |
|
6102 | + $no = $params[1]; |
|
6103 | + } else { |
|
6104 | + $no = I18N::translate('no'); |
|
6105 | + } |
|
6106 | 6106 | |
6107 | - return Database::prepare("SELECT SQL_NO_CACHE 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no; |
|
6107 | + return Database::prepare("SELECT SQL_NO_CACHE 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no; |
|
6108 | 6108 | } |
6109 | 6109 | } |
6110 | 6110 | |
@@ -6941,50 +6941,50 @@ discard block |
||
6941 | 6941 | } |
6942 | 6942 | // The current chart engine (Google charts) can't handle <sup></sup> markup |
6943 | 6943 | switch ($century) { |
6944 | - case 21: |
|
6945 | - return strip_tags(I18N::translateContext('CENTURY', '21st')); |
|
6946 | - case 20: |
|
6947 | - return strip_tags(I18N::translateContext('CENTURY', '20th')); |
|
6948 | - case 19: |
|
6949 | - return strip_tags(I18N::translateContext('CENTURY', '19th')); |
|
6950 | - case 18: |
|
6951 | - return strip_tags(I18N::translateContext('CENTURY', '18th')); |
|
6952 | - case 17: |
|
6953 | - return strip_tags(I18N::translateContext('CENTURY', '17th')); |
|
6954 | - case 16: |
|
6955 | - return strip_tags(I18N::translateContext('CENTURY', '16th')); |
|
6956 | - case 15: |
|
6957 | - return strip_tags(I18N::translateContext('CENTURY', '15th')); |
|
6958 | - case 14: |
|
6959 | - return strip_tags(I18N::translateContext('CENTURY', '14th')); |
|
6960 | - case 13: |
|
6961 | - return strip_tags(I18N::translateContext('CENTURY', '13th')); |
|
6962 | - case 12: |
|
6963 | - return strip_tags(I18N::translateContext('CENTURY', '12th')); |
|
6964 | - case 11: |
|
6965 | - return strip_tags(I18N::translateContext('CENTURY', '11th')); |
|
6966 | - case 10: |
|
6967 | - return strip_tags(I18N::translateContext('CENTURY', '10th')); |
|
6968 | - case 9: |
|
6969 | - return strip_tags(I18N::translateContext('CENTURY', '9th')); |
|
6970 | - case 8: |
|
6971 | - return strip_tags(I18N::translateContext('CENTURY', '8th')); |
|
6972 | - case 7: |
|
6973 | - return strip_tags(I18N::translateContext('CENTURY', '7th')); |
|
6974 | - case 6: |
|
6975 | - return strip_tags(I18N::translateContext('CENTURY', '6th')); |
|
6976 | - case 5: |
|
6977 | - return strip_tags(I18N::translateContext('CENTURY', '5th')); |
|
6978 | - case 4: |
|
6979 | - return strip_tags(I18N::translateContext('CENTURY', '4th')); |
|
6980 | - case 3: |
|
6981 | - return strip_tags(I18N::translateContext('CENTURY', '3rd')); |
|
6982 | - case 2: |
|
6983 | - return strip_tags(I18N::translateContext('CENTURY', '2nd')); |
|
6984 | - case 1: |
|
6985 | - return strip_tags(I18N::translateContext('CENTURY', '1st')); |
|
6986 | - default: |
|
6987 | - return ($century - 1) . '01-' . $century . '00'; |
|
6944 | + case 21: |
|
6945 | + return strip_tags(I18N::translateContext('CENTURY', '21st')); |
|
6946 | + case 20: |
|
6947 | + return strip_tags(I18N::translateContext('CENTURY', '20th')); |
|
6948 | + case 19: |
|
6949 | + return strip_tags(I18N::translateContext('CENTURY', '19th')); |
|
6950 | + case 18: |
|
6951 | + return strip_tags(I18N::translateContext('CENTURY', '18th')); |
|
6952 | + case 17: |
|
6953 | + return strip_tags(I18N::translateContext('CENTURY', '17th')); |
|
6954 | + case 16: |
|
6955 | + return strip_tags(I18N::translateContext('CENTURY', '16th')); |
|
6956 | + case 15: |
|
6957 | + return strip_tags(I18N::translateContext('CENTURY', '15th')); |
|
6958 | + case 14: |
|
6959 | + return strip_tags(I18N::translateContext('CENTURY', '14th')); |
|
6960 | + case 13: |
|
6961 | + return strip_tags(I18N::translateContext('CENTURY', '13th')); |
|
6962 | + case 12: |
|
6963 | + return strip_tags(I18N::translateContext('CENTURY', '12th')); |
|
6964 | + case 11: |
|
6965 | + return strip_tags(I18N::translateContext('CENTURY', '11th')); |
|
6966 | + case 10: |
|
6967 | + return strip_tags(I18N::translateContext('CENTURY', '10th')); |
|
6968 | + case 9: |
|
6969 | + return strip_tags(I18N::translateContext('CENTURY', '9th')); |
|
6970 | + case 8: |
|
6971 | + return strip_tags(I18N::translateContext('CENTURY', '8th')); |
|
6972 | + case 7: |
|
6973 | + return strip_tags(I18N::translateContext('CENTURY', '7th')); |
|
6974 | + case 6: |
|
6975 | + return strip_tags(I18N::translateContext('CENTURY', '6th')); |
|
6976 | + case 5: |
|
6977 | + return strip_tags(I18N::translateContext('CENTURY', '5th')); |
|
6978 | + case 4: |
|
6979 | + return strip_tags(I18N::translateContext('CENTURY', '4th')); |
|
6980 | + case 3: |
|
6981 | + return strip_tags(I18N::translateContext('CENTURY', '3rd')); |
|
6982 | + case 2: |
|
6983 | + return strip_tags(I18N::translateContext('CENTURY', '2nd')); |
|
6984 | + case 1: |
|
6985 | + return strip_tags(I18N::translateContext('CENTURY', '1st')); |
|
6986 | + default: |
|
6987 | + return ($century - 1) . '01-' . $century . '00'; |
|
6988 | 6988 | } |
6989 | 6989 | } |
6990 | 6990 | } |
@@ -41,10 +41,10 @@ |
||
41 | 41 | protected function flashMessageContainer(\stdClass $message) { |
42 | 42 | // This theme uses jQueryUI markup. |
43 | 43 | switch ($message->status) { |
44 | - case 'danger': |
|
45 | - return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | - default: |
|
47 | - return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
44 | + case 'danger': |
|
45 | + return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | + default: |
|
47 | + return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |