is_network_admin example

/** * Retrieves the URL to the admin area for either the current site or the network depending on context. * * @since 3.1.0 * * @param string $path Optional. Path relative to the admin URL. Default empty. * @param string $scheme Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() * and is_ssl(). 'http' or 'https' can be passed to force those schemes. * @return string Admin URL link with optional path appended. */
function self_admin_url( $path = '', $scheme = 'admin' ) {
    if ( is_network_admin() ) {
        $url = network_admin_url( $path$scheme );
    } elseif ( is_user_admin() ) {
        $url = user_admin_url( $path$scheme );
    } else {
        $url = admin_url( $path$scheme );
    }

    /** * Filters the admin URL for the current site or network depending on context. * * @since 4.9.0 * * @param string $url The complete URL including scheme and path. * @param string $path Path relative to the URL. Blank string if no path is specified. * @param string $scheme The scheme to use. */

    }

    /** * Checks if updates are intercepted by a filter. * * @since 5.2.0 * * @return array The test results. */
    public function test_wp_version_check_attached() {
        if ( ( ! is_multisite() || is_main_site() && is_network_admin() )
            && ! has_filter( 'wp_version_check', 'wp_version_check' )
        ) {
            return array(
                'description' => sprintf(
                    /* translators: %s: Name of the filter used. */
                    __( 'A plugin has prevented updates by disabling %s.' ),
                    '<code>wp_version_check()</code>'
                ),
                'severity'    => 'fail',
            );
        }
    }


        $install_actions['activate'] = sprintf(
            '<a href="%s" class="activatelink">' .
            '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
            esc_url( $activate_link ),
            __( 'Activate' ),
            /* translators: Hidden accessibility text. %s: Theme name. */
            sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' )$name )
        );

        if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) {
            $install_actions['network_enable'] = sprintf(
                '<a href="%s" target="_parent">%s</a>',
                esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ),
                __( 'Network Enable' )
            );
        }

        if ( 'web' === $this->type ) {
            $install_actions['themes_page'] = sprintf(
                '<a href="%s" target="_parent">%s</a>',
                self_admin_url( 'theme-install.php' ),
                

function add_thickbox() {
    wp_enqueue_script( 'thickbox' );
    wp_enqueue_style( 'thickbox' );

    if ( is_network_admin() ) {
        add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
    }
}

/** * Displays the XHTML generator that is generated on the wp_head hook. * * See {@see 'wp_head'}. * * @since 2.5.0 */
return strtr( $code$lang_codes );
}

/** * Displays an access denied message when a user tries to view a site's dashboard they * do not have access to. * * @since 3.2.0 * @access private */
function _access_denied_splash() {
    if ( ! is_user_logged_in() || is_network_admin() ) {
        return;
    }

    $blogs = get_blogs_of_user( get_current_user_id() );

    if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
        return;
    }

    $blog_name = get_bloginfo( 'name' );

    
/* translators: %s: Plugin name. */
                                $button_label = _x( 'Activate %s', 'plugin' );
                                $activate_url = add_query_arg(
                                    array(
                                        '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
                                        'action'   => 'activate',
                                        'plugin'   => $status['file'],
                                    ),
                                    network_admin_url( 'plugins.php' )
                                );

                                if ( is_network_admin() ) {
                                    $button_text = __( 'Network Activate' );
                                    /* translators: %s: Plugin name. */
                                    $button_label = _x( 'Network Activate %s', 'plugin' );
                                    $activate_url = add_query_arg( array( 'networkwide' => 1 )$activate_url );
                                }

                                $action_links[] = sprintf(
                                    '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
                                    esc_url( $activate_url ),
                                    esc_attr( sprintf( $button_label$plugin['name'] ) ),
                                    $button_text
                                );


/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

wp_enqueue_style( 'plugin-install' );
wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'updates' );
add_thickbox();

if ( is_multisite() && ! is_network_admin() ) {
    wp_redirect( network_admin_url( 'update-core.php' ) );
    exit;
}

if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_languages' ) ) {
    wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}

/** * Lists available core updates. * * @since 2.7.0 * * @global string $wp_local_package Locale code of the package. * @global wpdb $wpdb WordPress database abstraction object. * * @param object $update */
<?php /** * Theme file editor administration panel. * * @package WordPress * @subpackage Administration */

/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( is_multisite() && ! is_network_admin() ) {
    wp_redirect( network_admin_url( 'theme-editor.php' ) );
    exit;
}

if ( ! current_user_can( 'edit_themes' ) ) {
    wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
}

// Used in the HTML title tag. $title       = __( 'Edit Themes' );
$parent_file = 'themes.php';

$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo", $locale );

    if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists( WP_LANG_DIR . "/admin-$locale.mo" ) ) {
        load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo", $locale );
        return $return;
    }

    if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
        load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
    }

    if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) {
        load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo", $locale );
    }

    return $return;
}

/** * Loads a plugin's translated strings. * * If the path is not given then it will be the root of the plugin directory. * * The .mo file should be named based on the text domain with a dash, and then the locale exactly. * * @since 1.5.0 * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. * * @param string $domain Unique identifier for retrieving translated strings * @param string|false $deprecated Optional. Deprecated. Use the $plugin_rel_path parameter instead. * Default false. * @param string|false $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR where the .mo file resides. * Default false. * @return bool True when textdomain is successfully loaded, false otherwise. */
// Show only when the user is a member of this site, or they're a super admin.     if ( ! is_user_member_of_blog() && ! current_user_can( 'manage_network' ) ) {
        return;
    }

    $blogname = get_bloginfo( 'name' );

    if ( ! $blogname ) {
        $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
    }

    if ( is_network_admin() ) {
        /* translators: %s: Site title. */
        $blogname = sprintf( __( 'Network Admin: %s' )esc_html( get_network()->site_name ) );
    } elseif ( is_user_admin() ) {
        /* translators: %s: Site title. */
        $blogname = sprintf( __( 'User Dashboard: %s' )esc_html( get_network()->site_name ) );
    }

    $title = wp_html_excerpt( $blogname, 40, '&hellip;' );

    $wp_admin_bar->add_node(
        array(
            
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
require ABSPATH . 'wp-admin/includes/theme-install.php';

wp_reset_vars( array( 'tab' ) );

if ( ! current_user_can( 'install_themes' ) ) {
    wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
}

if ( is_multisite() && ! is_network_admin() ) {
    wp_redirect( network_admin_url( 'theme-install.php' ) );
    exit;
}

// Used in the HTML title tag. $title       = __( 'Add Themes' );
$parent_file = 'themes.php';

if ( ! is_network_admin() ) {
    $submenu_file = 'themes.php';
}

<?php /** * Build Administration Menu. * * @package WordPress * @subpackage Administration */

if ( is_network_admin() ) {

    /** * Fires before the administration menu loads in the Network Admin. * * The hook fires before menus and sub-menus are removed based on user privileges. * * @private * @since 3.1.0 */
    do_action( '_network_admin_menu' );
} elseif ( is_user_admin() ) {

    


/** * WordPress Administration Bootstrap. */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'install_plugins' ) ) {
    wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
}

if ( is_multisite() && ! is_network_admin() ) {
    wp_redirect( network_admin_url( 'plugin-install.php' ) );
    exit;
}

$wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
    $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );

    if ( ! empty( $_REQUEST['paged'] ) ) {
        
define( 'WP_INSTALLING_NETWORK', true );

/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'setup_network' ) ) {
    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}

if ( is_multisite() ) {
    if ( ! is_network_admin() ) {
        wp_redirect( network_admin_url( 'setup.php' ) );
        exit;
    }

    if ( ! defined( 'MULTISITE' ) ) {
        wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
    }
}

require_once __DIR__ . '/includes/network.php';


function wp_validate_logged_in_cookie( $user_id ) {
    if ( $user_id ) {
        return $user_id;
    }

    if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
        return false;
    }

    return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' );
}

/** * Gets the number of posts a user has written. * * @since 3.0.0 * @since 4.1.0 Added `$post_type` argument. * @since 4.3.0 Added `$public_only` argument. Added the ability to pass an array * of post types to `$post_type`. * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $userid User ID. * @param array|string $post_type Optional. Single post type or array of post types to count the number of posts for. Default 'post'. * @param bool $public_only Optional. Whether to only return counts for public posts. Default false. * @return string Number of posts the user has written in this post type. */
Home | Imprint | This part of the site doesn't use cookies.