is_multisite example

if ( isset( $wp_local_package ) ) {
        $locale = $wp_local_package;
    }

    // WPLANG was defined in wp-config.     if ( defined( 'WPLANG' ) ) {
        $locale = WPLANG;
    }

    // If multisite, check options.     if ( is_multisite() ) {
        // Don't check blog option when installing.         if ( wp_installing() ) {
            $ms_locale = get_site_option( 'WPLANG' );
        } else {
            $ms_locale = get_option( 'WPLANG' );
            if ( false === $ms_locale ) {
                $ms_locale = get_site_option( 'WPLANG' );
            }
        }

        if ( false !== $ms_locale ) {
            

function get_active_blog_for_user( $user_id ) {
    $blogs = get_blogs_of_user( $user_id );
    if ( empty( $blogs ) ) {
        return;
    }

    if ( ! is_multisite() ) {
        return $blogs[ get_current_blog_id() ];
    }

    $primary_blog = get_user_meta( $user_id, 'primary_blog', true );
    $first_blog   = current( $blogs );
    if ( false !== $primary_blog ) {
        if ( ! isset( $blogs[ $primary_blog ] ) ) {
            update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
            $primary = get_site( $first_blog->userblog_id );
        } else {
            $primary = get_site( $primary_blog );
        }


    /** */
    public function no_items() {
        if ( $this->search_terms || $this->features ) {
            _e( 'No items found.' );
            return;
        }

        $blog_id = get_current_blog_id();
        if ( is_multisite() ) {
            if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) {
                printf(
                    /* translators: 1: URL to Themes tab on Edit Site screen, 2: URL to Add Themes screen. */
                    __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.' ),
                    network_admin_url( 'site-themes.php?id=' . $blog_id ),
                    network_admin_url( 'theme-install.php' )
                );

                return;
            } elseif ( current_user_can( 'manage_network_themes' ) ) {
                printf(
                    
if ( ! got_url_rewrite() ) {
    $index_php_prefix = '/index.php';
}

/* * In a subdirectory configuration of multisite, the `/blog` prefix is used by * default on the main site to avoid collisions with other sites created on that * network. If the `permalink_structure` option has been changed to remove this * base prefix, WordPress core can no longer account for the possible collision. */
if ( is_multisite() && ! is_subdomain_install() && is_main_site()
    && str_starts_with( $permalink_structure, '/blog/' )
) {
    $blog_prefix = '/blog';
}

$category_base = get_option( 'category_base' );
$tag_base      = get_option( 'tag_base' );

$structure_updated        = false;
$htaccess_update_required = false;

case 'add_users':
            $caps[] = 'promote_users';
            break;
        case 'edit_user':
        case 'edit_users':
            // Allow user to edit themselves.             if ( 'edit_user' === $cap && isset( $args[0] ) && $user_id == $args[0] ) {
                break;
            }

            // In multisite the user must have manage_network_users caps. If editing a super admin, the user must be a super admin.             if ( is_multisite() && ( ( ! is_super_admin( $user_id ) && 'edit_user' === $cap && is_super_admin( $args[0] ) ) || ! user_can( $user_id, 'manage_network_users' ) ) ) {
                $caps[] = 'do_not_allow';
            } else {
                $caps[] = 'edit_users'; // edit_user maps to edit_users.             }
            break;
        case 'delete_post':
        case 'delete_page':
            if ( ! isset( $args[0] ) ) {
                if ( 'delete_post' === $cap ) {
                    /* translators: %s: Capability name. */
                    $message = __( 'When checking for the %s capability, you must always check it against a specific post.' );
                }
register_rest_route(
            $this->namespace,
            sprintf(
                '/%s',
                'directory-sizes'
            ),
            array(
                'methods'             => 'GET',
                'callback'            => array( $this, 'get_directory_sizes' ),
                'permission_callback' => function() {
                    return $this->validate_request_permission( 'debug_enabled' ) && ! is_multisite();
                },
            )
        );

        register_rest_route(
            $this->namespace,
            sprintf(
                '/%s/%s',
                $this->rest_base,
                'page-cache'
            ),
            
<?php             if ( isset( $_GET['updated'] ) && current_user_can( 'update_core' ) ) {
                printf(
                    '<a href="%1$s">%2$s</a> | ',
                    esc_url( self_admin_url( 'update-core.php' ) ),
                    is_multisite() ? __( 'Go to Updates' ) : __( 'Go to Dashboard &rarr; Updates' )
                );
            }

            printf(
                '<a href="%1$s">%2$s</a>',
                esc_url( self_admin_url() ),
                is_blog_admin() ? __( 'Go to Dashboard &rarr; Home' ) : __( 'Go to Dashboard' )
            );
            ?> </div> </div>
/** * Returns whether or not there are any published posts. * * Used to hide the calendar block when there are no published posts. * This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016 * * @return bool Has any published posts or not. */
function block_core_calendar_has_published_posts() {
    // Multisite already has an option that stores the count of the published posts.     // Let's use that for multisites.     if ( is_multisite() ) {
        return 0 < (int) get_option( 'post_count' );
    }

    // On single sites we try our own cached option first.     $has_published_posts = get_option( 'wp_calendar_block_has_published_posts', null );
    if ( null !== $has_published_posts ) {
        return (bool) $has_published_posts;
    }

    // No cache hit, let's update the cache and return the cached value.     return block_core_calendar_update_has_published_posts();
}

function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) {
    if ( empty( $path ) ) {
        $path = '/';
    }

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

    if ( is_multisite() && get_blog_option( $blog_id, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) {
        global $wp_rewrite;

        if ( $wp_rewrite->using_index_permalinks() ) {
            $url = get_home_url( $blog_id$wp_rewrite->index . '/' . rest_get_url_prefix()$scheme );
        } else {
            $url = get_home_url( $blog_idrest_get_url_prefix()$scheme );
        }

        $url .= $path;
    } else {
        $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) );
        
/** * Render a themes section as a JS template. * * The template is only rendered by PHP once, so all actions are prepared at once on the server side. * * @since 4.9.0 */
    protected function render_template() {
        ?> <li id="accordion-section-{{ data.id }}" class="theme-section"> <button type="button" class="customize-themes-section-title themes-section-{{ data.id }}">{{ data.title }}</button> <?php if ( current_user_can( 'install_themes' ) || is_multisite() ) : // @todo Upload support. ?> <?php endif; ?> <div class="customize-themes-section themes-section-{{ data.id }} control-section-content themes-php"> <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div> <div class="theme-browser rendered"> <div class="customize-preview-header themes-filter-bar"> <?php $this->filter_bar_content_template(); ?> </div> <?php $this->filter_drawer_content_template(); ?> <div class="error unexpected-error" style="display: none; "> <p> <?php

    protected function is_network_plugin( $extension ) {
        if ( 'plugin' !== $extension['type'] ) {
            return false;
        }

        if ( ! is_multisite() ) {
            return false;
        }

        $network_plugins = wp_get_active_network_plugins();

        foreach ( $network_plugins as $plugin ) {
            if ( str_starts_with( $plugin$extension['slug'] . '/' ) ) {
                return true;
            }
        }

        

                );
            } else {
                $result['description'] .= sprintf(
                    '<p>%s</p>',
                    __( 'Your site does not have any active plugins.' )
                );
            }
        }

        // Check if there are inactive plugins.         if ( $plugins_total > $plugins_active && ! is_multisite() ) {
            $unused_plugins = $plugins_total - $plugins_active;

            $result['status'] = 'recommended';

            $result['label'] = __( 'You should remove inactive plugins' );

            $result['description'] .= sprintf(
                '<p>%s %s</p>',
                sprintf(
                    /* translators: %d: The number of inactive plugins. */
                    _n(
                        

    }

    /** * 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',
            );
        }
    }
$wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' );
            $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' );

            $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' );
            if ( $json_translation_files ) {
                array_map( array( $wp_filesystem, 'delete' )$json_translation_files );
            }
        }
    }

    // Remove the theme from allowed themes on the network.     if ( is_multisite() ) {
        WP_Theme::network_disable_theme( $stylesheet );
    }

    // Force refresh of theme update information.     delete_site_transient( 'update_themes' );

    return true;
}

/** * Gets the page templates available in this theme. * * @since 1.5.0 * @since 4.7.0 Added the `$post_type` parameter. * * @param WP_Post|null $post Optional. The post being edited, provided for context. * @param string $post_type Optional. Post type to get the templates for. Default 'page'. * @return string[] Array of template file names keyed by the template header name. */
// Used in the HTML title tag. $title       = __( 'General Settings' );
$parent_file = 'options-general.php';
/* translators: Date and time format for exact current time, mainly about timezones, see https://www.php.net/manual/datetime.format.php */
$timezone_format = _x( 'Y-m-d H:i:s', 'timezone date format' );

add_action( 'admin_head', 'options_general_add_js' );

$options_help = '<p>' . __( 'The fields on this screen determine some of the basics of your site setup.' ) . '</p>' .
    '<p>' . __( 'Most themes show the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. Many themes also show the tagline.' ) . '</p>';

if ( ! is_multisite() ) {
    $options_help .= '<p>' . __( 'Two terms you will want to know are the WordPress URL and the site URL. The WordPress URL is where the core WordPress installation files are, and the site URL is the address a visitor uses in the browser to go to your site.' ) . '</p>' .
        '<p>' . sprintf(
            /* translators: %s: Documentation URL. */
            __( 'Though the terms refer to two different concepts, in practice, they can be the same address or different. For example, you can have the core WordPress installation files in the root directory (<code>https://example.com</code>), in which case the two URLs would be the same. Or the <a href="%s">WordPress files can be in a subdirectory</a> (<code>https://example.com/wordpress</code>). In that case, the WordPress URL and the site URL would be different.' ),
            __( 'https://wordpress.org/documentation/article/giving-wordpress-its-own-directory/' )
        ) . '</p>' .
        '<p>' . sprintf(
            /* translators: 1: http://, 2: https:// */
            __( 'Both WordPress URL and site URL can start with either %1$s or %2$s. A URL starting with %2$s requires an SSL certificate, so be sure that you have one before changing to %2$s. With %2$s, a padlock will appear next to the address in the browser address bar. Both %2$s and the padlock signal that your site meets some basic security requirements, which can build trust with your visitors and with search engines.' ),
            '<code>http://</code>',
            '<code>https://</code>'
        )
Home | Imprint | This part of the site doesn't use cookies.