Advertisements

network_site_url

Definition:
function network_site_url( $path = '', $scheme = null ) {}

Retrieve the site url for the current network.
Returns the site url with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.

Parameters

  • string $path: Optional. Path relative to the site url.
  • string $scheme: Optional. Scheme to give the site url context. Currently ‘http’, ‘https’, ‘login’, ‘login_post’, or ‘admin’.

Return values

returns:Site url link with optional path appended.

Defined filters

  • network_site_url
    apply_filters('network_site_url', $url, $path, $orig_scheme)

Source code

function network_site_url( $path = '', $scheme = null ) {

	global $current_site;



	if ( !is_multisite() )

		return site_url($path, $scheme);



	$orig_scheme = $scheme;

	if ( !in_array($scheme, array('http', 'https')) ) {

		if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )

			$scheme = 'https';

		elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )

			$scheme = 'https';

		elseif ( ('admin' == $scheme) && force_ssl_admin() )

			$scheme = 'https';

		else

			$scheme = ( is_ssl() ? 'https' : 'http' );

	}



	$url = $scheme . '://' . $current_site->domain . $current_site->path;



	if ( !empty($path) && is_string($path) && strpos($path, '..') === false )

		$url .= ltrim($path, '/');



	return apply_filters('network_site_url', $url, $path, $orig_scheme);

}

2427

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: