PluginProbe ʕ •ᴥ•ʔ
Code Manager / 1.0.3
Code Manager v1.0.3
1.0.48 1.0.47 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 1.0.39 1.0.4 1.0.40 1.0.41 1.0.42 1.0.43 1.0.44 1.0.45 1.0.46 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
code-manager / freemius / includes / entities / class-fs-affiliate-terms.php
code-manager / freemius / includes / entities Last commit date
class-fs-affiliate-terms.php 5 years ago class-fs-affiliate.php 5 years ago class-fs-billing.php 5 years ago class-fs-entity.php 5 years ago class-fs-payment.php 5 years ago class-fs-plugin-info.php 5 years ago class-fs-plugin-license.php 5 years ago class-fs-plugin-plan.php 5 years ago class-fs-plugin-tag.php 5 years ago class-fs-plugin.php 5 years ago class-fs-pricing.php 5 years ago class-fs-scope-entity.php 5 years ago class-fs-site.php 5 years ago class-fs-subscription.php 5 years ago class-fs-user.php 5 years ago index.php 5 years ago
class-fs-affiliate-terms.php
128 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.2.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_AffiliateTerms extends FS_Scope_Entity {
14
15 #region Properties
16
17 /**
18 * @var bool
19 */
20 public $is_active;
21 /**
22 * @var string Enum: `affiliation` or `rewards`. Defaults to `affiliation`.
23 */
24 public $type;
25 /**
26 * @var string Enum: `payout` or `credit`. Defaults to `payout`.
27 */
28 public $reward_type;
29 /**
30 * If `first`, the referral will be attributed to the first visited source containing the affiliation link that
31 * was clicked.
32 *
33 * @var string Enum: `first` or `last`. Defaults to `first`.
34 */
35 public $referral_attribution;
36 /**
37 * @var int Defaults to `30`, `0` for session cookie, and `null` for endless cookie (until cookies are cleaned).
38 */
39 public $cookie_days;
40 /**
41 * @var int
42 */
43 public $commission;
44 /**
45 * @var string Enum: `percentage` or `dollar`. Defaults to `percentage`.
46 */
47 public $commission_type;
48 /**
49 * @var null|int Defaults to `0` (affiliate only on first payment). `null` for commission for all renewals. If
50 * greater than `0`, affiliate will get paid for all renewals for `commission_renewals_days` days after
51 * the initial upgrade/purchase.
52 */
53 public $commission_renewals_days;
54 /**
55 * @var int Only cents and no percentage. In US cents, e.g.: 100 = $1.00. Defaults to `null`.
56 */
57 public $install_commission;
58 /**
59 * @var string Required default target link, e.g.: pricing page.
60 */
61 public $default_url;
62 /**
63 * @var string One of the following: 'all', 'new_customer', 'new_user'.
64 * If 'all' - reward for any user type.
65 * If 'new_customer' - reward only for new customers.
66 * If 'new_user' - reward only for new users.
67 */
68 public $reward_customer_type;
69 /**
70 * @var int Defaults to `0` (affiliate only on directly affiliated links). `null` if an affiliate will get
71 * paid for all customers' lifetime payments. If greater than `0`, an affiliate will get paid for all
72 * customer payments for `future_payments_days` days after the initial payment.
73 */
74 public $future_payments_days;
75 /**
76 * @var bool If `true`, allow referrals from social sites.
77 */
78 public $is_social_allowed;
79 /**
80 * @var bool If `true`, allow conversions without HTTP referrer header at all.
81 */
82 public $is_app_allowed;
83 /**
84 * @var bool If `true`, allow referrals from any site.
85 */
86 public $is_any_site_allowed;
87
88 #endregion Properties
89
90 /**
91 * @author Leo Fajardo (@leorw)
92 *
93 * @return string
94 */
95 function get_formatted_commission()
96 {
97 return ( 'dollar' === $this->commission_type ) ?
98 ( '$' . $this->commission ) :
99 ( $this->commission . '%' );
100 }
101
102 /**
103 * @author Leo Fajardo (@leorw)
104 *
105 * @return bool
106 */
107 function has_lifetime_commission() {
108 return ( 0 !== $this->future_payments_days );
109 }
110
111 /**
112 * @author Leo Fajardo (@leorw)
113 *
114 * @return bool
115 */
116 function is_session_cookie() {
117 return ( 0 == $this->cookie_days );
118 }
119
120 /**
121 * @author Leo Fajardo (@leorw)
122 *
123 * @return bool
124 */
125 function has_renewals_commission() {
126 return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 );
127 }
128 }