Ejemplo n.º 1
0
# gb::$site_url -- URL to the base of the site. Must end in a slash ("/").
if (isset($gb_site_url)) {
    gb::$site_url = $gb_site_url;
    unset($gb_site_url);
} else {
    gb::$site_url = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] !== '80' && $_SERVER['SERVER_PORT'] !== '443' ? ':' . $_SERVER['SERVER_PORT'] : '') . gb::$site_path;
}
# only set the following when called externally
if (!gb::$is_internal_call) {
    # gb::$theme_dir
    if (isset($gb_theme_dir)) {
        gb::$theme_dir = $gb_theme_dir;
        unset($gb_theme_dir);
    } else {
        $bt = debug_backtrace();
        gb::$theme_dir = dirname($bt[0]['file']);
    }
    # gb::$theme_url
    if (isset($gb_theme_url)) {
        gb::$theme_url = $gb_theme_url;
        unset($gb_theme_url);
    } else {
        $relpath = gb_relpath(gb::$site_dir, gb::$theme_dir);
        if ($relpath === '' || $relpath === '.') {
            gb::$theme_url = gb::$site_url;
        } elseif ($relpath[0] === '.' || $relpath[0] === '/') {
            $uplevels = $max_uplevels = 0;
            if ($relpath[0] === '/') {
                $uplevels = 1;
            }
            if ($relpath[0] === '.') {