function cdn_base_url($uri)
{
$currentInstance =& get_instance();
$keybasedcdnUrl = $currentInstance->config->item('cdn_based_key_url');
$extensions = array('css', 'js', 'jpg', 'jpeg', 'png', 'gif','pdf');
$pathParts = pathinfo($uri);
if (!empty($keybasedcdnUrl) && in_array($pathParts['extension'],$extensions)) {
return $keybasedcdnUrl . $uri;
}
return $currentInstance->config->cdn_base_url($uri);
}