PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 14.5.1
Jetpack – WP Security, Backup, Speed, & Growth v14.5.1
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 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / extensions / blocks / premium-content / _inc / subscription-service / interface-subscription-service.php
interface-subscription-service.php
66 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 interface Subscription_Service {
17
18 /**
19 * The subscription service can be used.
20 *
21 * @return bool
22 */
23 public static function available();
24
25 /**
26 * Allows a Subscription Service to setup anything it needs to provide its features.
27 *
28 * This is called during an `init` action hook callback.
29 *
30 * Examples of things a Service may want to do here:
31 * - Determine a visitor is arriving with a new token to unlock content and
32 * store the token for future browsing (e.g. in a cookie)
33 * - Set up WP-API endpoints necessary for the function to work
34 * - Token refreshes
35 *
36 * @return void
37 */
38 public function initialize();
39
40 /**
41 * Given a token (this could be from a cookie, a querystring, or some other means)
42 * can the visitor see the premium content?
43 *
44 * @param array $valid_plan_ids .
45 * @param string $access_level .
46 *
47 * @return bool
48 */
49 public function visitor_can_view_content( $valid_plan_ids, $access_level );
50
51 /**
52 * Is the current user a pending subscriber for the current site?
53 *
54 * @return bool
55 */
56 public function is_current_user_pending_subscriber(): bool;
57
58 /**
59 * The current visitor would like to obtain access. Where do they go?
60 *
61 * @param string $mode .
62 * @return string
63 */
64 public function access_url( $mode = 'subscribe' );
65 }
66