code review

This commit is contained in:
Jean-Christian Paul Denis 2023-03-21 21:37:40 +01:00
parent f90d9104b1
commit 7ae7faa3a1
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 9 additions and 9 deletions

View File

@ -16,8 +16,7 @@ namespace Dotclear\Plugin\simplyFavicon;
use dcCore;
use dcNsProcess;
use path;
use dcSettings;
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
@ -25,6 +24,7 @@ use Dotclear\Helper\Html\Form\{
Note,
Para
};
use path;
class Backend extends dcNsProcess
{
@ -42,7 +42,7 @@ class Backend extends dcNsProcess
}
dcCore::app()->addBehaviors([
'adminBlogPreferencesFormV2' => function ($blog_settings) {
'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void {
$exists = [];
$path = path::fullFromRoot((string) $blog_settings->get('system')->get('public_path'), DC_ROOT);
foreach (['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'] as $ext) {
@ -70,7 +70,7 @@ class Backend extends dcNsProcess
) .
'</div></div><br class="clear" /></div>';
},
'adminBeforeBlogSettingsUpdate' => function ($blog_settings) {
'adminBeforeBlogSettingsUpdate' => function (dcSettings $blog_settings): void {
$blog_settings->get('system')->put('simply_favicon', !empty($_POST['simply_favicon']));
},
]);

View File

@ -33,9 +33,9 @@ class Frontend extends dcNsProcess
return false;
}
dcCore::app()->addBehavior('publicHeadContent', function () {
dcCore::app()->addBehavior('publicHeadContent', function (): void {
if (!dcCore::app()->blog->settings->get('system')->get('simply_favicon')) {
return null;
return;
}
$public_path = path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT) . '/favicon.';
@ -53,7 +53,7 @@ class Frontend extends dcNsProcess
'<link rel="icon" type="image/png" href="' . $public_url . 'png" />' . "\n";
// all others
} else {
foreach (Urlhandler::$mimetypes as $ext => $mime) {
foreach (UrlHandler::$mimetypes as $ext => $mime) {
if (in_array($ext, ['ico', 'png'])) {
continue;
}

View File

@ -20,7 +20,7 @@ use path;
class UrlHandler extends dcUrlHandlers
{
public static $mimetypes = [
public static array $mimetypes = [
'ico' => 'image/x-icon',
'png' => 'image/png',
'bmp' => 'image/bmp',
@ -29,7 +29,7 @@ class UrlHandler extends dcUrlHandlers
'mng' => 'video/x-mng',
];
public static function simplyFaviconUrl($arg)
public static function simplyFaviconUrl(string $arg): void
{
$public_path = path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT);