最近,伟大的中华神墙再次发威,屏蔽掉了Wordpress等博客系统广泛使用的Gravatar头像系统,Wordpress在大陆使用时会出现Gravatar无法加载而导致的异常缓慢,好在国内的duoshuo.com提供了国内使用的Gravatar镜像系统,目前来说通行使用正常,于是花了一点时间写了一个Wordpress可以使用的插件,可以解决由于GFW屏蔽导致的Gravatar头像无法加载和加载缓慢的问题,在此分享给大家,欢迎下载使用。
插件名称:WP-ReplaceGravatarMirror
插件说明:
插件说明页面
使用方法:
1.下载最新版本的WP-ReplaceGravatarMirror,解压已下载完成的文件。下载地址:
https://github.com/limccn/WP-ReplaceGravatarMirror/tree/master/release/1.0
2.将解压后的wp-replace-gravatar-mirror文件夹上传到服务器的plugins目录下,或者使用Wordpress自带的上传安装插件功能
3.进入Wordpress后台,在插件选项卡中激活WP-ReplaceGravatarMirror
/** * Plugin Name: WP-ReplaceGravatarMirror * Plugin URI: https://github.com/limccn/WP-ReplaceGravatarMirror * Description: This plugin can helps your wordpress blog replace its default gravatar provider(gravatar.com) to a third-part gravatar mirror(duoshuo.com) which can be load faster in somewhere. * Author: limc * Author URI: http://www.lidaren.com/ * Version: 1.0 * License: GPL 2.0 *//** * Silence is golden */if (!defined('ABSPATH')) exit;class WP_Replace_Gravatar_Mirror{ /** * init Hook * */ public function __construct() { add_filter('get_avatar', array($this,'replace_gravatar_to_duoshuo'), 10, 3); } /** * Use DuoShuo's gravatar mirror to replace Gravatar's. * Simplely replace from "*.gravatar.com" to "gravatar.duoshuo.com". * * @param $avatar * @return mixed */ public function replace_gravatar_to_duoshuo($avatar) { $avatar = str_replace(array('www.gravatar.com','0.gravatar.com','1.gravatar.com','2.gravatar.com','s.gravatar.com'),'gravatar.duoshuo.com',$avatar); return $avatar; }}/** * bootstrap */new WP_Replace_Gravatar_Mirror;
插件的源代码可以在github找到,GitHub地址:https://github.com/limccn/WP-ReplaceGravatarMirror
最后,感谢多说网(duoshuo.com)提供的Gravatar镜像服务
--------------------------------------------------------------------------------------
- 版权声明:
- 如在本页面内无特别说明,本文内容均为[李大仁博客]原创,本文版权归[李大仁博客]所有。
- 欢迎转载,转载请务必在文章页面明显位置提供原文链接并注明出处。欢迎您在转载本文时保留本段声明。
- 文章标题:
[WP]WP-ReplaceGravatarMirror插件
- 独立博客:
李大仁博客
- 永久链接:
http://www.lidaren.com/archives/1525
--------------------------------------------------------------------------------------
以上内容由博客自动发布工具自动发布,最终显示内容和效果会与原文内容有所偏差,敬请谅解。
转载请注明原文地址: https://ju.6miu.com/read-1308165.html