add many styles for copyright text

This commit is contained in:
printempw 2016-12-27 23:05:09 +08:00
parent 5e567c48a5
commit 886b15de87
8 changed files with 49 additions and 55 deletions

View File

@ -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('自定义版权文字内可使用占位符,<code>{site_name}</code> 将会被自动替换为站点名称,<code>{site_url}</code> 会被替换为站点地址。');
});
})->handle();
return view('admin.customize', compact('homepage'));
}
public function score()

View File

@ -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')]);
}

View File

@ -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'
];

View File

@ -90,49 +90,7 @@
</div>
<div class="col-md-9">
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title">首页配置</h3>
</div><!-- /.box-header -->
<form method="post">
<input type="hidden" name="option" value="homepage">
<div class="box-body">
<?php
if (isset($_POST['option']) && $_POST['option'] == "homepage") {
Option::set('home_pic_url', $_POST['home_pic_url']);
Option::set('copyright_text', $_POST['copyright_text']);
echo '<div class="callout callout-success">设置已保存。</div>';
} ?>
<table class="table">
<tbody>
<tr>
<td class="key">首页图片地址</td>
<td class="value">
<input type="text" title="相对于首页的路径或者完整的 URL" data-toggle="tooltip" data-placement="top" class="form-control" name="home_pic_url" value="{{ option('home_pic_url') }}">
</td>
</tr>
<tr>
<td class="key">版权信息</td>
<td class="value">
对于任何恶意修改页面<b>右下角</b>的版权信息(包括不限于删除、修改作者信息、修改链接指向)的用户,作者保留对其追究责任的权力。
</td>
</tr>
<tr>
<td class="key">版权文字</td>
<td class="value">
<textarea class="form-control" rows="4" name="copyright_text">{{ option('copyright_text') }}</textarea>
<p class="description">自定义版权文字内可使用占位符,<code>{site_name}</code> 将会被自动替换为站点名称,<code>{site_url}</code> 会被替换为站点地址。</p>
</td>
</tr>
</tbody>
</table>
</div><!-- /.box-body -->
<div class="box-footer">
<button type="submit" name="submit" class="btn btn-primary">提交</button>
</div>
</form>
</div>
{!! $homepage->render() !!}
<div class="box box-default">
<div class="box-header with-border">

View File

@ -104,10 +104,10 @@
<footer class="main-footer">
<!-- YOU CAN NOT MODIFIY THE COPYRIGHT TEXT W/O PERMISSION -->
<div class="pull-right hidden-xs">
Powered with by <a href="https://github.com/printempw/blessing-skin-server">Blessing Skin Server</a>.
{!! bs_copyright() !!}
</div>
<!-- Default to the left -->
{!! bs_copyright() !!}
{!! bs_custom_copyright() !!}
</footer>
</div><!-- ./wrapper -->

View File

@ -141,10 +141,10 @@
<div class="container">
<!-- YOU CAN NOT MODIFIY THE COPYRIGHT TEXT W/O PERMISSION -->
<div class="pull-right hidden-xs">
Powered by <a href="https://github.com/printempw/blessing-skin-server">Blessing Skin Server</a>.
{!! bs_copyright() !!}
</div>
<!-- Default to the left -->
{!! bs_copyright() !!}
{!! bs_custom_copyright() !!}
</div>
</div>

View File

@ -128,10 +128,10 @@
<div class="container">
<!-- YOU CAN NOT MODIFIY THE COPYRIGHT TEXT W/O PERMISSION -->
<div class="pull-right hidden-xs">
Powered with by <a href="https://github.com/printempw/blessing-skin-server">Blessing Skin Server</a>.
{!! bs_copyright() !!}
</div>
<!-- Default to the left -->
{!! bs_copyright() !!}
{!! bs_custom_copyright() !!}
</div>
</footer>

View File

@ -107,10 +107,10 @@
<footer class="main-footer">
<!-- YOU CAN NOT MODIFIY THE COPYRIGHT TEXT W/O PERMISSION -->
<div class="pull-right hidden-xs">
Powered with by <a href="https://github.com/printempw/blessing-skin-server">Blessing Skin Server</a>.
{!! bs_copyright() !!}
</div>
<!-- Default to the left -->
{!! bs_copyright() !!}
{!! bs_custom_copyright() !!}
</footer>
</div><!-- ./wrapper -->