diff options
Diffstat (limited to 'plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-wpcom-token-subscription-service.php')
-rw-r--r-- | plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-wpcom-token-subscription-service.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-wpcom-token-subscription-service.php b/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-wpcom-token-subscription-service.php new file mode 100644 index 00000000..1bb80b6b --- /dev/null +++ b/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-wpcom-token-subscription-service.php @@ -0,0 +1,46 @@ +<?php +/** + * A paywall that exchanges JWT tokens from WordPress.com to allow + * a current visitor to view content that has been deemed "Premium content". + * + * @package Automattic\Jetpack\Extensions\Premium_Content + */ + +namespace Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service; + +/** + * Class WPCOM_Token_Subscription_Service + * + * @package Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service + */ +class WPCOM_Token_Subscription_Service extends Token_Subscription_Service { + + /** + * Is available() + * + * @inheritDoc + */ + public static function available() { + // phpcs:ignore ImportDetection.Imports.RequireImports.Symbol + return defined( 'IS_WPCOM' ) && IS_WPCOM === true; + } + + /** + * Is get_site_id() + * + * @inheritDoc + */ + public function get_site_id() { + return get_current_blog_id(); + } + + /** + * Is get_key() + * + * @inheritDoc + */ + public function get_key() { + // phpcs:ignore ImportDetection.Imports.RequireImports.Symbol + return defined( 'EARN_JWT_SIGNING_KEY' ) ? EARN_JWT_SIGNING_KEY : false; + } +} |