BSF_License_Manager::bsf_is_active_license( int $product_id )
BSF is active license.
Description
Parameters
- $product_id
-
(int) (Required) Product ID.
Source
File: admin/bsf-core/class-bsf-license-manager.php
public static function bsf_is_active_license( $product_id ) { $brainstrom_products = get_option( 'brainstrom_products', array() ); $brainstorm_plugins = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array(); $brainstorm_themes = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array(); $all_products = $brainstorm_plugins + $brainstorm_themes; // If a product is marked as free, it is considered as active. $is_free = self::is_product_free( $product_id ); if ( 'true' === $is_free || true === $is_free ) { return true; } $is_bundled = BSF_Update_Manager::bsf_is_product_bundled( $product_id ); // The product is not bundled. if ( isset( $all_products[ $product_id ] ) ) { if ( isset( $all_products[ $product_id ]['status'] ) && 'registered' === $all_products[ $product_id ]['status'] ) { // If the purchase key is empty, Return false. if ( ! isset( $all_products[ $product_id ]['purchase_key'] ) ) { return false; } // Check if license is active on API. if ( false === self::instance()->get_remote_license_status( $all_products[ $product_id ]['purchase_key'], $product_id ) ) { return false; } return true; } } // The product is bundled. if ( ! empty( $is_bundled ) ) { // If the bundled product does not require to activate the license then treat the license is active. $product = get_brainstorm_product( $product_id ); if ( isset( $product['licence_require'] ) && 'false' === $product['licence_require'] ) { return true; } foreach ( $is_bundled as $key => $value ) { $product_id = $value; if ( isset( $all_products[ $product_id ] ) ) { if ( isset( $all_products[ $product_id ]['status'] ) && 'registered' === $all_products[ $product_id ]['status'] ) { // If the purchase key is empty, Return false. if ( ! isset( $all_products[ $product_id ]['purchase_key'] ) ) { return false; } // Check if license is active on API. if ( false === self::instance()->get_remote_license_status( $all_products[ $product_id ]['purchase_key'], $product_id ) ) { return false; } return true; } } } } // By default Return false. return false; }
Expand full source code Collapse full source code View on Trac