-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sync coming soon status from LYS to WPCOM (#1503)
* Add atomic API helper, add sync from lys to wpcom * Changelog * Update includes/class-wc-calypso-bridge-coming-soon.php Co-authored-by: Chi-Hsuan Huang <[email protected]> --------- Co-authored-by: Chi-Hsuan Huang <[email protected]>
- Loading branch information
Showing
4 changed files
with
148 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
includes/atomic-api/class-wc-calypso-bridge-atomic-launch-api.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
use Automattic\Jetpack\Connection\Client; | ||
|
||
/** | ||
* Class WC_Calypso_Bridge_Atomic_Launch_API. | ||
* | ||
* @since x.x.x | ||
* @version x.x.x | ||
* | ||
* API for launch on Atomic. | ||
*/ | ||
class WC_Calypso_Bridge_Atomic_Launch_API { | ||
/** | ||
* Launch Atomic. | ||
*/ | ||
public static function launch_site() { | ||
if ( ! class_exists( '\Jetpack_Options' ) ) { | ||
return; | ||
} | ||
|
||
$blog_id = \Jetpack_Options::get_option( 'id' ); | ||
return Client::wpcom_json_api_request_as_user( | ||
sprintf( '/sites/%d/launch', $blog_id ), | ||
'2', | ||
array( | ||
'method' => 'POST', | ||
), | ||
json_encode( array( | ||
'site' => $blog_id | ||
) ), | ||
'wpcom' | ||
); | ||
} | ||
|
||
/** | ||
* Update coming soon. | ||
*/ | ||
public static function update_coming_soon( $is_coming_soon ) { | ||
if ( ! class_exists( '\Jetpack_Options' ) ) { | ||
return; | ||
} | ||
|
||
$blog_id = \Jetpack_Options::get_option( 'id' ); | ||
return Client::wpcom_json_api_request_as_user( | ||
sprintf( '/sites/%d/coming-soon', $blog_id ), | ||
'2', | ||
array( | ||
'method' => 'POST', | ||
), | ||
array( | ||
'is_coming_soon' => $is_coming_soon ? 1 : 0 | ||
), | ||
'wpcom' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters