← All changes
|
freemius/includes/entities/class-fs-plugin-license.php
+44
-0
2.3.2
→
8.1.0
View file →
| @@ -50,8 +50,15 @@ | ||
| 50 | 50 | * @var number |
| 51 | 51 | */ |
| 52 | 52 | public $parent_license_id; |
| 53 | 53 | /** |
| 54 | + * @author Leo Fajardo (@leorw) | |
| 55 | + * @since 2.4.0 | |
| 56 | + * | |
| 57 | + * @var array | |
| 58 | + */ | |
| 59 | + public $products; | |
| 60 | + /** | |
| 54 | 61 | * @var number |
| 55 | 62 | */ |
| 56 | 63 | public $pricing_id; |
| 57 | 64 | /** |
| @@ -74,8 +81,12 @@ | ||
| 74 | 81 | * @var string |
| 75 | 82 | */ |
| 76 | 83 | public $secret_key; |
| 77 | 84 | /** |
| 85 | + * @var bool | |
| 86 | + */ | |
| 87 | + public $is_whitelabeled; | |
| 88 | + /** | |
| 78 | 89 | * @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same |
| 79 | 90 | * license. |
| 80 | 91 | */ |
| 81 | 92 | public $is_free_localhost; |
| @@ -277,8 +288,12 @@ | ||
| 277 | 288 | * |
| 278 | 289 | * @return bool |
| 279 | 290 | */ |
| 280 | 291 | function is_first_payment_pending() { |
| 292 | + if ( $this->is_lifetime() ) { | |
| 293 | + return false; | |
| 294 | + } | |
| 295 | + | |
| 281 | 296 | return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) ); |
| 282 | 297 | } |
| 283 | 298 | |
| 284 | 299 | /** |
| @@ -285,6 +300,35 @@ | ||
| 285 | 300 | * @return int |
| 286 | 301 | */ |
| 287 | 302 | function total_activations() { |
| 288 | 303 | return ( $this->activated + $this->activated_local ); |
| 304 | + } | |
| 305 | + | |
| 306 | + /** | |
| 307 | + * @author Vova Feldman (@svovaf) | |
| 308 | + * @since 2.3.1 | |
| 309 | + * | |
| 310 | + * @return string | |
| 311 | + */ | |
| 312 | + function get_html_escaped_masked_secret_key() { | |
| 313 | + return self::mask_secret_key_for_html( $this->secret_key ); | |
| 314 | + } | |
| 315 | + | |
| 316 | + /** | |
| 317 | + * @author Vova Feldman (@svovaf) | |
| 318 | + * @since 2.3.1 | |
| 319 | + * | |
| 320 | + * @param string $secret_key | |
| 321 | + * | |
| 322 | + * @return string | |
| 323 | + */ | |
| 324 | + static function mask_secret_key_for_html( $secret_key ) { | |
| 325 | + return ( | |
| 326 | + // Initial 6 chars - sk_ABC | |
| 327 | + htmlspecialchars( substr( $secret_key, 0, 6 ) ) . | |
| 328 | + // Masking | |
| 329 | + str_pad( '', ( strlen( $secret_key ) - 9 ) * 6, '•' ) . | |
| 330 | + // Last 3 chars. | |
| 331 | + htmlspecialchars( substr( $secret_key, - 3 ) ) | |
| 332 | + ); | |
| 289 | 333 | } |
| 290 | 334 | } |