@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class BatchUpdateSearchReplacePlugin Batch Update plugin: search/replace |
24 | 24 | */ |
25 | -class BatchUpdateSearchReplacePlugin extends BatchUpdateBasePlugin { |
|
25 | +class BatchUpdateSearchReplacePlugin extends BatchUpdateBasePlugin |
|
26 | +{ |
|
26 | 27 | /** @var string Search string */ |
27 | 28 | private $search; |
28 | 29 | |
@@ -46,7 +47,8 @@ discard block |
||
46 | 47 | * |
47 | 48 | * @return string |
48 | 49 | */ |
49 | - public function getName() { |
|
50 | + public function getName() |
|
51 | + { |
|
50 | 52 | return I18N::translate('Search and replace'); |
51 | 53 | } |
52 | 54 | |
@@ -55,7 +57,8 @@ discard block |
||
55 | 57 | * |
56 | 58 | * @return string |
57 | 59 | */ |
58 | - public function getDescription() { |
|
60 | + public function getDescription() |
|
61 | + { |
|
59 | 62 | return /* I18N: Description of the “Search and replace” option of the batch update module */ I18N::translate('Search and replace text, using simple searches or advanced pattern matching.'); |
60 | 63 | } |
61 | 64 | |
@@ -64,7 +67,8 @@ discard block |
||
64 | 67 | * |
65 | 68 | * @return string[] |
66 | 69 | */ |
67 | - public function getRecordTypesToUpdate() { |
|
70 | + public function getRecordTypesToUpdate() |
|
71 | + { |
|
68 | 72 | return array('INDI', 'FAM', 'SOUR', 'REPO', 'NOTE', 'OBJE'); |
69 | 73 | } |
70 | 74 | |
@@ -76,7 +80,8 @@ discard block |
||
76 | 80 | * |
77 | 81 | * @return bool |
78 | 82 | */ |
79 | - public function doesRecordNeedUpdate($xref, $gedrec) { |
|
83 | + public function doesRecordNeedUpdate($xref, $gedrec) |
|
84 | + { |
|
80 | 85 | return !$this->error && preg_match('/(?:' . $this->regex . ')/mu' . $this->case, $gedrec); |
81 | 86 | } |
82 | 87 | |
@@ -88,7 +93,8 @@ discard block |
||
88 | 93 | * |
89 | 94 | * @return string |
90 | 95 | */ |
91 | - public function updateRecord($xref, $gedrec) { |
|
96 | + public function updateRecord($xref, $gedrec) |
|
97 | + { |
|
92 | 98 | // Allow "\n" to indicate a line-feed in replacement text. |
93 | 99 | // Back-references such as $1, $2 are handled automatically. |
94 | 100 | return preg_replace('/' . $this->regex . '/mu' . $this->case, str_replace('\n', "\n", $this->replace), $gedrec); |
@@ -97,7 +103,8 @@ discard block |
||
97 | 103 | /** |
98 | 104 | * Process the user-supplied options. |
99 | 105 | */ |
100 | - public function getOptions() { |
|
106 | + public function getOptions() |
|
107 | + { |
|
101 | 108 | parent::getOptions(); |
102 | 109 | $this->search = Filter::get('search'); |
103 | 110 | $this->replace = Filter::get('replace'); |
@@ -134,7 +141,8 @@ discard block |
||
134 | 141 | * |
135 | 142 | * @return string |
136 | 143 | */ |
137 | - public function getOptionsForm() { |
|
144 | + public function getOptionsForm() |
|
145 | + { |
|
138 | 146 | $descriptions = array( |
139 | 147 | 'exact' => I18N::translate('Match the exact text, even if it occurs in the middle of a word.'), |
140 | 148 | 'words' => I18N::translate('Match the exact text, unless it occurs in the middle of a word.'), |
@@ -20,13 +20,15 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Class BatchUpdateDuplicateLinksPlugin Batch Update plugin: remove duplicate links in records |
22 | 22 | */ |
23 | -class BatchUpdateDuplicateLinksPlugin extends BatchUpdateBasePlugin { |
|
23 | +class BatchUpdateDuplicateLinksPlugin extends BatchUpdateBasePlugin |
|
24 | +{ |
|
24 | 25 | /** |
25 | 26 | * User-friendly name for this plugin. |
26 | 27 | * |
27 | 28 | * @return string |
28 | 29 | */ |
29 | - public function getName() { |
|
30 | + public function getName() |
|
31 | + { |
|
30 | 32 | return I18N::translate('Remove duplicate links'); |
31 | 33 | } |
32 | 34 | |
@@ -35,7 +37,8 @@ discard block |
||
35 | 37 | * |
36 | 38 | * @return string |
37 | 39 | */ |
38 | - public function getDescription() { |
|
40 | + public function getDescription() |
|
41 | + { |
|
39 | 42 | return I18N::translate('A common error is to have multiple links to the same record, for example listing the same child more than once in a family record.'); |
40 | 43 | } |
41 | 44 | |
@@ -44,7 +47,8 @@ discard block |
||
44 | 47 | * |
45 | 48 | * @return string[] |
46 | 49 | */ |
47 | - public function getRecordTypesToUpdate() { |
|
50 | + public function getRecordTypesToUpdate() |
|
51 | + { |
|
48 | 52 | return array('INDI', 'FAM', 'SOUR', 'REPO', 'NOTE', 'OBJE'); |
49 | 53 | } |
50 | 54 | |
@@ -56,7 +60,8 @@ discard block |
||
56 | 60 | * |
57 | 61 | * @return bool |
58 | 62 | */ |
59 | - public function doesRecordNeedUpdate($xref, $gedrec) { |
|
63 | + public function doesRecordNeedUpdate($xref, $gedrec) |
|
64 | + { |
|
60 | 65 | return |
61 | 66 | preg_match('/(\n1.*@.+@.*(?:(?:\n[2-9].*)*))(?:\n1.*(?:\n[2-9].*)*)*\1/', $gedrec) || |
62 | 67 | preg_match('/(\n2.*@.+@.*(?:(?:\n[3-9].*)*))(?:\n2.*(?:\n[3-9].*)*)*\1/', $gedrec) || |
@@ -71,7 +76,8 @@ discard block |
||
71 | 76 | * |
72 | 77 | * @return string |
73 | 78 | */ |
74 | - public function updateRecord($xref, $gedrec) { |
|
79 | + public function updateRecord($xref, $gedrec) |
|
80 | + { |
|
75 | 81 | return preg_replace( |
76 | 82 | array( |
77 | 83 | '/(\n1.*@.+@.*(?:(?:\n[2-9].*)*))((?:\n1.*(?:\n[2-9].*)*)*\1)/', |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | * bool doesRecordNeedUpdate($xref, $gedrec) |
32 | 32 | * string updateRecord($xref, $gedrec) |
33 | 33 | */ |
34 | -class BatchUpdateBasePlugin { |
|
34 | +class BatchUpdateBasePlugin |
|
35 | +{ |
|
35 | 36 | /** @var bool User option; update change record */ |
36 | 37 | public $chan = false; |
37 | 38 | |
@@ -40,14 +41,16 @@ discard block |
||
40 | 41 | * |
41 | 42 | * @return string[] |
42 | 43 | */ |
43 | - public function getRecordTypesToUpdate() { |
|
44 | + public function getRecordTypesToUpdate() |
|
45 | + { |
|
44 | 46 | return array('INDI'); |
45 | 47 | } |
46 | 48 | |
47 | 49 | /** |
48 | 50 | * Default option is just the "don't update CHAN record" |
49 | 51 | */ |
50 | - public function getOptions() { |
|
52 | + public function getOptions() |
|
53 | + { |
|
51 | 54 | $this->chan = Filter::getBool('chan'); |
52 | 55 | } |
53 | 56 | |
@@ -56,7 +59,8 @@ discard block |
||
56 | 59 | * |
57 | 60 | * @return string |
58 | 61 | */ |
59 | - public function getOptionsForm() { |
|
62 | + public function getOptionsForm() |
|
63 | + { |
|
60 | 64 | return |
61 | 65 | '<div class="form-group">' . |
62 | 66 | '<label class="control-label col-sm-3">' . I18N::translate('Keep the existing “last change” information') . '</label>' . |
@@ -72,7 +76,8 @@ discard block |
||
72 | 76 | * |
73 | 77 | * @return string[] |
74 | 78 | */ |
75 | - public function getActionButtons($xref) { |
|
79 | + public function getActionButtons($xref) |
|
80 | + { |
|
76 | 81 | if (Auth::user()->getPreference('auto_accept')) { |
77 | 82 | return array( |
78 | 83 | BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'), |
@@ -92,7 +97,8 @@ discard block |
||
92 | 97 | * |
93 | 98 | * @return string |
94 | 99 | */ |
95 | - public function getActionPreview(GedcomRecord $record) { |
|
100 | + public function getActionPreview(GedcomRecord $record) |
|
101 | + { |
|
96 | 102 | $old_lines = preg_split('/[\n]+/', $record->getGedcom()); |
97 | 103 | $new_lines = preg_split('/[\n]+/', $this->updateRecord($record->getXref(), $record->getGedcom())); |
98 | 104 | $algorithm = new MyersDiff; |
@@ -122,7 +128,8 @@ discard block |
||
122 | 128 | * |
123 | 129 | * @return string |
124 | 130 | */ |
125 | - public static function decorateInsertedText($text) { |
|
131 | + public static function decorateInsertedText($text) |
|
132 | + { |
|
126 | 133 | return '<ins>' . $text . '</ins>'; |
127 | 134 | } |
128 | 135 | |
@@ -133,7 +140,8 @@ discard block |
||
133 | 140 | * |
134 | 141 | * @return string |
135 | 142 | */ |
136 | - public static function decorateDeletedText($text) { |
|
143 | + public static function decorateDeletedText($text) |
|
144 | + { |
|
137 | 145 | return '<del>' . $text . '</del>'; |
138 | 146 | } |
139 | 147 | |
@@ -144,7 +152,8 @@ discard block |
||
144 | 152 | * |
145 | 153 | * @return string |
146 | 154 | */ |
147 | - public static function createEditLinks($gedrec) { |
|
155 | + public static function createEditLinks($gedrec) |
|
156 | + { |
|
148 | 157 | return preg_replace( |
149 | 158 | "/@([^#@\n]+)@/m", |
150 | 159 | '<a href="#" onclick="return edit_raw(\'\\1\');">@\\1@</a>', |
@@ -21,13 +21,15 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Class BatchUpdateMissingDeathPlugin Batch Update plugin: add missing 1 BIRT/DEAT Y |
23 | 23 | */ |
24 | -class BatchUpdateMissingDeathPlugin extends BatchUpdateBasePlugin { |
|
24 | +class BatchUpdateMissingDeathPlugin extends BatchUpdateBasePlugin |
|
25 | +{ |
|
25 | 26 | /** |
26 | 27 | * User-friendly name for this plugin. |
27 | 28 | * |
28 | 29 | * @return string |
29 | 30 | */ |
30 | - public function getName() { |
|
31 | + public function getName() |
|
32 | + { |
|
31 | 33 | return I18N::translate('Add missing death records'); |
32 | 34 | } |
33 | 35 | |
@@ -36,7 +38,8 @@ discard block |
||
36 | 38 | * |
37 | 39 | * @return string |
38 | 40 | */ |
39 | - public function getDescription() { |
|
41 | + public function getDescription() |
|
42 | + { |
|
40 | 43 | return I18N::translate('You can speed up the privacy calculations by adding a death record to individuals whose death can be inferred from other dates, but who do not have a record of death, burial, cremation, etc.'); |
41 | 44 | } |
42 | 45 | |
@@ -48,7 +51,8 @@ discard block |
||
48 | 51 | * |
49 | 52 | * @return bool |
50 | 53 | */ |
51 | - public function doesRecordNeedUpdate($xref, $gedrec) { |
|
54 | + public function doesRecordNeedUpdate($xref, $gedrec) |
|
55 | + { |
|
52 | 56 | global $WT_TREE; |
53 | 57 | |
54 | 58 | return !preg_match('/\n1 (' . WT_EVENTS_DEAT . ')/', $gedrec) && Individual::getInstance($xref, $WT_TREE)->isDead(); |
@@ -62,7 +66,8 @@ discard block |
||
62 | 66 | * |
63 | 67 | * @return string |
64 | 68 | */ |
65 | - public function updateRecord($xref, $gedrec) { |
|
69 | + public function updateRecord($xref, $gedrec) |
|
70 | + { |
|
66 | 71 | return $gedrec . "\n1 DEAT Y"; |
67 | 72 | } |
68 | 73 | } |
@@ -23,13 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class HourglassChartModule |
25 | 25 | */ |
26 | -class HourglassChartModule extends AbstractModule implements ModuleChartInterface { |
|
26 | +class HourglassChartModule extends AbstractModule implements ModuleChartInterface |
|
27 | +{ |
|
27 | 28 | /** |
28 | 29 | * How should this module be labelled on tabs, menus, etc.? |
29 | 30 | * |
30 | 31 | * @return string |
31 | 32 | */ |
32 | - public function getTitle() { |
|
33 | + public function getTitle() |
|
34 | + { |
|
33 | 35 | return /* I18N: Name of a module/chart */ I18N::translate('Hourglass chart'); |
34 | 36 | } |
35 | 37 | |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | * |
39 | 41 | * @return string |
40 | 42 | */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “HourglassChart” module */ I18N::translate('An hourglass chart of an individual’s ancestors and descendants.'); |
43 | 46 | } |
44 | 47 | |
@@ -49,7 +52,8 @@ discard block |
||
49 | 52 | * |
50 | 53 | * @return int |
51 | 54 | */ |
52 | - public function defaultAccessLevel() { |
|
55 | + public function defaultAccessLevel() |
|
56 | + { |
|
53 | 57 | return Auth::PRIV_PRIVATE; |
54 | 58 | } |
55 | 59 | |
@@ -58,7 +62,8 @@ discard block |
||
58 | 62 | * |
59 | 63 | * @return Menu|null |
60 | 64 | */ |
61 | - public function getChartMenu(Individual $individual) { |
|
65 | + public function getChartMenu(Individual $individual) |
|
66 | + { |
|
62 | 67 | return new Menu( |
63 | 68 | $this->getTitle(), |
64 | 69 | 'hourglass.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
@@ -72,7 +77,8 @@ discard block |
||
72 | 77 | * |
73 | 78 | * @return Menu|null |
74 | 79 | */ |
75 | - public function getBoxChartMenu(Individual $individual) { |
|
80 | + public function getBoxChartMenu(Individual $individual) |
|
81 | + { |
|
76 | 82 | return $this->getChartMenu($individual); |
77 | 83 | } |
78 | 84 | } |
@@ -30,14 +30,17 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Class HtmlBlockModule |
32 | 32 | */ |
33 | -class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { |
|
33 | +class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface |
|
34 | +{ |
|
34 | 35 | /** {@inheritdoc} */ |
35 | - public function getTitle() { |
|
36 | + public function getTitle() |
|
37 | + { |
|
36 | 38 | return /* I18N: Name of a module */ I18N::translate('HTML'); |
37 | 39 | } |
38 | 40 | |
39 | 41 | /** {@inheritdoc} */ |
40 | - public function getDescription() { |
|
42 | + public function getDescription() |
|
43 | + { |
|
41 | 44 | return /* I18N: Description of the “HTML” module */ I18N::translate('Add your own text and graphics.'); |
42 | 45 | } |
43 | 46 | |
@@ -50,7 +53,8 @@ discard block |
||
50 | 53 | * |
51 | 54 | * @return string |
52 | 55 | */ |
53 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
56 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
57 | + { |
|
54 | 58 | global $ctype, $WT_TREE; |
55 | 59 | |
56 | 60 | $title = $this->getBlockSetting($block_id, 'title'); |
@@ -120,17 +124,20 @@ discard block |
||
120 | 124 | } |
121 | 125 | |
122 | 126 | /** {@inheritdoc} */ |
123 | - public function loadAjax() { |
|
127 | + public function loadAjax() |
|
128 | + { |
|
124 | 129 | return false; |
125 | 130 | } |
126 | 131 | |
127 | 132 | /** {@inheritdoc} */ |
128 | - public function isUserBlock() { |
|
133 | + public function isUserBlock() |
|
134 | + { |
|
129 | 135 | return true; |
130 | 136 | } |
131 | 137 | |
132 | 138 | /** {@inheritdoc} */ |
133 | - public function isGedcomBlock() { |
|
139 | + public function isGedcomBlock() |
|
140 | + { |
|
134 | 141 | return true; |
135 | 142 | } |
136 | 143 | |
@@ -139,7 +146,8 @@ discard block |
||
139 | 146 | * |
140 | 147 | * @param int $block_id |
141 | 148 | */ |
142 | - public function configureBlock($block_id) { |
|
149 | + public function configureBlock($block_id) |
|
150 | + { |
|
143 | 151 | global $WT_TREE; |
144 | 152 | |
145 | 153 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class ChangeReportModule |
24 | 24 | */ |
25 | -class ChangeReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class ChangeReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a module/report */ I18N::translate('Changes'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Changes” module */ I18N::translate('A report of recent and pending changes.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_USER; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -25,39 +25,46 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Class NotesTabModule |
27 | 27 | */ |
28 | -class NotesTabModule extends AbstractModule implements ModuleTabInterface { |
|
28 | +class NotesTabModule extends AbstractModule implements ModuleTabInterface |
|
29 | +{ |
|
29 | 30 | /** @var Fact[] A list facts for this note. */ |
30 | 31 | private $facts; |
31 | 32 | |
32 | 33 | /** {@inheritdoc} */ |
33 | - public function getTitle() { |
|
34 | + public function getTitle() |
|
35 | + { |
|
34 | 36 | return /* I18N: Name of a module */ I18N::translate('Notes'); |
35 | 37 | } |
36 | 38 | |
37 | 39 | /** {@inheritdoc} */ |
38 | - public function getDescription() { |
|
40 | + public function getDescription() |
|
41 | + { |
|
39 | 42 | return /* I18N: Description of the “Notes” module */ I18N::translate('A tab showing the notes attached to an individual.'); |
40 | 43 | } |
41 | 44 | |
42 | 45 | /** {@inheritdoc} */ |
43 | - public function defaultTabOrder() { |
|
46 | + public function defaultTabOrder() |
|
47 | + { |
|
44 | 48 | return 40; |
45 | 49 | } |
46 | 50 | |
47 | 51 | /** {@inheritdoc} */ |
48 | - public function hasTabContent() { |
|
52 | + public function hasTabContent() |
|
53 | + { |
|
49 | 54 | global $WT_TREE; |
50 | 55 | |
51 | 56 | return Auth::isEditor($WT_TREE) || $this->getFactsWithNotes(); |
52 | 57 | } |
53 | 58 | |
54 | 59 | /** {@inheritdoc} */ |
55 | - public function isGrayedOut() { |
|
60 | + public function isGrayedOut() |
|
61 | + { |
|
56 | 62 | return !$this->getFactsWithNotes(); |
57 | 63 | } |
58 | 64 | |
59 | 65 | /** {@inheritdoc} */ |
60 | - public function getTabContent() { |
|
66 | + public function getTabContent() |
|
67 | + { |
|
61 | 68 | global $controller; |
62 | 69 | |
63 | 70 | ob_start(); |
@@ -130,7 +137,8 @@ discard block |
||
130 | 137 | * |
131 | 138 | * @return Fact[] |
132 | 139 | */ |
133 | - private function getFactsWithNotes() { |
|
140 | + private function getFactsWithNotes() |
|
141 | + { |
|
134 | 142 | global $controller; |
135 | 143 | |
136 | 144 | if ($this->facts === null) { |
@@ -155,12 +163,14 @@ discard block |
||
155 | 163 | } |
156 | 164 | |
157 | 165 | /** {@inheritdoc} */ |
158 | - public function canLoadAjax() { |
|
166 | + public function canLoadAjax() |
|
167 | + { |
|
159 | 168 | return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
160 | 169 | } |
161 | 170 | |
162 | 171 | /** {@inheritdoc} */ |
163 | - public function getPreLoadContent() { |
|
172 | + public function getPreLoadContent() |
|
173 | + { |
|
164 | 174 | return ''; |
165 | 175 | } |
166 | 176 | } |
@@ -68,12 +68,14 @@ discard block |
||
68 | 68 | private $treesize; |
69 | 69 | |
70 | 70 | /** {@inheritdoc} */ |
71 | - public function getTitle() { |
|
71 | + public function getTitle() |
|
72 | + { |
|
72 | 73 | return /* I18N: The name of a module. Google Maps™ is a trademark. Do not translate it? http://en.wikipedia.org/wiki/Google_maps */ I18N::translate('Google Maps™'); |
73 | 74 | } |
74 | 75 | |
75 | 76 | /** {@inheritdoc} */ |
76 | - public function getDescription() { |
|
77 | + public function getDescription() |
|
78 | + { |
|
77 | 79 | return /* I18N: Description of the “Google Maps™” module */ I18N::translate('Show the location of places and events using the Google Maps™ mapping service.'); |
78 | 80 | } |
79 | 81 | |
@@ -83,7 +85,8 @@ discard block |
||
83 | 85 | * |
84 | 86 | * @param string $mod_action |
85 | 87 | */ |
86 | - public function modAction($mod_action) { |
|
88 | + public function modAction($mod_action) |
|
89 | + { |
|
87 | 90 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
88 | 91 | |
89 | 92 | switch ($mod_action) { |
@@ -115,19 +118,22 @@ discard block |
||
115 | 118 | } |
116 | 119 | |
117 | 120 | /** {@inheritdoc} */ |
118 | - public function getConfigLink() { |
|
121 | + public function getConfigLink() |
|
122 | + { |
|
119 | 123 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
120 | 124 | |
121 | 125 | return 'module.php?mod=' . $this->getName() . '&mod_action=admin_config'; |
122 | 126 | } |
123 | 127 | |
124 | 128 | /** {@inheritdoc} */ |
125 | - public function defaultTabOrder() { |
|
129 | + public function defaultTabOrder() |
|
130 | + { |
|
126 | 131 | return 80; |
127 | 132 | } |
128 | 133 | |
129 | 134 | /** {@inheritdoc} */ |
130 | - public function getPreLoadContent() { |
|
135 | + public function getPreLoadContent() |
|
136 | + { |
|
131 | 137 | global $controller; |
132 | 138 | |
133 | 139 | $controller->addInlineJavascript(" |
@@ -147,12 +153,14 @@ discard block |
||
147 | 153 | } |
148 | 154 | |
149 | 155 | /** {@inheritdoc} */ |
150 | - public function canLoadAjax() { |
|
156 | + public function canLoadAjax() |
|
157 | + { |
|
151 | 158 | return true; |
152 | 159 | } |
153 | 160 | |
154 | 161 | /** {@inheritdoc} */ |
155 | - public function getTabContent() { |
|
162 | + public function getTabContent() |
|
163 | + { |
|
156 | 164 | global $controller; |
157 | 165 | |
158 | 166 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
@@ -189,12 +197,14 @@ discard block |
||
189 | 197 | } |
190 | 198 | |
191 | 199 | /** {@inheritdoc} */ |
192 | - public function hasTabContent() { |
|
200 | + public function hasTabContent() |
|
201 | + { |
|
193 | 202 | return Module::getModuleByName('googlemap') || Auth::isAdmin(); |
194 | 203 | } |
195 | 204 | |
196 | 205 | /** {@inheritdoc} */ |
197 | - public function isGrayedOut() { |
|
206 | + public function isGrayedOut() |
|
207 | + { |
|
198 | 208 | return false; |
199 | 209 | } |
200 | 210 | |
@@ -205,7 +215,8 @@ discard block |
||
205 | 215 | * |
206 | 216 | * @return Menu |
207 | 217 | */ |
208 | - public function getChartMenu(Individual $individual) { |
|
218 | + public function getChartMenu(Individual $individual) |
|
219 | + { |
|
209 | 220 | return new Menu( |
210 | 221 | I18N::translate('Pedigree map'), |
211 | 222 | 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
@@ -221,14 +232,16 @@ discard block |
||
221 | 232 | * |
222 | 233 | * @return Menu |
223 | 234 | */ |
224 | - public function getBoxChartMenu(Individual $individual) { |
|
235 | + public function getBoxChartMenu(Individual $individual) |
|
236 | + { |
|
225 | 237 | return $this->getChartMenu($individual); |
226 | 238 | } |
227 | 239 | |
228 | 240 | /** |
229 | 241 | * A form to edit the module configuration. |
230 | 242 | */ |
231 | - private function config() { |
|
243 | + private function config() |
|
244 | + { |
|
232 | 245 | $controller = new PageController; |
233 | 246 | $controller |
234 | 247 | ->restrictAccess(Auth::isAdmin()) |
@@ -480,7 +493,8 @@ discard block |
||
480 | 493 | * |
481 | 494 | * @return string |
482 | 495 | */ |
483 | - private function googleMapsScript() { |
|
496 | + private function googleMapsScript() |
|
497 | + { |
|
484 | 498 | $key = $this->getSetting('GM_API_KEY'); |
485 | 499 | |
486 | 500 | return 'https://maps.googleapis.com/maps/api/js?v=3&key=' . $key . '&language=' . WT_LOCALE; |
@@ -489,7 +503,8 @@ discard block |
||
489 | 503 | /** |
490 | 504 | * Select a flag. |
491 | 505 | */ |
492 | - private function flags() { |
|
506 | + private function flags() |
|
507 | + { |
|
493 | 508 | global $WT_TREE; |
494 | 509 | |
495 | 510 | $controller = new SimpleController; |
@@ -691,7 +706,8 @@ discard block |
||
691 | 706 | /** |
692 | 707 | * Display a map showing the origins of ones ancestors. |
693 | 708 | */ |
694 | - private function pedigreeMap() { |
|
709 | + private function pedigreeMap() |
|
710 | + { |
|
695 | 711 | global $controller, $WT_TREE; |
696 | 712 | |
697 | 713 | $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); |
@@ -867,7 +883,8 @@ discard block |
||
867 | 883 | * |
868 | 884 | * @return string |
869 | 885 | */ |
870 | - private function pedigreeMapJavascript() { |
|
886 | + private function pedigreeMapJavascript() |
|
887 | + { |
|
871 | 888 | |
872 | 889 | $js = ' |
873 | 890 | // this variable will collect the html which will eventually be placed in the side bar |
@@ -1277,7 +1294,8 @@ discard block |
||
1277 | 1294 | /** |
1278 | 1295 | * Check places for missing data, etc. |
1279 | 1296 | */ |
1280 | - private function adminPlaceCheck() { |
|
1297 | + private function adminPlaceCheck() |
|
1298 | + { |
|
1281 | 1299 | global $WT_TREE; |
1282 | 1300 | |
1283 | 1301 | $gedcom_id = Filter::get('gedcom_id', null, $WT_TREE->getTreeId()); |
@@ -1566,7 +1584,8 @@ discard block |
||
1566 | 1584 | * |
1567 | 1585 | * @return bool |
1568 | 1586 | */ |
1569 | - private function checkMapData(Individual $individual) { |
|
1587 | + private function checkMapData(Individual $individual) |
|
1588 | + { |
|
1570 | 1589 | $statement = Database::prepare( |
1571 | 1590 | "SELECT COUNT(*) FROM `##placelinks` WHERE pl_gid = :xref AND pl_file = :tree_id" |
1572 | 1591 | ); |
@@ -1598,7 +1617,8 @@ discard block |
||
1598 | 1617 | * |
1599 | 1618 | * @return string[] |
1600 | 1619 | */ |
1601 | - private function removePrefixFromPlaceName($prefix_list, $place, $placelist) { |
|
1620 | + private function removePrefixFromPlaceName($prefix_list, $place, $placelist) |
|
1621 | + { |
|
1602 | 1622 | if ($prefix_list) { |
1603 | 1623 | foreach (explode(';', $prefix_list) as $prefix) { |
1604 | 1624 | if ($prefix && substr($place, 0, strlen($prefix) + 1) == $prefix . ' ') { |
@@ -1619,7 +1639,8 @@ discard block |
||
1619 | 1639 | * |
1620 | 1640 | * @return string[] |
1621 | 1641 | */ |
1622 | - private function removeSuffixFromPlaceName($suffix_list, $place, $placelist) { |
|
1642 | + private function removeSuffixFromPlaceName($suffix_list, $place, $placelist) |
|
1643 | + { |
|
1623 | 1644 | if ($suffix_list) { |
1624 | 1645 | foreach (explode(';', $suffix_list) as $postfix) { |
1625 | 1646 | if ($postfix && substr($place, -strlen($postfix) - 1) == ' ' . $postfix) { |
@@ -1641,7 +1662,8 @@ discard block |
||
1641 | 1662 | * |
1642 | 1663 | * @return string[] |
1643 | 1664 | */ |
1644 | - private function removePrefixAndSuffixFromPlaceName($prefix_list, $suffix_list, $place, $placelist) { |
|
1665 | + private function removePrefixAndSuffixFromPlaceName($prefix_list, $suffix_list, $place, $placelist) |
|
1666 | + { |
|
1645 | 1667 | if ($prefix_list && $suffix_list) { |
1646 | 1668 | foreach (explode(';', $prefix_list) as $prefix) { |
1647 | 1669 | foreach (explode(';', $suffix_list) as $postfix) { |
@@ -1663,7 +1685,8 @@ discard block |
||
1663 | 1685 | * |
1664 | 1686 | * @return string[] |
1665 | 1687 | */ |
1666 | - private function createPossiblePlaceNames($placename, $level) { |
|
1688 | + private function createPossiblePlaceNames($placename, $level) |
|
1689 | + { |
|
1667 | 1690 | $retlist = array(); |
1668 | 1691 | if ($level <= 9) { |
1669 | 1692 | $retlist = $this->removePrefixAndSuffixFromPlaceName($this->getSetting('GM_PREFIX_' . $level), $this->getSetting('GM_POSTFIX_' . $level), $placename, $retlist); // Remove both |
@@ -1682,7 +1705,8 @@ discard block |
||
1682 | 1705 | * |
1683 | 1706 | * @return null|\stdClass |
1684 | 1707 | */ |
1685 | - private function getLatitudeAndLongitudeFromPlaceLocation($place) { |
|
1708 | + private function getLatitudeAndLongitudeFromPlaceLocation($place) |
|
1709 | + { |
|
1686 | 1710 | $parent = explode(',', $place); |
1687 | 1711 | $parent = array_reverse($parent); |
1688 | 1712 | $place_id = 0; |
@@ -1720,7 +1744,8 @@ discard block |
||
1720 | 1744 | * |
1721 | 1745 | * @return array |
1722 | 1746 | */ |
1723 | - private function getPlaceData(Fact $fact) { |
|
1747 | + private function getPlaceData(Fact $fact) |
|
1748 | + { |
|
1724 | 1749 | $result = array(); |
1725 | 1750 | |
1726 | 1751 | $has_latitude = preg_match('/\n4 LATI (.+)/', $fact->getGedcom(), $match1); |
@@ -1778,7 +1803,8 @@ discard block |
||
1778 | 1803 | * |
1779 | 1804 | * @param Individual $indi |
1780 | 1805 | */ |
1781 | - private function buildIndividualMap(Individual $indi) { |
|
1806 | + private function buildIndividualMap(Individual $indi) |
|
1807 | + { |
|
1782 | 1808 | $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
1783 | 1809 | $facts = $indi->getFacts(); |
1784 | 1810 | foreach ($indi->getSpouseFamilies() as $family) { |
@@ -2127,7 +2153,8 @@ discard block |
||
2127 | 2153 | * |
2128 | 2154 | * @return int |
2129 | 2155 | */ |
2130 | - private function getPlaceLocationId($place) { |
|
2156 | + private function getPlaceLocationId($place) |
|
2157 | + { |
|
2131 | 2158 | $par = explode(',', strip_tags($place)); |
2132 | 2159 | $par = array_reverse($par); |
2133 | 2160 | $place_id = 0; |
@@ -2167,7 +2194,8 @@ discard block |
||
2167 | 2194 | * |
2168 | 2195 | * @return int |
2169 | 2196 | */ |
2170 | - private function getPlaceId($place) { |
|
2197 | + private function getPlaceId($place) |
|
2198 | + { |
|
2171 | 2199 | global $WT_TREE; |
2172 | 2200 | |
2173 | 2201 | $par = explode(',', $place); |
@@ -2207,7 +2235,8 @@ discard block |
||
2207 | 2235 | * |
2208 | 2236 | * @return int |
2209 | 2237 | */ |
2210 | - private function setPlaceIdMap($level, $parent) { |
|
2238 | + private function setPlaceIdMap($level, $parent) |
|
2239 | + { |
|
2211 | 2240 | $fullplace = ''; |
2212 | 2241 | if ($level == 0) { |
2213 | 2242 | return 0; |
@@ -2229,7 +2258,8 @@ discard block |
||
2229 | 2258 | * |
2230 | 2259 | * @return int |
2231 | 2260 | */ |
2232 | - private function setLevelMap($level, $parent) { |
|
2261 | + private function setLevelMap($level, $parent) |
|
2262 | + { |
|
2233 | 2263 | $fullplace = ''; |
2234 | 2264 | if ($level == 0) { |
2235 | 2265 | return 0; |
@@ -2250,7 +2280,8 @@ discard block |
||
2250 | 2280 | /** |
2251 | 2281 | * Called by placelist.php |
2252 | 2282 | */ |
2253 | - public function createMap() { |
|
2283 | + public function createMap() |
|
2284 | + { |
|
2254 | 2285 | global $level, $levelm, $plzoom, $WT_TREE; |
2255 | 2286 | |
2256 | 2287 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
@@ -2360,7 +2391,8 @@ discard block |
||
2360 | 2391 | * @param int $level |
2361 | 2392 | * @param string[] $parent |
2362 | 2393 | */ |
2363 | - private function printHowManyPeople($level, $parent) { |
|
2394 | + private function printHowManyPeople($level, $parent) |
|
2395 | + { |
|
2364 | 2396 | global $WT_TREE; |
2365 | 2397 | |
2366 | 2398 | $stats = new Stats($WT_TREE); |
@@ -2391,7 +2423,8 @@ discard block |
||
2391 | 2423 | * @param int $levelm |
2392 | 2424 | * @param string $linklevels |
2393 | 2425 | */ |
2394 | - private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels) { |
|
2426 | + private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels) |
|
2427 | + { |
|
2395 | 2428 | echo 'var icon_url = null;'; |
2396 | 2429 | if (!$place2['lati'] || !$place2['long']) { |
2397 | 2430 | echo 'var icon_url ="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png";'; |
@@ -2468,7 +2501,8 @@ discard block |
||
2468 | 2501 | * @param string $linklevels |
2469 | 2502 | * @param string[] $place_names |
2470 | 2503 | */ |
2471 | - public function mapScripts($numfound, $level, $parent, $linklevels, $place_names) { |
|
2504 | + public function mapScripts($numfound, $level, $parent, $linklevels, $place_names) |
|
2505 | + { |
|
2472 | 2506 | global $plzoom, $controller; |
2473 | 2507 | |
2474 | 2508 | $controller->addInlineJavascript(' |
@@ -2644,7 +2678,8 @@ discard block |
||
2644 | 2678 | * |
2645 | 2679 | * @return string[] |
2646 | 2680 | */ |
2647 | - private function placeIdToHierarchy($id) { |
|
2681 | + private function placeIdToHierarchy($id) |
|
2682 | + { |
|
2648 | 2683 | $statement = Database::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?"); |
2649 | 2684 | $arr = array(); |
2650 | 2685 | while ($id != 0) { |
@@ -2661,7 +2696,8 @@ discard block |
||
2661 | 2696 | * |
2662 | 2697 | * @return int |
2663 | 2698 | */ |
2664 | - private function getHighestIndex() { |
|
2699 | + private function getHighestIndex() |
|
2700 | + { |
|
2665 | 2701 | return (int) Database::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); |
2666 | 2702 | } |
2667 | 2703 | |
@@ -2670,7 +2706,8 @@ discard block |
||
2670 | 2706 | * |
2671 | 2707 | * @return int |
2672 | 2708 | */ |
2673 | - private function getHighestLevel() { |
|
2709 | + private function getHighestLevel() |
|
2710 | + { |
|
2674 | 2711 | return (int) Database::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); |
2675 | 2712 | } |
2676 | 2713 | |
@@ -2682,7 +2719,8 @@ discard block |
||
2682 | 2719 | * |
2683 | 2720 | * @return array[] |
2684 | 2721 | */ |
2685 | - private function getPlaceListLocation($parent_id, $inactive = false) { |
|
2722 | + private function getPlaceListLocation($parent_id, $inactive = false) |
|
2723 | + { |
|
2686 | 2724 | if ($inactive) { |
2687 | 2725 | $rows = Database::prepare( |
2688 | 2726 | "SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . |
@@ -2726,7 +2764,8 @@ discard block |
||
2726 | 2764 | * |
2727 | 2765 | * @param int $parent_id |
2728 | 2766 | */ |
2729 | - private function outputLevel($parent_id) { |
|
2767 | + private function outputLevel($parent_id) |
|
2768 | + { |
|
2730 | 2769 | $tmp = $this->placeIdToHierarchy($parent_id); |
2731 | 2770 | $maxLevel = $this->getHighestLevel(); |
2732 | 2771 | if ($maxLevel > 8) { |
@@ -2758,7 +2797,8 @@ discard block |
||
2758 | 2797 | * |
2759 | 2798 | * @return string[] |
2760 | 2799 | */ |
2761 | - private function findFiles($path) { |
|
2800 | + private function findFiles($path) |
|
2801 | + { |
|
2762 | 2802 | $placefiles = array(); |
2763 | 2803 | |
2764 | 2804 | try { |
@@ -2780,7 +2820,8 @@ discard block |
||
2780 | 2820 | /** |
2781 | 2821 | * Edit places. |
2782 | 2822 | */ |
2783 | - private function placesEdit() { |
|
2823 | + private function placesEdit() |
|
2824 | + { |
|
2784 | 2825 | $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
2785 | 2826 | |
2786 | 2827 | $action = Filter::post('action', null, Filter::get('action')); |
@@ -3416,7 +3457,8 @@ discard block |
||
3416 | 3457 | /** |
3417 | 3458 | * Places administration. |
3418 | 3459 | */ |
3419 | - private function adminPlaces() { |
|
3460 | + private function adminPlaces() |
|
3461 | + { |
|
3420 | 3462 | global $WT_TREE; |
3421 | 3463 | |
3422 | 3464 | $action = Filter::get('action'); |
@@ -4091,7 +4133,8 @@ discard block |
||
4091 | 4133 | /** |
4092 | 4134 | * Generate the streetview window. |
4093 | 4135 | */ |
4094 | - private function wtStreetView() { |
|
4136 | + private function wtStreetView() |
|
4137 | + { |
|
4095 | 4138 | header('Content-type: text/html; charset=UTF-8'); |
4096 | 4139 | |
4097 | 4140 | ?> |