: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @package Freemius for EDD Add-On
* @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_Pricing extends FS_Entity {
* @author Leo Fajardo (@leorw)
* @var string One of the following: `usd`, `gbp`, `eur`.
* @param object|bool $pricing
function __construct( $pricing = false ) {
parent::__construct( $pricing );
static function get_type() {
* @author Vova Feldman (@svovaf)
return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
* @author Vova Feldman (@svovaf)
return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
* @author Vova Feldman (@svovaf)
function has_lifetime() {
return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
* Check if unlimited licenses pricing.
* @author Vova Feldman (@svovaf)
function is_unlimited() {
return is_null( $this->licenses );
* Check if pricing has more than one billing cycle.
* @author Vova Feldman (@svovaf)
function is_multi_cycle() {
if ( $this->has_monthly() ) {
if ( $this->has_annual() ) {
if ( $this->has_lifetime() ) {
* Get annual over monthly discount.
* @author Vova Feldman (@svovaf)
function annual_discount_percentage() {
return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
* Get annual over monthly savings.
* @author Vova Feldman (@svovaf)
function annual_savings() {
return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
* @author Leo Fajardo (@leorw)
return ( 'usd' === $this->currency );