From 4aafa5128f4421d3cd88437a7f800e38bf32a4d5 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 6 Nov 2021 10:19:13 +0100 Subject: [PATCH] add favicon test on blog pref form --- _admin.php | 22 +++++++++++++++++++--- locales/fr/main.po | 20 ++++++++++---------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/_admin.php b/_admin.php index 113ed27..7833616 100644 --- a/_admin.php +++ b/_admin.php @@ -19,17 +19,33 @@ $core->addBehavior('adminBeforeBlogSettingsUpdate', ['adminSimplyFavicon', 'admi class adminSimplyFavicon { + public static $extensions = ['ico', 'png', 'bmp', 'gif', 'jpg', 'mng']; + public static function adminBlogPreferencesForm($core, $blog_settings) { + $exists = []; + $path = path::fullFromRoot((string) $blog_settings->system->public_path, DC_ROOT); + foreach (self::$extensions as $ext) { + if (file_exists($path . '/favicon.' . $ext)) { + $exists[] = sprintf('
  • %s
  • ', $path . '/favicon.' . $ext, 'favicon.' . $ext); + } + } + echo - '

    Favicon

    ' . + '

    Favicon

    ' . + '
    ' . '

    ' . '

    ' . __("You must place an image called favicon.png or .jpg or .ico into your blog's public directory.") . - '

    ' . - '
    '; + '

    ' . + ( + empty($exists) ? + '

    ' . __('There are no favicon in blog public directory') . '

    ' : + '

    ' . __('Current favicons:') . '

      ' . implode($exists) . '
    ' + ) . + '

    '; } public static function adminBeforeBlogSettingsUpdate($blog_settings) diff --git a/locales/fr/main.po b/locales/fr/main.po index 9189391..7d737c8 100644 --- a/locales/fr/main.po +++ b/locales/fr/main.po @@ -1,24 +1,24 @@ -# Language: Français -# Module: simplyFavicon - 2011.06.3 -# Date: 2011-08-03 21:55:04 -# Translated with translater 1.5 - msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: simplyFavicon 2011.06.3\n" +"Project-Id-Version: simplyFavicon 2021.09.02.1\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2011-08-03T21:55:04+00:00\n" -"Last-Translator: JC Denis\n" +"PO-Revision-Date: 2021-11-06T09:13:24+00:00\n" +"Last-Translator: Jean-Christian Denis\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: _admin.php:26 msgid "Enable \"Simply favicon\" extension" msgstr "Activer l'extension \"Simply favicon\"" -#: _admin.php:28 msgid "You must place an image called favicon.png or .jpg or .ico into your blog's public directory." msgstr "Vous devez placer une image nommée favicon.png, .jpg ou .ico dans le répertoire publique du blog." +msgid "There are no favicon in blog public directory" +msgstr "Il n'y a pas de Favicon dans le répertoire public du blog." + +msgid "Current favicons:" +msgstr "Favicons actuels :" +