class-fs-admin-menu-manager.php
1 year ago
class-fs-admin-notice-manager.php
1 year ago
class-fs-cache-manager.php
5 years ago
class-fs-checkout-manager.php
1 year ago
class-fs-clone-manager.php
11 months ago
class-fs-contact-form-manager.php
1 year ago
class-fs-debug-manager.php
1 year ago
class-fs-gdpr-manager.php
3 years ago
class-fs-key-value-storage.php
3 years ago
class-fs-license-manager.php
5 years ago
class-fs-option-manager.php
3 years ago
class-fs-permission-manager.php
3 years ago
class-fs-plan-manager.php
2 years ago
class-fs-plugin-manager.php
3 years ago
index.php
5 years ago
class-fs-license-manager.php
104 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 |
| 6 | * @since 1.0.6 |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | class FS_License_Manager /*extends FS_Abstract_Manager*/ |
| 14 | { |
| 15 | // |
| 16 | // |
| 17 | // /** |
| 18 | // * @var FS_License_Manager[] |
| 19 | // */ |
| 20 | // private static $_instances = array(); |
| 21 | // |
| 22 | // static function instance( Freemius $fs ) { |
| 23 | // $slug = strtolower( $fs->get_slug() ); |
| 24 | // |
| 25 | // if ( ! isset( self::$_instances[ $slug ] ) ) { |
| 26 | // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs ); |
| 27 | // } |
| 28 | // |
| 29 | // return self::$_instances[ $slug ]; |
| 30 | // } |
| 31 | // |
| 32 | //// private function __construct($slug) { |
| 33 | //// parent::__construct($slug); |
| 34 | //// } |
| 35 | // |
| 36 | // function entry_id() { |
| 37 | // return 'licenses'; |
| 38 | // } |
| 39 | // |
| 40 | // function sync( $id ) { |
| 41 | // |
| 42 | // } |
| 43 | // |
| 44 | // /** |
| 45 | // * @author Vova Feldman (@svovaf) |
| 46 | // * @since 1.0.5 |
| 47 | // * @uses FS_Api |
| 48 | // * |
| 49 | // * @param number|bool $plugin_id |
| 50 | // * |
| 51 | // * @return FS_Plugin_License[]|stdClass Licenses or API error. |
| 52 | // */ |
| 53 | // function api_get_user_plugin_licenses( $plugin_id = false ) { |
| 54 | // $api = $this->_fs->get_api_user_scope(); |
| 55 | // |
| 56 | // if ( ! is_numeric( $plugin_id ) ) { |
| 57 | // $plugin_id = $this->_fs->get_id(); |
| 58 | // } |
| 59 | // |
| 60 | // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" ); |
| 61 | // |
| 62 | // if ( ! isset( $result->error ) ) { |
| 63 | // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) { |
| 64 | // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] ); |
| 65 | // } |
| 66 | // |
| 67 | // $result = $result->licenses; |
| 68 | // } |
| 69 | // |
| 70 | // return $result; |
| 71 | // } |
| 72 | // |
| 73 | // function api_get_many() { |
| 74 | // |
| 75 | // } |
| 76 | // |
| 77 | // function api_activate( $id ) { |
| 78 | // |
| 79 | // } |
| 80 | // |
| 81 | // function api_deactivate( $id ) { |
| 82 | // |
| 83 | // } |
| 84 | |
| 85 | /** |
| 86 | * @param FS_Plugin_License[] $licenses |
| 87 | * |
| 88 | * @return bool |
| 89 | */ |
| 90 | static function has_premium_license( $licenses ) { |
| 91 | if ( is_array( $licenses ) ) { |
| 92 | foreach ( $licenses as $license ) { |
| 93 | /** |
| 94 | * @var FS_Plugin_License $license |
| 95 | */ |
| 96 | if ( ! $license->is_utilized() && $license->is_features_enabled() ) { |
| 97 | return true; |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | return false; |
| 103 | } |
| 104 | } |