@@ -22,20 +22,20 @@ |
||
22 | 22 | * {@inhericDoc} |
23 | 23 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
24 | 24 | */ |
25 | - protected function renderContent() { |
|
26 | - if($this->data->get('has_stats', false)) { |
|
27 | - $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)' , |
|
28 | - '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', |
|
29 | - date('Y'), |
|
30 | - '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
|
31 | - ); |
|
32 | - } |
|
33 | - else { |
|
34 | - $html = I18N::translate('No statistics could be retrieved from Piwik.'); |
|
35 | - } |
|
25 | + protected function renderContent() { |
|
26 | + if($this->data->get('has_stats', false)) { |
|
27 | + $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)' , |
|
28 | + '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', |
|
29 | + date('Y'), |
|
30 | + '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
|
31 | + ); |
|
32 | + } |
|
33 | + else { |
|
34 | + $html = I18N::translate('No statistics could be retrieved from Piwik.'); |
|
35 | + } |
|
36 | 36 | |
37 | - return $html; |
|
38 | - } |
|
37 | + return $html; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | 41 | } |
@@ -23,11 +23,11 @@ |
||
23 | 23 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
24 | 24 | */ |
25 | 25 | protected function renderContent() { |
26 | - if($this->data->get('has_stats', false)) { |
|
27 | - $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)' , |
|
28 | - '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', |
|
26 | + if ($this->data->get('has_stats', false)) { |
|
27 | + $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)', |
|
28 | + '<span class="odometer">'.I18N::number($this->data->get('visits_year')).'</span>', |
|
29 | 29 | date('Y'), |
30 | - '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
|
30 | + '<span class="odometer">'.I18N::number($this->data->get('visits_today')).'</span>' |
|
31 | 31 | ); |
32 | 32 | } |
33 | 33 | else { |
@@ -29,8 +29,7 @@ |
||
29 | 29 | date('Y'), |
30 | 30 | '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
31 | 31 | ); |
32 | - } |
|
33 | - else { |
|
32 | + } else { |
|
34 | 33 | $html = I18N::translate('No statistics could be retrieved from Piwik.'); |
35 | 34 | } |
36 | 35 |
@@ -23,51 +23,51 @@ |
||
23 | 23 | * {@inhericDoc} |
24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
25 | 25 | */ |
26 | - protected function renderContent() { |
|
26 | + protected function renderContent() { |
|
27 | 27 | |
28 | - return ' |
|
28 | + return ' |
|
29 | 29 | <tr> |
30 | 30 | <td class="descriptionbox wrap width33">' . |
31 | - I18N::translate('Enable Piwik Statistics') . |
|
32 | - // Ideally, would like to add helpLink, but this does not work for modules... |
|
33 | - // FunctionsPrint::helpLink('piwik_enabled', $this->getName()); |
|
34 | - '</td> |
|
31 | + I18N::translate('Enable Piwik Statistics') . |
|
32 | + // Ideally, would like to add helpLink, but this does not work for modules... |
|
33 | + // FunctionsPrint::helpLink('piwik_enabled', $this->getName()); |
|
34 | + '</td> |
|
35 | 35 | <td class="optionbox">' . |
36 | - FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . |
|
37 | - '</td> |
|
36 | + FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . |
|
37 | + '</td> |
|
38 | 38 | </tr>' . |
39 | 39 | |
40 | - '<tr> |
|
40 | + '<tr> |
|
41 | 41 | <td class="descriptionbox wrap width33">' . |
42 | - I18N::translate('Piwik URL') . |
|
43 | - '</td> |
|
42 | + I18N::translate('Piwik URL') . |
|
43 | + '</td> |
|
44 | 44 | <td class="optionbox"> |
45 | 45 | <input type="text" name="piwik_url" size="45" value="' . |
46 | - $this->data->get('piwik_url', '') . '" /> |
|
46 | + $this->data->get('piwik_url', '') . '" /> |
|
47 | 47 | </td> |
48 | 48 | </tr>' . |
49 | 49 | |
50 | - '<tr> |
|
50 | + '<tr> |
|
51 | 51 | <td class="descriptionbox wrap width33">' . |
52 | - I18N::translate('Piwik Token') . |
|
53 | - '</td> |
|
52 | + I18N::translate('Piwik Token') . |
|
53 | + '</td> |
|
54 | 54 | <td class="optionbox"> |
55 | 55 | <input type="text" name="piwik_token" size="45" value="' . |
56 | - $this->data->get('piwik_token', '') . '" /> |
|
56 | + $this->data->get('piwik_token', '') . '" /> |
|
57 | 57 | </td> |
58 | 58 | </tr>' . |
59 | 59 | |
60 | - '<tr> |
|
60 | + '<tr> |
|
61 | 61 | <td class="descriptionbox wrap width33">' . |
62 | - I18N::translate('Piwik Site ID') . |
|
63 | - '</td> |
|
62 | + I18N::translate('Piwik Site ID') . |
|
63 | + '</td> |
|
64 | 64 | <td class="optionbox"> |
65 | 65 | <input type="text" name="piwik_siteid" size="4" value="' . |
66 | - $this->data->get('piwik_siteid', '') . '" /> |
|
66 | + $this->data->get('piwik_siteid', '') . '" /> |
|
67 | 67 | </td> |
68 | 68 | </tr>' ; |
69 | 69 | |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | } |
@@ -28,42 +28,42 @@ |
||
28 | 28 | return ' |
29 | 29 | <tr> |
30 | 30 | <td class="descriptionbox wrap width33">' . |
31 | - I18N::translate('Enable Piwik Statistics') . |
|
31 | + I18N::translate('Enable Piwik Statistics'). |
|
32 | 32 | // Ideally, would like to add helpLink, but this does not work for modules... |
33 | 33 | // FunctionsPrint::helpLink('piwik_enabled', $this->getName()); |
34 | 34 | '</td> |
35 | 35 | <td class="optionbox">' . |
36 | - FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . |
|
36 | + FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')). |
|
37 | 37 | '</td> |
38 | 38 | </tr>' . |
39 | 39 | |
40 | 40 | '<tr> |
41 | 41 | <td class="descriptionbox wrap width33">' . |
42 | - I18N::translate('Piwik URL') . |
|
42 | + I18N::translate('Piwik URL'). |
|
43 | 43 | '</td> |
44 | 44 | <td class="optionbox"> |
45 | 45 | <input type="text" name="piwik_url" size="45" value="' . |
46 | - $this->data->get('piwik_url', '') . '" /> |
|
46 | + $this->data->get('piwik_url', '').'" /> |
|
47 | 47 | </td> |
48 | 48 | </tr>' . |
49 | 49 | |
50 | 50 | '<tr> |
51 | 51 | <td class="descriptionbox wrap width33">' . |
52 | - I18N::translate('Piwik Token') . |
|
52 | + I18N::translate('Piwik Token'). |
|
53 | 53 | '</td> |
54 | 54 | <td class="optionbox"> |
55 | 55 | <input type="text" name="piwik_token" size="45" value="' . |
56 | - $this->data->get('piwik_token', '') . '" /> |
|
56 | + $this->data->get('piwik_token', '').'" /> |
|
57 | 57 | </td> |
58 | 58 | </tr>' . |
59 | 59 | |
60 | 60 | '<tr> |
61 | 61 | <td class="descriptionbox wrap width33">' . |
62 | - I18N::translate('Piwik Site ID') . |
|
62 | + I18N::translate('Piwik Site ID'). |
|
63 | 63 | '</td> |
64 | 64 | <td class="optionbox"> |
65 | 65 | <input type="text" name="piwik_siteid" size="4" value="' . |
66 | - $this->data->get('piwik_siteid', '') . '" /> |
|
66 | + $this->data->get('piwik_siteid', '').'" /> |
|
67 | 67 | </td> |
68 | 68 | </tr>' ; |
69 | 69 |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | class WelcomeBlockController extends MvcController |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * Pages |
|
33 | - */ |
|
31 | + /** |
|
32 | + * Pages |
|
33 | + */ |
|
34 | 34 | |
35 | - /** |
|
36 | - * WelcomeBlock@index |
|
37 | - * |
|
38 | - * @param PageController $parent_controller |
|
39 | - * @param Tree $tree |
|
40 | - * @param string $block_id |
|
41 | - * @param string $template |
|
42 | - * @return $string |
|
43 | - */ |
|
44 | - public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
|
45 | - $view_bag = new ViewBag(); |
|
35 | + /** |
|
36 | + * WelcomeBlock@index |
|
37 | + * |
|
38 | + * @param PageController $parent_controller |
|
39 | + * @param Tree $tree |
|
40 | + * @param string $block_id |
|
41 | + * @param string $template |
|
42 | + * @return $string |
|
43 | + */ |
|
44 | + public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
|
45 | + $view_bag = new ViewBag(); |
|
46 | 46 | |
47 | - if($parent_controller && $tree) { |
|
47 | + if($parent_controller && $tree) { |
|
48 | 48 | |
49 | - $view_bag->set('tree', $tree); |
|
50 | - $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
|
49 | + $view_bag->set('tree', $tree); |
|
50 | + $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
|
51 | 51 | |
52 | - $id = $this->module->getName().$block_id; |
|
53 | - $class = $this->module->getName().'_block'; |
|
54 | - $parent_controller->addInlineJavascript(' |
|
52 | + $id = $this->module->getName().$block_id; |
|
53 | + $class = $this->module->getName().'_block'; |
|
54 | + $parent_controller->addInlineJavascript(' |
|
55 | 55 | jQuery("#maj-new_passwd").hide(); |
56 | 56 | jQuery("#maj-passwd_click").click(function() |
57 | 57 | { |
@@ -62,62 +62,62 @@ discard block |
||
62 | 62 | }); |
63 | 63 | '); |
64 | 64 | |
65 | - if (Auth::isAdmin()) { |
|
66 | - $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
67 | - } else { |
|
68 | - $title=''; |
|
69 | - } |
|
70 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
65 | + if (Auth::isAdmin()) { |
|
66 | + $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
67 | + } else { |
|
68 | + $title=''; |
|
69 | + } |
|
70 | + $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
71 | 71 | |
72 | - $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
|
73 | - $view_bag->set('piwik_enabled', $piwik_enabled); |
|
74 | - if($piwik_enabled) { |
|
75 | - $parent_controller->addInlineJavascript( |
|
76 | - '$("#piwik_stats") |
|
72 | + $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
|
73 | + $view_bag->set('piwik_enabled', $piwik_enabled); |
|
74 | + if($piwik_enabled) { |
|
75 | + $parent_controller->addInlineJavascript( |
|
76 | + '$("#piwik_stats") |
|
77 | 77 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
78 | - ); |
|
79 | - } |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
81 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
82 | 82 | |
83 | - if ($template) { |
|
84 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
85 | - } else { |
|
86 | - return $content; |
|
87 | - } |
|
88 | - } |
|
89 | - } |
|
83 | + if ($template) { |
|
84 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
85 | + } else { |
|
86 | + return $content; |
|
87 | + } |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | - /** |
|
94 | - * WelcomeBlock@config |
|
95 | - * |
|
96 | - * @param string $block_id |
|
97 | - */ |
|
98 | - public function config($block_id) { |
|
93 | + /** |
|
94 | + * WelcomeBlock@config |
|
95 | + * |
|
96 | + * @param string $block_id |
|
97 | + */ |
|
98 | + public function config($block_id) { |
|
99 | 99 | |
100 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
101 | - $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
|
102 | - $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url'))); |
|
103 | - $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid'))); |
|
104 | - $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); |
|
105 | - exit; |
|
106 | - } |
|
100 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
101 | + $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
|
102 | + $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url'))); |
|
103 | + $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid'))); |
|
104 | + $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); |
|
105 | + exit; |
|
106 | + } |
|
107 | 107 | |
108 | - $view_bag = new ViewBag(); |
|
108 | + $view_bag = new ViewBag(); |
|
109 | 109 | |
110 | - // Is Piwik Statistic Enabled ? |
|
111 | - $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0')); |
|
112 | - //Piwik Root Url |
|
113 | - $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', '')); |
|
114 | - // Piwik token |
|
115 | - $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', '')); |
|
116 | - // Piwik side id |
|
117 | - $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', '')); |
|
110 | + // Is Piwik Statistic Enabled ? |
|
111 | + $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0')); |
|
112 | + //Piwik Root Url |
|
113 | + $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', '')); |
|
114 | + // Piwik token |
|
115 | + $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', '')); |
|
116 | + // Piwik side id |
|
117 | + $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', '')); |
|
118 | 118 | |
119 | - ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->renderPartial(); |
|
120 | - } |
|
119 | + ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->renderPartial(); |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | 123 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
45 | 45 | $view_bag = new ViewBag(); |
46 | 46 | |
47 | - if($parent_controller && $tree) { |
|
47 | + if ($parent_controller && $tree) { |
|
48 | 48 | |
49 | 49 | $view_bag->set('tree', $tree); |
50 | 50 | $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
@@ -63,22 +63,22 @@ discard block |
||
63 | 63 | '); |
64 | 64 | |
65 | 65 | if (Auth::isAdmin()) { |
66 | - $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
66 | + $title = '<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged='.$tree->getNameHtml().'&ctype=gedcom"></a>'; |
|
67 | 67 | } else { |
68 | - $title=''; |
|
68 | + $title = ''; |
|
69 | 69 | } |
70 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
70 | + $title .= '<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
71 | 71 | |
72 | 72 | $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
73 | 73 | $view_bag->set('piwik_enabled', $piwik_enabled); |
74 | - if($piwik_enabled) { |
|
74 | + if ($piwik_enabled) { |
|
75 | 75 | $parent_controller->addInlineJavascript( |
76 | 76 | '$("#piwik_stats") |
77 | 77 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
78 | 78 | ); |
79 | 79 | } |
80 | 80 | |
81 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
81 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
82 | 82 | |
83 | 83 | if ($template) { |
84 | 84 | return Theme::theme()->formatBlock($id, $title, $class, $content); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function getConfigLink() { |
65 | 65 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
66 | 66 | |
67 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
67 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function getProvider() { |
84 | 84 | global $WT_TREE; |
85 | 85 | |
86 | - if(!$this->provider) { |
|
86 | + if (!$this->provider) { |
|
87 | 87 | $this->provider = new GeoAnalysisProvider($WT_TREE); |
88 | 88 | } |
89 | 89 | return $this->provider; |
@@ -24,82 +24,82 @@ |
||
24 | 24 | class GeoDispersionModule extends AbstractModule implements ModuleConfigInterface, DependentInterface { |
25 | 25 | |
26 | 26 | // How to update the database schema for this module |
27 | - const SCHEMA_TARGET_VERSION = 1; |
|
28 | - const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
|
29 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema'; |
|
27 | + const SCHEMA_TARGET_VERSION = 1; |
|
28 | + const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
|
29 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema'; |
|
30 | 30 | |
31 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
32 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
31 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
32 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
33 | 33 | |
34 | - /** |
|
35 | - * GeoDispersion analysis provider |
|
36 | - * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider |
|
37 | - */ |
|
38 | - protected $provider; |
|
34 | + /** |
|
35 | + * GeoDispersion analysis provider |
|
36 | + * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider |
|
37 | + */ |
|
38 | + protected $provider; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inhericDoc} |
|
42 | - */ |
|
43 | - public function getTitle() { |
|
44 | - return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion'); |
|
45 | - } |
|
40 | + /** |
|
41 | + * {@inhericDoc} |
|
42 | + */ |
|
43 | + public function getTitle() { |
|
44 | + return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion'); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * {@inhericDoc} |
|
49 | - */ |
|
50 | - public function getDescription() { |
|
51 | - return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.'); |
|
52 | - } |
|
47 | + /** |
|
48 | + * {@inhericDoc} |
|
49 | + */ |
|
50 | + public function getDescription() { |
|
51 | + return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.'); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * {@inhericDoc} |
|
56 | - */ |
|
57 | - public function modAction($mod_action) { |
|
58 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
54 | + /** |
|
55 | + * {@inhericDoc} |
|
56 | + */ |
|
57 | + public function modAction($mod_action) { |
|
58 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
59 | 59 | |
60 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
61 | - } |
|
60 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inhericDoc} |
|
65 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
66 | - */ |
|
67 | - public function getConfigLink() { |
|
68 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
63 | + /** |
|
64 | + * {@inhericDoc} |
|
65 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
66 | + */ |
|
67 | + public function getConfigLink() { |
|
68 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
69 | 69 | |
70 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | - } |
|
70 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inhericDoc} |
|
75 | - * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
76 | - */ |
|
77 | - public function validatePrerequisites() { |
|
78 | - return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
|
79 | - } |
|
73 | + /** |
|
74 | + * {@inhericDoc} |
|
75 | + * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
76 | + */ |
|
77 | + public function validatePrerequisites() { |
|
78 | + return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
|
79 | + } |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Get the GeoAnalysis Provider (initialise it if not done yet). |
83 | 83 | * |
84 | 84 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
85 | 85 | */ |
86 | - public function getProvider() { |
|
87 | - global $WT_TREE; |
|
86 | + public function getProvider() { |
|
87 | + global $WT_TREE; |
|
88 | 88 | |
89 | - if(!$this->provider) { |
|
90 | - $this->provider = new GeoAnalysisProvider($WT_TREE); |
|
91 | - } |
|
92 | - return $this->provider; |
|
93 | - } |
|
89 | + if(!$this->provider) { |
|
90 | + $this->provider = new GeoAnalysisProvider($WT_TREE); |
|
91 | + } |
|
92 | + return $this->provider; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Set the GeoAnalysis Provider. |
97 | 97 | * |
98 | 98 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
99 | 99 | */ |
100 | - public function setProvider(GeoAnalysisProvider $provider) { |
|
101 | - $this->provider = $provider; |
|
102 | - } |
|
100 | + public function setProvider(GeoAnalysisProvider $provider) { |
|
101 | + $this->provider = $provider; |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | 105 | } |
@@ -17,41 +17,41 @@ |
||
17 | 17 | */ |
18 | 18 | class JsonController extends BaseController { |
19 | 19 | |
20 | - /** |
|
21 | - * {@inheritDoc} |
|
22 | - * @see \Fisharebest\Webtrees\Controller\BaseController::pageHeader() |
|
23 | - */ |
|
24 | - public function pageHeader() { |
|
25 | - header('Content-Type: application/json'); |
|
26 | - header('Cache-Control: no-cache, must-revalidate'); |
|
27 | - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
28 | - // We've displayed the header - display the footer automatically |
|
29 | - register_shutdown_function(array($this, 'pageFooter')); |
|
20 | + /** |
|
21 | + * {@inheritDoc} |
|
22 | + * @see \Fisharebest\Webtrees\Controller\BaseController::pageHeader() |
|
23 | + */ |
|
24 | + public function pageHeader() { |
|
25 | + header('Content-Type: application/json'); |
|
26 | + header('Cache-Control: no-cache, must-revalidate'); |
|
27 | + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
28 | + // We've displayed the header - display the footer automatically |
|
29 | + register_shutdown_function(array($this, 'pageFooter')); |
|
30 | 30 | |
31 | - return $this; |
|
32 | - } |
|
31 | + return $this; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * {@inheritDoc} |
|
36 | - * @see \Fisharebest\Webtrees\Controller\BaseController::pageFooter() |
|
37 | - */ |
|
38 | - public function pageFooter() { |
|
39 | - return $this; |
|
40 | - } |
|
34 | + /** |
|
35 | + * {@inheritDoc} |
|
36 | + * @see \Fisharebest\Webtrees\Controller\BaseController::pageFooter() |
|
37 | + */ |
|
38 | + public function pageFooter() { |
|
39 | + return $this; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Restrict access. |
|
44 | - * |
|
45 | - * @param bool $condition |
|
46 | - * |
|
47 | - * @return $this |
|
48 | - */ |
|
49 | - public function restrictAccess($condition) { |
|
50 | - if ($condition !== true) { |
|
51 | - http_response_code(403); |
|
52 | - exit; |
|
53 | - } |
|
42 | + /** |
|
43 | + * Restrict access. |
|
44 | + * |
|
45 | + * @param bool $condition |
|
46 | + * |
|
47 | + * @return $this |
|
48 | + */ |
|
49 | + public function restrictAccess($condition) { |
|
50 | + if ($condition !== true) { |
|
51 | + http_response_code(403); |
|
52 | + exit; |
|
53 | + } |
|
54 | 54 | |
55 | - return $this; |
|
56 | - } |
|
55 | + return $this; |
|
56 | + } |
|
57 | 57 | } |
@@ -34,26 +34,26 @@ |
||
34 | 34 | protected $fact; |
35 | 35 | |
36 | 36 | /** |
37 | - * Contructor for the decorator |
|
38 | - * |
|
39 | - * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
|
40 | - */ |
|
37 | + * Contructor for the decorator |
|
38 | + * |
|
39 | + * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
|
40 | + */ |
|
41 | 41 | public function __construct(\Fisharebest\Webtrees\Fact $fact_in){ |
42 | 42 | $this->fact = $fact_in; |
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * Check if a fact has a date and is sourced |
|
47 | - * Values: |
|
48 | - * - 0, if no date is found for the fact |
|
49 | - * - -1, if the date is not precise |
|
50 | - * - -2, if the date is precise, but no source is found |
|
51 | - * - 1, if the date is precise, and a source is found |
|
52 | - * - 2, if the date is precise, a source exists, and is supported by a certificate (requires _ACT usage) |
|
53 | - * - 3, if the date is precise, a source exists, and the certificate supporting the fact is within an acceptable range of date |
|
54 | - * |
|
55 | - * @return int Level of sources |
|
56 | - */ |
|
46 | + * Check if a fact has a date and is sourced |
|
47 | + * Values: |
|
48 | + * - 0, if no date is found for the fact |
|
49 | + * - -1, if the date is not precise |
|
50 | + * - -2, if the date is precise, but no source is found |
|
51 | + * - 1, if the date is precise, and a source is found |
|
52 | + * - 2, if the date is precise, a source exists, and is supported by a certificate (requires _ACT usage) |
|
53 | + * - 3, if the date is precise, a source exists, and the certificate supporting the fact is within an acceptable range of date |
|
54 | + * |
|
55 | + * @return int Level of sources |
|
56 | + */ |
|
57 | 57 | public function isSourced(){ |
58 | 58 | $isSourced=0; |
59 | 59 | $date = $this->fact->getDate(false); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
40 | 40 | */ |
41 | - public function __construct(\Fisharebest\Webtrees\Fact $fact_in){ |
|
41 | + public function __construct(\Fisharebest\Webtrees\Fact $fact_in) { |
|
42 | 42 | $this->fact = $fact_in; |
43 | 43 | } |
44 | 44 | |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return int Level of sources |
56 | 56 | */ |
57 | - public function isSourced(){ |
|
58 | - $isSourced=0; |
|
57 | + public function isSourced() { |
|
58 | + $isSourced = 0; |
|
59 | 59 | $date = $this->fact->getDate(false); |
60 | - if($date->isOK()) { |
|
61 | - $isSourced=-1; |
|
62 | - if($date->qual1=='' && $date->minimumJulianDay() == $date->maximumJulianDay()){ |
|
63 | - $isSourced=-2; |
|
60 | + if ($date->isOK()) { |
|
61 | + $isSourced = -1; |
|
62 | + if ($date->qual1 == '' && $date->minimumJulianDay() == $date->maximumJulianDay()) { |
|
63 | + $isSourced = -2; |
|
64 | 64 | $citations = $this->fact->getCitations(); |
65 | - foreach($citations as $citation){ |
|
66 | - $isSourced=max($isSourced, 1); |
|
67 | - if(preg_match('/3 _ACT (.*)/', $citation) ){ |
|
68 | - $isSourced=max($isSourced, 2); |
|
65 | + foreach ($citations as $citation) { |
|
66 | + $isSourced = max($isSourced, 1); |
|
67 | + if (preg_match('/3 _ACT (.*)/', $citation)) { |
|
68 | + $isSourced = max($isSourced, 2); |
|
69 | 69 | preg_match_all("/4 DATE (.*)/", $citation, $datessource, PREG_SET_ORDER); |
70 | - foreach($datessource as $daterec){ |
|
70 | + foreach ($datessource as $daterec) { |
|
71 | 71 | $datesource = new Date($daterec[1]); |
72 | - if(abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN){ |
|
72 | + if (abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN) { |
|
73 | 73 | $isSourced = max($isSourced, 3); //If this level increases, do not forget to change the constant MAX_IS_SOURCED_LEVEL |
74 | 74 | } |
75 | 75 | } |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class Cache{ |
18 | 18 | |
19 | - /** |
|
20 | - * Underlying Zend Cache object |
|
21 | - * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
|
22 | - */ |
|
19 | + /** |
|
20 | + * Underlying Zend Cache object |
|
21 | + * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
|
22 | + */ |
|
23 | 23 | protected $cache=null; |
24 | 24 | |
25 | 25 | /** |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected static function getInstance() |
43 | 43 | { |
44 | - if (null === static::$instance) { |
|
45 | - static::$instance = new static(); |
|
46 | - } |
|
44 | + if (null === static::$instance) { |
|
45 | + static::$instance = new static(); |
|
46 | + } |
|
47 | 47 | |
48 | - return static::$instance; |
|
48 | + return static::$instance; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return string Cached key name |
92 | 92 | */ |
93 | 93 | protected function getKeyName($value, AbstractModule $mod = null){ |
94 | - $this->checkInit(); |
|
94 | + $this->checkInit(); |
|
95 | 95 | $mod_name = 'myartjaub'; |
96 | 96 | if($mod != null) $mod_name = $mod->getName(); |
97 | 97 | return $mod_name.'_'.$value; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return bool True is cached |
118 | 118 | */ |
119 | 119 | public static function isCached($value, AbstractModule $mod = null) { |
120 | - self::getInstance()->isCachedI($value, $mod); |
|
120 | + self::getInstance()->isCachedI($value, $mod); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return unknown_type Cached value |
141 | 141 | */ |
142 | 142 | public static function get($value, AbstractModule $mod = null){ |
143 | - self::getInstance()->getI($value, $mod); |
|
143 | + self::getInstance()->getI($value, $mod); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return unknown_type Cached value |
167 | 167 | */ |
168 | 168 | public static function save($value, $data, AbstractModule $mod = null){ |
169 | - self::getInstance()->saveI($value, $data, $mod); |
|
169 | + self::getInstance()->saveI($value, $data, $mod); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | */ |
176 | 176 | public function cleanI(){ |
177 | - $this->checkInit(); |
|
177 | + $this->checkInit(); |
|
178 | 178 | $this->cache->clean(); |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * Static invocation of the *clean* method. |
183 | 183 | */ |
184 | 184 | public static function clean() { |
185 | - self::getInstance()->cleanI(); |
|
185 | + self::getInstance()->cleanI(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Cache component to speed up some potential data retrievals |
16 | 16 | */ |
17 | -class Cache{ |
|
17 | +class Cache { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Underlying Zend Cache object |
21 | 21 | * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
22 | 22 | */ |
23 | - protected $cache=null; |
|
23 | + protected $cache = null; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines whether the cache has been initialised |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function init() { |
56 | 56 | // The translation libraries only work with a cache. |
57 | - $cache_options=array('automatic_serialization'=>true); |
|
57 | + $cache_options = array('automatic_serialization'=>true); |
|
58 | 58 | |
59 | 59 | if (ini_get('apc.enabled')) { |
60 | 60 | $this->cache = \Zend_Cache::factory('Core', 'Apc', $cache_options, array()); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * Initiliase the Cache if not done. |
80 | 80 | * |
81 | 81 | */ |
82 | - protected function checkInit(){ |
|
83 | - if(!$this->is_init) $this->init(); |
|
82 | + protected function checkInit() { |
|
83 | + if (!$this->is_init) $this->init(); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * @param AbstractModule $mod Calling module |
91 | 91 | * @return string Cached key name |
92 | 92 | */ |
93 | - protected function getKeyName($value, AbstractModule $mod = null){ |
|
93 | + protected function getKeyName($value, AbstractModule $mod = null) { |
|
94 | 94 | $this->checkInit(); |
95 | 95 | $mod_name = 'myartjaub'; |
96 | - if($mod !== null) $mod_name = $mod->getName(); |
|
96 | + if ($mod !== null) $mod_name = $mod->getName(); |
|
97 | 97 | return $mod_name.'_'.$value; |
98 | 98 | } |
99 | 99 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param AbstractModule $mod Calling module |
128 | 128 | * @return unknown_type Cached value |
129 | 129 | */ |
130 | - public function getI($value, AbstractModule $mod = null){ |
|
130 | + public function getI($value, AbstractModule $mod = null) { |
|
131 | 131 | $this->checkInit(); |
132 | 132 | return $this->cache->load($this->getKeyName($value, $mod)); |
133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param AbstractModule $mod Calling module |
140 | 140 | * @return unknown_type Cached value |
141 | 141 | */ |
142 | - public static function get($value, AbstractModule $mod = null){ |
|
142 | + public static function get($value, AbstractModule $mod = null) { |
|
143 | 143 | self::getInstance()->getI($value, $mod); |
144 | 144 | } |
145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param AbstractModule $mod Calling module |
152 | 152 | * @return unknown_type Cached value |
153 | 153 | */ |
154 | - public function saveI($value, $data, AbstractModule $mod = null){ |
|
154 | + public function saveI($value, $data, AbstractModule $mod = null) { |
|
155 | 155 | $this->checkInit(); |
156 | 156 | $this->cache->save($data, $this->getKeyName($value, $mod)); |
157 | 157 | return $this->get($value, $mod); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param AbstractModule $mod Calling module |
166 | 166 | * @return unknown_type Cached value |
167 | 167 | */ |
168 | - public static function save($value, $data, AbstractModule $mod = null){ |
|
168 | + public static function save($value, $data, AbstractModule $mod = null) { |
|
169 | 169 | self::getInstance()->saveI($value, $data, $mod); |
170 | 170 | } |
171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * Clean the cache |
174 | 174 | * |
175 | 175 | */ |
176 | - public function cleanI(){ |
|
176 | + public function cleanI() { |
|
177 | 177 | $this->checkInit(); |
178 | 178 | $this->cache->clean(); |
179 | 179 | } |
@@ -80,7 +80,9 @@ discard block |
||
80 | 80 | * |
81 | 81 | */ |
82 | 82 | protected function checkInit(){ |
83 | - if(!$this->is_init) $this->init(); |
|
83 | + if(!$this->is_init) { |
|
84 | + $this->init(); |
|
85 | + } |
|
84 | 86 | } |
85 | 87 | |
86 | 88 | /** |
@@ -93,7 +95,9 @@ discard block |
||
93 | 95 | protected function getKeyName($value, AbstractModule $mod = null){ |
94 | 96 | $this->checkInit(); |
95 | 97 | $mod_name = 'myartjaub'; |
96 | - if($mod !== null) $mod_name = $mod->getName(); |
|
98 | + if($mod !== null) { |
|
99 | + $mod_name = $mod->getName(); |
|
100 | + } |
|
97 | 101 | return $mod_name.'_'.$value; |
98 | 102 | } |
99 | 103 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param string $value Value name |
116 | 116 | * @param AbstractModule $mod Calling module |
117 | - * @return bool True is cached |
|
117 | + * @return boolean|null True is cached |
|
118 | 118 | */ |
119 | 119 | public static function isCached($value, AbstractModule $mod = null) { |
120 | 120 | self::getInstance()->isCachedI($value, $mod); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param string $value Value name |
150 | 150 | * @param mixed $data Value |
151 | 151 | * @param AbstractModule $mod Calling module |
152 | - * @return mixed Cached value |
|
152 | + * @return unknown_type|null Cached value |
|
153 | 153 | */ |
154 | 154 | public function saveI($value, $data, AbstractModule $mod = null){ |
155 | 155 | $this->checkInit(); |
@@ -15,12 +15,12 @@ |
||
15 | 15 | */ |
16 | 16 | interface MvcControllerInterface { |
17 | 17 | |
18 | - /** |
|
19 | - * Return the module attached to this controller. |
|
20 | - * |
|
21 | - * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
22 | - */ |
|
23 | - function getModule(); |
|
18 | + /** |
|
19 | + * Return the module attached to this controller. |
|
20 | + * |
|
21 | + * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
22 | + */ |
|
23 | + function getModule(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | 27 | \ No newline at end of file |
@@ -17,28 +17,28 @@ |
||
17 | 17 | */ |
18 | 18 | class MvcController implements MvcControllerInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * Reference module |
|
22 | - * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
23 | - */ |
|
24 | - protected $module; |
|
20 | + /** |
|
21 | + * Reference module |
|
22 | + * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
23 | + */ |
|
24 | + protected $module; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Constructor for MvcController |
|
28 | - * |
|
29 | - * @param AbstractModule $module |
|
30 | - */ |
|
31 | - public function __construct(AbstractModule $module) { |
|
32 | - $this->module = $module; |
|
33 | - } |
|
26 | + /** |
|
27 | + * Constructor for MvcController |
|
28 | + * |
|
29 | + * @param AbstractModule $module |
|
30 | + */ |
|
31 | + public function __construct(AbstractModule $module) { |
|
32 | + $this->module = $module; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
38 | - */ |
|
39 | - public function getModule() { |
|
40 | - return $this->module; |
|
41 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
38 | + */ |
|
39 | + public function getModule() { |
|
40 | + return $this->module; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | 45 | \ No newline at end of file |