FlickrRSS的修正

我在一个基于wordpress的blog上用了flickrRSS的插件,这个插件还是不错的。不过升级到2.7后,图片就显示不出来了。看了一下,开发者没有进行修正,只好找hack了。
修改的办法如下:
Replace:

1
if(preg_match('<img src="([^"]*)" [^/]*/>', $item['description'],$imgUrlMatches)) {

With:

1
2
3
4
5
6
7
// Hack to switch regular expression based on WordPress Version
   if (get_bloginfo('version')=='2.7') {
     $pattern = '/img src=(.*) width/';
   } else {
     $pattern = '<img src="([^"]*)" [^/]*/>';
   }
   if(preg_match($pattern, $item['description'],$imgUrlMatches)) {

Tags

   

Leave a Comment

It’s My Life © 2006-2009     Powered by WordPress     49 queries. 0.577 seconds.