← All changes
|
inc/freemius/includes/entities/class-fs-affiliate-terms.php
+131
-131
4.3.8
→
4.3.17
View file →
| @@ -1,132 +1,132 @@ | ||
| 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 | - * @var string $plugin_title Title of the plugin. This is used in case we are showing affiliate form for a Bundle instead of the `plugin` in context. | |
| 89 | - */ | |
| 90 | - public $plugin_title; | |
| 91 | - | |
| 92 | - #endregion Properties | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * @author Leo Fajardo (@leorw) | |
| 96 | - * | |
| 97 | - * @return string | |
| 98 | - */ | |
| 99 | - function get_formatted_commission() | |
| 100 | - { | |
| 101 | - return ( 'dollar' === $this->commission_type ) ? | |
| 102 | - ( '$' . $this->commission ) : | |
| 103 | - ( $this->commission . '%' ); | |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * @author Leo Fajardo (@leorw) | |
| 108 | - * | |
| 109 | - * @return bool | |
| 110 | - */ | |
| 111 | - function has_lifetime_commission() { | |
| 112 | - return ( 0 !== $this->future_payments_days ); | |
| 113 | - } | |
| 114 | - | |
| 115 | - /** | |
| 116 | - * @author Leo Fajardo (@leorw) | |
| 117 | - * | |
| 118 | - * @return bool | |
| 119 | - */ | |
| 120 | - function is_session_cookie() { | |
| 121 | - return ( 0 == $this->cookie_days ); | |
| 122 | - } | |
| 123 | - | |
| 124 | - /** | |
| 125 | - * @author Leo Fajardo (@leorw) | |
| 126 | - * | |
| 127 | - * @return bool | |
| 128 | - */ | |
| 129 | - function has_renewals_commission() { | |
| 130 | - return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 ); | |
| 131 | - } | |
| 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 | + * @var string $plugin_title Title of the plugin. This is used in case we are showing affiliate form for a Bundle instead of the `plugin` in context. | |
| 89 | + */ | |
| 90 | + public $plugin_title; | |
| 91 | + | |
| 92 | + #endregion Properties | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * @author Leo Fajardo (@leorw) | |
| 96 | + * | |
| 97 | + * @return string | |
| 98 | + */ | |
| 99 | + function get_formatted_commission() | |
| 100 | + { | |
| 101 | + return ( 'dollar' === $this->commission_type ) ? | |
| 102 | + ( '$' . $this->commission ) : | |
| 103 | + ( $this->commission . '%' ); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * @author Leo Fajardo (@leorw) | |
| 108 | + * | |
| 109 | + * @return bool | |
| 110 | + */ | |
| 111 | + function has_lifetime_commission() { | |
| 112 | + return ( 0 !== $this->future_payments_days ); | |
| 113 | + } | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * @author Leo Fajardo (@leorw) | |
| 117 | + * | |
| 118 | + * @return bool | |
| 119 | + */ | |
| 120 | + function is_session_cookie() { | |
| 121 | + return ( 0 == $this->cookie_days ); | |
| 122 | + } | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * @author Leo Fajardo (@leorw) | |
| 126 | + * | |
| 127 | + * @return bool | |
| 128 | + */ | |
| 129 | + function has_renewals_commission() { | |
| 130 | + return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 ); | |
| 131 | + } | |
| 132 | 132 | } |