some enhancement

pull/185/head
mashiro 2019-12-27 09:59:12 +08:00
parent 8b77fbd380
commit 2100ccd708
2 changed files with 1067 additions and 1072 deletions

View File

@ -7,7 +7,7 @@
* @package Sakura
*/
define( 'SAKURA_VERSION', '3.3.5' );
define( 'SAKURA_VERSION', wp_get_theme()->get('Version') );
define( 'BUILD_VERSION', '3' );
//ini_set('display_errors', true);
@ -736,7 +736,7 @@ function bolo_QTnextpage_arg1() {
//Login Page style
function custom_login() {
//echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/inc/login.css" />'."\n";
echo '<link rel="stylesheet" type="text/css" href="'.get_site_url().'/wp-content/themes/Sakura/inc/login.css?'.SAKURA_VERSION.'" />'."\n";
echo '<link rel="stylesheet" type="text/css" href="'.get_template_directory_uri().'/inc/login.css?'.SAKURA_VERSION.'" />'."\n";
//echo '<script type="text/javascript" src="'.get_bloginfo('template_directory').'/js/jquery.min.js"></script>'."\n";
echo '<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/jquery/jquery@1.8.2/jquery.min.js"></script>'."\n";
}
@ -762,7 +762,7 @@ function custom_html() {
}else{
$loginbg = 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.2.7/images/hd.png';
}
echo '<script type="text/javascript" src="'.get_site_url().'/wp-content/themes/Sakura/js/login.js"></script>'."\n";
echo '<script type="text/javascript" src="'.get_template_directory_uri().'/js/login.js"></script>'."\n";
echo '<script type="text/javascript">'."\n";
echo 'jQuery("body").prepend("<div class=\"loading\"><img src=\"https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/login_loading.gif\" width=\"58\" height=\"10\"></div><div id=\"bg\"><img /></div>");'."\n";
echo 'jQuery(\'#bg\').children(\'img\').attr(\'src\', \''.$loginbg.'\').load(function(){'."\n";
@ -1124,7 +1124,7 @@ function get_wp_root_path() {
$bilismiliestrans = array();
function push_bili_smilies(){
global $bilismiliestrans;
$smiles_path = get_wp_root_path(). "/themes/Sakura/images/smilies/bili/";
$smiles_path = __DIR__. "/images/smilies/bili/";
$name = array( 'baiyan','fadai','koubi','qinqin','weiqu','bishi','fanu','kun','se','weixiao','bizui','ganga','lengmo','shengbing','wunai','chan','guilian','liubixue','shengqi','xiaoku','daku','guzhang','liuhan','shuizhao','xieyanxiao','dalao','haixiu','liulei','sikao','yiwen','dalian','heirenwenhao','miantian','tiaokan','yun','dianzan','huaixiao','mudengkoudai','tiaopi','zaijian','doge','jingxia','nanguo','touxiao','zhoumei','facai','keai','outu','tuxue','zhuakuang' );
$return_smiles = '';
for( $i=0;$i<count($name);$i++ ){
@ -1359,7 +1359,7 @@ add_filter('site_url', 'wpadmin_filter', 10, 3);
function admin_ini() {
wp_enqueue_style('admin-styles-fix-icon', get_site_url() . '/wp-includes/css/dashicons.css');
wp_enqueue_style('cus-styles-fit', get_site_url() . '/wp-content/themes/Sakura/inc/css/dashboard-fix.css');
wp_enqueue_style('cus-styles-fit', get_template_directory_uri() . '/inc/css/dashboard-fix.css');
wp_enqueue_script( 'lazyload', 'https://cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload.min.js' );
}
add_action('admin_enqueue_scripts', 'admin_ini');

View File

@ -5,9 +5,8 @@
* If the identifier changes, it'll appear as if the options have been reset.
*/
function optionsframework_option_name() {
function optionsframework_option_name()
{
// 从样式表获取主题名称
$themename = wp_get_theme();
@ -28,7 +27,8 @@ function optionsframework_option_name() {
* Frame from: https://github.com/devinsays/options-framework-plugin/
*/
function optionsframework_options() {
function optionsframework_options()
{
// 测试数据
$test_array = array(
'one' => __('1', 'sakura'),
@ -37,23 +37,22 @@ function optionsframework_options() {
'four' => __('4', 'sakura'),
'five' => __('5', 'sakura'),
'six' => __('6', 'sakura'),
'seven' => __('7', 'sakura')
'seven' => __('7', 'sakura'),
);
// 复选框数组
$multicheck_array = array(
'one' => __('1', 'sakura'),
'two' => __('2', 'sakura'),
'three' => __('3', 'sakura'),
'four' => __('4', 'sakura'),
'five' => __('5', 'sakura')
'five' => __('5', 'sakura'),
);
// 复选框默认值
$multicheck_defaults = array(
'one' => '1',
'five' => '1'
'five' => '1',
);
// 背景默认值
@ -76,7 +75,7 @@ function optionsframework_options() {
'sizes' => array('6', '12', '14', '16', '20'),
'faces' => array('Helvetica Neue' => 'Helvetica Neue', 'Arial' => 'Arial'),
'styles' => array('normal' => '普通', 'bold' => '粗体'),
'color' => false
'color' => false,
);
// 将所有分类categories加入数组
@ -93,7 +92,6 @@ function optionsframework_options() {
$options_tags[$tag->term_id] = $tag->name;
}
// 将所有页面pages加入数组
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
@ -131,7 +129,7 @@ function optionsframework_options() {
'id' => 'theme_skin',
'std' => "#FE9600",
'desc' => __('Custom theme color', 'sakura'), /*自定义主题颜色*/
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -229,7 +227,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'),
'no' => __('Close', 'sakura')
'no' => __('Close', 'sakura'),
));
$options[] = array(
@ -239,7 +237,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'standard' => __('Standard', 'sakura'), /*标准*/
'imageflow' => __('Graphic', 'sakura')/*图文*/
'imageflow' => __('Graphic', 'sakura'), /*图文*/
));
$options[] = array(
@ -249,7 +247,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'round' => __('Round', 'sakura'), /*圆形*/
'square' => __('Square', 'sakura')/*方形*/
'square' => __('Square', 'sakura'), /*方形*/
));
$options[] = array(
@ -260,7 +258,7 @@ function optionsframework_options() {
'options' => array(
'left' => __('Left', 'sakura'), /*向左对齐*/
'right' => __('Right', 'sakura'), /*向右对齐*/
'alternate' => __('Alternate', 'sakura')/*左右交替*/
'alternate' => __('Alternate', 'sakura'), /*左右交替*/
));
$options[] = array(
@ -270,7 +268,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -287,7 +285,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'ajax' => __('Ajax load', 'sakura'), /*ajax加载*/
'np' => __('Previous and next page', 'sakura')/*上一页和下一页*/
'np' => __('Previous and next page', 'sakura'), /*上一页和下一页*/
));
$options[] = array(
@ -346,7 +344,6 @@ function optionsframework_options() {
'std' => '',
'type' => 'textarea');
//第一屏
$options[] = array(
'name' => __('First screen', 'sakura'), /*第一屏*/
@ -373,9 +370,16 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'v2' => __('Merge with signature', 'sakura'), /*与签名合并*/
'v1' => __('Independent line', 'sakura')/*独立成行*/
'v1' => __('Independent line', 'sakura'), /*独立成行*/
));
$options[] = array(
'name' => __('Cover manifest', 'sakura'), /*封面图片库*/
'desc' => sprintf(__('Fill in the manifest path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "https: //github.com/mashirozx/Sakura/wiki/options">Wiki </a>. Click <a href = "%s">here</a> to update manifest', 'sakura'), rest_url('sakura/v1/database/update')), /*填写 manifest 路径 用于随机图片展示最后不用加斜杠https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href="https://github.com/mashirozx/Sakura/wiki/options">Wiki</a>*/
'id' => 'cover_cdn',
'std' => 'https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3',
'type' => 'text');
$options[] = array(
'name' => __('full-screen display', 'sakura'), /*全屏显示*/
'desc' => __('Default on, check off', 'sakura'), /*默认开启,勾选关闭*/
@ -421,7 +425,7 @@ function optionsframework_options() {
'filter-undertint' => __('Undertint', 'sakura'), /*浅色*/
'filter-dim' => __('Dim', 'sakura'), /*暗淡*/
'filter-grid' => __('Grid', 'sakura'), /*网格*/
'filter-dot' => __('Dot', 'sakura')/*点点*/
'filter-dot' => __('Dot', 'sakura'), /*点点*/
));
$options[] = array(
@ -438,7 +442,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'left_and_right' => __('Alternate left and right', 'sakura'), /*左右交替*/
'bottom_to_top' => __('From bottom to top', 'sakura')/*从下往上*/
'bottom_to_top' => __('From bottom to top', 'sakura'), /*从下往上*/
));
$options[] = array(
@ -533,7 +537,6 @@ function optionsframework_options() {
'std' => '#',
'type' => 'text');
//文章页
$options[] = array(
'name' => __('Post page', 'sakura'), /*文章页*/
@ -556,7 +559,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -566,7 +569,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -576,7 +579,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -586,7 +589,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -601,7 +604,6 @@ function optionsframework_options() {
'id' => 'wechat_code',
'type' => 'upload');
//社交选项
$options[] = array(
'name' => __('Social network', 'sakura'), /*社交网络*/
@ -750,7 +752,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_a',
'std' => "#c6742b",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -758,7 +760,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_b',
'std' => "#d88e4c",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -766,7 +768,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_c',
'std' => "#695644",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -774,7 +776,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_d',
'std' => "#a19780",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -782,7 +784,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_base',
'std' => "#e5f8ff",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions used to color any SVG icons.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -790,7 +792,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_focus',
'std' => "#fff",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions used to color any SVG icons.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -798,7 +800,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_current',
'std' => "#fff",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions used to color any SVG icons.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -875,13 +877,6 @@ function optionsframework_options() {
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Cover manifest', 'sakura'),/*封面图片库*/
'desc' => sprintf(__('Fill in the manifest path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "https: //github.com/mashirozx/Sakura/wiki/options">Wiki </a>. Click <a href = "%s">here</a> to update manifest', 'sakura'), rest_url('sakura/v1/database/update')),/*填写 manifest 路径 用于随机图片展示最后不用加斜杠https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href="https://github.com/mashirozx/Sakura/wiki/options">Wiki</a>*/
'id' => 'cover_cdn',
'std' => 'https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3',
'type' => 'text');
$options[] = array(
'name' => __('Use the front-end library locally (lib.js、lib.css)', 'sakura'), /*本地调用前端库lib.js、lib.css*/
'desc' => __('The front-end library don\'t load from jsDelivr, not recommand', 'sakura'), /*前端库不走 jsDelivr不建议启用*/
@ -916,8 +911,8 @@ function optionsframework_options() {
'type' => "images",
'options' => array(
'tag' => 'https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square',
'tag2' => 'https://img.shields.io/github/commits-since/mashirozx/Sakura/v'.SAKURA_VERSION.'/dev.svg?style=flat-square'
)
'tag2' => 'https://img.shields.io/github/commits-since/mashirozx/Sakura/v' . SAKURA_VERSION . '/dev.svg?style=flat-square',
),
);
$options[] = array(
@ -990,7 +985,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'wp_statistics' => __('WP-Statistics plugin (Professional statistics, can exclude invalid access)', 'sakura'), /*WP-Statistics 插件(专业性统计,可排除无效访问)*/
'theme_build_in' => __('Theme built-in (simple statistics, calculate each page access request)', 'sakura')/*主题内建(简单的统计,计算每一次页面访问请求)*/
'theme_build_in' => __('Theme built-in (simple statistics, calculate each page access request)', 'sakura'), /*主题内建(简单的统计,计算每一次页面访问请求)*/
));
$options[] = array(
@ -1013,7 +1008,7 @@ function optionsframework_options() {
'options' => array(
'imgur' => __('Imgur (https://imgur.com)', 'sakura'),
'smms' => __('SM.MS (https://sm.ms)', 'sakura'),
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura')
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura'),
));
$options[] = array(