├── README.md
└── goofi.php
/README.md:
--------------------------------------------------------------------------------
1 | # goofi
2 | get google fonts onto your server with just one <link>
3 |
4 | instead of
5 | ```
6 |
7 | ```
8 |
9 | use
10 | ```
11 |
12 | ```
13 |
14 | and the script will get the fonts & css and then save it onto your server. After that, no more queries will be send to google's servers anymore ;-)
15 |
--------------------------------------------------------------------------------
/goofi.php:
--------------------------------------------------------------------------------
1 | [^']+)[^^]*?url\((?P[^\)]+)\)#", $css, $urls);
12 |
13 | foreach($urls['url'] as $nb=>$url){
14 | $font_file=str_replace(array("\0",'%20'), array('','+'),rawurlencode($urls['name'][$nb])).basename($url);
15 | if (!is_file($font_folder.'/'.$font_file)){
16 | $font=file_get_contents($url);
17 | file_put_contents($font_folder.'/'.$font_file, $font);
18 | }
19 | $css=str_replace($url,$font_folder.'/'.$font_file,$css);
20 | }
21 | file_put_contents($css_filename,$css );
22 | }else{
23 | $css=file_get_contents($css_filename);
24 | }
25 | exit($css);
26 | }
27 |
--------------------------------------------------------------------------------