: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
if ( ! defined( 'ABSPATH' ) ) {
class FS_Subscription extends FS_Entity {
public $amount_per_cycle;
public $outstanding_balance;
* @var string|null Datetime of the next payment, or null if cancelled.
* @var string|null Datetime of the cancellation.
* @var string Two characters country code
* @param object|bool $subscription
function __construct( $subscription = false ) {
parent::__construct( $subscription );
static function get_type() {
* Check if subscription is active.
* @author Vova Feldman (@svovaf)
if ( $this->is_canceled() ) {
! empty( $this->next_payment ) &&
strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME
* @author Vova Feldman (@svovaf)
return ! is_null( $this->canceled_at );
* Subscription considered to be new without any payments
* if the next payment should be made within less than 24 hours
* from the subscription creation.
* @author Vova Feldman (@svovaf)
function is_first_payment_pending() {
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
* @author Vova Feldman (@svovaf)
return ! is_null( $this->trial_ends );