From f26464ca9fe3e934f689e113ef69a193c4b46e29 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 6 Nov 2021 02:23:40 +0100 Subject: [PATCH] fix PSR12 CS --- _admin.php | 11 +++++------ _define.php | 29 ++++++++++++++--------------- _prepend.php | 11 +++++------ _public.php | 48 +++++++++++++++++++++++------------------------- 4 files changed, 47 insertions(+), 52 deletions(-) diff --git a/_admin.php b/_admin.php index b424947..113ed27 100644 --- a/_admin.php +++ b/_admin.php @@ -1,16 +1,15 @@

Favicon

' . '

' . '

' . __("You must place an image called favicon.png or .jpg or .ico into your blog's public directory.") . @@ -37,4 +36,4 @@ class adminSimplyFavicon { $blog_settings->system->put('simply_favicon', !empty($_POST['simply_favicon'])); } -} \ No newline at end of file +} diff --git a/_define.php b/_define.php index 6603f51..0eaf514 100644 --- a/_define.php +++ b/_define.php @@ -1,34 +1,33 @@ registerModule( - "Simply favicon", - "Multi-agents favicon", - "Jean-Christian Denis", + 'Simply favicon', + 'Multi-agents favicon', + 'Jean-Christian Denis', '2021.09.02.1', [ - 'requires' => [['core', '2.19']], + 'requires' => [['core', '2.19']], 'permissions' => 'admin', - 'type' => 'plugin', - 'support' => 'https://github.com/JcDenis/simplyFavicon', - 'details' => 'http://plugins.dotaddict.org/dc2/details/simplyFavicon', - 'repository' => 'https://raw.githubusercontent.com/JcDenis/simplyFavicon/master/dcstore.xml', - 'settings' => [ + 'type' => 'plugin', + 'support' => 'https://github.com/JcDenis/simplyFavicon', + 'details' => 'http://plugins.dotaddict.org/dc2/details/simplyFavicon', + 'repository' => 'https://raw.githubusercontent.com/JcDenis/simplyFavicon/master/dcstore.xml', + 'settings' => [ 'blog' => '#params.simply_favicon_params' ] ] -); \ No newline at end of file +); diff --git a/_prepend.php b/_prepend.php index 0a9e229..28052eb 100644 --- a/_prepend.php +++ b/_prepend.php @@ -1,20 +1,19 @@ url->register('simplyFavicon', 'favicon', '^favicon.(.*?)$', ['publicSimplyFavicon', 'simplyFaviconUrl']); \ No newline at end of file +$core->url->register('simplyFavicon', 'favicon', '^favicon.(.*?)$', ['publicSimplyFavicon', 'simplyFaviconUrl']); diff --git a/_public.php b/_public.php index f22b14b..17ac444 100644 --- a/_public.php +++ b/_public.php @@ -1,17 +1,16 @@ addBehavior('publicHeadContent', ['publicSimplyFavicon', 'publicHeadConte class publicSimplyFavicon extends dcUrlHandlers { - public static $mimetypes = array( + public static $mimetypes = [ 'ico' => 'image/x-icon', 'png' => 'image/png', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'mng' => 'video/x-mng' - ); + ]; public static function simplyFaviconUrl($arg) { global $core; - $mimetypes = self::$mimetypes; + $mimetypes = self::$mimetypes; $public_path = path::real(path::fullFromRoot($core->blog->settings->system->public_path, DC_ROOT)) . '/favicon.'; - if (!$core->blog->settings->system->simply_favicon - || empty($arg) - || !array_key_exists($arg, $mimetypes) + if (!$core->blog->settings->system->simply_favicon + || empty($arg) + || !array_key_exists($arg, $mimetypes) || file_exists($public_path . 'favicon' . $arg) ) { - throw new Exception ("Page not found", 404); - } - else { - header('Content-Type: ' . $mimetypes[$arg] . ';'); - readfile($public_path . $arg); - exit; + throw new Exception('Page not found', 404); } + + header('Content-Type: ' . $mimetypes[$arg] . ';'); + readfile($public_path . $arg); + exit; } public static function publicHeadContent($core) { - if (!$core->blog->settings->system->simply_favicon){ + if (!$core->blog->settings->system->simply_favicon) { return; } - $mimetypes = self::$mimetypes; + $mimetypes = self::$mimetypes; $public_path = path::real(path::fullFromRoot($core->blog->settings->system->public_path, DC_ROOT)) . '/favicon.'; - $public_url = $core->blog->url.$core->url->getBase('simplyFavicon') . '.'; + $public_url = $core->blog->url . $core->url->getBase('simplyFavicon') . '.'; // ico : IE6 if (file_exists($public_path . 'ico') && '?' != substr($core->blog->url, -1)) { - echo + echo '' . "\n"; } // png: apple and others if (file_exists($public_path . 'png')) { - echo + echo '' . "\n" . '' . "\n"; } // all others else { - foreach($mimetypes as $ext => $mime) - { + foreach ($mimetypes as $ext => $mime) { if (file_exists($public_path . $ext)) { echo '' . "\n"; + break; } } } } -} \ No newline at end of file +}