PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.0
Jetpack – WP Security, Backup, Speed, & Growth v16.0
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 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / sal / class.json-api-platform.php
class.json-api-platform.php
54 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * SAL_Platform class which defines a token to later be associated with a Jetpack site
4 *
5 * @package automattic/jetpack
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit( 0 );
10 }
11
12 require_once __DIR__ . '/class.json-api-token.php';
13
14 /**
15 * Base class for SAL_Platform
16 */
17 abstract class SAL_Platform {
18 /**
19 * A token that will represent a SAL_Token instance, default is empty.
20 *
21 * @var SAL_Token
22 */
23 public $token;
24
25 /**
26 * Contructs the SAL_Platform instance
27 *
28 * @param SAL_Token $token The variable which will store the SAL_Token instance.
29 */
30 public function __construct( $token ) {
31 if ( is_array( $token ) ) {
32 $token = SAL_Token::from_rest_token( $token );
33 } else {
34 $token = SAL_Token::for_anonymous_user();
35 }
36
37 $this->token = $token;
38 }
39
40 /**
41 * This is the get_site function declaration, initially not implemented.
42 *
43 * @param int $blog_id The sites Jetpack blog ID.
44 * @see class.json-api-platform-jetpack.php for the implementation of this function.
45 */
46 abstract public function get_site( $blog_id );
47 }
48
49 if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
50 require_once dirname( WP_CONTENT_DIR ) . '/public.api/rest/sal/class.json-api-platform-wpcom.php';
51 } else {
52 require_once __DIR__ . '/class.json-api-platform-jetpack.php';
53 }
54