add favicon test on blog pref form
This commit is contained in:
parent
651ef68ec1
commit
4aafa5128f
2 changed files with 29 additions and 13 deletions
22
_admin.php
22
_admin.php
|
@ -19,17 +19,33 @@ $core->addBehavior('adminBeforeBlogSettingsUpdate', ['adminSimplyFavicon', 'admi
|
||||||
|
|
||||||
class adminSimplyFavicon
|
class adminSimplyFavicon
|
||||||
{
|
{
|
||||||
|
public static $extensions = ['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'];
|
||||||
|
|
||||||
public static function adminBlogPreferencesForm($core, $blog_settings)
|
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
|
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">' .
|
'<p><label class="classic">' .
|
||||||
form::checkbox('simply_favicon', '1', (bool) $blog_settings->system->simply_favicon) .
|
form::checkbox('simply_favicon', '1', (bool) $blog_settings->system->simply_favicon) .
|
||||||
__('Enable "Simply favicon" extension') . '</label></p>' .
|
__('Enable "Simply favicon" extension') . '</label></p>' .
|
||||||
'<p class="form-note">' .
|
'<p class="form-note">' .
|
||||||
__("You must place an image called favicon.png or .jpg or .ico into your blog's public directory.") .
|
__("You must place an image called favicon.png or .jpg or .ico into your blog's public directory.") .
|
||||||
'</p>' .
|
'</p></div><div class="col">' .
|
||||||
'</div>';
|
(
|
||||||
|
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)
|
public static function adminBeforeBlogSettingsUpdate($blog_settings)
|
||||||
|
|
|
@ -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 ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"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"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: 2011-08-03T21:55:04+00:00\n"
|
"PO-Revision-Date: 2021-11-06T09:13:24+00:00\n"
|
||||||
"Last-Translator: JC Denis\n"
|
"Last-Translator: Jean-Christian Denis\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
|
||||||
#: _admin.php:26
|
|
||||||
msgid "Enable \"Simply favicon\" extension"
|
msgid "Enable \"Simply favicon\" extension"
|
||||||
msgstr "Activer l'extension \"Simply favicon\""
|
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."
|
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."
|
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 :"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue