includes/class-freemius.php
function has_api_connectivity( $flush_if_no_connectivity = false ) {
            $this->_logger->entrance();

            if ( isset( $this->_has_api_connection ) && ( $this->_has_api_connection || ! $flush_if_no_connectivity ) ) {
                return $this->_has_api_connection;
            }

            if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY &&
                 isset( $this->_storage->connectivity_test ) &&
                 true === $this->_storage->connectivity_test['is_connected']
            ) {
                unset( $this->_storage->connectivity_test );
            }

            if ( ! $this->should_run_connectivity_test( $flush_if_no_connectivity ) ) {
                $this->_has_api_connection = $this->_storage->connectivity_test['is_connected'];
                /**
                 * @since 1.1.6 During dev mode, if there's connectivity - turn Freemius on regardless the configuration.
                 *
                 * @since 1.2.1.5 If the user running the premium version then ignore the 'is_active' flag and turn Freemius on to enable license key activation.
                 */
                $this->_is_on = $this->_storage->connectivity_test['is_active'] ||
                                $this->is_premium() ||
                                ( WP_FS__DEV_MODE && $this->_has_api_connection && ! WP_FS__SIMULATE_FREEMIUS_OFF );

                return $this->_has_api_connection;
            }

            $pong         = $this->ping();
            $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );

            if ( ! $is_connected ) {
                // API failure.
                $this->_add_connectivity_issue_message( $pong );
            }

            if ( $is_connected ) {
                FS_GDPR_Manager::instance()->store_is_required( $pong->is_gdpr_required );
            }
            
            $this->store_connectivity_info( $pong, $is_connected );

            return $this->_has_api_connection;
        }
function has_api_connectivity( $flush_if_no_connectivity = false ) {
            $this->_logger->entrance();

            if ( isset( $this->_has_api_connection ) && ( $this->_has_api_connection || ! $flush_if_no_connectivity ) ) {
                return $this->_has_api_connection;
            }

            if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY &&
                 isset( $this->_storage->connectivity_test ) &&
                 true === $this->_storage->connectivity_test['is_connected']
            ) {
                unset( $this->_storage->connectivity_test );
            }

            if ( ! $this->should_run_connectivity_test( $flush_if_no_connectivity ) ) {
                $this->_has_api_connection = $this->_storage->connectivity_test['is_connected'];
                /**
                 * @since 1.1.6 During dev mode, if there's connectivity - turn Freemius on regardless the configuration.
                 *
                 * @since 1.2.1.5 If the user running the premium version then ignore the 'is_active' flag and turn Freemius on to enable license key activation.
                 */
                $this->_is_on = $this->_storage->connectivity_test['is_active'] ||
                                $this->is_premium() ||
                                ( WP_FS__DEV_MODE && $this->_has_api_connection && ! WP_FS__SIMULATE_FREEMIUS_OFF );

                return $this->_has_api_connection;
            }

            $pong         = $this->ping();
            $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );

            if ( ! $is_connected ) {
                // API failure.
                $this->_add_connectivity_issue_message( $pong );
            }

            if ( $is_connected ) {
                FS_GDPR_Manager::instance()->store_is_required( $pong->is_gdpr_required );
            }
            
            $this->store_connectivity_info( $pong, $is_connected );

            return $this->_has_api_connection;
        }
function has_api_connectivity ( $ flush_if_no_connectivity = false ) { $ this -> _logger -> entrance ( ) ; if ( isset ( $ this -> _has_api_connection ) && ( $ this -> _has_api_connection || ! $ flush_if_no_connectivity ) ) { return $ this -> _has_api_connection ; } if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY && isset ( $ this -> _storage -> connectivity_test ) && true === $ this -> _storage -> connectivity_test [ 'is_connected' ] ) { unset ( $ this -> _storage -> connectivity_test ) ; } if ( ! $ this -> should_run_connectivity_test ( $ flush_if_no_connectivity ) ) { $ this -> _has_api_connection = $ this -> _storage -> connectivity_test [ 'is_connected' ] ; /**
                 * @since 1.1.6 During dev mode, if there's connectivity - turn Freemius on regardless the configuration.
                 *
                 * @since 1.2.1.5 If the user running the premium version then ignore the 'is_active' flag and turn Freemius on to enable license key activation.
                 */ $ this -> _is_on = $ this -> _storage -> connectivity_test [ 'is_active' ] || $ this -> is_premium ( ) || ( WP_FS__DEV_MODE && $ this -> _has_api_connection && ! WP_FS__SIMULATE_FREEMIUS_OFF ) ; return $ this -> _has_api_connection ; } $ pong = $ this -> ping ( ) ; $ is_connected = $ this -> get_api_plugin_scope ( ) -> is_valid_ping ( $ pong ) ; if ( ! $ is_connected ) { // API failure.
 $ this -> _add_connectivity_issue_message ( $ pong ) ; } if ( $ is_connected ) { FS_GDPR_Manager :: instance ( ) -> store_is_required ( $ pong -> is_gdpr_required ) ; } $ this -> store_connectivity_info ( $ pong , $ is_connected ) ; return $ this -> _has_api_connection ; }
Check if there's any connectivity issue to Freemius API.

@author Vova Feldman (@svovaf)
@since  1.0.9

@param bool $flush_if_no_connectivity

@return bool
Check if there s any connectivity issue to Freemius API .