|
#11
|
||||
|
||||
|
i think its cool yo!
__________________
i should say more clever stuff |
|
#12
|
|||
|
|||
|
yes, I wanted to know what GRAVATARS are....
|
|
#13
|
|||
|
|||
|
I've updated, if not improved, the code in functions.php. First, I added a function that may or may not net more favicons, copied directly from http://www.peej.co.uk/projects/favatars.html
Code:
function getFavicon($url) {
$HTTPRequest = @fopen($url, 'r');
if ($HTTPRequest) {
stream_set_timeout($HTTPRequest, 0.1);
$html = fread($HTTPRequest, 4096);
$HTTPRequestData = stream_get_meta_data($HTTPRequest);
fclose($HTTPRequest);
if (!$HTTPRequestData['timed_out']){
if (preg_match('/<link[^>]+rel="(?:shortcut )?icon"[^>]+?href="([^"]+?)"/si',$html, $matches)) {
$linkUrl = html_entity_decode($matches[1]);
if (substr($linkUrl, 0, 1) == '/') {
$urlParts = parse_url($url);
$faviconURL = $urlParts['scheme'].'://'.$urlParts['host'].$linkUrl;
} elseif (substr($linkUrl, 0, 7) == 'http://') {
$faviconURL = $linkUrl;
} elseif (substr($url, -1, 1) == '/') {
$faviconURL = $url.$linkUrl;
} else { $faviconURL = $url.'/'.$linkUrl;
}
} else {
$urlParts = parse_url($url);
$faviconURL = $urlParts['scheme'].'://'.$urlParts['host'].'/favicon.ico';
}
$HTTPRequest = @fopen($faviconURL, 'r');
if ($HTTPRequest) {
stream_set_timeout($HTTPRequest, 0.1);
$favicon = fread($HTTPRequest, 8192);
$HTTPRequestData = stream_get_meta_data($HTTPRequest);
fclose($HTTPRequest);
if (!$HTTPRequestData['timed_out'] && strlen($favicon) < 8192) {
return $faviconURL;
}
}
}
}
return false;
}
Code:
if($comment_url != "") {
$comment_url = "http://$comment_url";
$comment_url = str_replace("http://http://","http://",$comment_url);
$grav_url="http://www.gravatar.com/avatar.php?gravatar_id=".md5($comment_email)."&amp;size=16";
$fav_url = getFavicon($comment_url);
$av_url = $grav_url;
if ($fav_url) {
$av_url = $fav_url;
}
$comment_name = "<a href='$comment_url' title='$lang_visit_homepage' target='_blank'><img src='$av_url' />$comment_name</a>";
}
__________________
http://asiftosay.com |
|
#14
|
|||
|
|||
|
I'm not a big fan of favatars, they're too small. A lot of people use gravatars now so the first version you made was simple for me to integrate.
|
|
#15
|
|||
|
|||
|
Please,
do these things in AddOns, users will not be able to follow that when they update PixelPost we have AddOns there, we do not want Hacks and modifications anymore as the support for users will be too difficult in case they update the official version... because of compatibility, do these things in AddOns
|
|
#16
|
||||
|
||||
|
could have sworn there was a favator addon i used a while back which worked super! till i accidently lost it updating version.
__________________
Affordable Website Design in North Wales |
|
#17
|
|||
|
|||
|
OK, I've made an addon for gravatars : http://forum.pixelpost.org/showthread.php?p=13411 . If there's interest, I'll try to make one for favatars too.
__________________
http://asiftosay.com |
| Post Reply |
| Thread Tools | |
|
|