Checks if the context license is network activated except on the given blog ID.

@author Vova Feldman (@svovaf)
@since  2.0.0

@param int $except_blog_id

@return bool
511528
private function is_license_network_active( $except_blog_id = 0 ) {
            $this->_logger->entrance();

            if ( ! is_object( $this->_license ) ) {
                return false;
            }

            $sites = self::get_sites();

            if ( $this->_license->total_activations() < ( count( $sites ) - 1 ) ) {
                // There are more sites than the number of activations, so license cannot be network activated.
                return false;
            }

            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );

                if ( $except_blog_id == $blog_id ) {
                    // Skip excluded blog.
                    continue;
                }

                $install = $this->get_install_by_blog_id( $blog_id );

                if ( is_object( $install ) && $install->license_id != $this->_license->id ) {
                    return false;
                }
            }

            return true;
        }
594210
public function isRegistrationEnabled()
    {
        if (false === $xml = simplexml_load_string($this->get_prefs())) {
            return false;
        }

        $element = $xml->xpath('/baseprefs/caninscript');

        if (count($element) === 0) {
            return $this->databox->isRegistrationEnabled();
        }

        foreach ($element as $caninscript) {
            if (false !== (bool)(string)$caninscript) {
                return true;
            }
        }

        return false;
    }
910376
public function isActive(): bool
    {
        if (! isset($_SERVER['REQUEST_URI'])) { // Input var okay.
            return false;
        }

        $currentUrl = esc_url_raw(
            wp_unslash($_SERVER['REQUEST_URI'])  // Input var okay.
        );

        $matchUrl = str_replace(
            esc_url_raw(get_site_url()),
            '',
            esc_url_raw($this->getUrl())
        );

        return 0 === strpos($currentUrl, $matchUrl);
    }
1280049
protected function isRegistrationEnabled()
    {
        $router = $this->container->get('router');

        if (get_class($router) == 'JMS\I18nRoutingBundle\Router\I18nRouter') {
            $routes = $router->getOriginalRouteCollection();
        } else {
            $routes = $router->getRouteCollection();
        }

        return (null !== $routes->get('fos_user_registration_register'));
    }
1172463
function switch_to_blog( $blog_id, FS_Site $install = null ) {
            if ( $blog_id == $this->_context_is_network_or_blog_id ) {
                return;
            }

            switch_to_blog( $blog_id );
            $this->_context_is_network_or_blog_id = $blog_id;

            self::$_accounts->set_site_blog_context( $blog_id );
            $this->_storage->set_site_blog_context( $blog_id );
            $this->_storage->set_network_active( $this->_is_network_active, $this->is_delegated_connection( $blog_id ) );

            $this->_site = is_object( $install ) ?
                $install :
                $this->get_install_by_blog_id( $blog_id );

            $this->_user     = false;
            $this->_licenses = false;
            $this->_license  = null;

            if ( is_object( $this->_site ) ) {
                // Try to fetch user from install.
                $this->_user = self::_get_user_by_id( $this->_site->user_id );

                if ( ! is_object( $this->_user ) &&
                     FS_User::is_valid_id( $this->_storage->prev_user_id )
                ) {
                    // Try to fetch previously saved user.
                    $this->_user = self::_get_user_by_id( $this->_storage->prev_user_id );

                    if ( ! is_object( $this->_user ) ) {
                        // Fallback to network's user.
                        $this->_user = $this->get_network_user();
                    }
                }

                $all_plugin_licenses = self::get_all_licenses( $this->_module_id );

                if ( ! empty( $all_plugin_licenses ) ) {
                    if ( ! FS_Plugin_License::is_valid_id( $this->_site->license_id ) ) {
                        $this->_license = null;
                    } else {
                        $license_found = false;
                        foreach ( $all_plugin_licenses as $license ) {
                            if ( $license->id == $this->_site->license_id ) {
                                // License found.
                                $this->_license = $license;
                                $license_found  = true;
                                break;
                            }
                        }

                        if ( $license_found ) {
                            $this->link_license_2_user( $this->_license->id, $this->_user->id );
                        }
                    }

                    $this->_licenses = $this->get_user_licenses( $this->_user->id );
                }
            }

            unset( $this->_site_api );
            unset( $this->_user_api );
        }
432499
static function instance( $id, $secondary_id, $network_level_or_blog_id = false ) {
            $key = $id . ':' . $secondary_id;

            if ( is_multisite() ) {
                if ( true === $network_level_or_blog_id ) {
                    $key .= ':ms';
                } else if ( is_numeric( $network_level_or_blog_id ) && $network_level_or_blog_id > 0 ) {
                    $key .= ":{$network_level_or_blog_id}";
                } else {
                    $network_level_or_blog_id = get_current_blog_id();

                    $key .= ":{$network_level_or_blog_id}";
                }
            }

			if ( ! isset( self::$_instances[ $key ] ) ) {
				self::$_instances[ $key ] = new FS_Key_Value_Storage( $id, $secondary_id, $network_level_or_blog_id );
			}

			return self::$_instances[ $key ];
		}
