class-fs-entity.php
10 years ago
class-fs-plugin-info.php
10 years ago
class-fs-plugin-license.php
10 years ago
class-fs-plugin-plan.php
10 years ago
class-fs-plugin-tag.php
10 years ago
class-fs-plugin.php
10 years ago
class-fs-scope-entity.php
10 years ago
class-fs-site.php
10 years ago
class-fs-subscription.php
10 years ago
class-fs-user.php
10 years ago
class-fs-plugin.php
90 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 6 | * @since 1.0.3 |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | class FS_Plugin extends FS_Scope_Entity { |
| 14 | /** |
| 15 | * @since 1.0.6 |
| 16 | * @var null|number |
| 17 | */ |
| 18 | public $parent_plugin_id; |
| 19 | /** |
| 20 | * @var string |
| 21 | */ |
| 22 | public $title; |
| 23 | /** |
| 24 | * @var string |
| 25 | */ |
| 26 | public $slug; |
| 27 | |
| 28 | #region Install Specific Properties |
| 29 | |
| 30 | /** |
| 31 | * @var string |
| 32 | */ |
| 33 | public $file; |
| 34 | /** |
| 35 | * @var string |
| 36 | */ |
| 37 | public $version; |
| 38 | /** |
| 39 | * @var bool |
| 40 | */ |
| 41 | public $auto_update; |
| 42 | /** |
| 43 | * @var FS_Plugin_Info |
| 44 | */ |
| 45 | public $info; |
| 46 | /** |
| 47 | * @since 1.0.9 |
| 48 | * |
| 49 | * @var bool |
| 50 | */ |
| 51 | public $is_premium; |
| 52 | /** |
| 53 | * @since 1.0.9 |
| 54 | * |
| 55 | * @var bool |
| 56 | */ |
| 57 | public $is_live; |
| 58 | |
| 59 | #endregion Install Specific Properties |
| 60 | |
| 61 | /** |
| 62 | * @param stdClass|bool $plugin |
| 63 | */ |
| 64 | function __construct( $plugin = false ) { |
| 65 | parent::__construct( $plugin ); |
| 66 | |
| 67 | $this->is_premium = false; |
| 68 | $this->is_live = true; |
| 69 | |
| 70 | if ( isset( $plugin->info ) && is_object( $plugin->info ) ) { |
| 71 | $this->info = new FS_Plugin_Info( $plugin->info ); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Check if plugin is an add-on (has parent). |
| 77 | * |
| 78 | * @author Vova Feldman (@svovaf) |
| 79 | * @since 1.0.6 |
| 80 | * |
| 81 | * @return bool |
| 82 | */ |
| 83 | function is_addon() { |
| 84 | return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id ); |
| 85 | } |
| 86 | |
| 87 | static function get_type() { |
| 88 | return 'plugin'; |
| 89 | } |
| 90 | } |