unlicensed. Key present but no validation // endpoint configured -> still unlicensed, not a silent green light. public static function is_licensed() { if ( '' === self::license_key() || '' === self::validation_endpoint() ) { return false; } return 'valid' === get_option( self::LICENSE_STATUS_OPTION, '' ); } public static function validate_now() { $key = self::license_key(); $url = self::validation_endpoint(); if ( '' === $key ) { return array( 'success' => false, 'message' => __( 'Enter a license key first.', 'argus-wordpress-defence' ) ); } if ( '' === $url ) { return array( 'success' => false, 'message' => __( 'No license validation server is configured for this deployment.', 'argus-wordpress-defence' ) ); } $response = wp_remote_post( $url, array( 'timeout' => 15, 'headers' => array( 'Content-Type' => 'application/json' ), 'body' => wp_json_encode( array( 'license_key' => $key, 'domain' => wp_parse_url( home_url(), PHP_URL_HOST ) ) ), ) ); update_option( self::LICENSE_CHECKED_OPTION, current_time( 'mysql', true ), false ); if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) { update_option( self::LICENSE_STATUS_OPTION, 'error', false ); return array( 'success' => false, 'message' => __( 'Could not reach the license server. Try again shortly.', 'argus-wordpress-defence' ) ); } $data = json_decode( wp_remote_retrieve_body( $response ), true ); $valid = is_array( $data ) && ! empty( $data['valid'] ); update_option( self::LICENSE_STATUS_OPTION, $valid ? 'valid' : 'invalid', false ); return array( 'success' => $valid, 'message' => $valid ? __( 'License activated.', 'argus-wordpress-defence' ) : __( 'That license key is not valid or has expired.', 'argus-wordpress-defence' ), ); } public static function status() { if ( self::is_licensed() ) { return 'licensed'; } return self::days_remaining() > 0 ? 'trial' : 'trial_expired'; } public static function summary() { return array( 'status' => self::status(), 'days_remaining' => self::days_remaining(), 'trial_ends_at' => gmdate( 'Y-m-d H:i:s', self::trial_ends_at() ), 'has_key' => '' !== self::license_key(), 'purchase_url' => defined( 'ARGUS_WPD_LICENSE_PURCHASE_URL' ) ? ARGUS_WPD_LICENSE_PURCHASE_URL : '', ); } }