header.php

<link rel="stylesheet" href="https://true-me.com/usr/themes/chopstack/css/jquery.fancybox.min.css">
<script src="https://true-me.com/usr/themes/chopstack/js/jquery.fancybox.min.js">"></script>

functions.php

<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

function themeInit($archive)
{
 Helper::options()->commentsMaxNestingLevels = 999;
 Helper::options()->commentsAntiSpam = false;
 Helper::options()->commentsMarkdown = true;
Helper::options()->commentsHTMLTagAllowed = '<a href=""><img src=""><img src="" class=""><code>';
    if ($archive->is('author')) {
       $archive->parameter->pageSize = 50; // 自定义条数
}
    if ($archive->is('single')&&!$archive->is('page', 'links'))
    {
        $archive->content = image_class_replace($archive->content);
    }
}

function image_class_replace($content)
{
$content = preg_replace('#<a(.*?) href="([^"]*/)?(([^"/]*)\.[^"]*)"(.*?)>#',
        '<a$1 href="$2$3"$5 target="_blank" rel="nofollow">', $content);

$content = preg_replace('#\s+<\/code><\/pre>#',
        '</code></pre>', $content);  // 代码高亮行号显示兼容typecho1.0版本

preg_match_all('/\<img.*?src\=\"(.*?)\"[^>]*>/i',$content,$mat);

$cnt = count( $mat[1] );

$content = preg_replace('#<img(.*?)src="([^"]*/)?(([^"/]*)\.[^"]*)"([^>]*?)>#',
        '<a data-fancybox="gallery" href="$2$3" data-no-instant><img$1 src="$2$3" $5>
</a>', $content);

$content = preg_replace('#<p><a data-fancybox="gallery"(.*?)><img(.*?)>
</a></p>#',
        '<a data-fancybox="gallery" $1><img$2>
</a>', $content);

$content = preg_replace('#<a data-fancybox="gallery"(.*?)><img(.*?)alt=\"(.*?)\-(25|33|50|75|100)\"(.*?)>
</a>(<br\s*/?>)?#',
        '<a data-fancybox="gallery" data-caption="$3" $1><img$2class="figure nocaption fig-$4" alt="$3" title="$3"$5>
</a>', $content);

$content = preg_replace('#<p><a(.*?) href="http(s)?\:\/\/www.bilibili.com\/video\/av(.*?)(\/)?(index\_(.*?)\.html)?"(.*?)><\/p>#',
        '<div id="chopstack-tv"><iframe src="//www.bilibili.com/html/player.html?aid=$3&page=$6" scrolling="no" border="0" frameborder="no" framespacing="0"></iframe></div>', $content);

$options = Typecho_Widget::widget('Widget_Options');
$fujian = $options->Enhance;
if(!empty($options->src_add) && !empty($options->cdn_add) && strtolower(md5($fujian))=='f881766500f28ea95a10bb2673bb32db'){
$content = str_ireplace($options->src_add,$options->cdn_add,$content);
}

    return $content;
}

?>