PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / extensions / blocks / premium-content / _inc / subscription-service / interface-subscription-service.php

interface-subscription-service.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.5, at extensions/blocks/premium-content/_inc/subscription-service/interface-subscription-service.php

70 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The Subscription Service represents the entity responsible for making sure a visitor
4 * can see blocks that are considered premium content.
5 *
6 * If a visitor is not allowed to see they need to be given a way gain access.
7 *
8 * It is assumed that it will be a monetary exchange but that is up to the host
9 * that brokers the content exchange.
10 *
11 * @package Automattic\Jetpack\Extensions\Premium_Content;
12 */
13
14 namespace Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit( 0 );
18 }
19
20 interface Subscription_Service {
21
22 /**
23 * The subscription service can be used.
24 *
25 * @return bool
26 */
27 public static function available();
28
29 /**
30 * Allows a Subscription Service to setup anything it needs to provide its features.
31 *
32 * This is called during an `init` action hook callback.
33 *
34 * Examples of things a Service may want to do here:
35 * - Determine a visitor is arriving with a new token to unlock content and
36 * store the token for future browsing (e.g. in a cookie)
37 * - Set up WP-API endpoints necessary for the function to work
38 * - Token refreshes
39 *
40 * @return void
41 */
42 public function initialize();
43
44 /**
45 * Given a token (this could be from a cookie, a querystring, or some other means)
46 * can the visitor see the premium content?
47 *
48 * @param array $valid_plan_ids .
49 * @param string $access_level .
50 *
51 * @return bool
52 */
53 public function visitor_can_view_content( $valid_plan_ids, $access_level );
54
55 /**
56 * Is the current user a pending subscriber for the current site?
57 *
58 * @return bool
59 */
60 public function is_current_user_pending_subscriber(): bool;
61
62 /**
63 * The current visitor would like to obtain access. Where do they go?
64 *
65 * @param string $mode .
66 * @return string
67 */
68 public function access_url( $mode = 'subscribe' );
69 }
70