[Plugin: WP-RecentComments] function rc_get_avatar_url fails on some html
-
Hi there!
When the $code variable has this value, then the function rc_get_avatar_url($code) won´t work. The alt, width and height attributes will still remain in the return value.
<img src="http://dev.sjukhuslakaren.se/wp-content/uploads/userphoto/8.thumbnail.jpg" alt="Mikael Rolfs" width="80" height="60" class="photo" />
To solve the problem, I added this code:
function rc_get_avatar_url($code) { //MY FIX - START $quotes = array('"', "'"); foreach ($quotes as $q) { $pos_start = strpos($code, $q.'http'); $pos_end = strpos($code, $q, $pos_start + 1); if ($pos_start !== false && $pos_end !== false) { $src = substr($code, $pos_start + 1, $pos_end - $pos_start - 1); $src = preg_replace(array('/&/i'), array('&'), $src); return $src; } } //MY FIX - END return preg_replace(array('/^.+(src=)(\"|\')/i', '/(\"|\')\sclass=(\"|\').+$/i', '/&/i'), array('', '', '&'), $code); }
Could this be added to the official version? Or maybe be done in a bettar way?
Best Regards
Patrik Hultgren
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: WP-RecentComments] function rc_get_avatar_url fails on some html’ is closed to new replies.