腾讯针对办公环境推出的聊天软件,其实可以理解成换了壳子的 QQ,没有广告和那些花里胡哨的冗余功能,这之前腾讯针对办公人群推出过腾讯 TM,限于利益关系和当时难以撼动的垄断地位,腾讯 TM 始终下不了狠心,放不下嘴边的蛋糕,不温不火,难有实质性突破。

而今,情况不大一样了,阿里钉钉的推出和其迅猛的发展势头显然让马化腾很着急,为了抢占办公这块大有作为的市场,出于保护自身利益,腾讯防御性地推出 TIM,着实有些被动。

腾讯 TIM 显然还是没有诚意,或者说准备不充分,主打功能是在线文档,相比阿里钉钉针对办公环境的建树,腾讯 TIM 还有一段长路要模仿,即便 TIM 某些方面在刻意模仿钉钉。

发现我还有些幽默细胞,所以打算开个段子的主题,发些我写的段子,期待不?

自去年年末开始玩蚂蚁森林,到今天终于种成一棵梭梭树,在蚂蚁森林好友间相互偷取能量,重燃了当初的偷菜游戏的热情。目前共有20位支付宝好友开通了蚂蚁森林,认真玩的不到10位,除了自己支付宝消费,平时很难收取到足够的能量,因此树长的及其缓慢,好在最近我发现了诀窍,自己每天能够生产出 2000g 的能量,才有了小树的疯狂生长。

由蚂蚁森林得到的一些思考

刚一接就觉得蚂蚁森林虽是一个公益项目,但丝毫不妨碍它作为一款休闲小游戏的呈现,以手机支付宝的巨大用户体量,发展手机小游戏绝对很有想象空间,也许蚂蚁森林本质上便是阿里发展手机游戏的一次尝试,要搞游戏,事实上支付宝很可能已经开始这么干了。这些年阿里在支付相关领域已经布局的差不多了,是时候在手机游戏领域寻求突破了(其它人都这么干了)。

通过游戏阿里可以赚钱,本身作为支付工具,对鼓励用户在游戏中消费具有先天优势;同时,还可以增强用户黏性、提升活跃度,加强用户间互动,从而建立支付宝梦寐以求的关系链。当前的问题可能是阿里缺少拿得出手的游戏产品,不管怎样,阿里迟早要踏足(手机)游戏领域。

坐车打发时间,胡乱写了以上这些,不知我的预言会不会成真。

本周上班没什么活,对博客外挂做了些许改动。

改进搜索结果显示

之前搜索结果默认最多显示100个字符长度,有个缺陷即便长度不够100,也会在最后加上省略号,改进之后只有长度超过100才会显示省略号。

<?php
$get_content = (strtolower($source) === "content") ? get_the_content() : get_the_excerpt();
echo mb_substr(get_the_excerpt(),0,100,"utf8");
if (strlen($get_content) > 100) {
        echo "...";
    }
?>

logo 做成字体图标,增加回到顶部功能

把小乌贼调整了一下,利用 icomoon 做成字体图标,这样无图模式也能看到小乌贼了。

同时,给小乌贼加了 go to top 功能,方便浏览时快速回到网页顶部。

临近放假事情不算多,利用空余时间陆陆续续对博客做了一些调整。

评论回复邮件通知延迟发送

无意发现了ze3kr 的评论回复邮件通知代码含有执行计划任务的代码,抄过来加到在用的评论回复邮件通知插件上,这个网站的评论回复邮件通知依赖 Comment Email Reply 插件,不知从 WordPress 的哪个版本开始这个插件便不再正常工作了,插件作者迟迟没有更新,一并做了修改,下面是修改后的完整代码:

<?php
/**
* Plugin Name: Comment Email Reply
* Plugin URI:  http://kilozwo.de/wordpress-comment-email-reply-plugin
* Description: Simply notifies comment-author via email if someone replies to his comment. Zero Configuration. Available in English and German. More languages welcome.
* Version:     1.0.5(dev)
* Author:      Jan Eichhorn
* Author URI:  http://kilozwo.de
* License:     GPLv2
*/

