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)) {

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.