add option for customizing favicon

This commit is contained in:
printempw 2016-12-31 13:36:46 +08:00
parent b861dbc0b5
commit 6d6abf41f5
8 changed files with 23 additions and 7 deletions

View File

@ -28,6 +28,9 @@ class AdminController extends Controller
{
$form->text('home_pic_url', '首页图片地址')->hint('相对于首页的路径或者完整的 URL');
$form->text('favicon_url', '网站图标')->hint('相对 resources/assets/ 的路径或者完整的 URL')
->description('所使用的图像必须具有相同的宽度和高度');
$form->select('copyright_prefer', '程序版权信息')
->option('0', 'Powered with ❤ by Blessing Skin Server.')
->option('1', 'Powered by Blessing Skin Server.')

View File

@ -130,6 +130,18 @@ if (! function_exists('bs_header')) {
}
}
if (! function_exists('bs_favicon')) {
function bs_favicon()
{
$url = Str::startsWith($url = option('favicon_url'), 'http') ? $url : assets($url);
return "<link rel=\"shortcut icon\" href=\"$url\">".
"<link rel=\"icon\" type=\"image/png\" href=\"$url\" sizes=\"192x192\">".
"<link rel=\"apple-touch-icon\" href=\"$url\" sizes=\"180x180\">";
}
}
if (! function_exists('bs_menu')) {
function bs_menu($type)

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-12-28 12:59:37
* @Last Modified time: 2016-12-31 13:25:58
*/
return [
@ -40,5 +40,6 @@ return [
'auto_detect_asset_url' => '1',
'plugins_enabled' => '',
'copyright_prefer' => '0',
'score_per_closet_item' => '0'
'score_per_closet_item' => '0',
'favicon_url' => 'images/favicon.ico'
];

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@yield('title') - {{ option('site_name') }}</title>
<link rel="shortcut icon" href="{{ assets('images/favicon.ico') }}">
{!! bs_favicon() !!}
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- App Styles -->

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@yield('title') - {{ option('site_name') }}</title>
<link rel="shortcut icon" href="{{ assets('images/favicon.ico') }}">
{!! bs_favicon() !!}
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- App Styles -->
{!! bs_header('auth') !!}

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ option('site_name') }}</title>
<link rel="shortcut icon" href="{{ assets('images/favicon.ico') }}">
{!! bs_favicon() !!}
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- App Styles -->

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@yield('title') - {{ option('site_name') }}</title>
<link rel="shortcut icon" href="{{ assets('images/favicon.ico') }}">
{!! bs_favicon() !!}
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- App Styles -->

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@yield('title') - {{ option('site_name') }}</title>
<link rel="shortcut icon" href="{{ assets('images/favicon.ico') }}">
{!! bs_favicon() !!}
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- App Styles -->