Example #1
0
/**
 * Detect WPMU blogname
 *
 * @return string
 */
function w3_get_blogname()
{
    static $blogname = null;
    if ($blogname === null) {
        if (w3_is_network()) {
            $host = w3_get_host();
            $domain = w3_get_domain($host);
            if (w3_is_subdomain_install()) {
                $blogname = $domain;
            } else {
                $uri = $_SERVER['REQUEST_URI'];
                $base_path = w3_get_base_path();
                if ($base_path != '' && strpos($uri, $base_path) === 0) {
                    $uri = substr_replace($uri, '/', 0, strlen($base_path));
                }
                $blogname = w3_get_blogname_from_uri($uri);
                if ($blogname != '') {
                    $blogname = $blogname . '.' . $domain;
                } else {
                    $blogname = $domain;
                }
            }
        } else {
            $blogname = '';
        }
    }
    return $blogname;
}
Example #2
0
/**
 * Detect WPMU blogname
 *
 * @return string
 */
function w3_get_blogname()
{
    static $blogname = null;
    if ($blogname === null) {
        if (w3_is_wpmu()) {
            $domain = w3_get_domain($_SERVER['HTTP_HOST']);
            if (w3_is_vhost()) {
                $blogname = $domain;
            } else {
                $uri = $_SERVER['REQUEST_URI'];
                $site_path = w3_get_site_path();
                if ($site_path != '' && strpos($uri, $site_path) === 0) {
                    $uri = substr_replace($uri, '/', 0, strlen($site_path));
                }
                $blogname = w3_get_blogname_from_uri($uri);
                if ($blogname != '') {
                    $blogname = $blogname . '.' . $domain;
                } else {
                    $blogname = $domain;
                }
            }
        } else {
            $blogname = '';
        }
    }
    return $blogname;
}