PluginProbe ʕ •ᴥ•ʔ
Image Widget / 4.2
Image Widget v4.2
trunk 1.0 2.0 2.1 2.2 2.2.1 2.2.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2 3.2.1 3.2.10 3.2.11 3.2.2 3.2.3 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1 4.1.1 4.1.2 4.2 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9
image-widget / freemius / includes / entities / class-fs-subscription.php
image-widget / freemius / includes / entities Last commit date
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-subscription.php
117 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.9
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Subscription extends FS_Entity {
14
15 #region Properties
16
17 /**
18 * @var number
19 */
20 public $user_id;
21 /**
22 * @var number
23 */
24 public $install_id;
25 /**
26 * @var number
27 */
28 public $plan_id;
29 /**
30 * @var number
31 */
32 public $license_id;
33 /**
34 * @var float
35 */
36 public $total_gross;
37 /**
38 * @var float
39 */
40 public $amount_per_cycle;
41 /**
42 * @var int # of months
43 */
44 public $billing_cycle;
45 /**
46 * @var float
47 */
48 public $outstanding_balance;
49 /**
50 * @var int
51 */
52 public $failed_payments;
53 /**
54 * @var string
55 */
56 public $gateway;
57 /**
58 * @var string
59 */
60 public $external_id;
61 /**
62 * @var string|null
63 */
64 public $trial_ends;
65 /**
66 * @var string|null Datetime of the next payment, or null if cancelled
67 */
68 public $next_payment;
69 /**
70 * @var string|null
71 */
72 public $vat_id;
73 /**
74 * @var string Two characters country code
75 */
76 public $country_code;
77
78 #endregion Properties
79
80 /**
81 * @param object|bool $subscription
82 */
83 function __construct( $subscription = false ) {
84 parent::__construct( $subscription );
85 }
86
87 static function get_type() {
88 return 'subscription';
89 }
90
91 /**
92 * Check if subscription is active.
93 *
94 * @author Vova Feldman (@svovaf)
95 * @since 1.0.9
96 *
97 * @return bool
98 */
99 function is_active() {
100 return ! empty( $this->next_payment ) &&
101 ( strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME );
102 }
103
104 /**
105 * Subscription considered to be new without any payments
106 * if the next payment should be made within less than 24 hours
107 * from the subscription creation.
108 *
109 * @author Vova Feldman (@svovaf)
110 * @since 1.0.9
111 *
112 * @return bool
113 */
114 function is_first_payment_pending() {
115 return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
116 }
117 }