add_filter('wp_mail_content_type', function($contentType) { return 'text/html'; });
function cer_comment_notification($comment_id) {
    $comment_object = get_comment($comment_id);
    if ($comment_object->comment_approved == 1 && $comment_object->comment_parent > 0) {
        $comment_parent = get_comment($comment_object->comment_parent);

        $mailcontent =
            '<html>
            <head>
            <style>
                #mgy{margin:0;padding:0;font-size:16px;font-size:1rem;line-height:1.8;color:#444}
                #mgy .a{width:100%}
                #mgy .b{width:520px;margin:0 auto;padding:20px}
                #mgy .c{clear:both}
                #mgy .d,#mgy .n{margin:0 0 24px}
                #mgy .e{border-top:1px solid #DDD}
                #mgy .f{margin-bottom:10px}
                #mgy .g{margin:0 5px 0 0}
                #mgy .h{width:100px;height:32px;line-height:32px;padding:2px;border-radius:30px;color:#FFF;background:#52C69C;box-shadow:1px 1px 0 #DDD}
                #mgy .h:hover{background:#57AD68}
                #mgy .j{margin:0 6px;border-bottom:1px dotted;text-decoration:none}
                #mgy .k{text-align:center;text-decoration:none}
                #mgy .l{display:block}
                #mgy .m{color:#57AD68}
                #mgy .o{margin:5px 0}
                #mgy .p{color:#5A5A5A}
                #mgy .q{background:#F0F0F0;border-radius:4px;padding:8px;line-height:1.5rem;line-height:24px}
                #mgy .s{color:#2458A1}
                @media screen and (max-width:720px) {
                    #mgy{font-size:18px;font-size:1.125rem;line-height:2}
                    #mgy .b{width:100%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
                }
            </style>
            </head>
            <body>
            <div id="mgy">
            <div class="a"><div class="b"><div class="o"><span class="g">'
            .$comment_parent->comment_author.
            ':</span>你好</div>'.
            '<div class="f"><span class="g s">'.$comment_object->comment_author.'</span>在'.
            '<a class="j" href="'.get_permalink($comment_parent->comment_post_ID).'">'.get_the_title($comment_parent->comment_post_ID).'</a>中 <span class="f">对你发表的评论:</span></div>'.
            '<div class="f q">'. esc_html($comment_parent->comment_content) .'</div>'.
            '<div class="f">作了如下回复:</div><div class="d s q">'
            . esc_html($comment_object->comment_content) .
            '</div>'.
            '<a class="d h k l" href="'.get_comment_link( $comment_parent->comment_ID ).'">继续回复</a>'.
            '<div class="f">感谢对<a class="j m" href="//maliyana.com">木瓜园</a>的支持,谢谢!</div>'.'<div class="e"><span class="p">MALI<span class="m">YA</span>NA</span></div></div></div></div>
            </body></html>';
        $email = $comment_parent->comment_author_email;
        $title ='来自 ['.get_option('blogname') . '] 的评论回复';
        wp_mail($email, $title, $mailcontent);
    }
}
add_action('comment_mail_notify','cer_comment_notification');

function comment_mail_notify_schedule($comment_id) {
    wp_schedule_single_event( time()+300, 'comment_mail_notify', array($comment_id));
}
add_action('wp_insert_comment','comment_mail_notify_schedule',99,2);

function cer_comment_status_changed($comment_id, $comment_status) {
    $comment_object = get_comment($comment_id);
    if ($comment_status == 'approve') {
        cer_comment_notification($comment_object->comment_ID, $comment_object);
    }
}
# Fire Email when comments gets approved later.
add_action('wp_set_comment_status','cer_comment_status_changed',99,2);
?>

更改防垃圾评论机制

卸载了 Akismet 插件,给评论功能加了两个小机关,配合起来效果不错,只是对人工垃圾评论无能为力。

外观上的一些调整

  • 过年了,要有气氛,临时改了个有春节喜庆氛围的配色;
  • 无限滚动改了新的加载动画,这是个 css3 动画,主要目的是改善手机无图模式下的浏览体验,同时,对 css3的支持,就意味着逐步停止对 IE 老旧浏览器的支持了。