[WP插件]Open Fonts替换。前端公共库、Google公共库、Google字体库CDN服务

文章转载于苏洋博客,原文地址:http://www.soulteary.com/2014/06/08/replace-google-fonts.html


CDN服务提供者为360,地址:http://libs.useso.com/

==================================================================

最近由于Google Open Fonts的众所周知的大姨妈问题,WordPress博客普遍出现了访问很慢的状况。

写了一个小插件,使用奇虎360的开放字体服务来替换Google的开放字体服务,插件任何问题,欢迎反馈。

=== Replace Google Fonts ===

Contributors: soulteary
Tags: Qihu Fonts, Qihu Web Fonts, 360 Fonts, 360 Web Fonts, Google Fonts, Google Web Fonts
Requires at least: 3.5
Tested up to: 3.8
Stable tag: 1.0

Use Qihoo 360 Open Fonts Service to replace Google’s.

== Description ==

[Plugin homepage](http://www.soulteary.com/2014/06/08/) | [Plugin author](http://www.soulteary.com/)

There are some problem with Google in china, the Google Fonts make the website too slow to open, so we can use Qihoo 360’s Web Fonts replace the Google’s.

[Project GitHub](https://github.com/soulteary/Replace-Google-Fonts).

== Installation ==

1. Upload replace-google-fonts folder to the /wp-content/plugins/ directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress

/**
* Plugin Name: Replace Google Fonts
* Plugin URI:  http://www.soulteary.com/2014/06/08/replace-google-fonts.html
* Description: Use Qihoo 360 Open Fonts Service to replace Google's.
* Author:      soulteary
* Author URI:  http://www.soulteary.com/
* Version:     1.0
* License:     GPL
*/
 
/**
* Silence is golden
*/
if(!defined('ABSPATH'))exit;
 
classReplace_Google_Fonts
{
 
    /**
     * init Hook
     *
     */
    publicfunction__construct()
    {
        add_filter('style_loader_tag',array($this,'ohMyFont'),888,4);
    }
 
 
    /**
     * Use Qihoo 360 Open Fonts Service to replace Google's.
     *
     * @param $text
     * @return mixed
     */
    publicfunctionohMyFont($text)
    {
        returnstr_replace('//fonts.googleapis.com/','//fonts.useso.com/',$text);
    }
}
 
/**
* bootstrap
*/
newReplace_Google_Fonts;

件下载:Replace-Google-Fonts

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值