private function handle_add_network() {
		$options_to_clone = filter_input( INPUT_POST, 'options_to_clone', FILTER_FORCE_ARRAY );
		if ( ! empty( $options_to_clone ) ) {
			$options_to_clone = array_keys( $options_to_clone );
		} else {
			$options_to_clone = array_keys( network_options_to_copy() );
		}

		$clone = filter_input( INPUT_POST, 'clone_network', FILTER_SANITIZE_NUMBER_INT );
		if ( empty( $clone ) ) {
			$clone = get_current_site()->id;
		}

		$network_title  = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) );
		$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) );
		$network_path   = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) );
		$site_name      = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_STRING ) );

		$network_title  = strip_tags( $network_title );
		$network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) );
		$network_path   = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) );
		$site_name      = ! empty( $site_name ) ? strip_tags( $site_name ) : $network_title;

		// Bail if missing fields.
		if ( empty( $network_title ) || empty( $network_domain ) || empty( $network_path ) ) {
			$this->handle_redirect( array(
				'page'            => 'add-new-network',
				'network_created' => '0',
			) );
		}

		$result  = add_network( array(
			'domain'           => $network_domain,
			'path'             => $network_path,
			'site_name'        => $site_name,
			'user_id'          => get_current_user_id(),
			'clone_network'    => $clone,
			'options_to_clone' => $options_to_clone,
		) );
		$success = '0';

		if ( ! empty( $result ) && ! is_wp_error( $result ) ) {
			if ( ! empty( $posted['title'] ) ) {
				update_network_option( $result, 'site_name', $posted['title'] );
			}

			update_network_option( $result, 'active_sitewide_plugins', array(
				'wp-multi-network/wpmn-loader.php' => time(),
			) );

			$success = '1';
		}

		$this->handle_redirect( array(
			'network_created' => $success,
		) );
	}
private function handle_add_network() {
		$options_to_clone = filter_input( INPUT_POST, 'options_to_clone', FILTER_FORCE_ARRAY );
		if ( ! empty( $options_to_clone ) ) {
			$options_to_clone = array_keys( $options_to_clone );
		} else {
			$options_to_clone = array_keys( network_options_to_copy() );
		}

		$clone = filter_input( INPUT_POST, 'clone_network', FILTER_SANITIZE_NUMBER_INT );
		if ( empty( $clone ) ) {
			$clone = get_current_site()->id;
		}

		$network_title  = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) );
		$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) );
		$network_path   = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) );
		$site_name      = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_STRING ) );

		$network_title  = strip_tags( $network_title );
		$network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) );
		$network_path   = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) );
		$site_name      = ! empty( $site_name ) ? strip_tags( $site_name ) : $network_title;

		// Bail if missing fields.
		if ( empty( $network_title ) || empty( $network_domain ) || empty( $network_path ) ) {
			$this->handle_redirect( array(
				'page'            => 'add-new-network',
				'network_created' => '0',
			) );
		}

		$result  = add_network( array(
			'domain'           => $network_domain,
			'path'             => $network_path,
			'site_name'        => $site_name,
			'user_id'          => get_current_user_id(),
			'clone_network'    => $clone,
			'options_to_clone' => $options_to_clone,
		) );
		$success = '0';

		if ( ! empty( $result ) && ! is_wp_error( $result ) ) {
			if ( ! empty( $posted['title'] ) ) {
				update_network_option( $result, 'site_name', $posted['title'] );
			}

			update_network_option( $result, 'active_sitewide_plugins', array(
				'wp-multi-network/wpmn-loader.php' => time(),
			) );

			$success = '1';
		}

		$this->handle_redirect( array(
			'network_created' => $success,
		) );
	}
private function handle_add_network ( ) { $ options_to_clone = filter_input ( INPUT_POST , 'options_to_clone' , FILTER_FORCE_ARRAY ) ; if ( ! empty ( $ options_to_clone ) ) { $ options_to_clone = array_keys ( $ options_to_clone ) ; } else { $ options_to_clone = array_keys ( network_options_to_copy ( ) ) ; } $ clone = filter_input ( INPUT_POST , 'clone_network' , FILTER_SANITIZE_NUMBER_INT ) ; if ( empty ( $ clone ) ) { $ clone = get_current_site ( ) -> id ; } $ network_title = wp_unslash ( filter_input ( INPUT_POST , 'title' , FILTER_SANITIZE_STRING ) ) ; $ network_domain = wp_unslash ( filter_input ( INPUT_POST , 'domain' , FILTER_SANITIZE_STRING ) ) ; $ network_path = wp_unslash ( filter_input ( INPUT_POST , 'path' , FILTER_SANITIZE_STRING ) ) ; $ site_name = wp_unslash ( filter_input ( INPUT_POST , 'new_site' , FILTER_SANITIZE_STRING ) ) ; $ network_title = strip_tags ( $ network_title ) ; $ network_domain = str_replace ( ' ' , '' , strtolower ( sanitize_text_field ( $ network_domain ) ) ) ; $ network_path = str_replace ( ' ' , '' , strtolower ( sanitize_text_field ( $ network_path ) ) ) ; $ site_name = ! empty ( $ site_name ) ? strip_tags ( $ site_name ) : $ network_title ; // Bail if missing fields. if ( empty ( $ network_title ) || empty ( $ network_domain ) || empty ( $ network_path ) ) { $ this -> handle_redirect ( array ( 'page' => 'add-new-network' , 'network_created' => '0' , ) ) ; } $ result = add_network ( array ( 'domain' => $ network_domain , 'path' => $ network_path , 'site_name' => $ site_name , 'user_id' => get_current_user_id ( ) , 'clone_network' => $ clone , 'options_to_clone' => $ options_to_clone , ) ) ; $ success = '0' ; if ( ! empty ( $ result ) && ! is_wp_error ( $ result ) ) { if ( ! empty ( $ posted [ 'title' ] ) ) { update_network_option ( $ result , 'site_name' , $ posted [ 'title' ] ) ; } update_network_option ( $ result , 'active_sitewide_plugins' , array ( 'wp-multi-network/wpmn-loader.php' => time ( ) , ) ) ; $ success = '1' ; } $ this -> handle_redirect ( array ( 'network_created' => $ success , ) ) ; }
Handles the request to add a new network.

@since 2.0.0
Handles the request to add a new network .