@@ -98,8 +98,11 @@ |
||
| 98 | 98 | <td class="col-xs-1"> |
| 99 | 99 | <?php if ($module instanceof ModuleConfigInterface): ?> |
| 100 | 100 | <a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a> |
| 101 | - <?php else: ?> |
|
| 102 | - <?php echo $module->getTitle(); ?> |
|
| 101 | + <?php else { |
|
| 102 | + : ?> |
|
| 103 | + <?php echo $module->getTitle(); |
|
| 104 | +} |
|
| 105 | +?> |
|
| 103 | 106 | <?php endif; ?> |
| 104 | 107 | </td> |
| 105 | 108 | <td class="col-xs-5"><?php echo $module->getDescription(); ?></td> |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | define('WT_SCRIPT_NAME', 'site-offline.php'); |
@@ -98,8 +98,11 @@ |
||
| 98 | 98 | <td class="col-xs-1"> |
| 99 | 99 | <?php if ($module instanceof ModuleConfigInterface): ?> |
| 100 | 100 | <a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a> |
| 101 | - <?php else: ?> |
|
| 102 | - <?php echo $module->getTitle(); ?> |
|
| 101 | + <?php else { |
|
| 102 | + : ?> |
|
| 103 | + <?php echo $module->getTitle(); |
|
| 104 | +} |
|
| 105 | +?> |
|
| 103 | 106 | <?php endif; ?> |
| 104 | 107 | </td> |
| 105 | 108 | <td class="col-xs-5"><?php echo $module->getDescription(); ?></td> |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | use Fisharebest\Webtrees\Theme\AdministrationTheme; |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | public function newParentNames($child_name, $parent_sex) { |
| 63 | 63 | if (preg_match(self::REGEX_SURNS, $child_name, $match)) { |
| 64 | - switch($parent_sex) { |
|
| 64 | + switch ($parent_sex) { |
|
| 65 | 65 | case 'M': |
| 66 | 66 | return array( |
| 67 | 67 | 'NAME' => '/' . $match['SURN1'] . '/ //', |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | use Fisharebest\Webtrees\Theme\AdministrationTheme; |
@@ -207,14 +207,14 @@ |
||
| 207 | 207 | |
| 208 | 208 | foreach ($differences as $difference) { |
| 209 | 209 | switch ($difference[1]) { |
| 210 | - case MyersDiff::DELETE: |
|
| 211 | - $diff_lines[] = '<del>' . $difference[0] . '</del>'; |
|
| 212 | - break; |
|
| 213 | - case MyersDiff::INSERT: |
|
| 214 | - $diff_lines[] = '<ins>' . $difference[0] . '</ins>'; |
|
| 215 | - break; |
|
| 216 | - default: |
|
| 217 | - $diff_lines[] = $difference[0]; |
|
| 210 | + case MyersDiff::DELETE: |
|
| 211 | + $diff_lines[] = '<del>' . $difference[0] . '</del>'; |
|
| 212 | + break; |
|
| 213 | + case MyersDiff::INSERT: |
|
| 214 | + $diff_lines[] = '<ins>' . $difference[0] . '</ins>'; |
|
| 215 | + break; |
|
| 216 | + default: |
|
| 217 | + $diff_lines[] = $difference[0]; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $recordsTotal = (int) Database::prepare("SELECT COUNT(*) FROM `##change`")->fetchOne(); |
| 180 | 180 | |
| 181 | 181 | $data = array(); |
| 182 | - $algorithm = new MyersDiff; |
|
| 182 | + $algorithm = new MyersDiff; |
|
| 183 | 183 | |
| 184 | 184 | foreach ($rows as $row) { |
| 185 | 185 | $old_lines = preg_split('/[\n]+/', $row->old_gedcom, -1, PREG_SPLIT_NO_EMPTY); |
@@ -207,14 +207,12 @@ discard block |
||
| 207 | 207 | $row->change_time, |
| 208 | 208 | I18N::translate($row->status), |
| 209 | 209 | GedcomRecord::getInstance($row->xref, Tree::findByName($gedc)) ? |
| 210 | - "<a href='gedrecord.php?pid={$row->xref}&ged={$row->gedcom_name}'>{$row->xref}</a>" : |
|
| 211 | - $row->xref, |
|
| 210 | + "<a href='gedrecord.php?pid={$row->xref}&ged={$row->gedcom_name}'>{$row->xref}</a>" : $row->xref, |
|
| 212 | 211 | '<div class="gedcom-data" dir="ltr">' . |
| 213 | 212 | preg_replace_callback('/@(' . WT_REGEX_XREF . ')@/', |
| 214 | 213 | function ($match) use ($gedc) { |
| 215 | 214 | return GedcomRecord::getInstance($match[1], Tree::findByName($gedc)) ? |
| 216 | - "<a href='#' onclick='return edit_raw(\"{$match[1]}\");'>{$match[0]}</a>" : |
|
| 217 | - $match[0]; |
|
| 215 | + "<a href='#' onclick='return edit_raw(\"{$match[1]}\");'>{$match[0]}</a>" : $match[0]; |
|
| 218 | 216 | }, |
| 219 | 217 | implode("\n", $diff_lines) |
| 220 | 218 | ) . |
@@ -247,7 +247,7 @@ |
||
| 247 | 247 | /** |
| 248 | 248 | * Which months follows this one? Calendars with leap-months should provide their own implementation. |
| 249 | 249 | * |
| 250 | - * @return int[] |
|
| 250 | + * @return integer[] |
|
| 251 | 251 | */ |
| 252 | 252 | protected function nextMonth() { |
| 253 | 253 | if ($this->m == 6 && !$this->isLeapYear()) { |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | use Fisharebest\Webtrees\Theme\AdministrationTheme; |
@@ -247,7 +247,7 @@ |
||
| 247 | 247 | /** |
| 248 | 248 | * Which months follows this one? Calendars with leap-months should provide their own implementation. |
| 249 | 249 | * |
| 250 | - * @return int[] |
|
| 250 | + * @return integer[] |
|
| 251 | 251 | */ |
| 252 | 252 | protected function nextMonth() { |
| 253 | 253 | if ($this->m == 6 && !$this->isLeapYear()) { |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | use Fisharebest\Webtrees\Theme\AdministrationTheme; |
@@ -528,10 +528,12 @@ discard block |
||
| 528 | 528 | version_compare(PHP_VERSION, '7.0', '<') && date('Y-m-d') >= '2016-08-28' |
| 529 | 529 | ) { |
| 530 | 530 | $server_warnings[] = I18N::translate('Your web server is using PHP version %s, which is no longer maintained. You should upgrade to a later version.', PHP_VERSION); |
| 531 | -} else |
|
| 531 | +} else { |
|
| 532 | 532 | |
| 533 | 533 | ?> |
| 534 | -<h1><?php echo $controller->getPageTitle(); ?></h1> |
|
| 534 | +<h1><?php echo $controller->getPageTitle(); |
|
| 535 | +} |
|
| 536 | +?></h1> |
|
| 535 | 537 | |
| 536 | 538 | <p> |
| 537 | 539 | <?php echo I18N::translate('These pages provide access to all the configuration settings and management tools for this webtrees site.'); ?> |
@@ -584,8 +586,11 @@ discard block |
||
| 584 | 586 | <a href="admin_site_upgrade.php" class="error"> |
| 585 | 587 | <?php echo /* I18N: %s is a version number */ I18N::translate('Upgrade to webtrees %s.', Filter::escapeHtml($latest_version)); ?> |
| 586 | 588 | </a> |
| 587 | - <?php else: ?> |
|
| 588 | - <?php echo I18N::translate('This is the latest version of webtrees. No upgrade is available.'); ?> |
|
| 589 | + <?php else { |
|
| 590 | + : ?> |
|
| 591 | + <?php echo I18N::translate('This is the latest version of webtrees. No upgrade is available.'); |
|
| 592 | +} |
|
| 593 | +?> |
|
| 589 | 594 | <?php endif; ?> |
| 590 | 595 | </p> |
| 591 | 596 | <?php endif; ?> |
@@ -747,9 +752,12 @@ discard block |
||
| 747 | 752 | <?php echo I18N::number($changes[$tree->getTreeId()]); ?> |
| 748 | 753 | <span class="sr-only"><?php echo I18N::translate('Pending changes'); ?> <?php echo $tree->getTitleHtml(); ?></span> |
| 749 | 754 | </a> |
| 750 | - <?php else: ?> |
|
| 755 | + <?php else { |
|
| 756 | + : ?> |
|
| 751 | 757 | - |
| 752 | - <?php endif; ?> |
|
| 758 | + <?php endif; |
|
| 759 | +} |
|
| 760 | +?> |
|
| 753 | 761 | </td> |
| 754 | 762 | <td class="text-right flip"> |
| 755 | 763 | <?php if ($individuals[$tree->getTreeId()]): ?> |
@@ -757,9 +765,12 @@ discard block |
||
| 757 | 765 | <?php echo I18N::number($individuals[$tree->getTreeId()]); ?> |
| 758 | 766 | <span class="sr-only"><?php echo I18N::translate('Individuals'); ?> <?php echo $tree->getTitleHtml(); ?></span> |
| 759 | 767 | </a> |
| 760 | - <?php else: ?> |
|
| 768 | + <?php else { |
|
| 769 | + : ?> |
|
| 761 | 770 | - |
| 762 | - <?php endif; ?> |
|
| 771 | + <?php endif; |
|
| 772 | +} |
|
| 773 | +?> |
|
| 763 | 774 | </td> |
| 764 | 775 | <td class="text-right flip"> |
| 765 | 776 | <?php if ($families[$tree->getTreeId()]): ?> |
@@ -767,9 +778,12 @@ discard block |
||
| 767 | 778 | <?php echo I18N::number($families[$tree->getTreeId()]); ?> |
| 768 | 779 | <span class="sr-only"><?php echo I18N::translate('Families'); ?> <?php echo $tree->getTitleHtml(); ?></span> |
| 769 | 780 | </a> |
| 770 | - <?php else: ?> |
|
| 781 | + <?php else { |
|
| 782 | + : ?> |
|
| 771 | 783 | - |
| 772 | - <?php endif; ?> |
|
| 784 | + <?php endif; |
|
| 785 | +} |
|
| 786 | +?> |
|
| 773 | 787 | </td> |
| 774 | 788 | <td class="text-right flip"> |
| 775 | 789 | <?php if ($sources[$tree->getTreeId()]): ?> |
@@ -777,9 +791,12 @@ discard block |
||
| 777 | 791 | <?php echo I18N::number($sources[$tree->getTreeId()]); ?> |
| 778 | 792 | <span class="sr-only"><?php echo I18N::translate('Sources'); ?> <?php echo $tree->getTitleHtml(); ?></span> |
| 779 | 793 | </a> |
| 780 | - <?php else: ?> |
|
| 794 | + <?php else { |
|
| 795 | + : ?> |
|
| 781 | 796 | - |
| 782 | - <?php endif; ?> |
|
| 797 | + <?php endif; |
|
| 798 | +} |
|
| 799 | +?> |
|
| 783 | 800 | </td> |
| 784 | 801 | <td class="text-right flip"> |
| 785 | 802 | <?php if ($repositories[$tree->getTreeId()]): ?> |
@@ -787,9 +804,12 @@ discard block |
||
| 787 | 804 | <?php echo I18N::number($repositories[$tree->getTreeId()]); ?> |
| 788 | 805 | <span class="sr-only"><?php echo I18N::translate('Repositories'); ?> <?php echo $tree->getTitleHtml(); ?></span> |
| 789 | 806 | </a> |
| 790 | - <?php else: ?> |
|
| 807 | + <?php else { |
|
| 808 | + : ?> |
|
| 791 | 809 | - |
| 792 | - <?php endif; ?> |
|
| 810 | + <?php endif; |
|
| 811 | +} |
|
| 812 | +?> |
|
| 793 | 813 | </td> |
| 794 | 814 | <td class="text-right flip"> |
| 795 | 815 | <?php if ($media[$tree->getTreeId()]): ?> |
@@ -797,9 +817,12 @@ discard block |
||
| 797 | 817 | <?php echo I18N::number($media[$tree->getTreeId()]); ?> |
| 798 | 818 | <span class="sr-only"><?php echo I18N::translate('Media objects'); ?> <?php echo $tree->getTitleHtml(); ?></span> |
| 799 | 819 | </a> |
| 800 | - <?php else: ?> |
|
| 820 | + <?php else { |
|
| 821 | + : ?> |
|
| 801 | 822 | - |
| 802 | - <?php endif; ?> |
|
| 823 | + <?php endif; |
|
| 824 | +} |
|
| 825 | +?> |
|
| 803 | 826 | </td> |
| 804 | 827 | </tr> |
| 805 | 828 | <?php endforeach; ?> |
@@ -282,15 +282,15 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | public static function gedcomAge($string) { |
| 284 | 284 | switch ($string) { |
| 285 | - case 'STILLBORN': |
|
| 286 | - // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (stillborn) |
|
| 287 | - return self::translate('(stillborn)'); |
|
| 288 | - case 'INFANT': |
|
| 289 | - // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in infancy) |
|
| 290 | - return self::translate('(in infancy)'); |
|
| 291 | - case 'CHILD': |
|
| 292 | - // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in childhood) |
|
| 293 | - return self::translate('(in childhood)'); |
|
| 285 | + case 'STILLBORN': |
|
| 286 | + // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (stillborn) |
|
| 287 | + return self::translate('(stillborn)'); |
|
| 288 | + case 'INFANT': |
|
| 289 | + // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in infancy) |
|
| 290 | + return self::translate('(in infancy)'); |
|
| 291 | + case 'CHILD': |
|
| 292 | + // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in childhood) |
|
| 293 | + return self::translate('(in childhood)'); |
|
| 294 | 294 | } |
| 295 | 295 | $age = array(); |
| 296 | 296 | if (preg_match('/(\d+)y/', $string, $match)) { |
@@ -874,15 +874,15 @@ discard block |
||
| 874 | 874 | */ |
| 875 | 875 | public static function defaultCalendar() { |
| 876 | 876 | switch (self::$locale->languageTag()) { |
| 877 | - case 'ar': |
|
| 878 | - return new ArabicCalendar; |
|
| 879 | - case 'fa': |
|
| 880 | - return new PersianCalendar; |
|
| 881 | - case 'he': |
|
| 882 | - case 'yi': |
|
| 883 | - return new JewishCalendar; |
|
| 884 | - default: |
|
| 885 | - return new GregorianCalendar; |
|
| 877 | + case 'ar': |
|
| 878 | + return new ArabicCalendar; |
|
| 879 | + case 'fa': |
|
| 880 | + return new PersianCalendar; |
|
| 881 | + case 'he': |
|
| 882 | + case 'yi': |
|
| 883 | + return new JewishCalendar; |
|
| 884 | + default: |
|
| 885 | + return new GregorianCalendar; |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | } |
@@ -421,7 +421,8 @@ |
||
| 421 | 421 | $translation = new Translation($translation_file); |
| 422 | 422 | $translations = array_merge($translations, $translation->asArray()); |
| 423 | 423 | } |
| 424 | - if ($cache_dir_exists && is_writeable($cache_file)) { // During setup, we may not have been able to create it. |
|
| 424 | + if ($cache_dir_exists && is_writeable($cache_file)) { |
|
| 425 | +// During setup, we may not have been able to create it. |
|
| 425 | 426 | file_put_contents($cache_file, '<' . '?php return ' . var_export($translations, true) . ';'); |
| 426 | 427 | } |
| 427 | 428 | } else { |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | use Fisharebest\Webtrees\Theme\AdministrationTheme; |
@@ -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; |
|
| 141 | - } |
|
| 127 | + case '<': |
|
| 128 | + // Assume this '<' starts an HTML element |
|
| 129 | + $endPos = strpos($workingText, '>'); // look for the terminating '>' |
|
| 130 | + if ($endPos === false) { |
|
| 131 | + $endPos = 0; |
|
| 132 | + } |
|
| 133 | + $currentLen += $endPos; |
|
| 134 | + $element = substr($workingText, 0, $currentLen); |
|
| 135 | + $temp = strtolower(substr($element, 0, 3)); |
|
| 136 | + if (strlen($element) < 7 && $temp == '<br') { |
|
| 137 | + if ($numberState) { |
|
| 138 | + $numberState = false; |
|
| 139 | + if (self::$currentState == 'RTL') { |
|
| 140 | + self::$waitingText .= WT_UTF8_PDF; |
|
| 142 | 141 | } |
| 143 | - self::breakCurrentSpan($result); |
|
| 144 | - } elseif (self::$waitingText == '') { |
|
| 145 | - $result .= $element; |
|
| 146 | - } else { |
|
| 147 | - self::$waitingText .= $element; |
|
| 148 | 142 | } |
| 149 | - $workingText = substr($workingText, $currentLen); |
|
| 150 | - break; |
|
| 151 | - case '&': |
|
| 152 | - // Assume this '&' starts an HTML entity |
|
| 153 | - $endPos = strpos($workingText, ';'); // look for the terminating ';' |
|
| 143 | + self::breakCurrentSpan($result); |
|
| 144 | + } elseif (self::$waitingText == '') { |
|
| 145 | + $result .= $element; |
|
| 146 | + } else { |
|
| 147 | + self::$waitingText .= $element; |
|
| 148 | + } |
|
| 149 | + $workingText = substr($workingText, $currentLen); |
|
| 150 | + break; |
|
| 151 | + case '&': |
|
| 152 | + // Assume this '&' starts an HTML entity |
|
| 153 | + $endPos = strpos($workingText, ';'); // look for the terminating ';' |
|
| 154 | + if ($endPos === false) { |
|
| 155 | + $endPos = 0; |
|
| 156 | + } |
|
| 157 | + $currentLen += $endPos; |
|
| 158 | + $entity = substr($workingText, 0, $currentLen); |
|
| 159 | + if (strtolower($entity) == ' ') { |
|
| 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 '}}' |
|
| 154 | 173 | if ($endPos === false) { |
| 155 | 174 | $endPos = 0; |
| 156 | 175 | } |
| 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); |
|
| 176 | + $currentLen = $endPos + 2; |
|
| 177 | + $directive = substr($workingText, 0, $currentLen); |
|
| 178 | + $workingText = substr($workingText, $currentLen); |
|
| 179 | + $result = $result . self::$waitingText . $directive; |
|
| 180 | + self::$waitingText = ''; |
|
| 168 | 181 | break; |
| 169 | - case '{': |
|
| 170 | - if (substr($workingText, 1, 1) == '{') { |
|
| 171 | - // Assume this '{{' starts a TCPDF directive |
|
| 172 | - $endPos = strpos($workingText, '}}'); // look for the terminating '}}' |
|
| 173 | - if ($endPos === false) { |
|
| 174 | - $endPos = 0; |
|
| 182 | + } |
|
| 183 | + default: |
|
| 184 | + // Look for strings of numbers with optional leading or trailing + or - |
|
| 185 | + // and with optional embedded numeric punctuation |
|
| 186 | + if ($numberState) { |
|
| 187 | + // If we're inside a numeric string, look for reasons to end it |
|
| 188 | + $offset = 0; // Be sure to look at the current character first |
|
| 189 | + $charArray = self::getChar($workingText . "\n", $offset); |
|
| 190 | + if (strpos(self::NUMBERS, $charArray['letter']) === false) { |
|
| 191 | + // This is not a digit. Is it numeric punctuation? |
|
| 192 | + if (substr($workingText . "\n", $offset, 6) == ' ') { |
|
| 193 | + $offset += 6; // This could be numeric punctuation |
|
| 194 | + } elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) { |
|
| 195 | + $offset += $charArray['length']; // This could be numeric punctuation |
|
| 175 | 196 | } |
| 176 | - $currentLen = $endPos + 2; |
|
| 177 | - $directive = substr($workingText, 0, $currentLen); |
|
| 178 | - $workingText = substr($workingText, $currentLen); |
|
| 179 | - $result = $result . self::$waitingText . $directive; |
|
| 180 | - self::$waitingText = ''; |
|
| 181 | - break; |
|
| 182 | - } |
|
| 183 | - default: |
|
| 184 | - // Look for strings of numbers with optional leading or trailing + or - |
|
| 185 | - // and with optional embedded numeric punctuation |
|
| 186 | - if ($numberState) { |
|
| 187 | - // If we're inside a numeric string, look for reasons to end it |
|
| 188 | - $offset = 0; // Be sure to look at the current character first |
|
| 197 | + // If the next character is a digit, the current character is numeric punctuation |
|
| 189 | 198 | $charArray = self::getChar($workingText . "\n", $offset); |
| 190 | 199 | if (strpos(self::NUMBERS, $charArray['letter']) === false) { |
| 191 | - // This is not a digit. Is it numeric punctuation? |
|
| 192 | - if (substr($workingText . "\n", $offset, 6) == ' ') { |
|
| 193 | - $offset += 6; // This could be numeric punctuation |
|
| 194 | - } elseif (strpos(self::NUMBER_PUNCTUATION, $charArray['letter']) !== false) { |
|
| 195 | - $offset += $charArray['length']; // This could be numeric punctuation |
|
| 196 | - } |
|
| 197 | - // If the next character is a digit, the current character is numeric punctuation |
|
| 198 | - $charArray = self::getChar($workingText . "\n", $offset); |
|
| 199 | - if (strpos(self::NUMBERS, $charArray['letter']) === false) { |
|
| 200 | - // This is not a digit. End the run of digits and punctuation. |
|
| 201 | - $numberState = false; |
|
| 202 | - if (self::$currentState == 'RTL') { |
|
| 203 | - if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) { |
|
| 204 | - $currentLetter = WT_UTF8_PDF . $currentLetter; |
|
| 205 | - } else { |
|
| 206 | - $currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run |
|
| 207 | - } |
|
| 200 | + // This is not a digit. End the run of digits and punctuation. |
|
| 201 | + $numberState = false; |
|
| 202 | + if (self::$currentState == 'RTL') { |
|
| 203 | + if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) { |
|
| 204 | + $currentLetter = WT_UTF8_PDF . $currentLetter; |
|
| 205 | + } else { |
|
| 206 | + $currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run |
|
| 208 | 207 | } |
| 209 | 208 | } |
| 210 | 209 | } |
| 211 | - } else { |
|
| 212 | - // If we're outside a numeric string, look for reasons to start it |
|
| 213 | - if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) { |
|
| 214 | - // This might be a number lead-in |
|
| 215 | - $offset = $currentLen; |
|
| 216 | - $nextChar = substr($workingText . "\n", $offset, 1); |
|
| 217 | - if (strpos(self::NUMBERS, $nextChar) !== false) { |
|
| 218 | - $numberState = true; // We found a digit: the lead-in is therefore numeric |
|
| 219 | - if (self::$currentState == 'RTL') { |
|
| 220 | - $currentLetter = WT_UTF8_LRE . $currentLetter; |
|
| 221 | - } |
|
| 222 | - } |
|
| 223 | - } elseif (strpos(self::NUMBERS, $currentLetter) !== false) { |
|
| 224 | - $numberState = true; // The current letter is a digit |
|
| 210 | + } |
|
| 211 | + } else { |
|
| 212 | + // If we're outside a numeric string, look for reasons to start it |
|
| 213 | + if (strpos(self::NUMBER_PREFIX, $currentLetter) !== false) { |
|
| 214 | + // This might be a number lead-in |
|
| 215 | + $offset = $currentLen; |
|
| 216 | + $nextChar = substr($workingText . "\n", $offset, 1); |
|
| 217 | + if (strpos(self::NUMBERS, $nextChar) !== false) { |
|
| 218 | + $numberState = true; // We found a digit: the lead-in is therefore numeric |
|
| 225 | 219 | if (self::$currentState == 'RTL') { |
| 226 | 220 | $currentLetter = WT_UTF8_LRE . $currentLetter; |
| 227 | 221 | } |
| 228 | 222 | } |
| 223 | + } elseif (strpos(self::NUMBERS, $currentLetter) !== false) { |
|
| 224 | + $numberState = true; // The current letter is a digit |
|
| 225 | + if (self::$currentState == 'RTL') { |
|
| 226 | + $currentLetter = WT_UTF8_LRE . $currentLetter; |
|
| 227 | + } |
|
| 229 | 228 | } |
| 229 | + } |
|
| 230 | + |
|
| 231 | + // Determine the directionality of the current UTF-8 character |
|
| 232 | + $newState = self::$currentState; |
|
| 233 | + while (true) { |
|
| 234 | + if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') { |
|
| 235 | + if (self::$currentState == '') { |
|
| 236 | + $newState = 'RTL'; |
|
| 237 | + break; |
|
| 238 | + } |
|
| 230 | 239 | |
| 231 | - // Determine the directionality of the current UTF-8 character |
|
| 232 | - $newState = self::$currentState; |
|
| 233 | - while (true) { |
|
| 234 | - if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') { |
|
| 235 | - if (self::$currentState == '') { |
|
| 240 | + if (self::$currentState == 'RTL') { |
|
| 241 | + break; |
|
| 242 | + } |
|
| 243 | + // Switch to RTL only if this isn't a solitary RTL letter |
|
| 244 | + $tempText = substr($workingText, $currentLen); |
|
| 245 | + while ($tempText != '') { |
|
| 246 | + $nextCharArray = self::getChar($tempText, 0); |
|
| 247 | + $nextLetter = $nextCharArray['letter']; |
|
| 248 | + $nextLen = $nextCharArray['length']; |
|
| 249 | + $tempText = substr($tempText, $nextLen); |
|
| 250 | + |
|
| 251 | + if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') { |
|
| 236 | 252 | $newState = 'RTL'; |
| 237 | - break; |
|
| 253 | + break 2; |
|
| 238 | 254 | } |
| 239 | 255 | |
| 240 | - if (self::$currentState == 'RTL') { |
|
| 241 | - break; |
|
| 256 | + if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) { |
|
| 257 | + $newState = 'RTL'; |
|
| 258 | + break 2; |
|
| 242 | 259 | } |
| 243 | - // Switch to RTL only if this isn't a solitary RTL letter |
|
| 244 | - $tempText = substr($workingText, $currentLen); |
|
| 245 | - while ($tempText != '') { |
|
| 246 | - $nextCharArray = self::getChar($tempText, 0); |
|
| 247 | - $nextLetter = $nextCharArray['letter']; |
|
| 248 | - $nextLen = $nextCharArray['length']; |
|
| 249 | - $tempText = substr($tempText, $nextLen); |
|
| 250 | - |
|
| 251 | - if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') { |
|
| 252 | - $newState = 'RTL'; |
|
| 253 | - break 2; |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) { |
|
| 257 | - $newState = 'RTL'; |
|
| 258 | - break 2; |
|
| 259 | - } |
|
| 260 | 260 | |
| 261 | - if ($nextLetter === ' ') { |
|
| 262 | - break; |
|
| 263 | - } |
|
| 264 | - $nextLetter .= substr($tempText . "\n", 0, 5); |
|
| 265 | - if ($nextLetter === ' ') { |
|
| 266 | - break; |
|
| 267 | - } |
|
| 268 | - } |
|
| 269 | - // This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality |
|
| 270 | - $currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF; |
|
| 271 | - $newState = 'LTR'; |
|
| 272 | - break; |
|
| 273 | - } |
|
| 274 | - if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) { |
|
| 275 | - // Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR |
|
| 276 | - $newState = 'LTR'; |
|
| 277 | - break; |
|
| 278 | - } |
|
| 279 | - if ($closeParIndex !== false) { |
|
| 280 | - // This closing parenthesis has to inherit the matching opening parenthesis' directionality |
|
| 281 | - if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') { |
|
| 282 | - $newState = $openParDirection[$closeParIndex]; |
|
| 261 | + if ($nextLetter === ' ') { |
|
| 262 | + break; |
|
| 283 | 263 | } |
| 284 | - $openParDirection[$closeParIndex] = ''; |
|
| 285 | - break; |
|
| 286 | - } |
|
| 287 | - if ($openParIndex !== false) { |
|
| 288 | - // Opening parentheses always inherit the following directionality |
|
| 289 | - self::$waitingText .= $currentLetter; |
|
| 290 | - $workingText = substr($workingText, $currentLen); |
|
| 291 | - while (true) { |
|
| 292 | - if ($workingText === '') { |
|
| 293 | - break; |
|
| 294 | - } |
|
| 295 | - if (substr($workingText, 0, 1) === ' ') { |
|
| 296 | - // Spaces following this left parenthesis inherit the following directionality too |
|
| 297 | - self::$waitingText .= ' '; |
|
| 298 | - $workingText = substr($workingText, 1); |
|
| 299 | - continue; |
|
| 300 | - } |
|
| 301 | - if (substr($workingText, 0, 6) === ' ') { |
|
| 302 | - // Spaces following this left parenthesis inherit the following directionality too |
|
| 303 | - self::$waitingText .= ' '; |
|
| 304 | - $workingText = substr($workingText, 6); |
|
| 305 | - continue; |
|
| 306 | - } |
|
| 264 | + $nextLetter .= substr($tempText . "\n", 0, 5); |
|
| 265 | + if ($nextLetter === ' ') { |
|
| 307 | 266 | break; |
| 308 | 267 | } |
| 309 | - $openParDirection[$openParIndex] = '?'; |
|
| 310 | - break 2; // double break because we're waiting for more information |
|
| 311 | 268 | } |
| 312 | - |
|
| 313 | - // We have a digit or a "normal" special character. |
|
| 314 | - // |
|
| 315 | - // When this character is not at the start of the input string, it inherits the preceding directionality; |
|
| 316 | - // at the start of the input string, it assumes the following directionality. |
|
| 317 | - // |
|
| 318 | - // Exceptions to this rule will be handled later during final clean-up. |
|
| 319 | - // |
|
| 269 | + // This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality |
|
| 270 | + $currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF; |
|
| 271 | + $newState = 'LTR'; |
|
| 272 | + break; |
|
| 273 | + } |
|
| 274 | + if (($currentLen != 1) || ($currentLetter >= 'A' && $currentLetter <= 'Z') || ($currentLetter >= 'a' && $currentLetter <= 'z')) { |
|
| 275 | + // Since it’s neither Hebrew nor Arabic, this UTF-8 character or ASCII letter must be LTR |
|
| 276 | + $newState = 'LTR'; |
|
| 277 | + break; |
|
| 278 | + } |
|
| 279 | + if ($closeParIndex !== false) { |
|
| 280 | + // This closing parenthesis has to inherit the matching opening parenthesis' directionality |
|
| 281 | + if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] != '?') { |
|
| 282 | + $newState = $openParDirection[$closeParIndex]; |
|
| 283 | + } |
|
| 284 | + $openParDirection[$closeParIndex] = ''; |
|
| 285 | + break; |
|
| 286 | + } |
|
| 287 | + if ($openParIndex !== false) { |
|
| 288 | + // Opening parentheses always inherit the following directionality |
|
| 320 | 289 | self::$waitingText .= $currentLetter; |
| 321 | 290 | $workingText = substr($workingText, $currentLen); |
| 322 | - if (self::$currentState != '') { |
|
| 323 | - $result .= self::$waitingText; |
|
| 324 | - self::$waitingText = ''; |
|
| 291 | + while (true) { |
|
| 292 | + if ($workingText === '') { |
|
| 293 | + break; |
|
| 294 | + } |
|
| 295 | + if (substr($workingText, 0, 1) === ' ') { |
|
| 296 | + // Spaces following this left parenthesis inherit the following directionality too |
|
| 297 | + self::$waitingText .= ' '; |
|
| 298 | + $workingText = substr($workingText, 1); |
|
| 299 | + continue; |
|
| 300 | + } |
|
| 301 | + if (substr($workingText, 0, 6) === ' ') { |
|
| 302 | + // Spaces following this left parenthesis inherit the following directionality too |
|
| 303 | + self::$waitingText .= ' '; |
|
| 304 | + $workingText = substr($workingText, 6); |
|
| 305 | + continue; |
|
| 306 | + } |
|
| 307 | + break; |
|
| 325 | 308 | } |
| 309 | + $openParDirection[$openParIndex] = '?'; |
|
| 326 | 310 | break 2; // double break because we're waiting for more information |
| 327 | 311 | } |
| 328 | - if ($newState != self::$currentState) { |
|
| 329 | - // A direction change has occurred |
|
| 330 | - self::finishCurrentSpan($result, false); |
|
| 331 | - self::$previousState = self::$currentState; |
|
| 332 | - self::$currentState = $newState; |
|
| 333 | - self::beginCurrentSpan($result); |
|
| 334 | - } |
|
| 312 | + |
|
| 313 | + // We have a digit or a "normal" special character. |
|
| 314 | + // |
|
| 315 | + // When this character is not at the start of the input string, it inherits the preceding directionality; |
|
| 316 | + // at the start of the input string, it assumes the following directionality. |
|
| 317 | + // |
|
| 318 | + // Exceptions to this rule will be handled later during final clean-up. |
|
| 319 | + // |
|
| 335 | 320 | self::$waitingText .= $currentLetter; |
| 336 | 321 | $workingText = substr($workingText, $currentLen); |
| 337 | - $result .= self::$waitingText; |
|
| 338 | - self::$waitingText = ''; |
|
| 322 | + if (self::$currentState != '') { |
|
| 323 | + $result .= self::$waitingText; |
|
| 324 | + self::$waitingText = ''; |
|
| 325 | + } |
|
| 326 | + break 2; // double break because we're waiting for more information |
|
| 327 | + } |
|
| 328 | + if ($newState != self::$currentState) { |
|
| 329 | + // A direction change has occurred |
|
| 330 | + self::finishCurrentSpan($result, false); |
|
| 331 | + self::$previousState = self::$currentState; |
|
| 332 | + self::$currentState = $newState; |
|
| 333 | + self::beginCurrentSpan($result); |
|
| 334 | + } |
|
| 335 | + self::$waitingText .= $currentLetter; |
|
| 336 | + $workingText = substr($workingText, $currentLen); |
|
| 337 | + $result .= self::$waitingText; |
|
| 338 | + self::$waitingText = ''; |
|
| 339 | 339 | |
| 340 | - foreach ($openParDirection as $index => $value) { |
|
| 341 | - // Since we now know the proper direction, remember it for all waiting opening parentheses |
|
| 342 | - if ($value === '?') { |
|
| 343 | - $openParDirection[$index] = self::$currentState; |
|
| 344 | - } |
|
| 340 | + foreach ($openParDirection as $index => $value) { |
|
| 341 | + // Since we now know the proper direction, remember it for all waiting opening parentheses |
|
| 342 | + if ($value === '?') { |
|
| 343 | + $openParDirection[$index] = self::$currentState; |
|
| 345 | 344 | } |
| 345 | + } |
|
| 346 | 346 | |
| 347 | - break; |
|
| 347 | + break; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
@@ -461,34 +461,34 @@ discard block |
||
| 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 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees: online genealogy |
|
| 4 | - * Copyright (C) 2016 webtrees development team |
|
| 5 | - * This program is free software: you can redistribute it and/or modify |
|
| 6 | - * it under the terms of the GNU General Public License as published by |
|
| 7 | - * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | - * (at your option) any later version. |
|
| 9 | - * This program is distributed in the hope that it will be useful, |
|
| 10 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | - * GNU General Public License for more details. |
|
| 13 | - * You should have received a copy of the GNU General Public License |
|
| 14 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | - */ |
|
| 3 | + * webtrees: online genealogy |
|
| 4 | + * Copyright (C) 2016 webtrees development team |
|
| 5 | + * This program is free software: you can redistribute it and/or modify |
|
| 6 | + * it under the terms of the GNU General Public License as published by |
|
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
|
| 8 | + * (at your option) any later version. |
|
| 9 | + * This program is distributed in the hope that it will be useful, |
|
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 | + * GNU General Public License for more details. |
|
| 13 | + * You should have received a copy of the GNU General Public License |
|
| 14 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 | + */ |
|
| 16 | 16 | namespace Fisharebest\Webtrees; |
| 17 | 17 | |
| 18 | 18 | use Fisharebest\Webtrees\Theme\AdministrationTheme; |