Where in com_easyblog/controllers could I store these functions? If you can point me in the right direction with a tutorial or documentation, I'd greatly appreciate it.
function getfavicon($url){ //get favicon URL from provided URL
$favicon = '';
$html = file_get_contents($url);
$dom = new DOMDocument();
$dom->loadHTML($html);
$links = $dom->getElementsByTagName('link');
for ($i = 0; $i < $links->length; $i++){
$link = $links->item($i);
if($link->getAttribute('rel') == 'icon'){
$favicon = $link->getAttribute('href');
}
}
return $favicon;
}
function strbtw($string, $start, $end){ //get string in between two unique strings
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini == 0) return '';
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}