9
404.php
|
@ -14,7 +14,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title itemprop="name"><?php global $page, $paged;wp_title( '-', true, 'right' );
|
||||
bloginfo( 'name' );$site_description = get_bloginfo( 'description', 'display' );
|
||||
if ( $site_description && ( is_home() || is_front_page() ) ) echo " - $site_description";if ( $paged >= 2 || $page >= 2 ) echo ' - ' . sprintf( __( '第 %s 页'), max( $paged, $page ) );?>
|
||||
if ( $site_description && ( is_home() || is_front_page() ) ) echo " - $site_description";if ( $paged >= 2 || $page >= 2 ) echo ' - ' . sprintf( __( 'page %s'), max( $paged, $page ) );/*第 %s 页*/?>
|
||||
</title>
|
||||
<link type="text/css" media="all" href="https://cdn.jsdelivr.net/gh/moezx/cdn@3.2.2/css/lib.css" rel="stylesheet" />
|
||||
<?php wp_head(); ?>
|
||||
|
@ -43,12 +43,11 @@ if (!no_report) httpGet(report_url);
|
|||
<div class="anim-icon" id="404" style="height: 66%;"></div>
|
||||
</div>
|
||||
<div class="err-button back">
|
||||
<a id="golast" href=javascript:history.go(-1);>返回上一页</a>
|
||||
<a id="gohome" href="<?php bloginfo('url');?>">返回主页</a>
|
||||
<a id="golast" href=javascript:history.go(-1);><?php _e('return to previous page','sakura');/*返回上一页*/?></a>
|
||||
<a id="gohome" href="<?php bloginfo('url');?>"><?php _e('return to home page','sakura');/*返回主页*/?></a>
|
||||
</div>
|
||||
<div style="display:block; width:284px;margin: auto;">
|
||||
<p style="margin-bottom: 1em;margin-top: 1.5em;text-align: center;font-size: 15px;">别急,试试站内搜索?</p>
|
||||
<p style="margin-bottom: 1em;text-align: center;font-size: 15px;">Don't worry, search in site?</p>
|
||||
<p style="margin-bottom: 1em;margin-top: 1.5em;text-align: center;font-size: 15px;"><?php _e('Don\'t worry, search in site?','sakura');/*别急,试试站内搜索?*/?></p>
|
||||
<form class="s-search" method="get" action="/" role="search">
|
||||
<i class="iconfont icon-search" style="bottom: 8px;left: 12px;"></i>
|
||||
<input class="text-input" style="padding: 8px 20px 8px 46px;" type="search" name="s" placeholder="<?php _e('Search...', 'akina') ?>" required>
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
Sakura🌸: A Wonderful WordPress Theme
|
||||
===
|
||||
|
||||
[中文](README.md) | Engilsh
|
||||
|
||||
![Sakura](https://view.moezx.cc/images/2018/05/26/sakura.png)
|
||||
|
||||
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square)
|
||||
![WP version](https://img.shields.io/badge/WordPress-5.0+-0073aa.svg?style=flat-square)
|
||||
[![GitHub release](https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square)](https://github.com/mashirozx/Sakura/releases/latest)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest/dev.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/dev)
|
||||
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
|
||||
|
||||
Modified based on theme [Akina (by Fuzzz)](http://www.akina.pw/themeakina) and [Siren (by Louie)](https://github.com/louie-senpai/Siren).
|
||||
|
||||
The rebuild version is on the way :)
|
||||
|
||||
### Install
|
||||
|
||||
#### By GIT
|
||||
```bash
|
||||
cd /wp-content/themes/
|
||||
git clone https://github.com/mashirozx/Sakura.git
|
||||
```
|
||||
|
||||
#### By FTP
|
||||
**Rename the theme folder name as `Sakura`** if you download form the green [Clone or download] button on this page. Make sure the path to the theme root is /wp-content/themes/Sakura/`.
|
||||
|
||||
### Configuration
|
||||
Config your theme at `Mune-Appearance-Sakura Options`. Please turn on `Use js and css file of the theme locally` under CDN tag if you want to modify local SCC an Javascript files.
|
||||
|
||||
### Update
|
||||
```bash
|
||||
cd /wp-content/themes/Sakura
|
||||
git fetch
|
||||
git pull
|
||||
```
|
||||
|
||||
[Learn more info about the theme (Chinese)](https://2heng.xin/theme-sakura/)
|
||||
|
||||
Enjoy it!
|
||||
|
||||
### Donate
|
||||
[WeChat Pay](https://view.moezx.cc/images/2018/05/28/WeChanQR.png) | [AliPay](https://view.moezx.cc/images/2018/05/28/AliPayQR.jpg) | [PayPal](https://paypal.me/mashirozx)
|
||||
|
||||
### Need a server?
|
||||
[![](https://www.vultr.com/media/banners/banner_728x90.png)](https://www.vultr.com/?ref=7674346)
|
18
README.md
|
@ -1,19 +1,23 @@
|
|||
Sakura🌸: A Wonderful WordPress Theme
|
||||
Sakura🌸: 樱花庄的白猫博客主题
|
||||
===
|
||||
|
||||
中文 | [Engilsh](README-en.md)
|
||||
|
||||
![Sakura](https://view.moezx.cc/images/2018/05/26/sakura.png)
|
||||
|
||||
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square)
|
||||
![WP version](https://img.shields.io/badge/WordPress-5.0+-0073aa.svg?style=flat-square)
|
||||
[![GitHub release](https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square)](https://github.com/mashirozx/Sakura/releases/latest)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/)
|
||||
![PHP version](https://shader.2heng.xin/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
|
||||
![WP version](https://shader.2heng.xin/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
|
||||
[![GitHub release](https://img.shields.io/github/v/release/mashirozx/Sakura.svg?style=flat-square&logo=github)](https://github.com/mashirozx/Sakura/releases/latest)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest/dev.svg?style=flat-square&logo=git&color=important)](https://github.com/mashirozx/Sakura/commits/dev)
|
||||
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
|
||||
|
||||
在 Louie 基于 Fuzzz 的 [Akina](http://www.akina.pw/themeakina) 主题修改的主题 [Siren](https://github.com/louie-senpai/Siren) 基础上三次修改 =.=
|
||||
|
||||
两位前辈做得已经很棒了,或许我所做的只是把他们的代码弄得凌乱不堪吧 :)
|
||||
|
||||
注意:建议 `git clone` 下载([简易 Git 使用指南](https://github.com/mashirozx/Sakura/wiki/Git-%E4%B8%8B%E8%BD%BD%E3%80%81%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97));如果选择下载压缩包,解压后记得把文件夹名改回 `Sakura`,也即保证主题路径为 `/wp-content/themes/Sakura/`;请留意主题说明里的其他注意事项。
|
||||
特别感谢 [@Spirit](https://github.com/spirit1431007) 对本项目的贡献!
|
||||
|
||||
注意:建议 `git clone` 下载([简易 Git 使用指南](https://github.com/mashirozx/Sakura/wiki/Git-%E4%B8%8B%E8%BD%BD%E3%80%81%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97));如果选择下载压缩包,**解压后记得把文件夹名改回 `Sakura`,也即保证主题路径为 `/wp-content/themes/Sakura/`**;主题设置在 `菜单-外观-Sakura 主题设置` 中;DIY 的时候建议采用[子主题](https://github.com/mashirozx/Sakura/tree/child) 并勾选 `Sakura 主题设置-CDN-本地调用主题 js、css 文件`;请留意主题说明里的其他注意事项。
|
||||
|
||||
主题使用说明见:<https://2heng.xin/theme-sakura/>
|
||||
|
||||
|
@ -27,4 +31,4 @@
|
|||
[微信支付](https://view.moezx.cc/images/2018/05/28/WeChanQR.png) | [支付宝](https://view.moezx.cc/images/2018/05/28/AliPayQR.jpg) | [PayPal](https://paypal.me/mashirozx)
|
||||
|
||||
### 需要服务器吗?
|
||||
<a href="https://www.vultr.com/?ref=7674346"><img src="https://www.vultr.com/media/banner_3.png" width="300" height="250"></a>
|
||||
[![](https://www.vultr.com/media/banners/banner_728x90.png)](https://www.vultr.com/?ref=7674346)
|
||||
|
|
|
@ -52,7 +52,7 @@ get_header(); ?>
|
|||
|
||||
</main><!-- #main -->
|
||||
<?php if ( akina_option('pagenav_style') == 'ajax') { ?>
|
||||
<div id="pagination" <?php if(akina_option('image_category') && is_category(explode(',',akina_option('image_category')))) echo 'class="pagination-archive"'; ?>><?php next_posts_link(__('Previous')); ?></div>
|
||||
<div id="pagination" <?php if(akina_option('image_category') && is_category(explode(',',akina_option('image_category')))) echo 'class="pagination-archive"'; ?>><?php next_posts_link(' Previous'); ?></div>
|
||||
<div id="add_post"><span id="add_post_time" style="visibility: hidden;" title="<?php echo akina_option('auto_load_post',''); ?>" ></span></div>
|
||||
<?php }else{ ?>
|
||||
<nav class="navigator">
|
||||
|
@ -62,5 +62,4 @@ get_header(); ?>
|
|||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
|
@ -73,7 +73,7 @@ get_header();
|
|||
|
||||
</main><!-- #main -->
|
||||
<?php if ( akina_option('pagenav_style') == 'ajax') { ?>
|
||||
<div id="pagination"><?php next_posts_link(__('Previous')); ?></div>
|
||||
<div id="pagination"><?php next_posts_link(' Previous'); ?></div>
|
||||
<div id="add_post"><span id="add_post_time" style="visibility: hidden;" title="<?php echo akina_option('auto_load_post',''); ?>" ></span></div>
|
||||
<?php }else{ ?>
|
||||
<nav class="navigator">
|
||||
|
@ -83,5 +83,4 @@ get_header();
|
|||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*! Generate by Mashiro. Fri Jan 25 09:41:42 2019*//*!
|
||||
/*! Generate by Mashiro. Mon Dec 23 09:48:25 2019*//*!
|
||||
* baguetteBox.js
|
||||
* @author feimosi
|
||||
* @version 1.11.0
|
||||
|
|
|
@ -924,6 +924,6 @@
|
|||
}
|
||||
|
||||
/*other fix*/
|
||||
.entry-content ol, ul {
|
||||
.entry-content ol,.entry-content ul {
|
||||
margin: auto !important;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,27 +55,34 @@
|
|||
position: relative
|
||||
}
|
||||
|
||||
.entry-content h3, .entry-content h4, .entry-content h5 {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.entry-content h3 {
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px dashed #ddd;
|
||||
color: #737373
|
||||
}
|
||||
|
||||
.entry-content h3:before {
|
||||
.entry-content h3:after {
|
||||
content: "#";
|
||||
margin-right: 5px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: #FF6D6D
|
||||
}
|
||||
|
||||
.entry-content h4:before {
|
||||
.entry-content h4:after {
|
||||
content: ">";
|
||||
margin-right: 5px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: #FF6D6D
|
||||
}
|
||||
|
||||
.entry-content h5:before {
|
||||
.entry-content h5:after {
|
||||
content: "?";
|
||||
margin-right: 5px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: #FF6D6D
|
||||
}
|
||||
|
||||
|
|
35
comments.php
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*if('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
||||
die(esc_html__('Please do not load this page directly.', 'akina'));*/
|
||||
die(__('Please do not load this page directly.', 'akina'));*/
|
||||
|
||||
if(post_password_required()){
|
||||
return;
|
||||
|
@ -18,13 +18,13 @@
|
|||
<section id="comments" class="comments">
|
||||
|
||||
<div class="commentwrap comments-hidden">
|
||||
<div class="notification"><i class="iconfont icon-mark"></i><?php esc_html_e('查看评论', 'akina'); ?> -
|
||||
<span class="noticom"><?php comments_number('NOTHING', '1 条评论', '% 条评论'); ?> </span>
|
||||
<div class="notification"><i class="iconfont icon-mark"></i><?php _e('view comments', 'sakura'); /*查看评论*/?> -
|
||||
<span class="noticom"><?php comments_number('NOTHING', '1'.__(" comment","sakura"), '%'.__(" comments","sakura")); ?> </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="comments-main">
|
||||
<h3 id="comments-list-title">Comments | <span class="noticom"><?php comments_number('NOTHING', '1 条评论', '% 条评论'); ?> </span></h3>
|
||||
<h3 id="comments-list-title">Comments | <span class="noticom"><?php comments_number('NOTHING', '1'.__(" comment","sakura"), '%'.__(" comments","sakura")); ?> </span></h3>
|
||||
<div id="loading-comments"><span></span></div>
|
||||
<?php if(have_comments()): ?>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
<?php if(comments_open()): ?>
|
||||
<div class="commentwrap">
|
||||
<div class="notification-hidden"><i class="iconfont icon-mark"></i> <?php esc_html_e('暂无评论', 'akina'); ?></div>
|
||||
<div class="notification-hidden"><i class="iconfont icon-mark"></i> <?php _e('no comment', 'sakura'); /*暂无评论*/?></div>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -50,21 +50,22 @@
|
|||
<?php
|
||||
|
||||
if(comments_open()){
|
||||
if(akina_option('norobot')) $robot_comments = '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="no-robot"><span class="siren-no-robot-checkbox siren-checkbox-radioInput"></span>滴,学生卡 | I\'m not a robot</label>';
|
||||
$private_ms = akina_option('open_private_message') ? '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="is-private"><span class="siren-is-private-checkbox siren-checkbox-radioInput"></span>悄悄话 | Comment in private</label>' : '';
|
||||
if(akina_option('norobot')) $robot_comments = '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="no-robot"><span class="siren-no-robot-checkbox siren-checkbox-radioInput"></span>'.__('I\'m not a robot', 'sakura').'</label>';
|
||||
$private_ms = akina_option('open_private_message') ? '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="is-private"><span class="siren-is-private-checkbox siren-checkbox-radioInput"></span>'.__('Comment in private', 'sakura').'</label>' : '';
|
||||
$mail_notify = akina_option('mail_notify') ? '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="mail-notify"><span class="siren-mail-notify-checkbox siren-checkbox-radioInput"></span>'.__('Comment reply notify', 'sakura').'</label>' : '';
|
||||
$args = array(
|
||||
'id_form' => 'commentform',
|
||||
'id_submit' => 'submit',
|
||||
'title_reply' => '',
|
||||
'title_reply_to' => '<div class="graybar"><i class="fa fa-comments-o"></i>' . esc_html__('Leave a Reply to', 'akina') . ' %s' . '</div>',
|
||||
'cancel_reply_link' => esc_html__('Cancel Reply', 'akina'),
|
||||
'label_submit' => esc_html__('BiuBiuBiu~', 'akina'),
|
||||
'comment_field' => '<p><i class="iconfont icon-markdown"></i> Markdown Supported while <i class="fa fa-code" aria-hidden="true"></i> Forbidden</p><div class="comment-textarea"><textarea placeholder="' . esc_attr__('你是我一生只会遇见一次的惊喜', 'akina') . ' ..." name="comment" class="commentbody" id="comment" rows="5" tabindex="4"></textarea><label class="input-label">你是我一生只会遇见一次的惊喜 ...</label></div>
|
||||
'title_reply_to' => '<div class="graybar"><i class="fa fa-comments-o"></i>' . __('Leave a Reply to', 'sakura') . ' %s' . '</div>',
|
||||
'cancel_reply_link' => __('Cancel Reply', 'sakura'),
|
||||
'label_submit' => __('BiuBiuBiu~', 'sakura'),
|
||||
'comment_field' => '<p style="font-style:italic"><a href="https://segmentfault.com/markdown" target="_blank"><i class="iconfont icon-markdown" style="color:#000"></i></a> Markdown Supported while <i class="fa fa-code" aria-hidden="true"></i> Forbidden</p><div class="comment-textarea"><textarea placeholder="' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ..." name="comment" class="commentbody" id="comment" rows="5" tabindex="4"></textarea><label class="input-label">' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ...</label></div>
|
||||
<div id="upload-img-show"></div>
|
||||
<!--插入表情面版-->
|
||||
<p id="emotion-toggle" class="no-select">
|
||||
<span class="emotion-toggle-off">戳我试试 OωO</span>
|
||||
<span class="emotion-toggle-on">嘿嘿嘿 ヾ(≧∇≦*)ゝ</span>
|
||||
<span class="emotion-toggle-off">' . __("Click me OωO", "sakura")/*戳我试试 OωO*/ . '</span>
|
||||
<span class="emotion-toggle-on">' . __("Woooooow ヾ(≧∇≦*)ゝ", "sakura")/*嘿嘿嘿 ヾ(≧∇≦*)ゝ*/ . '</span>
|
||||
</p>
|
||||
<div class="emotion-box no-select">
|
||||
<table class="motion-switcher-table">
|
||||
|
@ -89,13 +90,13 @@
|
|||
'fields' => apply_filters( 'comment_form_default_fields', array(
|
||||
'avatar' => '<div class="cmt-info-container"><div class="comment-user-avatar"><img src="https://gravatar.shino.cc/avatar/f11f237b3de93c93b24045e71f7f65c6?s=80&d=mm&r=g"><div class="socila-check qq-check"><i class="fa fa-qq" aria-hidden="true"></i></div><div class="socila-check gravatar-check"><i class="fa fa-google" aria-hidden="true"></i></div></div>',
|
||||
'author' =>
|
||||
'<div class="popup cmt-popup cmt-author" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -115px;width: 230px;">输入QQ号将自动拉取昵称和头像</span><input type="text" placeholder="' . esc_attr__('昵称或QQ号', 'akina') . ' ' . ( $req ? '(' . esc_attr__('必须 Name* ', 'akina') . ')' : '') . '" name="author" id="author" value="' . esc_attr($comment_author) . '" size="22" autocomplete="off" tabindex="1" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'<div class="popup cmt-popup cmt-author" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -115px;width: 230px;">' . __("Auto pull nickname and avatar with a QQ num. entered", "sakura")/*输入QQ号将自动拉取昵称和头像*/ . '</span><input type="text" placeholder="' . __("Nickname or QQ number", "sakura") /*昵称或QQ号*/. ' ' . ( $req ? '(' . __("Name* ", "sakura") . ')' : '') . '" name="author" id="author" value="' . esc_attr($comment_author) . '" size="22" autocomplete="off" tabindex="1" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'email' =>
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -65px;width: 130px;">你将收到回复通知</span><input type="text" placeholder="' . esc_attr__('邮箱', 'akina') . ' ' . ( $req ? '(' . esc_attr__('必须 Email* ', 'akina') . ')' : '') . '" name="email" id="email" value="' . esc_attr($comment_author_email) . '" size="22" tabindex="1" autocomplete="off" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -65px;width: 130px;">' . __("You will receive notification by email", "sakura")/*你将收到回复通知*/ . '</span><input type="text" placeholder="' . __("email", "sakura") . ' ' . ( $req ? '(' . __("Must* ", "sakura") . ')' : '') . '" name="email" id="email" value="' . esc_attr($comment_author_email) . '" size="22" tabindex="1" autocomplete="off" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'url' =>
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -55px;width: 110px;">禁止小广告😀</span><input type="text" placeholder="' . esc_attr__('网站 (选填 Site)', 'akina') . '" name="url" id="url" value="' . esc_attr($comment_author_url) . '" size="22" autocomplete="off" tabindex="1" /></div></div>' . $robot_comments . $private_ms ,
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -55px;width: 110px;">' . __("Advertisement is forbidden 😀", "sakura")/*禁止小广告😀*/ . '</span><input type="text" placeholder="' . __("Site", "sakura") . '" name="url" id="url" value="' . esc_attr($comment_author_url) . '" size="22" autocomplete="off" tabindex="1" /></div></div>' . $robot_comments . $private_ms . $mail_notify ,
|
||||
'qq' =>
|
||||
'<input type="text" placeholder="' . esc_attr__('QQ', 'akina') . '" name="new_field_qq" id="qq" value="' . esc_attr($comment_author_url) . '" style="display:none" autocomplete="off"/><!--此栏不可见-->'
|
||||
'<input type="text" placeholder="QQ" name="new_field_qq" id="qq" value="' . esc_attr($comment_author_url) . '" style="display:none" autocomplete="off"/><!--此栏不可见-->'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
$img_array = glob("gallery/*.{gif,jpg,png}",GLOB_BRACE);
|
||||
|
||||
$img = array_rand($img_array);
|
||||
|
||||
$imgurl=$img_array[$img];
|
||||
|
||||
if($imgurl) {
|
||||
header("Location: " . $imgurl);
|
||||
exit();
|
||||
} else {
|
||||
exit('error');
|
||||
}
|
||||
?>
|
Before Width: | Height: | Size: 486 KiB |
Before Width: | Height: | Size: 732 KiB |
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
$img_array = glob("gallery/*.{gif,jpg,png}",GLOB_BRACE);
|
||||
|
||||
$img = array_rand($img_array);
|
||||
|
||||
$imgurl=$img_array[$img];
|
||||
|
||||
if($imgurl) {
|
||||
header("Location: " . $imgurl);
|
||||
exit();
|
||||
} else {
|
||||
exit('error');
|
||||
}
|
||||
?>
|
34
footer.php
|
@ -59,7 +59,7 @@
|
|||
</div>
|
||||
<div class="m-search">
|
||||
<form class="m-search-form" method="get" action="<?php echo home_url(); ?>" role="search">
|
||||
<input class="m-search-input" type="search" name="s" placeholder="<?php _e('搜索...', 'akina') ?>" required>
|
||||
<input class="m-search-input" type="search" name="s" placeholder="<?php _e('Search...', 'sakura') /*搜索...*/?>" required>
|
||||
</form>
|
||||
</div>
|
||||
<?php wp_nav_menu( array( 'depth' => 2, 'theme_location' => 'primary', 'container' => false ) ); ?>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<?php if(akina_option('live_search')){ ?>
|
||||
<div class="micro">
|
||||
<i class="iconfont icon-search"></i>
|
||||
<input id="search-input" class="text-input" type="search" name="s" placeholder="<?php _e('想要找点什么呢?', 'akina') ?>" required>
|
||||
<input id="search-input" class="text-input" type="search" name="s" placeholder="<?php _e('Want to find something?', 'sakura') /*想要找点什么呢*/?>" required>
|
||||
</div>
|
||||
<div class="ins-section-wrapper">
|
||||
<a id="Ty" href="#"></a>
|
||||
|
@ -80,9 +80,9 @@
|
|||
</div>
|
||||
<?php }else{ ?>
|
||||
<div class="micro">
|
||||
<p class="micro mb-"><?php _e('想要找点什么呢?', 'akina') ?></p>
|
||||
<p class="micro mb-"><?php _e('Want to find something?', 'sakura') /*想要找点什么呢*/?></p>
|
||||
<i class="iconfont icon-search"></i>
|
||||
<input class="text-input" type="search" name="s" placeholder="<?php _e('Search', 'akina') ?>" required>
|
||||
<input class="text-input" type="search" name="s" placeholder="<?php _e('Search', 'sakura') ?>" required>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
@ -139,16 +139,24 @@
|
|||
</div>
|
||||
</div>
|
||||
<canvas id="night-mode-cover"></canvas>
|
||||
<?php if (akina_option('sakura_widget')) : ?>
|
||||
<aside id="secondary" class="widget-area" role="complementary" style="left: -400px;">
|
||||
<div class="heading"><?php _e('Widgets') /*小工具*/ ?></div>
|
||||
<div class="sakura_widget">
|
||||
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sakura_widget')) : endif; ?>
|
||||
</div>
|
||||
<div class="show-hide-wrap"><button class="show-hide"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"></path></svg></button></div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
<?php if (akina_option('playlist_id', '')): ?>
|
||||
<div id="aplayer-float" style="z-index: 100;"
|
||||
class="aplayer"
|
||||
data-id="<?php echo akina_option('playlist_id', ''); ?>"
|
||||
data-server="netease"
|
||||
data-type="playlist"
|
||||
data-fixed="true"
|
||||
data-theme="orange">
|
||||
</div>
|
||||
<style>.skin-menu{left:auto;right:10px;}.changeSkin-gear{left:auto;right:5px;}</style>
|
||||
<div id="aplayer-float" style="z-index: 100;"
|
||||
class="aplayer"
|
||||
data-id="<?php echo akina_option('playlist_id', ''); ?>"
|
||||
data-server="netease"
|
||||
data-type="playlist"
|
||||
data-fixed="true"
|
||||
data-theme="orange">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
1969
functions.php
|
@ -32,7 +32,7 @@ Theme by Mashiro
|
|||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
|
||||
<title itemprop="name"><?php global $page, $paged;wp_title( '-', true, 'right' );
|
||||
bloginfo( 'name' );$site_description = get_bloginfo( 'description', 'display' );
|
||||
if ( $site_description && ( is_home() || is_front_page() ) ) echo " - $site_description";if ( $paged >= 2 || $page >= 2 ) echo ' - ' . sprintf( __( '第 %s 页'), max( $paged, $page ) );?>
|
||||
if ( $site_description && ( is_home() || is_front_page() ) ) echo " - $site_description";if ( $paged >= 2 || $page >= 2 ) echo ' - ' . sprintf( __( 'page %s ','sakura'), max( $paged, $page ) );/*第 %s 页*/?>
|
||||
</title>
|
||||
<?php
|
||||
if (akina_option('akina_meta') == true) {
|
||||
|
@ -78,8 +78,7 @@ window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}
|
|||
<?php endif; ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<?php if(get_template_directory_uri() != get_site_url().'/wp-content/themes/Sakura') echo '<div style="position:fixed;height:100%;width:100%;top:0;left:0;font-size:20px;z-index:999999;background-color: #fff;">Plz rename the theme folder name as <span style="color:red">Sakura</span>!<br>请将主题文件夹名改为 <span style="color:red">Sakura</span>!</div>'; ?>
|
||||
<div class="scrollbar" id="bar"></div>
|
||||
<div class="scrollbar" id="bar"></div>
|
||||
<section id="main-container">
|
||||
<?php
|
||||
if(!akina_option('head_focus')){
|
||||
|
|
|
@ -17,7 +17,7 @@ class Parsedown
|
|||
{
|
||||
# ~
|
||||
|
||||
const version = '1.7.1';
|
||||
const version = '1.7.3';
|
||||
|
||||
# ~
|
||||
|
||||
|
@ -429,7 +429,21 @@ class Parsedown
|
|||
|
||||
if (isset($matches[1]))
|
||||
{
|
||||
$class = 'language-'.$matches[1];
|
||||
/**
|
||||
* https://www.w3.org/TR/2011/WD-html5-20110525/elements.html#classes
|
||||
* Every HTML element may have a class attribute specified.
|
||||
* The attribute, if specified, must have a value that is a set
|
||||
* of space-separated tokens representing the various classes
|
||||
* that the element belongs to.
|
||||
* [...]
|
||||
* The space characters, for the purposes of this specification,
|
||||
* are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab),
|
||||
* U+000A LINE FEED (LF), U+000C FORM FEED (FF), and
|
||||
* U+000D CARRIAGE RETURN (CR).
|
||||
*/
|
||||
$language = substr($matches[1], 0, strcspn($matches[1], " \t\n\f\r"));
|
||||
|
||||
$class = 'language-'.$language;
|
||||
|
||||
$Element['attributes'] = array(
|
||||
'class' => $class,
|
||||
|
|
BIN
inc/QQWry.Dat
|
@ -0,0 +1,421 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Router
|
||||
*/
|
||||
add_action('rest_api_init', function () {
|
||||
register_rest_route('sakura/v1', '/image/upload', array(
|
||||
'methods' => 'POST',
|
||||
'callback' => 'upload_image',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/cache_search/json', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'cache_search_json',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/image/cover', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'cover_gallery',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/image/feature', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'feature_gallery',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/database/update', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'update_database',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/qqinfo/json', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'get_qq_info',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/qqinfo/avatar', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'get_qq_avatar',
|
||||
));
|
||||
});
|
||||
|
||||
/**
|
||||
* QQ info
|
||||
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/json
|
||||
*/
|
||||
function get_qq_info(WP_REST_Request $request)
|
||||
{
|
||||
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
|
||||
$output = array(
|
||||
'status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.'
|
||||
);
|
||||
} elseif ($_GET['qq']) {
|
||||
$qq = $_GET['qq'];
|
||||
/**
|
||||
* TODO: 设置host,国外服务器默认解析的不是国内IP,可能无法获取数据
|
||||
* 182.254.92.32 r.qzone.qq.com
|
||||
* 参考:https://www.php.net/manual/zh/function.file-get-contents.php#108309
|
||||
*/
|
||||
$get_info = file_get_contents('http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=' . $qq);
|
||||
$get_info = mb_convert_encoding($get_info, "UTF-8", "GBK");
|
||||
$name = json_decode(substr($get_info, 17, -1), true);
|
||||
if ($name) {
|
||||
$output = array(
|
||||
'status' => 200,
|
||||
'success' => true,
|
||||
'message' => 'success',
|
||||
'avatar' => 'https://q.qlogo.cn/headimg_dl?dst_uin=' . $qq . '&spec=100',
|
||||
'name' => $name[$qq][6],
|
||||
);
|
||||
} else {
|
||||
$output = array(
|
||||
'status' => 404,
|
||||
'success' => false,
|
||||
'message' => 'QQ number not exist.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$output = array(
|
||||
'status' => 400,
|
||||
'success' => false,
|
||||
'message' => 'Bad Request'
|
||||
);
|
||||
}
|
||||
|
||||
$result = new WP_REST_Response($output, $output['status']);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Image uploader response
|
||||
*/
|
||||
function upload_image(WP_REST_Request $request)
|
||||
{
|
||||
// see: https://developer.wordpress.org/rest-api/requests/
|
||||
|
||||
// handle file params $file === $_FILES
|
||||
/**
|
||||
* curl \
|
||||
* -F "filecomment=This is an img file" \
|
||||
* -F "cmt_img_file=@screenshot.jpg" \
|
||||
* https://dev.2heng.xin/wp-json/sakura/v1/image/upload
|
||||
*/
|
||||
// $file = $request->get_file_params();
|
||||
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
|
||||
$output = array('status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.',
|
||||
'link' => "https://view.moezx.cc/images/2019/11/14/step04.md.png",
|
||||
'proxy' => akina_option('cmt_image_proxy') . "https://view.moezx.cc/images/2019/11/14/step04.md.png",
|
||||
);
|
||||
$result = new WP_REST_Response($output, 403);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
switch (akina_option("img_upload_api")) {
|
||||
case 'imgur':
|
||||
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
|
||||
$API_Request = Imgur_API($image);
|
||||
break;
|
||||
case 'smms':
|
||||
$image = $_FILES;
|
||||
$API_Request = SMMS_API($image);
|
||||
break;
|
||||
case 'chevereto':
|
||||
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
|
||||
$API_Request = Chevereto_API($image);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = new WP_REST_Response($API_Request, $API_Request['status']);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chevereto upload interface
|
||||
*/
|
||||
function Chevereto_API($image)
|
||||
{
|
||||
$upload_url = akina_option('cheverto_url') . '/api/1/upload';
|
||||
$args = array(
|
||||
'body' => array(
|
||||
'source' => base64_encode($image),
|
||||
'key' => akina_option('chevereto_api_key'),
|
||||
),
|
||||
);
|
||||
|
||||
$response = wp_remote_post($upload_url, $args);
|
||||
$reply = json_decode($response["body"]);
|
||||
|
||||
if ($reply->status_txt == 'OK' && $reply->status_code == 200) {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = "success";
|
||||
$link = $reply->image->image->url;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = $reply->status_code;
|
||||
$success = false;
|
||||
$message = $reply->error->message;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imgur upload interface
|
||||
*/
|
||||
function Imgur_API($image)
|
||||
{
|
||||
$client_id = akina_option('imgur_client_id');
|
||||
$upload_url = akina_option('imgur_upload_image_proxy');
|
||||
$args = array(
|
||||
'headers' => array(
|
||||
'Authorization' => 'Client-ID ' . $client_id,
|
||||
),
|
||||
'body' => array(
|
||||
'image' => base64_encode($image),
|
||||
),
|
||||
);
|
||||
|
||||
$response = wp_remote_post($upload_url, $args);
|
||||
$reply = json_decode($response["body"]);
|
||||
|
||||
if ($reply->success && $reply->status == 200) {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = "success";
|
||||
$link = $reply->data->link;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = $reply->status;
|
||||
$success = false;
|
||||
$message = $reply->data->error;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* smms upload interface
|
||||
*/
|
||||
function SMMS_API($image)
|
||||
{
|
||||
$client_id = akina_option('smms_client_id');
|
||||
$upload_url = "https://sm.ms/api/v2/upload";
|
||||
$filename = $image['cmt_img_file']['name'];
|
||||
$filedata = $image['cmt_img_file']['tmp_name'];
|
||||
$Boundary = wp_generate_password();
|
||||
$bits = file_get_contents($filedata);
|
||||
|
||||
$args = array(
|
||||
"headers" => "Content-Type: multipart/form-data; boundary=$Boundary\r\n\r\nAuthorization: Basic $client_id\r\n\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97",
|
||||
"body" => "--$Boundary\r\nContent-Disposition: form-data; name=\"smfile\"; filename=\"$filename\"\r\n\r\n$bits\r\n\r\n--$Boundary--"
|
||||
);
|
||||
|
||||
$response = wp_remote_post($upload_url, $args);
|
||||
$reply = json_decode($response["body"]);
|
||||
|
||||
if ($reply->success && $reply->code == 'success') {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = $reply->message;
|
||||
$link = $reply->data->url;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else if (preg_match("/Image upload repeated limit/i", $reply->message, $matches)) {
|
||||
$status = 200; // sm.ms 接口不规范,建议检测到重复的情况下返回标准化的 code,并单独把 url 放进一个字段
|
||||
$success = true;
|
||||
$message = $reply->message;
|
||||
$link = str_replace('Image upload repeated limit, this image exists at: ', '', $reply->message);
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = 400;
|
||||
$success = false;
|
||||
$message = $reply->message;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*
|
||||
* 定制实时搜索 rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/cache_search/json
|
||||
* @可在cache_search_json()函数末尾通过设置 HTTP header 控制 json 缓存时间
|
||||
*/
|
||||
function cache_search_json()
|
||||
{
|
||||
$vowels = array("[", "{", "]", "}", "<", ">", "\r\n", "\r", "\n", "-", "'", '"', '`', " ", ":", ";", '\\', " ", "toc");
|
||||
$regex = <<<EOS
|
||||
/<\/?[a-zA-Z]+("[^"]*"|'[^']*'|[^'">])*>|begin[\S\s]*\/begin|hermit[\S\s]*\/hermit|img[\S\s]*\/img|{{.*?}}|:.*?:/m
|
||||
EOS;
|
||||
|
||||
$posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
|
||||
while ($posts->have_posts()): $posts->the_post();
|
||||
$output .= '{"type":"post","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', get_the_content()))) . '},';
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
$pages = get_pages();
|
||||
foreach ($pages as $page) {
|
||||
$output .= '{"type":"page","link":"' . get_page_link($page) . '","title":' . json_encode($page->post_title) . ',"comments":"' . $page->comment_count . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', $page->post_content))) . '},';
|
||||
}
|
||||
|
||||
$tags = get_tags();
|
||||
foreach ($tags as $tag) {
|
||||
$output .= '{"type":"tag","link":"' . get_term_link($tag) . '","title":' . json_encode($tag->name) . ',"comments":"","text":""},';
|
||||
}
|
||||
|
||||
$categories = get_categories();
|
||||
foreach ($categories as $category) {
|
||||
$output .= '{"type":"category","link":"' . get_term_link($category) . '","title":' . json_encode($category->name) . ',"comments":"","text":""},';
|
||||
}
|
||||
if (akina_option('live_search_comment')) {
|
||||
$comments = get_comments();
|
||||
foreach ($comments as $comment) {
|
||||
$is_private = get_comment_meta($comment->comment_ID, '_private', true);
|
||||
if ($is_private) {
|
||||
$output .= '{"type":"comment","link":"' . get_comment_link($comment) . '","title":' . json_encode(get_the_title($comment->comment_post_ID)) . ',"comments":"","text":' . json_encode($comment->comment_author . ":" . __("The comment is private", "sakura") /*该评论为私密评论*/) . '},';
|
||||
continue;
|
||||
} else {
|
||||
$output .= '{"type":"comment","link":"' . get_comment_link($comment) . '","title":' . json_encode(get_the_title($comment->comment_post_ID)) . ',"comments":"","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, " ", $comment->comment_author . ":" . $comment->comment_content))) . '},';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output = substr($output, 0, strlen($output) - 1);
|
||||
|
||||
$data = '[' . $output . ']';
|
||||
$result = new WP_REST_Response(json_decode($data), 200);
|
||||
$result->set_headers(
|
||||
array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Cache-Control' => 'max-age=3600', // json 缓存控制
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* 随机封面图 rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
|
||||
*/
|
||||
function cover_gallery() {
|
||||
if(akina_option('cover_cdn_options')=="type_2"){
|
||||
$img_array = glob(get_template_directory() . "/manifest/gallary/*.{gif,jpg,png}",GLOB_BRACE);
|
||||
$img = array_rand($img_array);
|
||||
$imgurl = trim($img_array[$img]);
|
||||
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
|
||||
}elseif(akina_option('cover_cdn_options')=="type_3"){
|
||||
$imgurl = akina_option('cover_cdn');
|
||||
}else{
|
||||
global $sakura_image_array;
|
||||
$img_array = json_decode($sakura_image_array, true);
|
||||
$img = array_rand($img_array);
|
||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
|
||||
if(strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) {
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
|
||||
} else {
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
|
||||
}
|
||||
}
|
||||
$data = array('cover image');
|
||||
$response = new WP_REST_Response($data);
|
||||
$response->set_status(302);
|
||||
$response->header('Location', $imgurl);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/*
|
||||
* 随机文章特色图 rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
|
||||
*/
|
||||
function feature_gallery() {
|
||||
return cover_gallery();
|
||||
}
|
||||
|
||||
/*
|
||||
* update database rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
|
||||
*/
|
||||
function update_database() {
|
||||
if(akina_option('cover_cdn_options')=="type_1"){
|
||||
global $wpdb;
|
||||
$sakura_table_name = $wpdb->base_prefix.'sakura';
|
||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory();
|
||||
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
|
||||
if($manifest) {
|
||||
$manifest = array(
|
||||
"mate_key" => "manifest_json",
|
||||
"mate_value" => $manifest
|
||||
);
|
||||
$time = array(
|
||||
"mate_key" => "json_time",
|
||||
"mate_value" => date("Y-m-d H:i:s",time())
|
||||
);
|
||||
|
||||
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='manifest_json'");
|
||||
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='json_time'");
|
||||
$wpdb->insert($sakura_table_name,$manifest);
|
||||
$wpdb->insert($sakura_table_name,$time);
|
||||
$output = "manifest.json has been stored into database.";
|
||||
}else{
|
||||
$output = "manifest.json not found, please ensure your url ($img_domain) is corrent.";
|
||||
}
|
||||
$result = new WP_REST_Response($output, 200);
|
||||
return $result;
|
||||
}else{
|
||||
return new WP_REST_Response("Invalid access", 200);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* QQ头像链接解密
|
||||
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/avatar
|
||||
*/
|
||||
function get_qq_avatar(){
|
||||
global $sakura_privkey;
|
||||
$encrypted=$_GET["qq"];
|
||||
if(isset($encrypted)){
|
||||
$iv = str_repeat($sakura_privkey, 2);
|
||||
$encrypted = urldecode(base64_decode($encrypted));
|
||||
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
|
||||
preg_match('/^\d{3,}$/', $qq_number, $matches);
|
||||
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';
|
||||
if(akina_option('qq_avatar_link')=='type_2'){
|
||||
$imgdata = file_get_contents($imgurl);
|
||||
header("Content-type: image/jpeg");
|
||||
header("Cache-Control: max-age=86400");
|
||||
echo $imgdata;
|
||||
}else{
|
||||
$response = new WP_REST_Response();
|
||||
$response->set_status(301);
|
||||
$response->header('Location', $imgurl);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,10 +42,10 @@ function z_add_texonomy_field() {
|
|||
}
|
||||
|
||||
echo '<div class="form-field">
|
||||
<label for="taxonomy_image">' . __('分类/标签图像', 'categories-images') . '</label>
|
||||
<label for="taxonomy_image">' . __('category/tag image', 'sakura') /*分类/标签图像*/. '</label>
|
||||
<input type="text" name="taxonomy_image" id="taxonomy_image" value="" />
|
||||
<br/>
|
||||
<button class="z_upload_image_button button">' . __('添加图像', 'categories-images') . '</button>
|
||||
<button class="z_upload_image_button button">' . __('add image', 'sakura') /*添加图像*/. '</button>
|
||||
</div>'.z_script();
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ function z_edit_texonomy_field($taxonomy) {
|
|||
else
|
||||
$image_url = z_taxonomy_image_url( $taxonomy->term_id, NULL, TRUE );
|
||||
echo '<tr class="form-field">
|
||||
<th scope="row" valign="top"><label for="taxonomy_image">' . __('分类/标签图像', 'categories-images') . '</label></th>
|
||||
<th scope="row" valign="top"><label for="taxonomy_image">' .__('category/tag image', 'sakura') /*分类/标签图像*/. '</label></th>
|
||||
<td><img class="taxonomy-image" src="' . z_taxonomy_image_url( $taxonomy->term_id, 'medium', TRUE ) . '"/><br/><input type="text" name="taxonomy_image" id="taxonomy_image" value="'.$image_url.'" /><br />
|
||||
<button class="z_upload_image_button button">' . __('添加图像', 'categories-images') . '</button>
|
||||
<button class="z_remove_image_button button">' . __('删除图像', 'categories-images') . '</button>
|
||||
<button class="z_upload_image_button button">' . __('add image', 'sakura') /*添加图像*/. '</button>
|
||||
<button class="z_remove_image_button button">' . __('remove image', 'sakura') /*删除图像*/. '</button>
|
||||
</td>
|
||||
</tr>'.z_script();
|
||||
}
|
||||
|
@ -194,8 +194,8 @@ function z_quick_edit_custom_box($column_name, $screen, $name) {
|
|||
<span class="title"><img src="" alt="暂无"/></span>
|
||||
<span class="input-text-wrap"><input type="text" name="taxonomy_image" value="" class="tax_list" /></span>
|
||||
<span class="input-text-wrap">
|
||||
<button class="z_upload_image_button button">' . __('添加图像', 'categories-images') . '</button>
|
||||
<button class="z_remove_image_button button">' . __('删除图像', 'categories-images') . '</button>
|
||||
<button class="z_upload_image_button button">' . __('add image', 'sakura') /*添加图像*/. '</button>
|
||||
<button class="z_remove_image_button button">' . __('remove image', 'sakura') /*删除图像*/. '</button>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -208,7 +208,7 @@ function z_quick_edit_custom_box($column_name, $screen, $name) {
|
|||
function z_taxonomy_columns( $columns ) {
|
||||
$new_columns = array();
|
||||
$new_columns['cb'] = $columns['cb'];
|
||||
$new_columns['thumb'] = __('图像', 'categories-images');
|
||||
$new_columns['thumb'] = __('image', 'sakura')/*图像*/;
|
||||
|
||||
unset( $columns['cb'] );
|
||||
|
||||
|
@ -220,7 +220,7 @@ function z_taxonomy_columns( $columns ) {
|
|||
*/
|
||||
function z_taxonomy_column( $columns, $column, $id ) {
|
||||
if ( $column == 'thumb' )
|
||||
$columns = '<span><img src="' . z_taxonomy_image_url($id, 'thumbnail', TRUE) . '" alt="' . __('暂无', 'categories-images') . '" class="wp-post-image" /></span>';
|
||||
$columns = '<span><img src="' . z_taxonomy_image_url($id, 'thumbnail', TRUE) . '" alt="' . __('no image', 'sakura') /*暂无*/. '" class="wp-post-image" /></span>';
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
|
|
@ -78,15 +78,7 @@ if ( akina_option('toggle-menu') == 'no') { ?>
|
|||
.comments .comments-hidden {display:none !important;}
|
||||
<?php } // comments ?>
|
||||
<?php
|
||||
|
||||
if (akina_option('cover_img')) {
|
||||
$imgurl = akina_option('cover_img');
|
||||
} else {
|
||||
$imgurl = get_site_url()."/wp-content/themes/Sakura/cover/index.php";
|
||||
}
|
||||
|
||||
|
||||
$image_api = 'background-image: url("'.$imgurl.'");';
|
||||
$image_api = 'background-image: url("'.rest_url('sakura/v1/image/cover').'");';
|
||||
$bg_style = akina_option('focus_height') ? 'background-position: center center;background-attachment: inherit;' : '';
|
||||
?>
|
||||
.centerbg{<?php echo $image_api.$bg_style ?>background-position: center center;background-attachment: inherit;}
|
||||
|
|
|
@ -66,9 +66,10 @@ color: #676767 !important}
|
|||
background: none;
|
||||
box-shadow: none;
|
||||
margin-top: 10px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#login form p {
|
||||
#login form p,#login form .user-pass-wrap {
|
||||
font-family:"Microsoft Yahei";
|
||||
position:relative;
|
||||
padding:0px 35px;
|
||||
|
@ -116,6 +117,18 @@ color: #676767 !important}
|
|||
border: 1px solid #FF5656;
|
||||
}
|
||||
|
||||
.login .button.wp-hide-pw{
|
||||
height: 46px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.login .button.wp-hide-pw .dashicons{
|
||||
right: 1rem;
|
||||
}
|
||||
|
||||
#login .form-send .bot {
|
||||
width:100%;
|
||||
border-bottom:1px solid #ccc;
|
||||
|
|
|
@ -25,21 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
/* If the user can't edit theme options, no use running this plugin */
|
||||
|
||||
if ( get_user_locale( get_current_user_id() ) == "zh_CN") {
|
||||
define( 'SAKURA_OPTIONS', 'Sakura主题设置' );
|
||||
}
|
||||
if ( get_user_locale( get_current_user_id() ) == "zh_TW") {
|
||||
define( 'SAKURA_OPTIONS', 'Sakura主題設置' );
|
||||
}
|
||||
if ( get_user_locale( get_current_user_id() ) == "ja") {
|
||||
define( 'SAKURA_OPTIONS', 'さくらテーマの設定' );
|
||||
}
|
||||
if ( get_user_locale( get_current_user_id() ) == "ja-JP") {
|
||||
define( 'SAKURA_OPTIONS', 'さくらテーマの設定' );
|
||||
} else {
|
||||
define( 'SAKURA_OPTIONS', 'Sakura Options' );
|
||||
}
|
||||
|
||||
add_action( 'init', 'optionsframework_rolescheck' );
|
||||
|
||||
function optionsframework_rolescheck () {
|
||||
|
@ -194,8 +179,8 @@ function optionsframework_setdefaults() {
|
|||
function optionsframework_menu_settings() {
|
||||
|
||||
$menu = array(
|
||||
'page_title' => __( SAKURA_OPTIONS, 'optionsframework'),
|
||||
'menu_title' => __( SAKURA_OPTIONS, 'optionsframework'),
|
||||
'page_title' => __('Sakura Options', 'sakura'),
|
||||
'menu_title' => __('Sakura Options', 'sakura'),
|
||||
'capability' => 'edit_theme_options',
|
||||
'menu_slug' => 'options-framework',
|
||||
'callback' => 'optionsframework_page'
|
||||
|
@ -275,7 +260,6 @@ if ( !function_exists( 'optionsframework_page' ) ) :
|
|||
function optionsframework_page() { ?>
|
||||
|
||||
<div id="optionsframework-wrap" class="wrap">
|
||||
<?php screen_icon( 'themes' ); ?>
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<?php echo optionsframework_tabs(); ?>
|
||||
</h2>
|
||||
|
@ -288,8 +272,8 @@ function optionsframework_page() { ?>
|
|||
<?php settings_fields( 'optionsframework' ); ?>
|
||||
<?php optionsframework_fields(); /* Settings */ ?>
|
||||
<div id="optionsframework-submit">
|
||||
<input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( '保存设置', 'options_framework_theme' ); ?>" />
|
||||
<input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( '恢复默认', 'options_framework_theme' ); ?>" onclick="return confirm( '<?php print esc_js( __( '如果单击“确定”会导致之前所有的设置都丢失,确定要这样做吗?', 'options_framework_theme' ) ); ?>' );" />
|
||||
<input type="submit" class="button-primary" name="update" value="<?php _e( 'Save', 'sakura' ); ?>" />
|
||||
<input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore default', 'sakura' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'All setting will be lost, sure?', 'sakura' ) ); ?>' );" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -425,7 +409,7 @@ function optionsframework_adminbar() {
|
|||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'appearance',
|
||||
'id' => 'of_theme_options',
|
||||
'title' => __( SAKURA_OPTIONS, 'options_framework_theme' ),
|
||||
'title' => __('Sakura Options', 'sakura'),
|
||||
'href' => admin_url( 'themes.php?page=options-framework' )
|
||||
));
|
||||
}
|
||||
|
@ -507,4 +491,4 @@ if ( ! function_exists( 'akina_option' ) ) {
|
|||
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,15 +48,15 @@ function optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
|
|||
if ( $value ) {
|
||||
$class = ' has-file';
|
||||
}
|
||||
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('未选择文件', 'options_framework_theme') .'" />' . "\n";
|
||||
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('Choose file', 'sakura') .'" />' . "\n";
|
||||
if ( function_exists( 'wp_enqueue_media' ) ) {
|
||||
if ( ( $value == '' ) ) {
|
||||
$output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( '上传', 'options_framework_theme' ) . '" />' . "\n";
|
||||
$output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( 'Upload', 'sakura' ) . '" />' . "\n";
|
||||
} else {
|
||||
$output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( '移除', 'options_framework_theme' ) . '" />' . "\n";
|
||||
$output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'sakura' ) . '" />' . "\n";
|
||||
}
|
||||
} else {
|
||||
$output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'options_framework_theme' ) . '</i></p>';
|
||||
$output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'sakura' ) . '</i></p>';
|
||||
}
|
||||
|
||||
if ( $_desc != '' ) {
|
||||
|
@ -80,7 +80,7 @@ function optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
|
|||
$output .= '';
|
||||
|
||||
// Standard generic output if it's not an image.
|
||||
$title = __( 'View File', 'options_framework_theme' );
|
||||
$title = __( 'View File', 'sakura' );
|
||||
$output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">'.$title.'</a></span></div>';
|
||||
}
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ function optionsframework_media_scripts( $hook ) {
|
|||
wp_register_script( 'of-media-uploader', OPTIONS_FRAMEWORK_DIRECTORY .'js/media-uploader.js', array( 'jquery' ) );
|
||||
wp_enqueue_script( 'of-media-uploader' );
|
||||
wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
|
||||
'upload' => __( '上传', 'options_framework_theme' ),
|
||||
'remove' => __( '移除', 'options_framework_theme' )
|
||||
'upload' => __( 'Upload', 'sakura' ),
|
||||
'remove' => __( 'Remove', 'sakura' )
|
||||
) );
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ mashiro_option.site_name = "<?php echo akina_option('site_name', ''); ?>";
|
|||
mashiro_option.author_name = "<?php echo akina_option('author_name', ''); ?>";
|
||||
mashiro_option.template_url = "<?php echo get_template_directory_uri(); ?>";
|
||||
mashiro_option.site_url = "<?php echo site_url(); ?>";
|
||||
mashiro_option.qq_api_url = "https://api.2heng.xin/qqinfo/";
|
||||
mashiro_option.qq_avatar_api_url = "https://api.2heng.xin/qqinfo/";
|
||||
mashiro_option.qq_api_url = "<?php echo rest_url('sakura/v1/qqinfo/json'); ?>";
|
||||
// mashiro_option.qq_avatar_api_url = "https://api.2heng.xin/qqinfo/";
|
||||
mashiro_option.live_search = <?php if ( akina_option('live_search') ){ echo 'true'; } else { echo 'false'; } ?>;
|
||||
|
||||
<?php if( akina_option('sakura_skin_bg' )){ $bg_arry=explode(" ", akina_option('sakura_skin_bg' ));?>
|
||||
<?php if( akina_option('sakura_skin_bg' )){ $bg_arry=explode(",", akina_option('sakura_skin_bg' ));?>
|
||||
mashiro_option.skin_bg0 = "<?php echo $bg_arry[0] ?>";
|
||||
mashiro_option.skin_bg1 = "<?php echo $bg_arry[1] ?>";
|
||||
mashiro_option.skin_bg2 = "<?php echo $bg_arry[2] ?>";
|
||||
|
@ -60,6 +60,7 @@ mashiro_option.entry_content_theme_src = "<?php echo get_template_directory_uri(
|
|||
<?php }elseif(akina_option('entry_content_theme') == "github") {?>
|
||||
mashiro_option.entry_content_theme_src = "<?php echo get_template_directory_uri() ?>/cdn/theme/github.css?<?php echo SAKURA_VERSION.akina_option('cookie_version', ''); ?>";
|
||||
<?php } ?>
|
||||
mashiro_option.entry_content_theme = "<?php echo akina_option('entry_content_theme'); ?>";
|
||||
|
||||
<?php if(akina_option('jsdelivr_cdn_test')){ ?>
|
||||
mashiro_option.jsdelivr_css_src = "<?php echo get_template_directory_uri() ?>/cdn/css/lib.css?<?php echo SAKURA_VERSION.akina_option('cookie_version', ''); ?>";
|
||||
|
@ -70,15 +71,9 @@ mashiro_option.jsdelivr_css_src = "https://cdn.jsdelivr.net/gh/mashirozx/Sakura@
|
|||
mashiro_option.float_player_on = true;
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if (akina_option('cover_img')) {
|
||||
$imgurl = akina_option('cover_img');
|
||||
} else {
|
||||
$imgurl = get_site_url()."/wp-content/themes/Sakura/cover/index.php";
|
||||
} ?>
|
||||
mashiro_option.cover_api = "<?php echo $imgurl; ?>";
|
||||
mashiro_option.cover_api = "<?php echo rest_url('sakura/v1/image/cover'); ?>";
|
||||
|
||||
/*End of Initial Variables*/
|
||||
</script>
|
||||
<?php }
|
||||
add_action('wp_head', 'font_end_js_control');
|
||||
add_action('wp_head', 'font_end_js_control');
|
||||
|
|
|
@ -25,12 +25,12 @@ function akina_posted_on() {
|
|||
);
|
||||
|
||||
$posted_on = sprintf(
|
||||
esc_html_x( 'Posted on %s', 'post date', 'akina' ),
|
||||
_x( 'Posted on %s', 'post date', 'sakura' ),
|
||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||
);
|
||||
|
||||
$byline = sprintf(
|
||||
esc_html_x( 'by %s', 'post author', 'akina' ),
|
||||
_x( 'by %s', 'post author', 'sakura' ),
|
||||
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||
);
|
||||
|
||||
|
@ -47,29 +47,29 @@ function akina_entry_footer() {
|
|||
// Hide category and tag text for pages.
|
||||
if ( 'post' === get_post_type() ) {
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$categories_list = get_the_category_list( esc_html__( ', ', 'akina' ) );
|
||||
$categories_list = get_the_category_list( __( ', ', 'sakura' ) );
|
||||
if ( $categories_list && akina_categorized_blog() ) {
|
||||
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'akina' ) . '</span>', $categories_list ); // WPCS: XSS OK.
|
||||
printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'sakura' ) . '</span>', $categories_list ); // WPCS: XSS OK.
|
||||
}
|
||||
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'akina' ) );
|
||||
$tags_list = get_the_tag_list( '', __( ', ', 'sakura' ) );
|
||||
if ( $tags_list ) {
|
||||
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'akina' ) . '</span>', $tags_list ); // WPCS: XSS OK.
|
||||
printf( '<span class="tags-links">' . __( 'Tagged %1$s', 'sakura' ) . '</span>', $tags_list ); // WPCS: XSS OK.
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||
echo '<span class="comments-link">';
|
||||
/* translators: %s: post title */
|
||||
comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'akina' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) );
|
||||
comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'sakura' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) );
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
edit_post_link(
|
||||
sprintf(
|
||||
/* translators: %s: Name of current post */
|
||||
esc_html__( 'Edit %s', 'akina' ),
|
||||
__( 'Edit %s', 'sakura' ),
|
||||
the_title( '<span class="screen-reader-text">"', '"</span>', false )
|
||||
),
|
||||
'<span class="edit-link">',
|
||||
|
|
|
@ -43,11 +43,7 @@ function get_avatar_profile_url(){
|
|||
* 随机图
|
||||
*/
|
||||
function get_random_bg_url(){
|
||||
if ( empty( akina_option('default_feature_image' )) ) {
|
||||
return get_template_directory_uri().'/feature/index.php?'.rand(1,1000);
|
||||
} else {
|
||||
return akina_option('default_feature_image').'?'.rand(1,1000);
|
||||
}
|
||||
return rest_url('sakura/v1/image/feature').'?'.rand(1,1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,10 +57,10 @@ function get_random_bg_url(){
|
|||
*/
|
||||
function poi_time_since( $older_date, $comment_date = false, $text = false ) {
|
||||
$chunks = array(
|
||||
array( 24 * 60 * 60, __( ' 天前', 'akina' ) ),
|
||||
array( 60 * 60 , __( ' 小时前', 'akina' ) ),
|
||||
array( 60 , __( ' 分钟前', 'akina' ) ),
|
||||
array( 1, __( ' 秒前', 'akina' ) )
|
||||
array( 24 * 60 * 60, __( ' days ago', 'sakura' ) ),/*天前*/
|
||||
array( 60 * 60 , __( ' hours ago', 'sakura' ) ),/*小时前*/
|
||||
array( 60 , __( ' minutes ago', 'sakura' ) ),/*分钟前*/
|
||||
array( 1, __( ' seconds ago', 'sakura' ) )/*秒前*/
|
||||
);
|
||||
|
||||
$newer_date = time() - (akina_option('time_zone_fix')*60*60);
|
||||
|
@ -72,7 +68,7 @@ function poi_time_since( $older_date, $comment_date = false, $text = false ) {
|
|||
if($text){
|
||||
$output = '';
|
||||
}else{
|
||||
$output = '发布于 ';
|
||||
$output = __('Posted on ','sakura')/*发布于*/;
|
||||
}
|
||||
|
||||
if ( $since < 30 * 24 * 60 * 60 ) {
|
||||
|
@ -118,7 +114,10 @@ if(akina_option('classify_display')){
|
|||
*/
|
||||
function comment_add_at( $comment_text, $comment = '') {
|
||||
if( $comment->comment_parent > 0) {
|
||||
$comment_text = '<a href="#comment-' . $comment->comment_parent . '" class="comment-at">@'.get_comment_author( $comment->comment_parent ) . '</a> ' . $comment_text;
|
||||
if(substr($comment_text, 0, 3) === "<p>")
|
||||
$comment_text = str_replace(substr($comment_text, 0, 3), '<p><a href="#comment-' . $comment->comment_parent . '" class="comment-at">@'.get_comment_author( $comment->comment_parent ) . '</a> ', $comment_text);
|
||||
else
|
||||
$comment_text = '<a href="#comment-' . $comment->comment_parent . '" class="comment-at">@'.get_comment_author( $comment->comment_parent ) . '</a> ' . $comment_text;
|
||||
}
|
||||
return $comment_text;
|
||||
}
|
||||
|
@ -128,7 +127,7 @@ add_filter( 'comment_text' , 'comment_add_at', 20, 2);
|
|||
/*
|
||||
* Ajax评论
|
||||
*/
|
||||
if ( version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' ) ) { wp_die('请升级到4.4以上版本'); }
|
||||
if ( version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' ) ) { wp_die(__('Please upgrade wordpress to version 4.4+','sakura')); }/*请升级到4.4以上版本*/
|
||||
// 提示
|
||||
if(!function_exists('siren_ajax_comment_err')) {
|
||||
function siren_ajax_comment_err($t) {
|
||||
|
@ -184,7 +183,7 @@ if(!function_exists('siren_ajax_comment_callback')) {
|
|||
<div class="commentinfo">
|
||||
<section class="commeta">
|
||||
<div class="left">
|
||||
<h4 class="author"><a href="<?php comment_author_url(); ?>"><?php echo get_avatar( $comment->comment_author_email, '80', '', get_comment_author() ); ?><?php comment_author(); ?> <span class="isauthor" title="<?php esc_attr_e('Author', 'akina'); ?>"></span></a></h4>
|
||||
<h4 class="author"><a href="<?php comment_author_url(); ?>"><?php echo get_avatar( $comment->comment_author_email, '80', '', get_comment_author() ); ?><?php comment_author(); ?> <span class="isauthor" title="<?php esc_attr_e('Author', 'sakura'); ?>"></span></a></h4>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="info"><time datetime="<?php comment_date('Y-m-d'); ?>"><?php echo poi_time_since(strtotime($comment->comment_date), true );//comment_date(get_option('date_format')); ?></time></div>
|
||||
|
@ -230,16 +229,16 @@ function Exuser_center(){ ?>
|
|||
function gopage(url,type){
|
||||
URL = url;
|
||||
if(type == 1){
|
||||
TYPE = '管理后台';
|
||||
TYPE = <?php _e('dashboard','sakura')/*管理后台*/?>;
|
||||
}else{
|
||||
TYPE = '主页';
|
||||
TYPE = <?php _e('home','sakura')/*主页*/?>;
|
||||
}
|
||||
for(var i=secs;i>=0;i--){
|
||||
window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000);
|
||||
}
|
||||
}
|
||||
function doUpdate(num){
|
||||
document.getElementById('login-showtime').innerHTML = '空降成功,'+num+'秒后自动转到'+TYPE;
|
||||
document.getElementById('login-showtime').innerHTML = '<?php _e("Login successful, ","sakura")/*空降成功*/?>'+num+'<?php _e("seconds later automatically transfer to","sakura")/*秒后自动转到*/?>'+TYPE;
|
||||
if(num == 0) { window.location=URL; }
|
||||
}
|
||||
</script>
|
||||
|
@ -260,18 +259,18 @@ function Exuser_center(){ ?>
|
|||
// 登录成功
|
||||
function login_ok(){
|
||||
global $current_user;
|
||||
get_currentuserinfo();
|
||||
wp_get_current_user();
|
||||
?>
|
||||
<p class="ex-login-avatar"><a href="http://cn.gravatar.com/" title="更换头像" target="_blank" rel="nofollow"><?php echo get_avatar( $current_user->user_email, '110' ); ?></a></p>
|
||||
<p class="ex-login-username">你好,<strong><?php echo $current_user->display_name; ?></strong></p>
|
||||
<p class="ex-login-avatar"><a href="http://cn.gravatar.com/" title="<?php _e('Change avatar','sakura')/*更换头像*/?>" target="_blank" rel="nofollow"><?php echo get_avatar( $current_user->user_email, '110' ); ?></a></p>
|
||||
<p class="ex-login-username"><?php _e('Hello, ','sakura')/*你好,*/?><strong><?php echo $current_user->display_name; ?></strong></p>
|
||||
<?php if($current_user->user_email){echo '<p>'.$current_user->user_email.'</p>';} ?>
|
||||
<p id="login-showtime"></p>
|
||||
<p class="ex-logout">
|
||||
<a href="<?php bloginfo('url'); ?>" title="首页">首页</a>
|
||||
<a href="<?php bloginfo('url'); ?>" title="<?php _e('Home','sakura')/*首页*/?>"><?php _e('Home','sakura')/*首页*/?></a>
|
||||
<?php if(current_user_can('level_10')){ ?>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/" title="后台" target="_top">后台</a>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/" title="<?php _e('Manage','sakura')/*后台*/?>" target="_top"><?php _e('Manage','sakura')/*后台*/?></a>
|
||||
<?php } ?>
|
||||
<a href="<?php echo wp_logout_url(get_bloginfo('url')); ?>" title="登出" target="_top">登出?</a>
|
||||
<a href="<?php echo wp_logout_url(get_bloginfo('url')); ?>" title="<?php _e('Logout','sakura')/*登出*/?>" target="_top"><?php _e('Sign out? ','sakura')/*登出?*/?></a>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
@ -296,7 +295,7 @@ function the_headPattern(){
|
|||
$edit_this_post_link = '';
|
||||
}
|
||||
$t .= the_title( '<h1 class="entry-title">', '</h1>', false);
|
||||
$t .= '<p class="entry-census"><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'"><img src="'. get_avatar_url( get_the_author_meta('ID'), 64 )/*$ava*/ .'"></a></span><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'">'. get_the_author() .'</a></span><span class="bull">·</span>'. poi_time_since(get_post_time('U', true),false,true) .'<span class="bull">·</span>'. get_post_views(get_the_ID()) .' 次阅读'.$edit_this_post_link.'</p>';
|
||||
$t .= '<p class="entry-census"><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'"><img src="'. get_avatar_url( get_the_author_meta('ID'), 64 )/*$ava*/ .'"></a></span><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'">'. get_the_author() .'</a></span><span class="bull">·</span>'. poi_time_since(get_post_time('U', true),false,true) .'<span class="bull">·</span>'. get_post_views(get_the_ID()) .' '._n("View","Views",get_post_views(get_the_ID()),"sakura")/*次阅读*/.$edit_this_post_link.'</p>';
|
||||
endwhile; endif;
|
||||
}elseif(is_page()){
|
||||
$full_image_url = $full_image_url[0];
|
||||
|
@ -308,7 +307,7 @@ function the_headPattern(){
|
|||
$t .= ' <span class="cat-des">'.$des.'</span>';
|
||||
}elseif(is_search()){
|
||||
$full_image_url = get_random_bg_url();
|
||||
$t .= '<h1 class="entry-title search-title"> 关于“ '.get_search_query().' ”的搜索结果</h1>';
|
||||
$t .= '<h1 class="entry-title search-title"> '.sprintf( __( "Search results for \" %s \"","sakura" ), get_search_query()) ./*关于“ '.get_search_query().' ”的搜索结果*/'</h1>';
|
||||
}
|
||||
if(akina_option('patternimg')) $full_image_url = false;
|
||||
if(!is_home() && $full_image_url) : ?>
|
||||
|
@ -351,7 +350,7 @@ function the_video_headPattern_hls(){
|
|||
$edit_this_post_link = '';
|
||||
}
|
||||
$t .= the_title( '<h1 class="entry-title">', '<button id="coverVideo-btn" class=".constant-width-to-height-ratio" onclick="coverVideo()"><i class="fa fa-pause" aria-hidden="true"></i></button></h1>', false);
|
||||
$t .= '<p class="entry-census"><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'"><img src="'. get_avatar_url( get_the_author_meta('ID'), 64 )/*$ava*/ .'"></a></span><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'">'. get_the_author() .'</a></span><span class="bull">·</span>'. poi_time_since(get_post_time('U', true),false,true) .'<span class="bull">·</span>'. get_post_views(get_the_ID()) .' 次阅读'.$edit_this_post_link.'</p>';
|
||||
$t .= '<p class="entry-census"><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'"><img src="'. get_avatar_url( get_the_author_meta('ID'), 64 )/*$ava*/ .'"></a></span><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'">'. get_the_author() .'</a></span><span class="bull">·</span>'. poi_time_since(get_post_time('U', true),false,true) .'<span class="bull">·</span>'. get_post_views(get_the_ID()) .' '._n("View","Views",get_post_views(get_the_ID()),"sakura")/*次阅读*/.$edit_this_post_link.'</p>';
|
||||
endwhile; endif;
|
||||
}elseif(is_page()){
|
||||
$full_image_url = $full_image_url[0];
|
||||
|
@ -366,7 +365,7 @@ function the_video_headPattern_hls(){
|
|||
}elseif(is_search()){
|
||||
$full_image_url = get_random_bg_url();
|
||||
$thubm_image_url = 'https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.1/img/svg/loader/orange.progress-bar-stripe-loader.svg';
|
||||
$t .= '<h1 class="entry-title search-title"> 关于“ '.get_search_query().' ”的搜索结果</h1>';
|
||||
$t .= '<h1 class="entry-title search-title"> '.sprintf( __( "Search results for \" %s \"","sakura" ), get_search_query()) ./*关于“ '.get_search_query().' ”的搜索结果*/'</h1>';
|
||||
}
|
||||
$thubm_image_url = $thubm_image_url . "#lazyload-blur";
|
||||
$thubm_image_url = str_replace(akina_option('qiniu_cdn'),'https://cdn.2heng.xin/',$thubm_image_url);
|
||||
|
@ -414,12 +413,12 @@ function the_video_headPattern_normal(){
|
|||
$ava = akina_option('focus_logo', '') ? akina_option('focus_logo', '') : get_avatar_url(get_the_author_meta('user_email'));
|
||||
global $user_ID;
|
||||
if($user_ID && current_user_can('level_10')) {
|
||||
$edit_this_post_link = '<span class="bull">·</span><a href="'.get_edit_post_link().'">EDIT</a>';
|
||||
$edit_this_post_link = '<span class="bull">·</span><a href="'.get_edit_post_link().'">'._e("EDIT","sakura").'</a>';
|
||||
} else {
|
||||
$edit_this_post_link = '';
|
||||
}
|
||||
$t .= the_title( '<h1 class="entry-title">', '<button id="coverVideo-btn" class=".constant-width-to-height-ratio" onclick="coverVideo()"><i class="fa fa-pause" aria-hidden="true"></i></button></h1>', false);
|
||||
$t .= '<p class="entry-census"><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'"><img src="'. get_avatar_url( get_the_author_meta('ID'), 64 )/*$ava*/ .'"></a></span><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'">'. get_the_author() .'</a></span><span class="bull">·</span>'. poi_time_since(get_post_time('U', true),false,true) .'<span class="bull">·</span>'. get_post_views(get_the_ID()) .' 次阅读'.$edit_this_post_link.'</p>';
|
||||
$t .= '<p class="entry-census"><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'"><img src="'. get_avatar_url( get_the_author_meta('ID'), 64 )/*$ava*/ .'"></a></span><span><a href="'. esc_url(get_author_posts_url(get_the_author_meta('ID'),get_the_author_meta( 'user_nicename' ))) .'">'. get_the_author() .'</a></span><span class="bull">·</span>'. poi_time_since(get_post_time('U', true),false,true) .'<span class="bull">·</span>'. get_post_views(get_the_ID()) .' '._n("View","Views",get_post_views(get_the_ID()),"sakura")/*次阅读*/.$edit_this_post_link.'</p>';
|
||||
endwhile; endif;
|
||||
}elseif(is_page()){
|
||||
$full_image_url = $full_image_url[0];
|
||||
|
@ -434,7 +433,7 @@ function the_video_headPattern_normal(){
|
|||
}elseif(is_search()){
|
||||
$full_image_url = get_random_bg_url();
|
||||
$thubm_image_url = 'https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.1/img/svg/loader/orange.progress-bar-stripe-loader.svg';
|
||||
$t .= '<h1 class="entry-title search-title"> 关于“ '.get_search_query().' ”的搜索结果</h1>';
|
||||
$t .= '<h1 class="entry-title search-title"> '.sprintf( __( "Search results for \" %s \"","sakura" ), get_search_query()) ./*关于“ '.get_search_query().' ”的搜索结果*/'</h1>';
|
||||
}
|
||||
$thubm_image_url = $thubm_image_url . "#lazyload-blur";
|
||||
$thubm_image_url = str_replace(akina_option('qiniu_cdn'),'https://cdn.2heng.xin/',$thubm_image_url);
|
||||
|
@ -464,7 +463,7 @@ function the_video_headPattern_normal(){
|
|||
* 导航栏用户菜单
|
||||
*/
|
||||
function header_user_menu(){
|
||||
global $current_user;get_currentuserinfo();
|
||||
global $current_user;wp_get_current_user();
|
||||
if(is_user_logged_in()){
|
||||
$ava = akina_option('focus_logo') ? akina_option('focus_logo') : get_avatar_url( $current_user->user_email );
|
||||
?>
|
||||
|
@ -476,11 +475,11 @@ function header_user_menu(){
|
|||
</div>
|
||||
<div class="user-menu-option">
|
||||
<?php if (current_user_can('level_10')) { ?>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/" target="_blank">管理中心</a>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/post-new.php" target="_blank">撰写文章</a>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/" target="_blank"><?php _e('Dashboard','sakura')/*管理中心*/?></a>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/post-new.php" target="_blank"><?php _e('New post','sakura')/*撰写文章*/?></a>
|
||||
<?php } ?>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/profile.php" target="_blank">个人资料</a>
|
||||
<a href="<?php echo wp_logout_url(get_bloginfo('url')); ?>" target="_top">退出登录</a>
|
||||
<a href="<?php bloginfo('url'); ?>/wp-admin/profile.php" target="_blank"><?php _e('Profile','sakura')/*个人资料*/?></a>
|
||||
<a href="<?php echo wp_logout_url(get_bloginfo('url')); ?>" target="_top"><?php _e('Sign out','sakura')/*退出登录*/?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -510,7 +509,9 @@ function header_user_menu(){
|
|||
// 上一篇
|
||||
function get_prev_thumbnail_url() {
|
||||
$prev_post = get_previous_post();
|
||||
if ( has_post_thumbnail($prev_post->ID) ) {
|
||||
if (!$prev_post) {
|
||||
return get_random_bg_url(); // 首页图
|
||||
} else if ( has_post_thumbnail($prev_post->ID) ) {
|
||||
$img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $prev_post->ID ), 'large');
|
||||
return $img_src[0]; // 特色图
|
||||
}
|
||||
|
@ -723,7 +724,7 @@ function siren_private_message_hook($comment_content , $comment){
|
|||
$current_commenter = wp_get_current_commenter();
|
||||
if ( $is_private ) $comment_content = '#私密# ' . $comment_content;
|
||||
if ( $current_commenter['comment_author_email'] == $email || $parent_email == $current_commenter['comment_author_email'] || current_user_can('delete_user') ) return $comment_content;
|
||||
if ( $is_private ) return '<i class="fa fa-lock" aria-hidden="true"></i> 该评论为私密评论';
|
||||
if ( $is_private ) return '<i class="fa fa-lock" aria-hidden="true"></i> '.__("The comment is private","sakura")/*该评论为私密评论*/;
|
||||
return $comment_content;
|
||||
}
|
||||
add_filter('get_comment_text','siren_private_message_hook',10,2);
|
||||
|
|
|
@ -64,7 +64,7 @@ get_header();
|
|||
<?php else : get_template_part( 'tpl/content', 'none' ); endif; ?>
|
||||
</main><!-- #main -->
|
||||
<?php if ( akina_option('pagenav_style') == 'ajax') { ?>
|
||||
<div id="pagination"><?php next_posts_link('Previous'); ?></div>
|
||||
<div id="pagination"><?php next_posts_link(' Previous'); ?></div>
|
||||
<div id="add_post"><span id="add_post_time" style="visibility: hidden;" title="<?php echo akina_option('auto_load_post',''); ?>" ></span></div>
|
||||
<?php }else{ ?>
|
||||
<nav class="navigator">
|
||||
|
|
466
js/sakura-app.js
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Sakura application bundle theme ver 3.2.0
|
||||
* Sakura theme application bundle
|
||||
* @author Mashiro
|
||||
* @url https://2heng.xin
|
||||
* @date 2019.8.3
|
||||
|
@ -63,7 +63,7 @@ function imgError(ele, type) {
|
|||
default:
|
||||
ele.src = 'https://view.moezx.cc/images/2018/05/13/image-404.png';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function post_list_show_animation() {
|
||||
if ($("article").hasClass("post-list-thumb")) {
|
||||
|
@ -73,6 +73,7 @@ function post_list_show_animation() {
|
|||
}
|
||||
var io = new IntersectionObserver(callback, options);
|
||||
var articles = document.querySelectorAll('.post-list-thumb');
|
||||
|
||||
function callback(entries) {
|
||||
entries.forEach((article) => {
|
||||
if (article.target.classList.contains("post-list-show")) {
|
||||
|
@ -157,9 +158,9 @@ try {
|
|||
code_highlight_style();
|
||||
} catch (e) {}
|
||||
|
||||
if (Poi.reply_link_version == 'new'){
|
||||
$('body').on('click','.comment-reply-link',function(){
|
||||
addComment.moveForm( "comment-"+$(this).attr('data-commentid'), $(this).attr('data-commentid'), "respond", $(this).attr('data-postid') );
|
||||
if (Poi.reply_link_version == 'new') {
|
||||
$('body').on('click', '.comment-reply-link', function () {
|
||||
addComment.moveForm("comment-" + $(this).attr('data-commentid'), $(this).attr('data-commentid'), "respond", $(this).attr('data-postid'));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
@ -179,9 +180,9 @@ function attach_image() {
|
|||
for (var i = 0; i < this.files.length; i++) {
|
||||
var f = this.files[i];
|
||||
var formData = new FormData();
|
||||
formData.append('smfile', f);
|
||||
formData.append('cmt_img_file', f);
|
||||
$.ajax({
|
||||
url: 'https://sm.ms/api/upload',
|
||||
url: Poi.api + 'sakura/v1/image/upload?_wpnonce=' + Poi.nonce,
|
||||
type: 'POST',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
|
@ -195,18 +196,28 @@ function attach_image() {
|
|||
setTimeout(function () {
|
||||
cached.html('<i class="fa fa-picture-o" aria-hidden="true"></i>');
|
||||
}, 1000);
|
||||
var get_the_url = res.data.url;
|
||||
$('#upload-img-show').append('<img class="lazyload upload-image-preview" src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg" data-src="' + get_the_url + '" onclick="window.open(\'' + get_the_url + '\')" onerror="imgError(this)" />');
|
||||
lazyload();
|
||||
addComment.createButterbar("图片上传成功~<br>Uploaded successfully~");
|
||||
grin(res.data.url.replace('https://i.loli.net/', '{UPLOAD}'), type = 'Img');
|
||||
if (res.status == 200) {
|
||||
var get_the_url = res.proxy;
|
||||
$('#upload-img-show').append('<img class="lazyload upload-image-preview" src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg" data-src="' + get_the_url + '" onclick="window.open(\'' + get_the_url + '\')" onerror="imgError(this)" />');
|
||||
lazyload();
|
||||
addComment.createButterbar("图片上传成功~<br>Uploaded successfully~");
|
||||
grin(get_the_url, type = 'Img');
|
||||
} else {
|
||||
addComment.createButterbar("上传失败!<br>Uploaded failed!<br> 文件名/Filename: "+f.name+"<br>code: "+res.status+"<br>"+res.message, 3000);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
cached.html('<i class="fa fa-times" aria-hidden="true" style="color:red"></i>');
|
||||
alert("上传失败,请重试.\nUpload failed, please try again.");
|
||||
setTimeout(function () {
|
||||
cached.html('<i class="fa fa-picture-o" aria-hidden="true"></i>');
|
||||
}, 1000);
|
||||
// console.info(jqXHR.responseText);
|
||||
// console.info(jqXHR.status);
|
||||
// console.info(jqXHR.readyState);
|
||||
// console.info(jqXHR.statusText);
|
||||
// console.info(textStatus);
|
||||
// console.info(errorThrown);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -297,6 +308,7 @@ function checkskinSecter() {
|
|||
$(".headertop-bar-sakura").removeClass('headertop-bar-sakura').addClass('headertop-bar');
|
||||
}
|
||||
}
|
||||
|
||||
function checkBgImgCookie() {
|
||||
var bgurl = getCookie("bgImgSetting");
|
||||
if (!bgurl) {
|
||||
|
@ -306,7 +318,7 @@ function checkBgImgCookie() {
|
|||
}
|
||||
}
|
||||
if (document.body.clientWidth > 860) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
checkBgImgCookie();
|
||||
}, 100);
|
||||
}
|
||||
|
@ -317,15 +329,16 @@ function no_right_click() {
|
|||
});
|
||||
}
|
||||
no_right_click();
|
||||
$(document).ready(function() {
|
||||
function checkskin_bg(a){
|
||||
$(document).ready(function () {
|
||||
function checkskin_bg(a) {
|
||||
return a == "none" ? "" : a
|
||||
}
|
||||
|
||||
function changeBG() {
|
||||
var cached=$(".menu-list");
|
||||
cached.find("li").each(function() {
|
||||
var cached = $(".menu-list");
|
||||
cached.find("li").each(function () {
|
||||
var tagid = this.id;
|
||||
cached.on("click", "#" + tagid, function(){
|
||||
cached.on("click", "#" + tagid, function () {
|
||||
if (tagid == "white-bg") {
|
||||
mashiro_global.variables.skinSecter = true;
|
||||
checkskinSecter();
|
||||
|
@ -372,14 +385,14 @@ $(document).ready(function() {
|
|||
|
||||
function closeSkinMenu() {
|
||||
$(".skin-menu").removeClass('show');
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$(".changeSkin-gear").css("visibility", "visible");
|
||||
}, 300);
|
||||
}
|
||||
$(".changeSkin-gear").click(function() {
|
||||
$(".changeSkin-gear").click(function () {
|
||||
$(".skin-menu").toggleClass('show');
|
||||
})
|
||||
$(".skin-menu #close-skinMenu").click(function() {
|
||||
$(".skin-menu #close-skinMenu").click(function () {
|
||||
closeSkinMenu();
|
||||
});
|
||||
add_upload_tips();
|
||||
|
@ -463,10 +476,10 @@ function timeSeriesReload(flag) {
|
|||
var al_expand_collapse_click = 0;
|
||||
$('#al_expand_collapse').click(function () {
|
||||
if (al_expand_collapse_click == 0) {
|
||||
$al_post_list.show();
|
||||
$al_post_list.show(400);
|
||||
al_expand_collapse_click++;
|
||||
} else if (al_expand_collapse_click == 1) {
|
||||
$al_post_list.hide();
|
||||
$al_post_list.hide(400);
|
||||
al_expand_collapse_click--;
|
||||
}
|
||||
});
|
||||
|
@ -512,28 +525,32 @@ function killCoverVideo() {
|
|||
|
||||
function coverVideoIni() {
|
||||
if ($('video').hasClass('hls')) {
|
||||
var video = addComment.I('coverVideo');
|
||||
var video_src = $('#coverVideo').attr('data-src');
|
||||
if(Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(video_src);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED,function() {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = video_src;
|
||||
video.addEventListener('loadedmetadata',function() {
|
||||
video.play();
|
||||
});
|
||||
}
|
||||
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.3/cdn/js/src/16.hls.js", function(){
|
||||
var video = addComment.I('coverVideo');
|
||||
var video_src = $('#coverVideo').attr('data-src');
|
||||
if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(video_src);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = video_src;
|
||||
video.addEventListener('loadedmetadata', function () {
|
||||
video.play();
|
||||
});
|
||||
}
|
||||
});
|
||||
//console.info('ini:coverVideoIni()');
|
||||
}
|
||||
}
|
||||
|
||||
function copy_code_block() {
|
||||
$('pre code').each(function (i, block) {
|
||||
$(block).attr({ id: 'hljs-' + i });
|
||||
$(block).attr({
|
||||
id: 'hljs-' + i
|
||||
});
|
||||
$(this).after('<a class="copy-code" href="javascript:" data-clipboard-target="#hljs-' + i + '" title="拷贝代码"><i class="fa fa-clipboard" aria-hidden="true"></i></a>');
|
||||
});
|
||||
var clipboard = new ClipboardJS('.copy-code');
|
||||
|
@ -547,8 +564,8 @@ function tableOfContentScroll(flag) {
|
|||
} else {
|
||||
if (flag) {
|
||||
var id = 1,
|
||||
heading_fix=$("article").hasClass("type-post") ? $("div").hasClass("pattern-attachment-img") ? -75 : 200 : 375;
|
||||
$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function() {
|
||||
heading_fix = mashiro_option.entry_content_theme == "sakura" ? $("article").hasClass("type-post") ? $("div").hasClass("pattern-attachment-img") ? -75 : 200 : 375 : window.innerHeight / 2;
|
||||
$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function () {
|
||||
var hyphenated = "toc-head-" + id;
|
||||
this.id = hyphenated;
|
||||
id++;
|
||||
|
@ -557,7 +574,7 @@ function tableOfContentScroll(flag) {
|
|||
tocSelector: '.toc',
|
||||
contentSelector: ['.entry-content', '.links'],
|
||||
headingSelector: 'h1, h2, h3, h4, h5',
|
||||
headingsOffset: heading_fix-window.innerHeight/2,
|
||||
headingsOffset: heading_fix - window.innerHeight / 2,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -606,7 +623,7 @@ $(document).on("click", ".sm", function () {
|
|||
if (confirm(msg) == true) {
|
||||
$(this).commentPrivate();
|
||||
} else {
|
||||
aler("已取消");
|
||||
alert("已取消");
|
||||
}
|
||||
});
|
||||
$.fn.commentPrivate = function () {
|
||||
|
@ -722,7 +739,7 @@ $(function () {
|
|||
getqqinfo();
|
||||
});
|
||||
|
||||
if(mashiro_option.float_player_on) {
|
||||
if (mashiro_option.float_player_on) {
|
||||
function aplayerF() {
|
||||
'use strict';
|
||||
var aplayers = [],
|
||||
|
@ -736,7 +753,7 @@ if(mashiro_option.float_player_on) {
|
|||
autoplay: !1,
|
||||
mutex: !0,
|
||||
lrcType: 3,
|
||||
listFolded: !1,
|
||||
listFolded: 1,
|
||||
preload: 'auto',
|
||||
theme: '#2980b9',
|
||||
loop: 'all',
|
||||
|
@ -761,7 +778,7 @@ if(mashiro_option.float_player_on) {
|
|||
console.log(a)
|
||||
}
|
||||
var lrcTag = 1;
|
||||
$(".aplayer.aplayer-fixed").click(function(){
|
||||
$(".aplayer.aplayer-fixed").click(function () {
|
||||
if (lrcTag == 1) {
|
||||
for (var f = 0; f < aplayers.length; f++) try {
|
||||
aplayers[f].lrc.show();
|
||||
|
@ -772,18 +789,16 @@ if(mashiro_option.float_player_on) {
|
|||
lrcTag = 2;
|
||||
});
|
||||
var apSwitchTag = 0;
|
||||
var aplayerlist=$(".aplayer-list");
|
||||
aplayerlist.removeClass( "aplayer-list-hide" ).css({maxHeight:'0px'});
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
||||
$(".aplayer-miniswitcher").click(function(){
|
||||
$(".aplayer-miniswitcher").click(function () {
|
||||
if (apSwitchTag == 0) {
|
||||
aplayerlist.removeClass( "aplayer-list-hide" ).animate({maxHeight:'250px'});
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").removeClass( "ap-hover" );
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").removeClass("ap-hover");
|
||||
$("#secondary").addClass("active");
|
||||
apSwitchTag = 1;
|
||||
} else {
|
||||
aplayerlist.css({maxHeight:'0px'});
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass( "ap-hover" );
|
||||
apSwitchTag =0;
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
||||
$("#secondary").removeClass("active");
|
||||
apSwitchTag = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -824,12 +839,13 @@ if(mashiro_option.float_player_on) {
|
|||
document.addEventListener('DOMContentLoaded', loadMeting, !1);
|
||||
}
|
||||
if (document.body.clientWidth > 860) {
|
||||
aplayerF ();
|
||||
aplayerF();
|
||||
}
|
||||
}
|
||||
|
||||
function getqqinfo() {
|
||||
var is_get_by_qq = false,cached = $('input');
|
||||
var is_get_by_qq = false,
|
||||
cached = $('input');
|
||||
if (!getCookie('user_qq') && !getCookie('user_qq_email') && !getCookie('user_author')) {
|
||||
cached.filter('#qq,#author,#email,#url').val('');
|
||||
}
|
||||
|
@ -851,12 +867,10 @@ function getqqinfo() {
|
|||
var qq = cached.filter('#author').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: mashiro_option.qq_api_url + '?type=getqqnickname&qq=' + qq,
|
||||
dataType: 'jsonp',
|
||||
jsonp: 'callback',
|
||||
jsonpCallback: 'portraitCallBack',
|
||||
url: mashiro_option.qq_api_url + '?qq=' + qq + '&_wpnonce=' + Poi.nonce,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
cached.filter('#author').val(data[qq][6]);
|
||||
cached.filter('#author').val(data.name);
|
||||
cached.filter('#email').val($.trim(qq) + '@qq.com');
|
||||
if (mashiro_option.qzone_autocomplete) {
|
||||
cached.filter('#url').val('https://user.qzone.qq.com/' + $.trim(qq));
|
||||
|
@ -868,12 +882,15 @@ function getqqinfo() {
|
|||
$('.qq-check').css('display', 'block');
|
||||
$('.gravatar-check').css('display', 'none');
|
||||
}
|
||||
setCookie('user_author', data[qq][6], 30);
|
||||
setCookie('user_author', data.name, 30);
|
||||
setCookie('user_qq', qq, 30);
|
||||
setCookie('is_user_qq', 'yes', 30);
|
||||
setCookie('user_qq_email', qq + '@qq.com', 30);
|
||||
setCookie('user_email', qq + '@qq.com', 30);
|
||||
emailAddressFlag = cached.filter('#email').val();
|
||||
/***/
|
||||
$('div.comment-user-avatar img').attr('src', data.avatar);
|
||||
setCookie('user_avatar', data.avatar, 30);
|
||||
},
|
||||
error: function () {
|
||||
cached.filter('#qq').val('');
|
||||
|
@ -883,19 +900,7 @@ function getqqinfo() {
|
|||
setCookie('user_qq', '', 30);
|
||||
setCookie('user_email', cached.filter('#email').val(), 30);
|
||||
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: mashiro_option.qq_avatar_api_url + '?type=getqqavatar&qq=' + qq,
|
||||
dataType: 'jsonp',
|
||||
jsonp: 'callback',
|
||||
jsonpCallback: 'qqavatarCallBack',
|
||||
success: function (data) {
|
||||
$('div.comment-user-avatar img').attr('src', data[qq]);
|
||||
setCookie('user_avatar', data[qq], 30);
|
||||
},
|
||||
error: function () {
|
||||
/***/
|
||||
cached.filter('#qq,#email,#url').val('');
|
||||
if (!cached.filter('#qq').val()) {
|
||||
$('.qq-check').css('display', 'none');
|
||||
|
@ -906,6 +911,27 @@ function getqqinfo() {
|
|||
}
|
||||
}
|
||||
});
|
||||
// $.ajax({
|
||||
// type: 'get',
|
||||
// url: mashiro_option.qq_avatar_api_url + '?type=getqqavatar&qq=' + qq,
|
||||
// dataType: 'jsonp',
|
||||
// jsonp: 'callback',
|
||||
// jsonpCallback: 'qqavatarCallBack',
|
||||
// success: function (data) {
|
||||
// $('div.comment-user-avatar img').attr('src', data[qq]);
|
||||
// setCookie('user_avatar', data[qq], 30);
|
||||
// },
|
||||
// error: function () {
|
||||
// cached.filter('#qq,#email,#url').val('');
|
||||
// if (!cached.filter('#qq').val()) {
|
||||
// $('.qq-check').css('display', 'none');
|
||||
// $('.gravatar-check').css('display', 'block');
|
||||
// setCookie('user_qq', '', 30);
|
||||
// $('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
|
||||
// setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
});
|
||||
if (getCookie('user_avatar') && getCookie('user_email') && getCookie('is_user_qq') == 'no' && !getCookie('user_qq_email')) {
|
||||
$('div.comment-user-avatar img').attr('src', getCookie('user_avatar'));
|
||||
|
@ -954,6 +980,19 @@ function mail_me() {
|
|||
window.open(mail);
|
||||
}
|
||||
|
||||
function activate_widget(){
|
||||
if (document.body.clientWidth > 860) {
|
||||
$('.show-hide').on('click', function() {
|
||||
$("#secondary").toggleClass("active")
|
||||
});
|
||||
}else{
|
||||
$("#secondary").remove();
|
||||
}
|
||||
}
|
||||
setTimeout(function () {
|
||||
activate_widget();
|
||||
}, 100);
|
||||
|
||||
mashiro_global.ini.normalize();
|
||||
loadCSS(mashiro_option.jsdelivr_css_src);
|
||||
loadCSS(mashiro_option.entry_content_theme_src);
|
||||
|
@ -1284,20 +1323,22 @@ var home = location.href,
|
|||
AH: function () {
|
||||
if (Poi.windowheight == 'auto') {
|
||||
if ($('h1.main-title').length > 0) {
|
||||
var _height = $(window).height()+"px";
|
||||
var _height = $(window).height() + "px";
|
||||
$('#centerbg').css({
|
||||
'height': _height
|
||||
});
|
||||
$('#bgvideo').css({
|
||||
'min-height': _height
|
||||
});
|
||||
window.resizeFlag= null;
|
||||
window.resizeFlag = null;
|
||||
$(window).resize(function () {
|
||||
//直接resize性能爆炸,改成延时
|
||||
if(resizeFlag=null){
|
||||
if (resizeFlag = null) {
|
||||
clearTimeout(resizeFlag);
|
||||
}
|
||||
resizeFlag = setTimeout(function(){ Siren.AH();}, 1000);
|
||||
resizeFlag = setTimeout(function () {
|
||||
Siren.AH();
|
||||
}, 1000);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
@ -1349,131 +1390,134 @@ var home = location.href,
|
|||
$('.js-toggle-search').on('click', function () {
|
||||
$('.js-toggle-search').toggleClass('is-active');
|
||||
$('.js-search').toggleClass('is-visible');
|
||||
$('html').css('overflow-y','hidden');
|
||||
$('html').css('overflow-y', 'hidden');
|
||||
if (mashiro_option.live_search) {
|
||||
var QueryStorage = [];
|
||||
search_a("https://"+document.domain+"/wp-json/cache_search/v1/json/");
|
||||
|
||||
var otxt = addComment.I("search-input"),
|
||||
list = addComment.I("PostlistBox"),
|
||||
Record = list.innerHTML,
|
||||
searchFlag = null;
|
||||
otxt.oninput = function () {
|
||||
if(searchFlag=null){
|
||||
clearTimeout(searchFlag);
|
||||
}
|
||||
searchFlag = setTimeout(function(){
|
||||
query(QueryStorage, otxt.value, Record);
|
||||
div_href();
|
||||
}, 250);
|
||||
};
|
||||
var QueryStorage = [];
|
||||
search_a(Poi.api + "sakura/v1/cache_search/json");
|
||||
|
||||
function search_a(val) {
|
||||
if(sessionStorage.getItem('search')!=null){
|
||||
QueryStorage = JSON.parse(sessionStorage.getItem('search'));
|
||||
query(QueryStorage, $("#search-input").val(), Record);
|
||||
div_href();
|
||||
}else{
|
||||
var _xhr = new XMLHttpRequest();
|
||||
_xhr.open("GET", val, true)
|
||||
_xhr.send();
|
||||
_xhr.onreadystatechange = function () {
|
||||
if (_xhr.readyState == 4 && _xhr.status == 200) {
|
||||
json = _xhr.responseText;
|
||||
if (json != "") {
|
||||
sessionStorage.setItem('search',json);
|
||||
QueryStorage = JSON.parse(json);
|
||||
query(QueryStorage, otxt.value, Record);
|
||||
div_href();
|
||||
var otxt = addComment.I("search-input"),
|
||||
list = addComment.I("PostlistBox"),
|
||||
Record = list.innerHTML,
|
||||
searchFlag = null;
|
||||
otxt.oninput = function () {
|
||||
if (searchFlag = null) {
|
||||
clearTimeout(searchFlag);
|
||||
}
|
||||
searchFlag = setTimeout(function () {
|
||||
query(QueryStorage, otxt.value, Record);
|
||||
div_href();
|
||||
}, 250);
|
||||
};
|
||||
|
||||
function search_a(val) {
|
||||
if (sessionStorage.getItem('search') != null) {
|
||||
QueryStorage = JSON.parse(sessionStorage.getItem('search'));
|
||||
query(QueryStorage, $("#search-input").val(), Record);
|
||||
div_href();
|
||||
} else {
|
||||
var _xhr = new XMLHttpRequest();
|
||||
_xhr.open("GET", val, true)
|
||||
_xhr.send();
|
||||
_xhr.onreadystatechange = function () {
|
||||
if (_xhr.readyState == 4 && _xhr.status == 200) {
|
||||
json = _xhr.responseText;
|
||||
if (json != "") {
|
||||
sessionStorage.setItem('search', json);
|
||||
QueryStorage = JSON.parse(json);
|
||||
query(QueryStorage, otxt.value, Record);
|
||||
div_href();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Object.values) Object.values = function (obj) {
|
||||
if (obj !== Object(obj))
|
||||
throw new TypeError('Object.values called on a non-object');
|
||||
var val = [],
|
||||
key;
|
||||
for (key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
val.push(obj[key]);
|
||||
if (!Object.values) Object.values = function (obj) {
|
||||
if (obj !== Object(obj))
|
||||
throw new TypeError('Object.values called on a non-object');
|
||||
var val = [],
|
||||
key;
|
||||
for (key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
val.push(obj[key]);
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
function Cx(arr, q) {
|
||||
q = q.replace(q,"^(?=.*?"+q+").+$").replace(/\s/g,")(?=.*?");
|
||||
i = arr.filter(
|
||||
v => Object.values(v).some(
|
||||
v => new RegExp(q + '').test(v)
|
||||
)
|
||||
);
|
||||
return i;
|
||||
}
|
||||
function div_href(){
|
||||
$(".ins-selectable").each(function(){
|
||||
$(this).click(function(){
|
||||
$("#Ty").attr('href',$(this).attr('href'));
|
||||
$("#Ty").click();
|
||||
$(".search_close").click();
|
||||
});
|
||||
});
|
||||
}
|
||||
function search_result(keyword, link, fa, title, iconfont, comments, text){
|
||||
if(keyword){
|
||||
var s = keyword.trim().split(" "),
|
||||
a = title.indexOf(s[s.length-1]),
|
||||
b = text.indexOf(s[s.length-1]);
|
||||
title=a<60 ? title.slice(0,80):title.slice(a-30,a+30);
|
||||
title=title.replace(s[s.length-1], '<mark class="search-keyword"> ' + s[s.length-1].toUpperCase() + ' </mark>');
|
||||
text=b<60 ? text.slice(0,80):text.slice(b-30,b+30);
|
||||
text=text.replace(s[s.length-1], '<mark class="search-keyword"> ' + s[s.length-1].toUpperCase() + ' </mark>');
|
||||
}
|
||||
return '<div class="ins-selectable ins-search-item" href="' + link + '"><header><i class="fa fa-'+ fa +'" aria-hidden="true"></i>' + title + '<i class="iconfont icon-'+ iconfont +'"> ' + comments + '</i>' + '</header><p class="ins-search-preview">' + text + '</p></div>';
|
||||
}
|
||||
|
||||
function query(B, A, z) {
|
||||
var x, v, s, y = "",
|
||||
w = "",
|
||||
u = "",
|
||||
r = "",
|
||||
p = "",
|
||||
F = "",
|
||||
H = "",
|
||||
G = '<section class="ins-section"><header class="ins-section-header">',
|
||||
D = "</section>",
|
||||
E = "</header>",
|
||||
C = Cx(B, A.trim());
|
||||
for (x = 0; x < Object.keys(C).length; x++) {
|
||||
H = C[x];
|
||||
switch (v = H.type) {
|
||||
case "post":
|
||||
w = w + search_result(A, H.link, "file", H.title, "mark", H.comments, H.text);
|
||||
break;
|
||||
case "tag":
|
||||
p = p + search_result("", H.link, "tag", H.title, "none", "", "");
|
||||
break;
|
||||
case "category":
|
||||
r = r + search_result("", H.link, "folder", H.title, "none", "", "");
|
||||
break;
|
||||
case "page":
|
||||
u = u + search_result(A, H.link, "file", H.title, "mark", H.comments, H.text);
|
||||
break;
|
||||
case "comment":
|
||||
F = F + search_result(A, H.link, "comment", H.title, "none", "", H.text);
|
||||
break
|
||||
}
|
||||
}
|
||||
w && (y = y + G + "文章" + E + w + D), u && (y = y + G + "页面" + E + u + D), r && (y = y + G + "分类" + E + r + D), p && (y = y + G + "标签" + E + p + D), F && (y = y + G + "评论" + E + F + D), s = addComment.I("PostlistBox"), s.innerHTML = y
|
||||
}
|
||||
function Cx(arr, q) {
|
||||
q = q.replace(q, "^(?=.*?" + q + ").+$").replace(/\s/g, ")(?=.*?");
|
||||
i = arr.filter(
|
||||
v => Object.values(v).some(
|
||||
v => new RegExp(q + '').test(v)
|
||||
)
|
||||
);
|
||||
return i;
|
||||
}
|
||||
|
||||
function div_href() {
|
||||
$(".ins-selectable").each(function () {
|
||||
$(this).click(function () {
|
||||
$("#Ty").attr('href', $(this).attr('href'));
|
||||
$("#Ty").click();
|
||||
$(".search_close").click();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function search_result(keyword, link, fa, title, iconfont, comments, text) {
|
||||
if (keyword) {
|
||||
var s = keyword.trim().split(" "),
|
||||
a = title.indexOf(s[s.length - 1]),
|
||||
b = text.indexOf(s[s.length - 1]);
|
||||
title = a < 60 ? title.slice(0, 80) : title.slice(a - 30, a + 30);
|
||||
title = title.replace(s[s.length - 1], '<mark class="search-keyword"> ' + s[s.length - 1].toUpperCase() + ' </mark>');
|
||||
text = b < 60 ? text.slice(0, 80) : text.slice(b - 30, b + 30);
|
||||
text = text.replace(s[s.length - 1], '<mark class="search-keyword"> ' + s[s.length - 1].toUpperCase() + ' </mark>');
|
||||
}
|
||||
return '<div class="ins-selectable ins-search-item" href="' + link + '"><header><i class="fa fa-' + fa + '" aria-hidden="true"></i>' + title + '<i class="iconfont icon-' + iconfont + '"> ' + comments + '</i>' + '</header><p class="ins-search-preview">' + text + '</p></div>';
|
||||
}
|
||||
|
||||
function query(B, A, z) {
|
||||
var x, v, s, y = "",
|
||||
w = "",
|
||||
u = "",
|
||||
r = "",
|
||||
p = "",
|
||||
F = "",
|
||||
H = "",
|
||||
G = '<section class="ins-section"><header class="ins-section-header">',
|
||||
D = "</section>",
|
||||
E = "</header>",
|
||||
C = Cx(B, A.trim());
|
||||
for (x = 0; x < Object.keys(C).length; x++) {
|
||||
H = C[x];
|
||||
switch (v = H.type) {
|
||||
case "post":
|
||||
w = w + search_result(A, H.link, "file", H.title, "mark", H.comments, H.text);
|
||||
break;
|
||||
case "tag":
|
||||
p = p + search_result("", H.link, "tag", H.title, "none", "", "");
|
||||
break;
|
||||
case "category":
|
||||
r = r + search_result("", H.link, "folder", H.title, "none", "", "");
|
||||
break;
|
||||
case "page":
|
||||
u = u + search_result(A, H.link, "file", H.title, "mark", H.comments, H.text);
|
||||
break;
|
||||
case "comment":
|
||||
F = F + search_result(A, H.link, "comment", H.title, "none", "", H.text);
|
||||
break
|
||||
}
|
||||
}
|
||||
w && (y = y + G + "文章" + E + w + D), u && (y = y + G + "页面" + E + u + D), r && (y = y + G + "分类" + E + r + D), p && (y = y + G + "标签" + E + p + D), F && (y = y + G + "评论" + E + F + D), s = addComment.I("PostlistBox"), s.innerHTML = y
|
||||
}
|
||||
}
|
||||
});
|
||||
$('.search_close').on('click', function () {
|
||||
if ($('.js-search').hasClass('is-visible')) {
|
||||
$('.js-toggle-search').toggleClass('is-active');
|
||||
$('.js-search').toggleClass('is-visible');
|
||||
$('html').css('overflow-y','unset');
|
||||
$('html').css('overflow-y', 'unset');
|
||||
}
|
||||
});
|
||||
$('#show-nav').on('click', function () {
|
||||
|
@ -1492,7 +1536,8 @@ var home = location.href,
|
|||
NH: function () {
|
||||
var h1 = 0;
|
||||
$(window).scroll(function () {
|
||||
var s = $(document).scrollTop(),cached = $('.site-header');
|
||||
var s = $(document).scrollTop(),
|
||||
cached = $('.site-header');
|
||||
if (s == h1) {
|
||||
cached.removeClass('yya');
|
||||
}
|
||||
|
@ -1505,16 +1550,18 @@ var home = location.href,
|
|||
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
|
||||
var load_post_timer;
|
||||
var intersectionObserver = new IntersectionObserver(function (entries) {
|
||||
if (entries[0].intersectionRatio <= 0) return;
|
||||
var page_next = $('#pagination a').attr("href");
|
||||
var load_key = addComment.I("add_post_time");
|
||||
if(page_next!=undefined && load_key ){
|
||||
var load_time = addComment.I("add_post_time").title;
|
||||
if(load_time !="233"){
|
||||
console.log("%c 自动加载时倒计时 %c","background:#9a9da2; color:#ffffff; border-radius:4px;","","",load_time);
|
||||
load_post_timer=setTimeout(function(){load_post();},load_time*1000);
|
||||
}
|
||||
}
|
||||
if (entries[0].intersectionRatio <= 0) return;
|
||||
var page_next = $('#pagination a').attr("href");
|
||||
var load_key = addComment.I("add_post_time");
|
||||
if (page_next != undefined && load_key) {
|
||||
var load_time = addComment.I("add_post_time").title;
|
||||
if (load_time != "233") {
|
||||
console.log("%c 自动加载时倒计时 %c", "background:#9a9da2; color:#ffffff; border-radius:4px;", "", "", load_time);
|
||||
load_post_timer = setTimeout(function () {
|
||||
load_post();
|
||||
}, load_time * 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
intersectionObserver.observe(
|
||||
document.querySelector('.footer-device')
|
||||
|
@ -1524,7 +1571,8 @@ var home = location.href,
|
|||
load_post();
|
||||
return false;
|
||||
});
|
||||
function load_post() {
|
||||
|
||||
function load_post() {
|
||||
$('#pagination a').addClass("loading").text("");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
@ -1539,17 +1587,19 @@ var home = location.href,
|
|||
post_list_show_animation();
|
||||
if (nextHref != undefined) {
|
||||
$("#pagination a").attr("href", nextHref);
|
||||
//加载完成上滑
|
||||
//加载完成上滑
|
||||
var tempScrollTop = $(window).scrollTop();
|
||||
$(window).scrollTop(tempScrollTop);
|
||||
$body.animate({ scrollTop: tempScrollTop + 300 }, 666)
|
||||
$body.animate({
|
||||
scrollTop: tempScrollTop + 300
|
||||
}, 666)
|
||||
} else {
|
||||
$("#pagination").html("<span>很高兴你翻到这里,但是真的没有了...</span>");
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
XCS: function () {
|
||||
var __cancel = jQuery('#cancel-comment-reply-link'),
|
||||
|
@ -1748,8 +1798,8 @@ $(function () {
|
|||
$(document).pjax('a[target!=_top]', '#page', {
|
||||
fragment: '#page',
|
||||
timeout: 8000,
|
||||
}).on('pjax:beforeSend', () => { //离开页面停止播放
|
||||
$('.normal-cover-video').each(function() {
|
||||
}).on('pjax:beforeSend', () => { //离开页面停止播放
|
||||
$('.normal-cover-video').each(function () {
|
||||
this.pause();
|
||||
this.src = '';
|
||||
this.load = '';
|
||||
|
@ -1784,7 +1834,7 @@ $(function () {
|
|||
if ($('.js-search.is-visible').length > 0) {
|
||||
$('.js-toggle-search').toggleClass('is-active');
|
||||
$('.js-search').toggleClass('is-visible');
|
||||
$('html').css('overflow-y','unset');
|
||||
$('html').css('overflow-y', 'unset');
|
||||
}
|
||||
});
|
||||
window.addEventListener('popstate', function (e) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<?php if (!is_home()&&(comments_open()) ){ ?>
|
||||
<section class="duoshuowrapper comments">
|
||||
<div class="commentwrap comments-hidden">
|
||||
<div class="notification"><i class="iconfont icon-comment"></i><?php esc_html_e('查看评论', 'akina'); ?></div>
|
||||
<div class="notification"><i class="iconfont icon-comment"></i><?php _e('View comments', 'sakura'); /*查看评论*/?></div>
|
||||
</div>
|
||||
<div class="comments-main">
|
||||
<div class="commentwrap">
|
||||
|
|
|
@ -58,9 +58,6 @@
|
|||
<?php if (akina_option('facebook')){ ?>
|
||||
<li><a href="<?php echo akina_option('facebook', ''); ?>" target="_blank" class="social-wangyiyun" title="Facebook"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/facebook.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('googleplus')){ ?>
|
||||
<li><a href="<?php echo akina_option('googleplus', ''); ?>" target="_blank" class="social-wangyiyun" title="Google+"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/googleplus.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('jianshu')){ ?>
|
||||
<li><a href="<?php echo akina_option('jianshu', ''); ?>" target="_blank" class="social-wangyiyun" title="Jianshu"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/jianshu.png"/></a></li>
|
||||
<?php } ?>
|
||||
|
@ -120,9 +117,6 @@
|
|||
<?php if (akina_option('facebook')){ ?>
|
||||
<li><a href="<?php echo akina_option('facebook', ''); ?>" target="_blank" class="social-wangyiyun" title="Facebook"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/facebook.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('googleplus')){ ?>
|
||||
<li><a href="<?php echo akina_option('googleplus', ''); ?>" target="_blank" class="social-wangyiyun" title="Google+"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/googleplus.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('jianshu')){ ?>
|
||||
<li><a href="<?php echo akina_option('jianshu', ''); ?>" target="_blank" class="social-wangyiyun" title="Jianshu"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/jianshu.png"/></a></li>
|
||||
<?php } ?>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"python.pythonPath": "C:\\Users\\Mashiro\\AppData\\Local\\Programs\\Python\\Python38\\python.exe"
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
封面图生成工具
|
||||
===
|
||||
|
||||
### 依赖
|
||||
Python3
|
||||
PIL (Pillow)
|
||||
|
||||
### 安装依赖
|
||||
安装 Python: <https://docs.python.org/zh-cn/3.7/using/index.html>
|
||||
|
||||
安装 PIL:
|
||||
|
||||
```bash
|
||||
# Linix/Mac Terminal
|
||||
pip install Pillow
|
||||
# 如果也安装了 Python 2,需要指定 pip 版本:
|
||||
pip3 install Pillow
|
||||
|
||||
# Windows Powershell 或者 CMD
|
||||
pip install Pillow
|
||||
# 如果也安装了 Python 2,需要指定 pip 版本:
|
||||
pip3 install Pillow
|
||||
# 如果提示权限不足([WinError 5] Access is denied),请运行:
|
||||
pip install Pillow --user
|
||||
```
|
||||
|
||||
### 运行
|
||||
把图片文件放到 `gallary` 目录,Windows 可直接双击 manifest.py,或者和其他操作系统一样,在 Terminal、Powershell、CMD 中运行:
|
||||
|
||||
```bash
|
||||
# 切换到 manifest.py 所在目录:
|
||||
cd /path/to/manifest/
|
||||
python manifest.py
|
||||
# 如果也安装了 Python 2,需要指定 Python 版本:
|
||||
python3 manifest.py
|
||||
```
|
||||
|
||||
GUI 程序开发中,除了以上运行 manifest.py 的方法以外,也可直接运行 qt.py 启动可视化窗口,需要安装 PyQT5:
|
||||
```bash
|
||||
pip3 install PyQt5
|
||||
python3 qt.py
|
||||
```
|
||||
|
||||
### TODO
|
||||
shell/batch 自动安装依赖、自动删除过期文件、压缩图片、GitHub API push、release
|
|
@ -0,0 +1 @@
|
|||
from .manifest import *
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 248 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 200 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 9.7 KiB |
|
@ -0,0 +1 @@
|
|||
{"19313b0d62b27c8ba022f60fbfedd5ee": {"source": "beyond_by_auroralion-dan5njb.jpg", "jpeg": ["jpeg/19313b0d62b27c8ba022f60fbfedd5ee.jpeg", "jpeg/19313b0d62b27c8ba022f60fbfedd5ee.th.jpeg"], "webp": ["webp/19313b0d62b27c8ba022f60fbfedd5ee.webp", "webp/19313b0d62b27c8ba022f60fbfedd5ee.th.webp"]}, "783bf161f47b32882f0e962fd4064de7": {"source": "pixar_up_movie_balloons_desktop_1920x1080_hd-wallpaper-507967.jpg", "jpeg": ["jpeg/783bf161f47b32882f0e962fd4064de7.jpeg", "jpeg/783bf161f47b32882f0e962fd4064de7.th.jpeg"], "webp": ["webp/783bf161f47b32882f0e962fd4064de7.webp", "webp/783bf161f47b32882f0e962fd4064de7.th.webp"]}, "e9f33c2c502ab43804964ce7edd431f9": {"source": "\u6d77\u306e\u7a7a(56993195)_by_\u590fT.jpg", "jpeg": ["jpeg/e9f33c2c502ab43804964ce7edd431f9.jpeg", "jpeg/e9f33c2c502ab43804964ce7edd431f9.th.jpeg"], "webp": ["webp/e9f33c2c502ab43804964ce7edd431f9.webp", "webp/e9f33c2c502ab43804964ce7edd431f9.th.webp"]}}
|
|
@ -0,0 +1,74 @@
|
|||
# coding=utf-8
|
||||
'''
|
||||
Created on Apr 23, 2018
|
||||
Desc: Webp convertor
|
||||
@author: Mashiro https://2heng.xin
|
||||
'''
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import hashlib
|
||||
from PIL import Image
|
||||
|
||||
class Single(object):
|
||||
def __init__(self, file, manifest):
|
||||
self.file = file
|
||||
self.mani = manifest
|
||||
|
||||
def hash(self):
|
||||
hasher = hashlib.md5()
|
||||
with open('gallary/' + self.file, 'rb') as afile:
|
||||
buf = afile.read()
|
||||
hasher.update(buf)
|
||||
self.hash = hasher.hexdigest()
|
||||
self.jpeg = 'jpeg/' + self.hash + '.jpeg'
|
||||
self.webp = 'webp/' + self.hash + '.webp'
|
||||
self.jpeg_th = 'jpeg/' + self.hash + '.th.jpeg'
|
||||
self.webp_th = 'webp/' + self.hash + '.th.webp'
|
||||
|
||||
def optimize(self):
|
||||
im = Image.open('gallary/' + self.file).convert('RGB')
|
||||
im.save(self.jpeg, 'JPEG') # todo: TinyPNG API
|
||||
im.save(self.webp, 'WEBP')
|
||||
im.thumbnail((450, 300))
|
||||
im.save(self.jpeg_th, 'JPEG') # todo: TinyPNG API
|
||||
im.save(self.webp_th, 'WEBP')
|
||||
|
||||
def manifest(self):
|
||||
self.mani[self.hash] = {
|
||||
'source': self.file,
|
||||
'jpeg': [self.jpeg, self.jpeg_th],
|
||||
'webp': [self.webp, self.webp_th]
|
||||
}
|
||||
|
||||
def main(self):
|
||||
self.hash()
|
||||
# if os.path.exists(self.jpeg) and os.path.exists(self.webp):
|
||||
self.optimize()
|
||||
self.manifest()
|
||||
return self.mani
|
||||
|
||||
def gen_manifest_json():
|
||||
onlyfiles = [f for f in os.listdir('gallary') if os.path.isfile(os.path.join('gallary', f))]
|
||||
id = 1
|
||||
Manifest = {}
|
||||
for f in onlyfiles:
|
||||
try:
|
||||
worker = Single(f, Manifest)
|
||||
Manifest = worker.main()
|
||||
print(str(id) + '/' + str(len(onlyfiles)))
|
||||
id += 1
|
||||
except OSError:
|
||||
print("Falied to optimize the picture: " + f)
|
||||
with open('manifest.json', 'w+') as json_file:
|
||||
json.dump(Manifest, json_file)
|
||||
|
||||
|
||||
def main():
|
||||
gen_manifest_json()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
key = input('`manifest.json` saved. Press any key to quit.')
|
||||
quit()
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Nov 29, 2019
|
||||
Desc: Webp convertor QT
|
||||
@author: Mashiro @ https://2heng.xin
|
||||
"""
|
||||
|
||||
import sys
|
||||
import time
|
||||
from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QPushButton, QMessageBox, QDesktopWidget, QGridLayout
|
||||
from PyQt5.QtCore import QCoreApplication
|
||||
from PyQt5.QtGui import QIcon
|
||||
from manifest import main as manifest
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.initUI()
|
||||
|
||||
def initUI(self):
|
||||
self.statusBar().showMessage('Ready')
|
||||
|
||||
self.BtnWid = QWidget(self)
|
||||
self.setCentralWidget(self.BtnWid)
|
||||
grid = QGridLayout()
|
||||
self.BtnWid.setLayout(grid)
|
||||
|
||||
names = ['Generate manifest.json',
|
||||
'Pull from GitHub',
|
||||
'Push to GitHub',
|
||||
'Release on GitHub',
|
||||
'Push manifest.json to WordPress',
|
||||
'About and Turtor']
|
||||
|
||||
actions = [self.Action_1,
|
||||
self.Action_0,
|
||||
self.Action_0,
|
||||
self.Action_0,
|
||||
self.Action_0]
|
||||
|
||||
positions = [(i, j) for i in range(6) for j in range(1)]
|
||||
|
||||
for position, name, action in zip(positions, names, actions):
|
||||
if name == '':
|
||||
continue
|
||||
button = QPushButton(name)
|
||||
button.clicked.connect(action)
|
||||
grid.addWidget(button, *position)
|
||||
|
||||
# self.resize(500, 500)
|
||||
self.center()
|
||||
self.setWindowTitle('Manifest Generator')
|
||||
self.setWindowIcon(QIcon('icon.png'))
|
||||
|
||||
self.show()
|
||||
|
||||
def Action_0(self):
|
||||
sender = self.sender()
|
||||
self.statusBar().showMessage('"' + sender.text() + '" was pressed')
|
||||
|
||||
#Generate manifest.json
|
||||
def Action_1(self):
|
||||
# self.statusBar().showMessage('Processing...')
|
||||
# time.sleep(1)
|
||||
manifest()
|
||||
self.statusBar().showMessage('`manifest.json` saved.')
|
||||
|
||||
def center(self):
|
||||
qr = self.frameGeometry()
|
||||
cp = QDesktopWidget().availableGeometry().center()
|
||||
qr.moveCenter(cp)
|
||||
self.move(qr.topLeft())
|
||||
|
||||
def closeEvent(self, event):
|
||||
reply = QMessageBox.question(self, 'Message',
|
||||
"Are you sure to quit?", QMessageBox.Yes |
|
||||
QMessageBox.No, QMessageBox.No)
|
||||
|
||||
if reply == QMessageBox.Yes:
|
||||
event.accept()
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
ex = MainWindow()
|
||||
sys.exit(app.exec_())
|
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 190 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 24 KiB |
2076
options.php
1
page.php
|
@ -29,5 +29,4 @@ get_header(); ?>
|
|||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
|
@ -16,7 +16,7 @@ get_header(); ?>
|
|||
if ( have_posts() ) : ?>
|
||||
<?php if(akina_option('patternimg') || !get_random_bg_url()){ ?>
|
||||
<header class="page-header">
|
||||
<h1 class="page-title"><?php printf( esc_html__( '搜索结果: %s', 'akina' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
|
||||
<h1 class="page-title"><?php printf( __( 'search result: %s', 'sakura' )/*搜索结果*/, '<span>' . get_search_query() . '</span>' ); ?></h1>
|
||||
</header><!-- .page-header -->
|
||||
<?php } ?>
|
||||
<?php
|
||||
|
@ -39,7 +39,7 @@ get_header(); ?>
|
|||
<!-- search start -->
|
||||
<form class="s-search">
|
||||
<i class="iconfont icon-search"></i>
|
||||
<input class="text-input" type="search" name="s" placeholder="<?php _e('Search...', 'akina') ?>" required>
|
||||
<input class="text-input" type="search" name="s" placeholder="<?php _e('Search...', 'sakura') ?>" required>
|
||||
</form>
|
||||
<!-- search end -->
|
||||
</div>
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
* @package Akina
|
||||
*/
|
||||
|
||||
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
|
||||
return;
|
||||
}
|
||||
//disable get_sidebar()
|
||||
return;
|
||||
?>
|
||||
|
||||
<aside id="secondary" class="widget-area" role="complementary">
|
||||
|
|
|
@ -23,5 +23,4 @@ get_header(); ?>
|
|||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
119
style.css
|
@ -1,14 +1,14 @@
|
|||
@charset "utf-8";
|
||||
/*
|
||||
Theme Name: Sakura
|
||||
Theme URI: https://2heng.xin/theme-sakura/
|
||||
Author: Mashiro, Louie, Fuzzz
|
||||
Theme URI: https://github.com/mashirozx/Sakura/
|
||||
Author: Mashiro, Spirit, Louie, Fuzzz
|
||||
Author URI: http://2heng.xin
|
||||
Description: Akina主题分支(原版地址 http://www.akina.pw/themeakina)
|
||||
Version: 3.2.4
|
||||
Description: A wonderful branch of theme Akina
|
||||
Version: 3.3.6
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Text Domain: akina
|
||||
Text Domain: sakura
|
||||
Tags: 樱花庄的白猫
|
||||
*/
|
||||
|
||||
|
@ -1195,8 +1195,9 @@ a:hover {
|
|||
padding: 10px;
|
||||
top: 46px;
|
||||
right: -13px;
|
||||
width: 80px;
|
||||
min-width: 80px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
z-index: 9999;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 40px -8px rgba(0, 0, 0, .5);
|
||||
|
@ -4357,6 +4358,12 @@ i.iconfont.js-toggle-search.iconsearch {
|
|||
}
|
||||
|
||||
.ins-section .ins-section-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
padding: 8px 15px;
|
||||
z-index: 1;
|
||||
color: #9a9a9a;
|
||||
border-bottom: 1px solid #e2e2e2;
|
||||
}
|
||||
|
@ -6802,7 +6809,8 @@ input[type=radio]:checked:before {
|
|||
.changeSkin-gear {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 5px;
|
||||
left: auto;
|
||||
right: 5px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: 99;
|
||||
|
@ -8287,7 +8295,8 @@ td.hljs-ln-numbers {
|
|||
.skin-menu {
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
left: 10px;
|
||||
left: auto;
|
||||
right: 10px;
|
||||
height: auto;
|
||||
width: 220px;
|
||||
border-radius: 5px;
|
||||
|
@ -8493,3 +8502,97 @@ h1[id*=toc-head]::before,h2[id*=toc-head]::before,h3[id*=toc-head]::before,h4[id
|
|||
visibility:hidden
|
||||
}
|
||||
|
||||
@media (max-width:860px) {
|
||||
.widget-area{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.widget-area {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
bottom: 66px;
|
||||
left: -400px;
|
||||
z-index: 3;
|
||||
width: 400px;
|
||||
-webkit-transition: .3s;
|
||||
transition: all .3s;
|
||||
background-color: rgba(255,255,255,0.8);
|
||||
box-shadow: 0 1px 20px -8px rgba(0,0,0,.5);
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.widget-area.active{
|
||||
left: -1px !important;
|
||||
}
|
||||
|
||||
.widget-area .sakura_widget{
|
||||
padding: 16px;
|
||||
height: calc(100% - 30px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.widget-area .sakura_widget h2 {
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
|
||||
.widget-area .sakura_widget ol,.widget-area .sakura_widget ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.widget-area .heading{
|
||||
color: #555;
|
||||
font-size: 20px;
|
||||
font-weight: 900;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
background-color: #f5f5f5;
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
.widget-area .show-hide-wrap{
|
||||
position: absolute;
|
||||
background: #e6e6e6;
|
||||
right: -18px;
|
||||
width: 18px;
|
||||
height: 66px;
|
||||
border-radius: 0 6px 6px 0;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.active .show-hide-wrap {
|
||||
width: 100%;
|
||||
right: 0;
|
||||
transition: all .3s ease;
|
||||
}
|
||||
|
||||
.widget-area .show-hide{
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
outline:none;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
opacity: .8;
|
||||
vertical-align: middle;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
-webkit-transform: rotateY(0);
|
||||
transform: rotateY(0);
|
||||
cursor: pointer;
|
||||
border-radius: 0 6px 6px 0;
|
||||
transition: all .3s ease;
|
||||
}
|
||||
|
||||
.widget-area.active .show-hide{
|
||||
-webkit-transform: rotateY(180deg);
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
.widget-area .show-hide svg{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</div>
|
||||
<div class="works-meta">
|
||||
<div class="works-comnum">
|
||||
<span><i class="iconfont icon-mark"></i> <?php comments_popup_link('暂无', '1 ', '% '); ?></span>
|
||||
<span><i class="iconfont icon-mark"></i> <?php comments_popup_link(__('NOTHING','sakura'), '1 ', '% '); /*暂无*/?></span>
|
||||
</div>
|
||||
<div class="works-views">
|
||||
<span><i class="iconfont icon-attention"></i> <?php echo get_post_views(get_the_ID()); ?> </span>
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
</div>
|
||||
<div class="info-meta">
|
||||
<div class="comnum">
|
||||
<span><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 条评论', '% 条评论'); ?></span>
|
||||
<span><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 '.__("Comment","sakura")/*条评论*/, '% '.__("Comments","sakura")/*条评论*/); ?></span>
|
||||
</div>
|
||||
<div class="views">
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()); ?> 热度</span>
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()).' '._n('Hit','Hits',get_post_views(get_the_ID()),'sakura')/*热度*/?></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer><!-- .entry-footer -->
|
||||
|
|
|
@ -11,18 +11,18 @@
|
|||
|
||||
<section class="no-results not-found">
|
||||
<header class="page-header">
|
||||
<h1 class="page-title"><?php esc_html_e( '没有找到任何东西!', 'akina' ); ?></h1>
|
||||
<h1 class="page-title"><?php _e( 'There is noyhing here!', 'sakura' ); /*没有找到任何东西*/?></h1>
|
||||
</header><!-- .page-header -->
|
||||
|
||||
<div class="page-content">
|
||||
<?php
|
||||
if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
|
||||
|
||||
<p><?php printf( wp_kses( __( '准备好发布你的第一篇文章了么? <a href="%1$s">点击这里开始</a>.', 'akina' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
|
||||
<p><?php printf( wp_kses( __( 'Ready to post your first article? <a href="%1$s">Click here to start</a>.', 'sakura' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); /*准备好发布你的第一篇文章了么? <a href="%1$s">点击这里开始</a>.*/?></p>
|
||||
|
||||
<?php elseif ( is_search() ) : ?>
|
||||
<div class="sorry">
|
||||
<p><?php esc_html_e( '没有找到你想要的,看看其他的吧。', 'akina' ); ?></p>
|
||||
<p><?php _e( 'Didn\'t find what you want, look at the other ones.', 'sakura' ); /*没有找到你想要的,看看其他的吧。*/?></p>
|
||||
<div class="sorry-inner">
|
||||
<ul class="search-no-reasults">
|
||||
<?php
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php esc_html_e( '我们似乎没有找到你想要的东西. 或许你可以搜索一下试试.', 'akina' ); ?></p>
|
||||
<p><?php _e( 'We didn\'t seem to find what you want. Maybe you can search for it.', 'sakura' ); /*我们似乎没有找到你想要的东西. 或许你可以搜索一下试试.*/?></p>
|
||||
<?php
|
||||
|
||||
endif; ?>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
the_content();
|
||||
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'akina' ),
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'sakura' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
|
@ -32,7 +32,7 @@
|
|||
edit_post_link(
|
||||
sprintf(
|
||||
/* translators: %s: Name of current post */
|
||||
esc_html__( 'Edit %s', 'akina' ),
|
||||
__( 'Edit %s', 'sakura' ),
|
||||
the_title( '<span class="screen-reader-text">"', '"</span>', false )
|
||||
),
|
||||
'<span class="edit-link">',
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<?php if(akina_option('patternimg') || !get_post_thumbnail_id(get_the_ID())) { ?>
|
||||
<header class="entry-header">
|
||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
<p class="entry-census"><?php echo poi_time_since(strtotime($post->post_date_gmt)); ?> <?php echo get_post_views(get_the_ID()); ?> 次阅读</p>
|
||||
<p class="entry-census"><?php echo poi_time_since(strtotime($post->post_date_gmt)); ?> <?php echo get_post_views(get_the_ID()).' '. _n('View','Views',get_post_views(get_the_ID()),'sakura')/*次阅读*/?> </p>
|
||||
<hr>
|
||||
</header><!-- .entry-header -->
|
||||
<?php } ?>
|
||||
|
@ -31,7 +31,7 @@
|
|||
</div><!-- .entry-content -->
|
||||
<?php the_reward(); ?>
|
||||
<footer class="post-footer">
|
||||
<div class="post-lincenses"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="nofollow"><i class="fa fa-creative-commons" aria-hidden="true"></i> 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a></div>
|
||||
<div class="post-lincenses"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="nofollow"><i class="fa fa-creative-commons" aria-hidden="true"></i> <?php _e('Attribution-NonCommercial-ShareAlike 4.0 International','sakura'); /*知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议*/?></a></div>
|
||||
<div class="post-tags">
|
||||
<?php if ( has_tag() ) { echo '<i class="iconfont icon-tags"></i> '; the_tags('', ' ', ' ');}?>
|
||||
</div>
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
<footer class="entry-footer">
|
||||
<div class="info-meta">
|
||||
<div class="comnum">
|
||||
<span><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 条评论', '% 条评论'); ?></span>
|
||||
<span><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 '.__("Comment","sakura")/*条评论*/, '% '.__("Comments","sakura")/*条评论*/); ?></span>
|
||||
</div>
|
||||
<div class="views">
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()); ?> 热度</span>
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()).' '._n('Hit','Hits',get_post_views(get_the_ID()),'sakura')/*热度*/?></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer><!-- .entry-footer -->
|
||||
|
|
|
@ -49,8 +49,8 @@ $the_cat = get_the_category();
|
|||
</div>
|
||||
<a href="<?php the_permalink(); ?>" class="post-title"><h3><?php the_title();?></h3></a>
|
||||
<div class="post-meta">
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()); ?> 热度</span>
|
||||
<span class="comments-number"><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 条评论', '% 条评论'); ?></span>
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()).' '._n('Hit','Hits',get_post_views(get_the_ID()),'sakura')/*热度*/?></span>
|
||||
<span class="comments-number"><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 '.__("Comment","sakura")/*条评论*/, '% '.__("Comments","sakura")/*条评论*/); ?></span>
|
||||
<span><i class="iconfont icon-file"></i><a href="<?php echo esc_url(get_category_link($the_cat[0]->cat_ID)); ?>"><?php echo $the_cat[0]->cat_name; ?></a>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
</div>
|
||||
<div class="info-meta">
|
||||
<div class="comnum">
|
||||
<span><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 条评论', '% 条评论'); ?></span>
|
||||
<span><i class="iconfont icon-mark"></i><?php comments_popup_link('NOTHING', '1 '.__("Comment","sakura")/*条评论*/, '% '.__("Comments","sakura")/*条评论*/); ?></span>
|
||||
</div>
|
||||
<div class="views">
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()); ?> 热度</span>
|
||||
<span><i class="iconfont icon-attention"></i><?php echo get_post_views(get_the_ID()).' '._n('Hit','Hits',get_post_views(get_the_ID()),'sakura')/*热度*/?></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer><!-- .entry-footer -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<?php the_post_thumbnail('full'); ?>
|
||||
<header class="entry-header">
|
||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
<p class="entry-census"><?php echo poi_time_since(strtotime($post->post_date_gmt)); ?> <?php echo get_post_views(get_the_ID()); ?> 次阅读</p>
|
||||
<p class="entry-census"><?php echo poi_time_since(strtotime($post->post_date_gmt)); ?> <?php echo get_post_views(get_the_ID()).' '._n('View','Views',get_post_views(get_the_ID()),'sakura')/*次阅读*/?></p>
|
||||
<hr>
|
||||
</header>
|
||||
</div>
|
||||
|
|
|
@ -11,40 +11,40 @@ if( !empty($_POST['register_reg']) ) {
|
|||
|
||||
// Check the username
|
||||
if ( $sanitized_user_login == '' ) {
|
||||
$error .= '<strong>错误</strong>:请输入用户名。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Please enter username.","sakura")./*请输入用户名。*/'<br />';
|
||||
} elseif ( ! validate_username( $sanitized_user_login ) ) {
|
||||
$error .= '<strong>错误</strong>:此用户名包含无效字符,请输入有效的用户名。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Invalid characters, please enter a valid username.","sakura")./*此用户名包含无效字符,请输入有效的用户名。*/'<br />';
|
||||
$sanitized_user_login = '';
|
||||
} elseif ( username_exists( $sanitized_user_login ) ) {
|
||||
$error .= '<strong>错误</strong>:该用户名已被注册。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("This username has been registered.","sakura")./*该用户名已被注册。*/'<br />';
|
||||
}
|
||||
|
||||
// Check the e-mail address
|
||||
if ( $user_email == '' ) {
|
||||
$error .= '<strong>错误</strong>:请填写电子邮件地址。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Please enter email address.","sakura")./*请填写电子邮件地址。*/'<br />';
|
||||
} elseif ( ! is_email( $user_email ) ) {
|
||||
$error .= '<strong>错误</strong>:电子邮件地址不正确。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Invalid email address.","sakura")./*电子邮件地址不正确。*/'<br />';
|
||||
$user_email = '';
|
||||
} elseif ( email_exists( $user_email ) ) {
|
||||
$error .= '<strong>错误</strong>:该电子邮件地址已经被注册。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("This email address has been registered.","sakura")./*该电子邮件地址已经被注册。*/'<br />';
|
||||
}
|
||||
|
||||
// Check the password
|
||||
if(strlen($_POST['user_pass']) < 6){
|
||||
$error .= '<strong>错误</strong>:密码长度至少6位。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Password length is at least 6 digits.","sakura")./*密码长度至少6位。*/'<br />';
|
||||
}elseif($_POST['user_pass'] != $_POST['user_pass2']){
|
||||
$error .= '<strong>错误</strong>:两次输入的密码不一致。<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Inconsistent password entered twice.","sakura")./*两次输入的密码不一致。*/'<br />';
|
||||
}
|
||||
|
||||
// verification
|
||||
if(akina_option('login_validate') && strlen($_POST['verification']) > 0 ){
|
||||
$error .= '<strong>错误</strong>:请拖动滑块验证身份<br />';
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Please drag the slider to verify identity","sakura")./*请拖动滑块验证身份*/'<br />';
|
||||
}
|
||||
|
||||
if($error == '') {
|
||||
$user_id = wp_create_user( $sanitized_user_login, $_POST['user_pass'], $user_email );
|
||||
if ( !$user_id ) {
|
||||
$error .= sprintf( '<strong>错误</strong>:无法完成注册请求... 请联系<a href=\"mailto:%s\">管理员</a>!<br />', get_option( 'admin_email' ) );
|
||||
$error .= '<strong>'.__("Error","sakura")./*错误*/'</strong>:'.__("Unable to complete registration request...Please contact","sakura")./*无法完成注册请求... 请联系*/'<a href=\"mailto:'. get_option( 'admin_email' ) .'\">'.__("administrator","sakura")./*管理员*/'</a>!<br />';
|
||||
}else if (!is_user_logged_in()) {
|
||||
$user = get_userdatabylogin($sanitized_user_login);
|
||||
$user_id = $user->ID;
|
||||
|
@ -73,14 +73,14 @@ if( !empty($_POST['register_reg']) ) {
|
|||
<div id="verification-slider">
|
||||
<div id="slider">
|
||||
<div id="slider_bg"></div>
|
||||
<span id="label">»</span><span id="labelTip">拖动滑块验证</span>
|
||||
<span id="label">»</span><span id="labelTip"><?php _e("Drag the slider to verify","sakura")/*拖动滑块验证*/?></span>
|
||||
</div>
|
||||
<input type="hidden" name="verification" value="verification" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="register_reg" value="ok" />
|
||||
<?php if(!empty($error)) { echo '<p class="user-error">'.$error.'</p>'; } ?>
|
||||
<input class="button register-button" name="submit" type="submit" value="注 册">
|
||||
<input class="button register-button" name="submit" type="submit" value="<?php _e("Sign up","sakura")/*注 册*/?>">
|
||||
</form>
|
||||
</div>
|
||||
<?php }else{
|
||||
|
@ -89,7 +89,7 @@ if( !empty($_POST['register_reg']) ) {
|
|||
<script>//window.location.href='<?php echo $loadurl; ?>';</script>
|
||||
<?php } ?>
|
||||
<?php else : ?>
|
||||
<div class="register-close"><p>暂未开放注册。</p></div>
|
||||
<div class="register-close"><p><?php _e("Registration is not open yet.","sakura")/*暂未开放注册。*/?></p></div>
|
||||
<?php endif; ?>
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
|
@ -194,4 +194,4 @@ get_footer();
|
|||
return milliSeconds;
|
||||
}
|
||||
</script>
|
||||
<script type='text/javascript' src='<?php bloginfo("template_url"); ?>/user/verification.js'></script>
|
||||
<script type='text/javascript' src='<?php bloginfo("template_url"); ?>/user/verification.js'></script>
|
||||
|
|
|
@ -10,7 +10,7 @@ get_header();
|
|||
#ini_set('display_errors', '1');
|
||||
?>
|
||||
<div id="main">
|
||||
<header class="page-header"><h1 class="cat-title">归档</h1> <span class="cat-des"><p>Archives</p> </span></header>
|
||||
<header class="page-header"><h1 class="cat-title">时光轴</h1> <span class="cat-des"><p>TimeLine</p> </span></header>
|
||||
<div id="main-part">
|
||||
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?>
|
||||
<article class="art">
|
||||
|
@ -28,4 +28,4 @@ get_header();
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php get_footer();
|
||||
<?php get_footer();
|
||||
|
|