UPDATES EasySocial 4.0.15 Released! Joomla 5.x and PHP 8.x compatible now!

Helpdesk

Your Time
Our Time
Response Time
24 — 48 hours
We strive to provide the fastest ever response possible. However, we are not super beings.

Allow at least 24 — 48 hours
  Support is online
Our support specialists is available now. We will attend to you as soon as we can.
  Support is online

Where to save custom functions?

David Montoya · ·
4:36 AM Friday, 08 April 2016
None
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);
}
The replies under this section are restricted to logged in users or users with an active subscription with us