Habari\Theme::dir_to_url PHP Метод

dir_to_url() публичный Метод

Convert a theme directory or resource into a URL
public dir_to_url ( string $dir ) : boolean | string
$dir string The pathname to convert
Результат boolean | string The URL to use, or false if none was found
    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;
    }