class.json-api-date.php
3 years ago
class.json-api-links.php
2 years ago
class.json-api-metadata.php
2 years ago
class.json-api-platform-jetpack.php
3 years ago
class.json-api-platform.php
3 years ago
class.json-api-post-base.php
2 years ago
class.json-api-post-jetpack.php
4 years ago
class.json-api-site-base.php
2 years ago
class.json-api-site-jetpack-base.php
3 years ago
class.json-api-site-jetpack.php
2 years ago
class.json-api-token.php
2 years ago
class.json-api-platform-jetpack.php
39 lines
| 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | /** |
| 3 | * WPORG_Platform class that extends SAL_Platform, returning a Jetpack_Site with a $blog_id and $token |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | require_once __DIR__ . '/class.json-api-platform.php'; |
| 9 | |
| 10 | /** |
| 11 | * Base class for WPORG_Platform, which extends SAL_Platform |
| 12 | */ |
| 13 | class WPORG_Platform extends SAL_Platform { |
| 14 | |
| 15 | /** |
| 16 | * Given a Jetpack blog ID, this function returns a Jetpack_Site instance |
| 17 | * |
| 18 | * @param int $blog_id A Jetpack blog ID. |
| 19 | * @return Jetpack_Site A Jetpack_Site instance including all relevant details needed to define a Jetpack site. |
| 20 | **/ |
| 21 | public function get_site( $blog_id ) { |
| 22 | require_once __DIR__ . '/class.json-api-site-jetpack.php'; |
| 23 | return new Jetpack_Site( $blog_id, $this ); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move these functions to some other file. |
| 28 | |
| 29 | /** |
| 30 | * Given a token instance (with blog and user id related information), this function returns a new WPORG_Platform instance |
| 31 | * |
| 32 | * @param SAL_Token $token A token instance. |
| 33 | * @see class.json-api-token.php |
| 34 | * @return WPORG_Platform A WPORG_Platform instance including all relevant details needed to define a Jetpack site, as well as a token instance. |
| 35 | **/ |
| 36 | function wpcom_get_sal_platform( $token ) { |
| 37 | return new WPORG_Platform( $token ); |
| 38 | } |
| 39 |