一个简单的WordPress头像加速插件,提取自wp-china-yes插件。
<?php
/*
Plugin Name:Gravatar头像加速
Description:本插件可针对中国大陆地区网站对Gravatar头像服务进行替换加速,且支持SSL协议。
Version: 1.0
*/
/*gravatar头像加速*/
function Gravatar($avatar) {
$avatar = str_replace(array( "0.gravatar.com", "1.gravatar.com","www.gravatar.com", "2.gravatar.com","secure.gravatar.com"), "gravatar.wp-china-yes.net", $avatar);
return $avatar;
}
function Gravatar_start() {
ob_start("Gravatar");
}
function Gravatar_end() {
ob_end_flush();
}
add_action('init', 'Gravatar_start');
add_action('shutdown', 'Gravatar_end');
?>
© 版权声明
THE END
暂无评论内容