[wp-hackers] Can't find where <p> and <br /> tags are coming from
Diana K. C
dianakac at gmail.com
Fri Aug 3 23:46:51 UTC 2012
I needed to hardcode a plugin that retrieves Picasa Album, it works ok but don't know why P e BR tags are appearing, I tried to strip_tags, trim etc and can't get rid of them. Echoing works but then gets out before anything else in site as always :(
I think is something wrong in php, but maybe something to do with xml?! Thanks for any help.
The bit that outputs code I changed a bit is:
$html_gallery = '<ul class="gallery-list row">'."\n";
foreach ($feed as $entry) {
$title = $entry->getTitle();
$summary = $entry->getSummary();
$stuff = $entry->getMediaGroup()->getContent();
$url = $stuff[0]->getUrl();
$thumbnail = $entry->getMediaGroup()->getThumbnail();
$tags = $entry->getMediaGroup()->getKeywords();
$size = $entry->getGphotoSize();
$height = $entry->getGphotoHeight();
$width = $entry->getGphotoWidth();
$html_gallery .= "\n \t".'<li class="gallery-item"><a href="'.$url.'" class="lightbox"><figure><img class="imgpicasa" src="'.$thumbnail[2]->url.'" width="'.$thumbnail[1]->width.'" height="'.$thumbnail[1]->height.'"/><figcaption></figcaption></figure></a></li>'; //SOMETHING WRONG HERE?
}
$html_gallery .= '</ul>';
$content = $html_gallery.$content;
return strip_tags($content,'<ul><li><a><figure><figcaption><img>');
}
The wrong output (<br/> and <p> breaking layout :( ):
<li class="gallery-item"><a href="http://lh6.ggpht.com/-C1JJV9zcwr8/TVms7N1oktI/AAAAAAAAAss/wFdr1BpCPys/DSCN1215.JPG" class="lightbox"><br />
<figure><img class="imgpicasa" src="http://lh6.ggpht.com/-C1JJV9zcwr8/TVms7N1oktI/AAAAAAAAAss/wFdr1BpCPys/s288/DSCN1215.JPG" width="144" height="108"/><br />
<figcaption></figcaption>
</figure>
<p></a></li>
FULL PLUGIN CODE BEFORE MOD: http://pastebin.com/Zfasaz1J
More information about the wp-hackers
mailing list