From 886b15de87ddaa124c55de8e7d55ceb234935a77 Mon Sep 17 00:00:00 2001 From: printempw Date: Tue, 27 Dec 2016 23:05:09 +0800 Subject: [PATCH] add many styles for copyright text --- app/Http/Controllers/AdminController.php | 20 ++++++++++- app/helpers.php | 19 +++++++++- config/options.php | 5 +-- resources/views/admin/customize.tpl | 44 +----------------------- resources/views/admin/master.tpl | 4 +-- resources/views/index.tpl | 4 +-- resources/views/skinlib/master.tpl | 4 +-- resources/views/user/master.tpl | 4 +-- 8 files changed, 49 insertions(+), 55 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 8b0b941b..f425dd01 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -22,7 +22,25 @@ class AdminController extends Controller public function customize() { - return view('admin.customize'); + $homepage = Option::form('homepage', '首页配置', function($form) + { + $form->text('home_pic_url', '首页图片地址')->hint('相对于首页的路径或者完整的 URL'); + + $form->select('copyright_prefer', '程序版权信息', function($options) { + $options->add('0', 'Powered with ❤ by Blessing Skin Server.'); + $options->add('1', 'Powered by Blessing Skin Server.'); + $options->add('2', '由 Blessing Skin Server 强力驱动.'); + $options->add('3', '自豪地采用 Blessing Skin Server.'); + })->setSelected(Option::get('copyright_prefer', 0, false)); + + $form->textarea('copyright_text', '自定义版权文字', function($textarea) { + $textarea->setRows(6); + $textarea->setDescription('自定义版权文字内可使用占位符,{site_name} 将会被自动替换为站点名称,{site_url} 会被替换为站点地址。'); + }); + + })->handle(); + + return view('admin.customize', compact('homepage')); } public function score() diff --git a/app/helpers.php b/app/helpers.php index 6f7c142a..801e070e 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -179,7 +179,24 @@ if (! function_exists('bs_menu')) { if (! function_exists('bs_copyright')) { - function bs_copyright() + function bs_copyright($prefer = null) + { + $prefer = is_null($prefer) ? Option::get('copyright_prefer', 0, false) : $prefer; + + $base64CopyrightText = [ + 'UG93ZXJlZCB3aXRoIOKdpCBieSA8YSBocmVmPSJodHRwczovL2dpdGh1Yi5jb20vcHJpbnRlbXB3L2JsZXNzaW5nLXNraW4tc2VydmVyIj5CbGVzc2luZyBTa2luIFNlcnZlcjwvYT4u', + 'UG93ZXJlZCBieSA8YSBocmVmPSJodHRwczovL2dpdGh1Yi5jb20vcHJpbnRlbXB3L2JsZXNzaW5nLXNraW4tc2VydmVyIj5CbGVzc2luZyBTa2luIFNlcnZlcjwvYT4u', + '55SxIDxhIGhyZWY9Imh0dHBzOi8vZ2l0aHViLmNvbS9wcmludGVtcHcvYmxlc3Npbmctc2tpbi1zZXJ2ZXIiPkJsZXNzaW5nIFNraW4gU2VydmVyPC9hPiDlvLrlipvpqbHliqgu', + '6Ieq6LGq5Zyw6YeH55SoIDxhIGhyZWY9Imh0dHBzOi8vZ2l0aHViLmNvbS9wcmludGVtcHcvYmxlc3Npbmctc2tpbi1zZXJ2ZXIiPkJsZXNzaW5nIFNraW4gU2VydmVyPC9hPi4=' + ]; + + return base64_decode(Arr::get($base64CopyrightText, $prefer, $base64CopyrightText[0])); + } +} + +if (! function_exists('bs_custom_copyright')) { + + function bs_custom_copyright() { return Utils::getStringReplaced(Option::get('copyright_text'), ['{site_name}' => Option::get('site_name'), '{site_url}' => Option::get('site_url')]); } diff --git a/config/options.php b/config/options.php index ad0f1c2e..beee6a13 100644 --- a/config/options.php +++ b/config/options.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-07-29 11:53:11 * @Last Modified by: printempw - * @Last Modified time: 2016-12-21 22:49:31 + * @Last Modified time: 2016-12-27 22:56:31 */ return [ @@ -38,5 +38,6 @@ return [ 'max_upload_file_size' => '1024', 'force_ssl' => '0', 'auto_detect_asset_url' => '1', - 'plugins_enabled' => '' + 'plugins_enabled' => '', + 'copyright_prefer' => '0' ]; diff --git a/resources/views/admin/customize.tpl b/resources/views/admin/customize.tpl index 43380286..c38b017e 100644 --- a/resources/views/admin/customize.tpl +++ b/resources/views/admin/customize.tpl @@ -90,49 +90,7 @@
-
-
-

首页配置

-
-
- -
- 设置已保存。
'; - } ?> - - - - - - - - - - - - - - - -
首页图片地址 - -
版权信息 - 对于任何恶意修改页面右下角的版权信息(包括不限于删除、修改作者信息、修改链接指向)的用户,作者保留对其追究责任的权力。 -
版权文字 - -

自定义版权文字内可使用占位符,{site_name} 将会被自动替换为站点名称,{site_url} 会被替换为站点地址。

-
-
- - -
+ {!! $homepage->render() !!}
diff --git a/resources/views/admin/master.tpl b/resources/views/admin/master.tpl index 3c1337ab..d5c35d1b 100644 --- a/resources/views/admin/master.tpl +++ b/resources/views/admin/master.tpl @@ -104,10 +104,10 @@
- {!! bs_copyright() !!} + {!! bs_custom_copyright() !!}
diff --git a/resources/views/index.tpl b/resources/views/index.tpl index 57604627..3d99b20b 100644 --- a/resources/views/index.tpl +++ b/resources/views/index.tpl @@ -141,10 +141,10 @@
- {!! bs_copyright() !!} + {!! bs_custom_copyright() !!}
diff --git a/resources/views/skinlib/master.tpl b/resources/views/skinlib/master.tpl index 2af30d68..ced4259c 100644 --- a/resources/views/skinlib/master.tpl +++ b/resources/views/skinlib/master.tpl @@ -128,10 +128,10 @@
- {!! bs_copyright() !!} + {!! bs_custom_copyright() !!}
diff --git a/resources/views/user/master.tpl b/resources/views/user/master.tpl index 1fb952e3..04eb84bd 100644 --- a/resources/views/user/master.tpl +++ b/resources/views/user/master.tpl @@ -107,10 +107,10 @@