includes/class-freemius.php
private function can_activate_license_on_network( FS_Plugin_License $license ) {
            $sites = self::get_sites();

            $production_count = 0;
            $localhost_count  = 0;

            $installs_without_license = array();
            $disconnected_site_ids    = array();

            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );
                $install = $this->get_install_by_blog_id( $blog_id );

                if ( is_object( $install ) ) {
                    if ( FS_Plugin_License::is_valid_id( $install->license_id ) ) {
                        // License already activated on the install.
                        continue;
                    }

                    $url = $install->url;

                    $installs_without_license[ $blog_id ] = $install;
                } else {
                    $url = is_object( $site ) ?
                        $site->siteurl :
                        get_site_url( $blog_id );

                    $disconnected_site_ids[] = $blog_id;
                }

                if ( FS_Site::is_localhost_by_address( $url ) ) {
                    $localhost_count ++;
                } else {
                    $production_count ++;
                }
            }

            if ( ! $license->can_activate_bulk( $production_count, $localhost_count ) ) {
                return false;
            }

            return array(
                'installs'         => $installs_without_license,
                'sites'            => $disconnected_site_ids,
                'production_count' => $production_count,
                'localhost_count'  => $localhost_count,
            );
        }
private function can_activate_license_on_network( FS_Plugin_License $license ) {
            $sites = self::get_sites();

            $production_count = 0;
            $localhost_count  = 0;

            $installs_without_license = array();
            $disconnected_site_ids    = array();

            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );
                $install = $this->get_install_by_blog_id( $blog_id );

                if ( is_object( $install ) ) {
                    if ( FS_Plugin_License::is_valid_id( $install->license_id ) ) {
                        // License already activated on the install.
                        continue;
                    }

                    $url = $install->url;

                    $installs_without_license[ $blog_id ] = $install;
                } else {
                    $url = is_object( $site ) ?
                        $site->siteurl :
                        get_site_url( $blog_id );

                    $disconnected_site_ids[] = $blog_id;
                }

                if ( FS_Site::is_localhost_by_address( $url ) ) {
                    $localhost_count ++;
                } else {
                    $production_count ++;
                }
            }

            if ( ! $license->can_activate_bulk( $production_count, $localhost_count ) ) {
                return false;
            }

            return array(
                'installs'         => $installs_without_license,
                'sites'            => $disconnected_site_ids,
                'production_count' => $production_count,
                'localhost_count'  => $localhost_count,
            );
        }
private function can_activate_license_on_network ( FS_Plugin_License $ license ) { $ sites = self :: get_sites ( ) ; $ production_count = 0 ; $ localhost_count = 0 ; $ installs_without_license = array ( ) ; $ disconnected_site_ids = array ( ) ; foreach ( $ sites as $ site ) { $ blog_id = self :: get_site_blog_id ( $ site ) ; $ install = $ this -> get_install_by_blog_id ( $ blog_id ) ; if ( is_object ( $ install ) ) { if ( FS_Plugin_License :: is_valid_id ( $ install -> license_id ) ) { // License already activated on the install.
 continue ; } $ url = $ install -> url ; $ installs_without_license [ $ blog_id ] = $ install ; } else { $ url = is_object ( $ site ) ? $ site -> siteurl : get_site_url ( $ blog_id ) ; $ disconnected_site_ids [ ] = $ blog_id ; } if ( FS_Site :: is_localhost_by_address ( $ url ) ) { $ localhost_count ++ ; } else { $ production_count ++ ; } } if ( ! $ license -> can_activate_bulk ( $ production_count , $ localhost_count ) ) { return false ; } return array ( 'installs' => $ installs_without_license , 'sites' => $ disconnected_site_ids , 'production_count' => $ production_count , 'localhost_count' => $ localhost_count , ) ; }
Checks if the given license can be activated on the whole network.

@author Vova Feldman (@svovaf)
@since  2.0.0

@param \FS_Plugin_License $license

@return false|array {
@type array[int]FS_Site $installs Blog ID to install map.
@type int[]               $sites            Non-connected blog IDs.
@type int                 $production_count Production sites count.
@type int                 $localhost_count  Production sites count.
}
Checks if the given license can be activated on the whole network .