move to Franck style

This commit is contained in:
JcDenis 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 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')){return;} if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
$core->addBehavior('adminBlogPreferencesForm',array('adminSimplyFavicon','adminBlogPreferencesForm')); $core->addBehavior('adminBlogPreferencesForm', ['adminSimplyFavicon', 'adminBlogPreferencesForm']);
$core->addBehavior('adminBeforeBlogSettingsUpdate',array('adminSimplyFavicon','adminBeforeBlogSettingsUpdate')); $core->addBehavior('adminBeforeBlogSettingsUpdate', ['adminSimplyFavicon', 'adminBeforeBlogSettingsUpdate']);
class adminSimplyFavicon class adminSimplyFavicon
{ {
public static function adminBlogPreferencesForm($core, $blog_settings) public static function adminBlogPreferencesForm($core, $blog_settings)
{ {
echo echo
'<fieldset><legend>Favicon</legend>'. '<div class="fieldset"><h4 id="simply_favicon_params">Favicon</h4>' .
'<p><label class="classic">' . '<p><label class="classic">' .
form::checkbox('simply_favicon', '1', (boolean) $blog_settings->system->simply_favicon) . form::checkbox('simply_favicon', '1', (boolean) $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>' .
'</fieldset>'; '</div>';
} }
public static function adminBeforeBlogSettingsUpdate($blog_settings) public static function adminBeforeBlogSettingsUpdate($blog_settings)
@ -35,4 +37,3 @@ class adminSimplyFavicon
$blog_settings->system->put('simply_favicon', !empty($_POST['simply_favicon'])); $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 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')){return;} if (!defined('DC_RC_PATH')){
return;
}
$this->registerModule( $this->registerModule(
/* Name */ "Simply favicon", /* Name */ "Simply favicon",
@ -19,4 +21,3 @@ $this->registerModule(
/* Version */ '2021.08.15', /* Version */ '2021.08.15',
/* Permissions */ 'admin' /* Permissions */ 'admin'
); );
?>

View file

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