换了个Pigeon
主题~30¥
老是用handsome让我产生了视觉疲劳,而且我本身好像不太喜欢花哨和三栏的主题
也许后续还会换回去吧
也可能还会更换一个minirizhi PLUS
~50¥
这俩个主题都差不多的风格,另外觉得还是emlog和zblog也挺不错的 WP的话太臃肿了 始终玩不转
post.php
list.php
文件
将 <time datetime="<?php $this->date('c'); ?>"><?php echo feature::formatTime($this->created); ?>
修改为 <time datetime="<?php $this->date('c'); ?>"><?php echo date('Y-m-d' , $this->created); ?>
common\comments.php
文件<?php echo feature::formatTime($comments->created); ?>
改为<?php echo date('Y-m-d H:i:s' , $comments->created); ?>
\common\say.php
文件
<div class="cross_right_time"><?php echo feature::formatTime($comments->created); ?></div>
改为<div class="cross_right_time"><?php echo date('Y-m-d H:i:s' , $comments->created); ?></div>
在functions.php
文件里 添加 数字转换为大写中文函数
function numToWord($num)
{
$chiNum = array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖");
$chiUni = array('','拾', '佰', '仟', '萬', '億', '拾', '佰', '仟');
$chiStr = '';
$num_str = (string)$num;
$count = strlen($num_str);
$last_flag = true; //上一个 是否为0
$zero_flag = true; //是否第一个
$temp_num = null; //临时数字
$chiStr = '';//拼接结果
if ($count == 2) {//两位数
$temp_num = $num_str[0];
$chiStr = $temp_num == 1 ? $chiUni[1] : $chiNum[$temp_num].$chiUni[1];
$temp_num = $num_str[1];
$chiStr .= $temp_num == 0 ? '' : $chiNum[$temp_num];
}else if($count > 2){
$index = 0;
for ($i=$count-1; $i >= 0 ; $i--) {
$temp_num = $num_str[$i];
if ($temp_num == 0) {
if (!$zero_flag && !$last_flag ) {
$chiStr = $chiNum[$temp_num]. $chiStr;
$last_flag = true;
}
}else{
$chiStr = $chiNum[$temp_num].$chiUni[$index%9] .$chiStr;
$zero_flag = false;
$last_flag = false;
}
$index ++;
}
}else{
$chiStr = $chiNum[$num_str[0]];
}
return $chiStr;
}
themeInit
函数改为
function themeInit($archive){
$archive = spam_protection_pre($archive, $post, $result);
}
function spam_protection_math() {
$num1 = rand(0, 10);
$num2 = rand(0, 10);
//<input type="text" id="code" required="" name="sum" value="" placeholder=" 拾 + 伍 = ? * ">
//echo "<div style=\"align-items: baseline;\"><p for=\"math\" id=\"Verification_code\" style=\"margin-bottom:0\">请输入<code>".numToWord($num1)."</code>+<code>".numToWord($num2)."</code>的计算结果:</p><input type=\"text\" name=\"sum\" class=\"text\" value=\"\" size=\"25\" id=\"sum\" tabindex=\"4\" style=\"flex:1\" placeholder=\"\">\n</div>";
echo '<input type="text" id="code" required="" name="sum" value="" placeholder="验证请回答: ' .numToWord($num1). '+' .numToWord($num2). '= ? * ">';
echo "<input type=\"hidden\" name=\"num1\" value=\"$num1\">\n";
echo "<input type=\"hidden\" name=\"num2\" value=\"$num2\">";
}
function spam_protection_pre($archive, $post, $result) {
if ($_REQUEST['text'] != null) {
If($_POST['num1'] == null || $_POST['num2'] == null) {
throw new Typecho_Widget_Exception(_t('验证码异常.', '评论失败'));
} else {
$sum = $_POST['sum'];
switch ($sum) {
case $_POST['num1'] + $_POST['num2'] : break;
case null:
throw new Typecho_Widget_Exception(_t('请输入验证码.', '评论失败'));
break;
default:
throw new Typecho_Widget_Exception(_t('验证码错误.', '评论失败'));
}
}
}
return $archive;
if ($archive->is('single'))
{
$archive->content = image_class_replace($archive->content);
}
if($archive->request->isPost() && $archive->request->likeup && $archive->request->do_action){
likeup($archive->request->likeup,$archive->request->do_action);
exit;
}
Helper::options()->commentsAntiSpam = false; //关闭反垃圾
最后在主题目录pigeon/common/comments.php
合适的地方加入
<?php spam_protection_math();?>
这个方法发现和主题自带的点赞功能有冲突 已经修复,详情见下面详细代码
functions.php.txt
后续完整新方法:
也可采用更加厉害的插件
/*头部背景图透明*/
#header .header_bg_img img {
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0.2;
}
#header .header_info {
display: flex;
flex: 1 1 auto;
flex-direction: column;
padding-left: 0.85rem;
}
#header .header_info_name {
flex: 1 1 auto;
font-size: 2rem;
}
#header .header_info_qm {
font-size: 1rem;
}
#header .header_avatar {
width: 80px;
height: 80px;
border-radius: 3px;
overflow: hidden;
flex-shrink: 0;
}
#headers .meun_li {
margin-right:0.937rem;
font-size:1.5rem;
display:inline-block;
letter-spacing:-2px;
}
#headers .meun_ul {
padding:0;
margin:0;
list-style:none;
font-size:14px;
line-height:2;
}
#headers .level_li {
padding:0.1rem .625rem;
font-size:15px;
text-align:center;
border-bottom:1px solid rgba(238,238,238,0.33);
}
/*网站背景图片*/
body{
background-image:url(//blog.cdn.76fx.com/diy/bg1.png);
background-repeat: repeat;
background-attachment: fixed;
background-position: center top;
}
/*方正锐正圆*/
@font-face{font-family:FontStyle;src:url("https://vkceyugu.cdn.bspapp.com/VKCEYUGU-06306e5d-82ba-4a56-a140-e63cf54b9f21/72d75607-476c-4f9a-8253-10e975550957.woff2");format("woff2");font-display:swap;}*{font-family:FontStyle;}
body {
background: #f6f6f6;
background-image: linear-gradient(0deg,transparent 24%,rgba(201,195,195,.329) 25%,hsla(0,8%,80.4%,.05) 26%,transparent 27%,transparent 74%,hsla(0,5.2%,81%,.185) 75%,rgba(180,176,176,.05) 76%,transparent 77%,transparent),linear-gradient(90deg,transparent 24%,rgba(204,196,196,.226) 25%,hsla(0,4%,66.1%,.05) 26%,transparent 27%,transparent 74%,hsla(0,5.2%,81%,.185) 75%,rgba(180,176,176,.05) 76%,transparent 77%,transparent);
background-size: 50px 50px;
margin: 0 auto;
padding: 0;
font-size: 14px;
color: #333;
font-family: Lato,PingFang SC,Microsoft YaHei,sans-serif;
}