Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




network_site_url [ WordPress Function ]

network_site_url ( $path = '', $scheme = null )
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', 'admin', or 'relative'.
Returns:
  • (string) Site url link with optional path appended.
Defined at:



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.

Source


<?php
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''relative' ) ) ) {
        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' );
    }

    if ( 
'relative' == $scheme )
        
$url $current_site->path;
    else
        
$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);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics