public function dir_to_url($dir)
{
static $tomatch = false;
if (!$tomatch) {
$tomatch = array(Site::get_dir('config') . '/themes/' => Site::get_url('user') . '/themes/', HABARI_PATH . '/user/themes/' => Site::get_url('habari') . '/user/themes/', HABARI_PATH . '/3rdparty/themes/' => Site::get_url('habari') . '/3rdparty/themes/', HABARI_PATH . '/system/themes/' => Site::get_url('habari') . '/system/themes/', HABARI_PATH . '/system/admin/' => Site::get_url('habari') . '/system/admin/');
}
if (preg_match('#^(' . implode('|', array_map('preg_quote', array_keys($tomatch))) . ')(.*)$#', $dir, $matches)) {
return $tomatch[$matches[1]] . $matches[2];
}
return false;
}