Google Reader Widget 插件
Written on 十月 8, 2007 – 9:26 下午 | by paopao
从暑假开始使用 Google Reader ,最初只是用它最基本的功能——订阅。渐渐地,不再满足于简单阅读,开始使用星标、分享等功能。前几天突然想把我的 Google Reader 的分享内容加到我的侧边栏里,于是搜索了一圈,试用了几个插件,最后选定了 Google Reader Widget 这个插件。这个插件带有 widget ,添加方便,而且可以设置显示的方式。
现在本地测试了一下,没什么问题,顺便修改了一下默认的显示设置。但是传到本站却显示不了任何条目。在站点里找到一个error_log文件,里面有如下警告:
PHP Warning: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: URL file-access is disabled in the server configuration in /.../wp-content/plugins/googlereader.php on line 56
原来我的服务器的php.ini里的设置导致 file_get_contents 函数不能以 URL 作为参数,但是我又无法更改这个设置。好在 WordPress 给我们提供了一个 Snoopy 类来完成这件事,我在 Fanfou Daily 这个插件里也用到了这个类。修改 googlereader.php 的第56行从
$stories = file_get_contents($uri);
修改为
require_once ABSPATH.WPINC.'/class-snoopy.php'; $client = new Snoopy(); $headers = ""; if ( is_array($headers) ) $client->rawheaders = $headers; @$client->fetch($uri); if ( !($client->status >= 200 && $client->status < 300) ) return false; $stories = $client->results;
这样就可以正常使用了,具体效果见本站侧边栏 ^_^
另外在这个插件页面的留言里有一个使用cURL的解决方案
Popularity: 39% [?]
Tags: google-reader, plugin, wordpress

7 Responses to “Google Reader Widget 插件”
By Oka on 十 10, 2007 | Reply | Quote
在paopao的带领下我也开始用google reader了,很方便的咯 ^o^
By Digbuzz on 十一 9, 2007 | Reply | Quote
好文,放到我挖网( digbuzz.com , 最大的中文 Digg)挖一挖会不错,还可给你带来大量流量!
By paopao on 十一 10, 2007 | Reply | Quote
@Digbuzz 欢迎提交至我挖网
By uno on 十二 25, 2007 | Reply | Quote
泡泡除了这个widget,你还试过其他的那些,能列出来吗?
By paopao on 十二 25, 2007 | Reply | Quote
@uno 你是指关于Google Reader的widget?当时试的已经忘了,你用google搜索关键词Google Reader widget wordpress就能找到不少
By 技术资料 on 十一 16, 2008 | Reply | Quote
文章不错啊,继续加点好的文章来看看。看完了给你顶几下。(*^__^*) 嘻嘻…
By 去死皮 on 十 8, 2011 | Reply | Quote
继续加点好的文章来看看