summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2020-06-20 17:48:01 +0100
committerGreg Roach <greg@subaqua.co.uk>2020-06-20 17:48:01 +0100
commit870365fb1aa7d55f2aaaca387c66e18b81144214 (patch)
tree5fb54cba7aa255b4b05f2c056ddad5f3914fd985
parente73fb82fca19f57c368bf7e0880b75183416ef6d (diff)
downloadwebtrees-870365fb1aa7d55f2aaaca387c66e18b81144214.tar.gz
webtrees-870365fb1aa7d55f2aaaca387c66e18b81144214.tar.bz2
webtrees-870365fb1aa7d55f2aaaca387c66e18b81144214.zip
Replace deprecated functions
-rw-r--r--app/Auth.php13
-rw-r--r--app/Functions/FunctionsEdit.php7
-rw-r--r--app/Http/Controllers/Admin/ModuleController.php3
-rw-r--r--resources/views/admin/components.phtml4
-rw-r--r--resources/views/admin/trees-preferences.phtml5
-rw-r--r--resources/views/admin/trees-privacy.phtml5
6 files changed, 24 insertions, 13 deletions
diff --git a/app/Auth.php b/app/Auth.php
index 4f0175ff7b..81f3ffc6a8 100644
--- a/app/Auth.php
+++ b/app/Auth.php
@@ -468,4 +468,17 @@ class Auth
throw new RecordAccessDeniedException();
}
+
+ /**
+ * @return array<int,string>
+ */
+ public static function accessLevelNames(): array
+ {
+ return [
+ Auth::PRIV_PRIVATE => I18N::translate('Show to visitors'),
+ Auth::PRIV_USER => I18N::translate('Show to members'),
+ Auth::PRIV_NONE => I18N::translate('Show to managers'),
+ Auth::PRIV_HIDE => I18N::translate('Hide from everyone'),
+ ];
+ }
}
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php
index 7004c79c37..ea62b13475 100644
--- a/app/Functions/FunctionsEdit.php
+++ b/app/Functions/FunctionsEdit.php
@@ -103,12 +103,7 @@ class FunctionsEdit
*/
public static function optionsAccessLevels(): array
{
- return [
- Auth::PRIV_PRIVATE => I18N::translate('Show to visitors'),
- Auth::PRIV_USER => I18N::translate('Show to members'),
- Auth::PRIV_NONE => I18N::translate('Show to managers'),
- Auth::PRIV_HIDE => I18N::translate('Hide from everyone'),
- ];
+ return Auth::accessLevelNames();
}
/**
diff --git a/app/Http/Controllers/Admin/ModuleController.php b/app/Http/Controllers/Admin/ModuleController.php
index fb49c517b4..d1924ce8c5 100644
--- a/app/Http/Controllers/Admin/ModuleController.php
+++ b/app/Http/Controllers/Admin/ModuleController.php
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Controllers\Admin;
+use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\I18N;
@@ -284,7 +285,7 @@ class ModuleController extends AbstractAdminController
$uses_access = in_array($interface, $this->module_service->componentsWithAccess(), true);
$uses_sorting = in_array($interface, $this->module_service->componentsWithOrder(), true);
- $level_text = FunctionsEdit::optionsAccessLevels();
+ $level_text = Auth::accessLevelNames();
$access_summary = $modules
->mapWithKeys(static function (ModuleInterface $module) use ($interface, $level_text, $trees): array {
diff --git a/resources/views/admin/components.phtml b/resources/views/admin/components.phtml
index f6a41039e0..824c1ccddb 100644
--- a/resources/views/admin/components.phtml
+++ b/resources/views/admin/components.phtml
@@ -1,6 +1,6 @@
<?php
-use Fisharebest\Webtrees\Functions\FunctionsEdit;
+use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
@@ -94,7 +94,7 @@ use Fisharebest\Webtrees\View;
<?= e($tree->title()) ?>
</td>
<td>
- <?= view('components/select', ['name' => 'access-' . $module->name() . '-' . $tree->id(), 'selected' => $module->accessLevel($tree, $interface), 'options' => FunctionsEdit::optionsAccessLevels()]) ?>
+ <?= view('components/select', ['name' => 'access-' . $module->name() . '-' . $tree->id(), 'selected' => $module->accessLevel($tree, $interface), 'options' => Auth::accessLevelNames()]) ?>
</tr>
<?php endforeach ?>
</tbody>
diff --git a/resources/views/admin/trees-preferences.phtml b/resources/views/admin/trees-preferences.phtml
index 2e0213d315..09d2122f90 100644
--- a/resources/views/admin/trees-preferences.phtml
+++ b/resources/views/admin/trees-preferences.phtml
@@ -1,5 +1,6 @@
<?php
+use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
use Fisharebest\Webtrees\I18N;
@@ -251,7 +252,7 @@ use Fisharebest\Webtrees\I18N;
<?= /* I18N: A configuration setting */ I18N::translate('Show a download link in the media viewer') ?>
</legend>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'SHOW_MEDIA_DOWNLOAD', 'selected' => $tree->getPreference('SHOW_MEDIA_DOWNLOAD'), 'options' => FunctionsEdit::optionsAccessLevels()]) ?>
+ <?= view('components/select', ['name' => 'SHOW_MEDIA_DOWNLOAD', 'selected' => $tree->getPreference('SHOW_MEDIA_DOWNLOAD'), 'options' => Auth::accessLevelNames()]) ?>
<p class="small text-muted">
<?= /* I18N: Help text for the “Show a download link in the media viewer” configuration setting */ I18N::translate('This option will make it easier for users to download images.') ?>
</p>
@@ -299,7 +300,7 @@ use Fisharebest\Webtrees\I18N;
<?= I18N::translate('Images without watermarks') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'SHOW_NO_WATERMARK', 'selected' => $tree->getPreference('SHOW_NO_WATERMARK'), 'options' => FunctionsEdit::optionsAccessLevels()]) ?>
+ <?= view('components/select', ['name' => 'SHOW_NO_WATERMARK', 'selected' => $tree->getPreference('SHOW_NO_WATERMARK'), 'options' => Auth::accessLevelNames()]) ?>
<p class="small text-muted">
<?= /* I18N: Help text for the “Images without watermarks” configuration setting */ I18N::translate('Watermarks are optional and normally shown just to visitors.') ?>
</p>
diff --git a/resources/views/admin/trees-privacy.phtml b/resources/views/admin/trees-privacy.phtml
index ebfae3270b..4f2ba2e4a7 100644
--- a/resources/views/admin/trees-privacy.phtml
+++ b/resources/views/admin/trees-privacy.phtml
@@ -1,5 +1,6 @@
<?php
+use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
use Fisharebest\Webtrees\I18N;
@@ -45,7 +46,7 @@ use Fisharebest\Webtrees\View;
</div>
</div>
<div class="col-sm-8">
- <?= view('components/select', ['name' => 'SHOW_DEAD_PEOPLE', 'selected' => $tree->getPreference('SHOW_DEAD_PEOPLE'), 'options' => array_slice(FunctionsEdit::optionsAccessLevels(), 0, 2, true)]) ?>
+ <?= view('components/select', ['name' => 'SHOW_DEAD_PEOPLE', 'selected' => $tree->getPreference('SHOW_DEAD_PEOPLE'), 'options' => array_slice(Auth::accessLevelNames(), 0, 2, true)]) ?>
<p class="small text-muted">
<?= /* I18N: Help text for the “Show dead individuals” configuration setting */ I18N::translate('Set the privacy access level for all dead individuals.') ?>
</p>
@@ -130,7 +131,7 @@ use Fisharebest\Webtrees\View;
</div>
</div>
<div class="col-sm-8">
- <?= view('components/select', ['name' => 'SHOW_LIVING_NAMES', 'selected' => $tree->getPreference('SHOW_LIVING_NAMES'), 'options' => array_slice(FunctionsEdit::optionsAccessLevels(), 0, 3, true)]) ?>
+ <?= view('components/select', ['name' => 'SHOW_LIVING_NAMES', 'selected' => $tree->getPreference('SHOW_LIVING_NAMES'), 'options' => array_slice(Auth::accessLevelNames(), 0, 3, true)]) ?>
<p class="small text-muted">
<?= /* I18N: Help text for the “Show names of private individuals” configuration setting */ I18N::translate('This option will show the names (but no other details) of private individuals. Individuals are private if they are still alive or if a privacy restriction has been added to their individual record. To hide a specific name, add a privacy restriction to that name record.') ?>
</p>