1363869
protected function hasToBeAuthorized()
    {
        if ( in_array($this->route->getName(), self::$except) ) return false;

        return (bool) $this->route->getName();
    }
810434
public static function isDismissed( $id ) {
		$dismissed = false;
		$id = sanitize_key( $id );

		// Get all of the notices this user has dismissed.
		$dismissals = get_user_meta( get_current_user_id(), 'boldgrid_dismissed_admin_notices' );

		// Loop through all of the dismissed notices. If we find our $id, then mark bool and break.
		foreach ( $dismissals as $dismissal ) {
			if ( $id === $dismissal['id'] ) {
				$dismissed = true;
				break;
			}
		}

		return $dismissed;
	}
636569
private function ping( $blog_id = null, $is_gdpr_test = false ) {
            if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY ) {
                return false;
            }

            $version = $this->get_plugin_version();

            $is_update = $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() );

            return $this->get_api_plugin_scope()->ping(
                $this->get_anonymous_id( $blog_id ),
                array(
                    'is_update'    => json_encode( $is_update ),
                    'version'      => $version,
                    'sdk'          => $this->version,
                    'is_admin'     => json_encode( is_admin() ),
                    'is_ajax'      => json_encode( self::is_ajax() ),
                    'is_cron'      => json_encode( self::is_cron() ),
                    'is_gdpr_test' => $is_gdpr_test,
                    'is_http'      => json_encode( WP_FS__IS_HTTP_REQUEST ),
                )
            );
        }
287007
public function enabled(string $for = ''): bool
    {
        global $wp_markdown_extra;
        $mde = $wp_markdown_extra;

        $for = $for === 'posts' || $for === 'comments' ? $for : 'posts';
        return $mde && $mde->s::getOption($for.'_enable');
    }
598211
protected function isAllowed()
    {
        /** @var  \Arcanesoft\Contracts\Auth\Models\User  $user */
        if (is_null($user = auth()->user()))
            return false;

        return $user->isAdmin() || $user->isModerator();
    }
756880
function is_site_delegated_connection( $blog_id = 0 ) {
            if ( ! $this->_is_network_active ) {
                return false;
            }

            if ( 0 == $blog_id ) {
                $blog_id = get_current_blog_id();
            }

            return $this->_storage->get( 'is_delegated_connection', false, $blog_id );
        }
993897
protected function isVisitorIpExcluded()
    {
        $excludedIps = $this->getAttributes('excluded_ips', 'global_excluded_ips');

        if (!empty($excludedIps)) {
            $ip = IP::fromBinaryIP($this->ip);
            if ($ip->isInRanges($excludedIps)) {
                Common::printDebug('Visitor IP ' . $ip->toString() . ' is excluded from being tracked');
                return true;
            }
        }

        return false;
    }
846843
public function check_activation() {
		$license_data = get_option( $this->product->get_key() . '_license_data', '' );
		if ( '' === $license_data ) {
			return false;
		}

		return isset( $license_data->error ) ? ( 'no_activations_left' == $license_data->error ) : false;

	}
1097858
public function is_enabled() {
		// IF this is not explicitly disabled, always true.
		$disabled = 'no' === $this->enabled;
		return apply_filters( 'woocommerce_email_enabled_' . $this->id, ! $disabled, $this->object );
	}
225240
private function reset_anonymous_mode( $network_or_blog_id = 0 ) {
            if ( true === $network_or_blog_id ) {
                unset( $this->_storage->is_anonymous_ms );
            } else {
                $this->_storage->remove( 'is_anonymous', true, $network_or_blog_id );
            }

            /**
             * Ensure that this field is also "false", otherwise, if the current module's type is "theme" and the module
             * has no menus, the opt-in popup will not be shown immediately (in this case, the user will have to click
             * on the admin notice that contains the opt-in link in order to trigger the opt-in popup).
             *
             * @author Leo Fajardo (@leorw)
             * @since  1.2.2
             */
            if ( ! $this->_is_network_active ||
                 0 === $network_or_blog_id ||
                 get_current_blog_id() == $network_or_blog_id ||
                 ( true === $network_or_blog_id && fs_is_network_admin() )
            ) {
                unset( $this->_is_anonymous );
            }
        }
953758
function set_site_blog_context( $blog_id ) {
            $this->_blog_id = $blog_id;

            $this->_options = FS_Option_Manager::get_manager( $this->_id, false, $this->_blog_id );
        }