Skip to content

Commit

Permalink
fix(Version 2.1.1): 🐛 Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
syfxlin committed Oct 20, 2019
1 parent af1e6f0 commit c479d00
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 26 deletions.
7 changes: 4 additions & 3 deletions footer.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
$footer_text = get_option('origami_footer_text'); ?>
$footer_text = get_option('origami_footer_text');
$footer_pos = get_option('origami_footer_pos', 'right');
?>
<footer class="ori-footer">
<section id="scroll-top" class="btn btn-action"><i class="icon icon-arrow-up"></i></section>
<div class="ori-container columns">
<div></div>
<div class="ori-container columns <?php echo $footer_pos; ?>">
<section class="ori-copyright col-4">
<?php echo $footer_text; ?>
<br/>
Expand Down
5 changes: 3 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,9 @@ function lazyload_img_all($content)
}
function origami_lazyload_img_process_callback($matches)
{
$rep_src = '';
$rep_srcset = '';
$rep_src =
'src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="';
$rep_srcset = $rep_src;
$img_attr = $matches[1];
str_replace("'", '"', $img_attr);
if (preg_match('/(src="([^"]*)?")/i', $img_attr, $src_matches) !== 0) {
Expand Down
Binary file modified image/comment-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified image/origami.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 61 additions & 16 deletions include/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ function origami_auto_comment_image($comment)
{
global $allowedtags;
$allowedtags['img'] = ['src' => [], 'alt' => []];
$allowedtags['pre'] = ['class' => true];
$allowedtags['code'] = ['class' => true];
$allowedtags['p'] = true;
$allowedtags['ul'] = true;
$allowedtags['ol'] = true;
$allowedtags['li'] = true;
$allowedtags['sub'] = true;
$allowedtags['sup'] = true;
$allowedtags['del'] = true;
$allowedtags['em'] = true;
$allowedtags['strong'] = true;
$allowedtags['blockquote'] = true;
return $comment;
}
add_filter('preprocess_comment', 'origami_auto_comment_image');
Expand Down Expand Up @@ -47,7 +59,11 @@ function origami_comment_respond_email($comment_id, $comment)
$comment_post_id = $comment_parent->comment_post_ID;
$comment_parent_author_name = $comment_parent->comment_author;
$pat = '/\/comment-page-(\d+)/';
$comment_link = preg_replace($pat, '?comment_page=$1',get_comment_link($comment_parent->comment_ID));
$comment_link = preg_replace(
$pat,
'?comment_page=$1',
get_comment_link($comment_parent->comment_ID)
);

$headers =
"Content-Type: text/html; charset=\"" .
Expand All @@ -56,12 +72,15 @@ function origami_comment_respond_email($comment_id, $comment)

$subject = '你在 [' . get_option('blogname') . '] 上的评论有了新回复。';

$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
$message =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>你在[' . $blog_name . ']上的评论有了新回复。</title>
<title>你在[' .
$blog_name .
']上的评论有了新回复。</title>
</head>
<body>
<table
Expand Down Expand Up @@ -94,14 +113,18 @@ function origami_comment_respond_email($comment_id, $comment)
>
<tbody>
<tr>
<td align="left" style="font-size: 30px;color:#40C4FF;">' . $title . '</td>
<td align="left" style="font-size: 30px;color:#40C4FF;">' .
$title .
'</td>
<td align="right">
<img
width="32"
height="32"
style="display:block;width: 45px;height: 45px;border-radius:50%;"
alt="avatar"
src="' . $icon . '"
src="' .
$icon .
'"
/>
</td>
</tr>
Expand Down Expand Up @@ -170,44 +193,62 @@ function origami_comment_respond_email($comment_id, $comment)
>
尊敬的<span
style="color:#40ceff;font-weight:bold"
>' . $comment_parent_author_name . '</span
>' .
$comment_parent_author_name .
'</span
>,您好!
</td>
</tr>
<tr>
<td
style="font-family:Roboto-Regular,Helvetica,Arial,sans-serif;font-size:13px;color:#202020;line-height:1.5"
>
您对[' . $blog_name . ']上 《<a
您对[' .
$blog_name .
']上 《<a
style="white-space:nowrap;color:#40ceff"
href="' . get_permalink($comment_post_id) . '"
>' . get_the_title($comment_post_id) . '</a>》
href="' .
get_permalink($comment_post_id) .
'"
>' .
get_the_title($comment_post_id) .
'</a>》
一文的评论有新回复,欢迎您前来继续参与讨论。<br /><br />这是您发表的原始评论
<ol
style="background:#e0e0e0;margin:5px;padding:20px 40px 20px"
>
' . $comment_parent->comment_content . '
' .
$comment_parent->comment_content .
'
</ol>
<span style="color:#40ceff;font-weight:bold"
>' . $comment_author_name . '</span
>' .
$comment_author_name .
'</span
>给您的回复如下
<ol
style="background:#e0e0e0;margin:5px;padding:20px 40px 20px"
>
' . $comment->comment_content . '
' .
$comment->comment_content .
'
</ol>
<br />如有需要,您可以<a
style="text-decoration:none;color:#4285f4"
target="_blank"
href="' . $comment_link . '"
href="' .
$comment_link .
'"
>查看有关此回复的详细信息</a
>。
</td>
</tr>
<tr height="26px"></tr>
<tr>
<td style="font-family:Roboto-Regular,Helvetica,Arial,sans-serif;font-size:13px;color:#202020;line-height:1.5">
' . $salute . '
' .
$salute .
'
</td>
</tr>
<tr height="20px"></tr>
Expand All @@ -218,7 +259,9 @@ function origami_comment_respond_email($comment_id, $comment)
>
<tbody>
<tr>
<td>' . $footer . '</td>
<td>' .
$footer .
'</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -253,7 +296,9 @@ function origami_comment_respond_email($comment_id, $comment)
<tr>
<td>
<div style="direction: ltr;">
©Copyright&nbsp;2019&nbsp;' . $blog_name . '
©Copyright&nbsp;2019&nbsp;' .
$blog_name .
'
</div>
</td>
</tr>
Expand Down
14 changes: 14 additions & 0 deletions include/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public function admin_init()
// 页脚设置
register_setting('origami_style', 'origami_footer_text');
register_setting('origami_style', 'origami_footer_time');
register_setting('origami_style', 'origami_footer_pos');
add_settings_section(
'origami_style_footer',
__('3.页脚设置', 'origami'),
Expand Down Expand Up @@ -157,6 +158,19 @@ public function admin_init()
'是否显示页脚时间?若填写时间代表显示,格式如下</br>07/01/2017 00:00:09'
]
);
add_settings_field(
'origami_footer_pos',
__('页脚时间', 'origami'),
[&$this, 'settings_field_input_text'],
'origami_style',
'origami_style_footer',
[
'field' => 'origami_footer_pos',
'value' => 'right',
'type' => 'text',
'description' => '页脚的位置(left,center,right)'
]
);

//About card设置
register_setting('origami_style', 'origami_about_card_enable');
Expand Down
15 changes: 14 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ origami.initComments = function() {
if (page > pageCount) {
page = pageCount;
}
closeReply();
let loadF = function() {
$http({
url: '/wp-json/origami/v1/comments',
Expand All @@ -517,6 +518,7 @@ origami.initComments = function() {
}, 600);
pageOut = page;
changeNav();
initReply();
callback(pageOut, response);
},
error: function(status) {
Expand Down Expand Up @@ -686,6 +688,17 @@ origami.initComments = function() {
e.preventDefault();
});
};
let closeReply = function() {
let response = document.getElementById('comments-response');
let form = document.getElementById('comments-form');
let submitEle = document.getElementById('response-submit');
let closeResponse = document.getElementById('close-response');
form.remove();
response.appendChild(form);
submitEle.setAttribute('data-commentid', 0);
submitEle.setAttribute('data-lv', 1);
closeResponse.style.visibility = 'hidden';
};
let initReply = function() {
let response = document.getElementById('comments-response');
let form = document.getElementById('comments-form');
Expand Down Expand Up @@ -1669,7 +1682,7 @@ window.addEventListener('load', function() {
origami.initGitCard();
origami.initArticleCard();
}
if (LazyLoad) {
if (window.LazyLoad) {
new LazyLoad({
elements_selector: '.lazy',
load_delay: 500,
Expand Down
Loading

0 comments on commit c479d00

Please sign in to comment.