move to Franck style

This commit is contained in:
Jean-Christian Paul Denis 2021-08-16 23:44:38 +02:00
parent 72dbed6e5f
commit 12c1305d4d
4 changed files with 45 additions and 39 deletions

View File

@ -10,24 +10,26 @@
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')){return;}
if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
$core->addBehavior('adminBlogPreferencesForm',array('adminSimplyFavicon','adminBlogPreferencesForm'));
$core->addBehavior('adminBeforeBlogSettingsUpdate',array('adminSimplyFavicon','adminBeforeBlogSettingsUpdate'));
$core->addBehavior('adminBlogPreferencesForm', ['adminSimplyFavicon', 'adminBlogPreferencesForm']);
$core->addBehavior('adminBeforeBlogSettingsUpdate', ['adminSimplyFavicon', 'adminBeforeBlogSettingsUpdate']);
class adminSimplyFavicon
{
public static function adminBlogPreferencesForm($core, $blog_settings)
{
echo
'<fieldset><legend>Favicon</legend>'.
'<div class="fieldset"><h4 id="simply_favicon_params">Favicon</h4>' .
'<p><label class="classic">' .
form::checkbox('simply_favicon', '1', (boolean) $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>' .
'</fieldset>';
'</div>';
}
public static function adminBeforeBlogSettingsUpdate($blog_settings)
@ -35,4 +37,3 @@ class adminSimplyFavicon
$blog_settings->system->put('simply_favicon', !empty($_POST['simply_favicon']));
}
}
?>

View File

@ -10,7 +10,9 @@
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')){return;}
if (!defined('DC_RC_PATH')){
return;
}
$this->registerModule(
/* Name */ "Simply favicon",
@ -19,4 +21,3 @@ $this->registerModule(
/* Version */ '2021.08.15',
/* Permissions */ 'admin'
);
?>

View File

@ -10,9 +10,10 @@
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')){return;}
if (!defined('DC_RC_PATH')){
return;
}
$__autoload['publicSimplyFavicon'] = dirname(__FILE__) . '/_public.php';
$core->url->register('simplyFavicon','favicon','^favicon.(.*?)$',array('publicSimplyFavicon','simplyFaviconUrl'));
?>
$core->url->register('simplyFavicon', 'favicon', '^favicon.(.*?)$', ['publicSimplyFavicon', 'simplyFaviconUrl']);

View File

@ -10,9 +10,11 @@
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')){return;}
if (!defined('DC_RC_PATH')){
return;
}
$core->addBehavior('publicHeadContent',array('publicSimplyFavicon','publicHeadContent'));
$core->addBehavior('publicHeadContent', ['publicSimplyFavicon','publicHeadContent']);
class publicSimplyFavicon extends dcUrlHandlers
{
@ -48,7 +50,9 @@ class publicSimplyFavicon extends dcUrlHandlers
public static function publicHeadContent($core)
{
if (!$core->blog->settings->system->simply_favicon){return;}
if (!$core->blog->settings->system->simply_favicon){
return;
}
$mimetypes = self::$mimetypes;
$public_path = path::real(path::fullFromRoot((string) $core->blog->settings->public_path, DC_ROOT)) . '/favicon.';
@ -78,4 +82,3 @@ class publicSimplyFavicon extends dcUrlHandlers
}
}
}
?>