feat: add feature switches for cc (#183)

pull/230/head
Seaton Jiang 2020-03-16 11:43:06 +08:00
parent 1b789393d3
commit 2f4859b06f
3 changed files with 30 additions and 16 deletions

View File

@ -16,6 +16,14 @@ jQuery(document).ready(function($) {
$('#section-'+id+'_links').show();
}
jQuery('#g_cc_switch').click(function() {
jQuery('#section-g_cc').fadeToggle(400);
});
if (jQuery('#g_cc_switch:checked').val() !== undefined) {
jQuery('#section-g_cc').show();
}
jQuery('#g_donate').click(function() {
jQuery('#section-g_donate_alipay').fadeToggle(400);
jQuery('#section-g_donate_wechat').fadeToggle(400);

View File

@ -231,10 +231,17 @@ function kratos_options()
$options[] = array(
'name' => __('知识共享协议', 'kratos'),
'desc' => __('开启文章知识共享协议', 'kratos'),
'id' => 'g_cc_switch',
'type' => 'checkbox',
);
$options[] = array(
'desc' => __('选择文章的知识共享协议', 'kratos'),
'id' => 'g_cc',
'std' => 'one',
'type' => 'select',
'class' => 'hidden',
'options' => $cc_array,
);

View File

@ -3,7 +3,7 @@
* 文章内容
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2020.03.14
* @version 2020.03.16
*/
get_header(); ?>
@ -87,21 +87,20 @@ get_header(); ?>
}
?>
</div>
<div class="copyright">
<span class="text-center">
<?php
$cc_array = array(
'one' => __('知识共享署名 4.0 国际许可协议', 'kratos'),
'two' => __('知识共享署名-非商业性使用 4.0 国际许可协议', 'kratos'),
'three' => __('知识共享署名-禁止演绎 4.0 国际许可协议', 'kratos'),
'four' => __('知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议', 'kratos'),
'five' => __('知识共享署名-相同方式共享 4.0 国际许可协议', 'kratos'),
'six' => __('知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议', 'kratos'),
);
$select_cc = $cc_array[kratos_option('g_cc', 'one')];
printf( __( '本作品采用 %s 进行许可','kratos' ) , $select_cc );?>
</span>
</div>
<?php if(kratos_option('g_cc_switch', false)){
$cc_array = array(
'one' => __('知识共享署名 4.0 国际许可协议', 'kratos'),
'two' => __('知识共享署名-非商业性使用 4.0 国际许可协议', 'kratos'),
'three' => __('知识共享署名-禁止演绎 4.0 国际许可协议', 'kratos'),
'four' => __('知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议', 'kratos'),
'five' => __('知识共享署名-相同方式共享 4.0 国际许可协议', 'kratos'),
'six' => __('知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议', 'kratos'),
);
$select_cc = $cc_array[kratos_option('g_cc', 'one')];
echo '<div class="copyright"><span class="text-center">';
printf( __( '本作品采用 %s 进行许可','kratos' ) , $select_cc );
echo '</span></div>';
} ?>
<div class="footer clearfix">
<div class="tags float-left">
<span><?php _e('标签:' , 'kratos'); ?></span>