add favicon test on blog pref form

master
Jean-Christian Paul Denis 2021-11-06 10:19:13 +01:00
parent 651ef68ec1
commit 4aafa5128f
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 29 additions and 13 deletions

View File

@ -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('<li title="%s">%s</li>', $path . '/favicon.' . $ext, 'favicon.' . $ext);
}
}
echo
'<div class="fieldset"><h4 id="simply_favicon_params">Favicon</h4>' .
'<div class="fieldset clear"><h4 id="simply_favicon_params">Favicon</h4>' .
'<div class="two-cols"><div class="col">' .
'<p><label class="classic">' .
form::checkbox('simply_favicon', '1', (bool) $blog_settings->system->simply_favicon) .
__('Enable "Simply favicon" extension') . '</label></p>' .
'<p class="form-note">' .
__("You must place an image called favicon.png or .jpg or .ico into your blog's public directory.") .
'</p>' .
'</div>';
'</p></div><div class="col">' .
(
empty($exists) ?
'<p>' . __('There are no favicon in blog public directory') . '</p>' :
'<p>' . __('Current favicons:') . '</p><ul class="nice">' . implode($exists) . '</ul>'
) .
'</div></div><br class="clear" /></div>';
}
public static function adminBeforeBlogSettingsUpdate($blog_settings)

View File

@ -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 :"