Enable Gzip Compression
Add the following code to typecho’s config.inc.php
/** Enable gzip compression */
ob_start('ob_gzhandler');
Remove Address Bar index.php
In Typeho background settings in the address rewrite select wordpress style, set pseudo-static for typecho, as follows:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
Site Setup Https
Add the following code to the configuration file.
define('__TYPECHO_SECURE__',true);
Bypass Proxy to Get IP
Add the following code to the configuration file
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];}
Modify Gravatar Avatar to QQ Avatar
Search within the Common.php file in the blog’s root directory under /var/Typecho (get gravatar avatar address) or roughly at line 816
/**
* Get QQ avatar, if it fails, get Gravatar avatar.
*
* @param string $mail
* @param int $size
* @param string $rating
* @param string $default
* @param bool $isSecure
* @return string
*/
public static function gravatarUrl($mail, $size, $rating, $default, $isSecure = false)
{
$reg = "/^\d{5,11}@[qQ][Qq]\.(com)$/";
if (preg_match($reg, $mail)) {
$img = explode("@", $mail);
$url = "//q2.qlogo.cn/headimg_dl?dst_uin={$img[0]}&spec=100";
} else {
if (defined('__TYPECHO_GRAVATAR_PREFIX__')) {
$url = __TYPECHO_GRAVATAR_PREFIX__;
} else {
$url = $isSecure ? 'https://sdn.geekzu.org' : 'https://gravatar.inwao.com';
$url .= '/avatar/';
}
if (!empty($mail)) {
$url .= md5(strtolower(trim($mail)));
}
$url .= '?s=' . $size;
$url .= '&r=' . $rating;
$url .= '&d=' . $default;
}
return $url;
}
Modify the File Upload Path
Open the following file var/Widget/Upload.php and modify the upload directory.
/**
* Upload component
*
* @ Author Qi Ning
* @ category typecho
* @ Widgets
*/
class Upload extends Contents implements ActionInterface
{
// Upload the file directory.
public constant UPLOAD_DIR = 'usr/uploads'; /*** UPLOAD_DIR = 'usr/uploads'.
/**
* Delete files.
*
* Array of parameters $content file-related information
* Returns bool
*/
public static function deleteHandle(array $content): bool
{
$result = Plugin::factory(Upload::class)->trigger($hasDeleted)->deleteHandle($content); { If ($hasDeleted) is deleted, deleteHandle($content) is deleted.
If ($hasDeleted) {
Return $result; }
}
return @unlink(__TYPECHO_ROOT_DIR__ . '/' . $content['attachment]-> path); } }
}
10 条评论
作者以非凡的视角解读平凡,让文字焕发出别样的光彩。
文章的叙述风格独特,用词精准,让人回味无穷。
这篇文章提供了宝贵的经验和见解,对读者有很大的启发和帮助。
文章深入浅出,既有深度思考,又不乏广度覆盖,令人叹为观止。
存在主义视角的介入提升了思想维度。
对传统与现代的融合思考颇具启发性。
建议引入反面案例,增强辩证性。
故事线完整,伏笔巧妙,结局耐人寻味。
结论部分可提出实际应用建议,提升价值。
立意高远,以小见大,引发读者对社会/人性的深层共鸣。