prepare to DC 2.24
This commit is contained in:
parent
a49db43016
commit
c24989196f
@ -14,14 +14,14 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$core->addBehavior('adminBlogPreferencesForm', ['adminSimplyFavicon', 'adminBlogPreferencesForm']);
|
||||
$core->addBehavior('adminBeforeBlogSettingsUpdate', ['adminSimplyFavicon', 'adminBeforeBlogSettingsUpdate']);
|
||||
dcCore::app()->addBehavior('adminBlogPreferencesFormV2', ['adminSimplyFavicon', 'adminBlogPreferencesForm']);
|
||||
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', ['adminSimplyFavicon', 'adminBeforeBlogSettingsUpdate']);
|
||||
|
||||
class adminSimplyFavicon
|
||||
{
|
||||
public static $extensions = ['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'];
|
||||
|
||||
public static function adminBlogPreferencesForm($core, $blog_settings)
|
||||
public static function adminBlogPreferencesForm($blog_settings)
|
||||
{
|
||||
$exists = [];
|
||||
$path = path::fullFromRoot((string) $blog_settings->system->public_path, DC_ROOT);
|
||||
|
22
_define.php
22
_define.php
@ -18,16 +18,18 @@ $this->registerModule(
|
||||
'Simply favicon',
|
||||
'Multi-agents favicon',
|
||||
'Jean-Christian Denis',
|
||||
'2021.11.06',
|
||||
'2022.11.12',
|
||||
[
|
||||
'requires' => [['core', '2.19']],
|
||||
'permissions' => 'admin',
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://github.com/JcDenis/simplyFavicon',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/simplyFavicon',
|
||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/simplyFavicon/master/dcstore.xml',
|
||||
'settings' => [
|
||||
'blog' => '#params.simply_favicon_params'
|
||||
]
|
||||
'requires' => [['core', '2.24']],
|
||||
'permissions' => dcCore::app()->auth->makePermissions([
|
||||
dcAuth::PERMISSION_ADMIN,
|
||||
]),
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://github.com/JcDenis/simplyFavicon',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/simplyFavicon',
|
||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/simplyFavicon/master/dcstore.xml',
|
||||
'settings' => [
|
||||
'blog' => '#params.simply_favicon_params',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
@ -14,6 +14,6 @@ if (!defined('DC_RC_PATH')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$__autoload['publicSimplyFavicon'] = dirname(__FILE__) . '/_public.php';
|
||||
Clearbricks::lib()->autoload(['publicSimplyFavicon' => __DIR__ . '/_public.php']);
|
||||
|
||||
$core->url->register('simplyFavicon', 'favicon', '^favicon.(.*?)$', ['publicSimplyFavicon', 'simplyFaviconUrl']);
|
||||
dcCore::app()->url->register('simplyFavicon', 'favicon', '^favicon.(.*?)$', ['publicSimplyFavicon', 'simplyFaviconUrl']);
|
||||
|
20
_public.php
20
_public.php
@ -14,7 +14,7 @@ if (!defined('DC_RC_PATH')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$core->addBehavior('publicHeadContent', ['publicSimplyFavicon', 'publicHeadContent']);
|
||||
dcCore::app()->addBehavior('publicHeadContent', ['publicSimplyFavicon', 'publicHeadContent']);
|
||||
|
||||
class publicSimplyFavicon extends dcUrlHandlers
|
||||
{
|
||||
@ -24,16 +24,14 @@ class publicSimplyFavicon extends dcUrlHandlers
|
||||
'bmp' => 'image/bmp',
|
||||
'gif' => 'image/gif',
|
||||
'jpg' => 'image/jpeg',
|
||||
'mng' => 'video/x-mng'
|
||||
'mng' => 'video/x-mng',
|
||||
];
|
||||
|
||||
public static function simplyFaviconUrl($arg)
|
||||
{
|
||||
global $core;
|
||||
$public_path = path::fullFromRoot(dcCore::app()->blog->settings->system->public_path, DC_ROOT);
|
||||
|
||||
$public_path = path::fullFromRoot($core->blog->settings->system->public_path, DC_ROOT);
|
||||
|
||||
if ($core->blog->settings->system->simply_favicon
|
||||
if (dcCore::app()->blog->settings->system->simply_favicon
|
||||
&& !empty($arg)
|
||||
&& array_key_exists($arg, self::$mimetypes)
|
||||
&& file_exists($public_path . '/favicon.' . $arg)
|
||||
@ -48,17 +46,17 @@ class publicSimplyFavicon extends dcUrlHandlers
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function publicHeadContent($core)
|
||||
public static function publicHeadContent()
|
||||
{
|
||||
if (!$core->blog->settings->system->simply_favicon) {
|
||||
if (!dcCore::app()->blog->settings->system->simply_favicon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$public_path = path::fullFromRoot($core->blog->settings->system->public_path, DC_ROOT) . '/favicon.';
|
||||
$public_url = $core->blog->url . $core->url->getBase('simplyFavicon') . '.';
|
||||
$public_path = path::fullFromRoot(dcCore::app()->blog->settings->system->public_path, DC_ROOT) . '/favicon.';
|
||||
$public_url = dcCore::app()->blog->url . dcCore::app()->url->getBase('simplyFavicon') . '.';
|
||||
|
||||
// ico : IE6
|
||||
if (file_exists($public_path . 'ico') && '?' != substr($core->blog->url, -1)) {
|
||||
if (file_exists($public_path . 'ico') && '?' != substr(dcCore::app()->blog->url, -1)) {
|
||||
echo
|
||||
'<link rel="SHORTCUT ICON" type="image/x-icon" href="' . $public_url . 'ico" />' . "\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user