<?php
/**
 * Licensing gate.
 *
 * A thin abstraction over the question "is this site Pro?". Feature code calls
 * DrezSync_License::is_pro() and never talks to the payment platform directly.
 *
 * For now it returns false unless a dev override is set, because the payment
 * platform is not wired yet. Later this is connected to Freemius, and can be
 * swapped to a self-hosted system such as WHMCS, by changing only this file.
 *
 * @package DrezSync
 */

defined( 'ABSPATH' ) || exit;

/**
 * Answers whether Pro features are active.
 */
class DrezSync_License {

	/**
	 * Whether Pro features are active on this site.
	 *
	 * The real unlock comes from the license backend (Freemius, later WHMCS)
	 * through the drezsync_is_pro filter, and is checked server side against a
	 * paid, domain-locked license. Feature code calls only this method.
	 *
	 * @return bool
	 */
	public static function is_pro() {

		/**
		 * Filters whether DrezSync Pro is active. Wired to the license backend
		 * (Freemius, later WHMCS), which validates a paid license server side.
		 *
		 * @param bool $is_pro Whether Pro is active.
		 */
		return (bool) apply_filters( 'drezsync_is_pro', false );
	}
}
