functions.php 文件添加
function themeInit($comment){
$comment = spam_protection_pre($comment, $post, $result);
}
function spam_protection_math(){
$num1=rand(1,49);
$num2=rand(1,49);
echo '<label for="math">请输入<code>'.$num1.'</code>+<code>'.$num2.'</code>的...
话题typecho共有相关文章 16 篇。
Typecho 加强评论拦截和自定义敏感词过滤

functions.php 文件添加
设置敏感词过滤后台选项和过滤敏感词函数
function themeConfig($form) {
$SensitiveWords = new Typecho_Widget_Helper_Form_Element_Textarea('SensitiveWords', NULL, NULL, _t('评论敏感词过滤'), _t('过滤词语格式:词语|词语2|词语3'));
$SensitiveWords->setAttribute('class', 'typecho-option option_main');
$form-...
Typecho 替换全站 gravatar 头像地址

网站根目录下的 config.inc.php 文件,加入:
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://cravatar.cn/avatar/'); //更换头像源
Typecho 页面判断函数

$this->is('index') //首页
$this->is('archive') //归档
$this->is('category') //分类栏目
$this->is('tag') //标签
$this->is('date') //日期归档页
$this->is('single') //内容页
$this->is('post') //内容页
$this->is('page') //独立页面
$this->is('attachment') //附件
$this->is('category','cat_sl...
Typecho 分页和上下篇函数调用

分页
<?php $this->pageLink('下一页','next'); ?>
<?php $this->pageLink('上一页'); ?>
<?php $this->pageNav('上一页', '下一页', '5', '……'); ?>
<?php $this->pageNav('Newer', 'Older', 1, '...', array('wrapTag' => 'nav', 'wrapClass' => 'page-nav', 'itemTag' => '', 'prevClass...
Apache,Nginx 设置 typecho 伪静态去除 index.php

Apache 下设置 typecho 伪静态
设置 - 永久链接 - 启用地址重写功能
网站根目录 创建 .htaccess 文件,粘贴
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
Nginx ...
最新评论