summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
committerAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
commita6b006c0f1ef757f23375f7906193370337d8bd7 (patch)
tree4467c6423b2c54e6ef8c3e79241a833fb17833a5 /plugins/jetpack/sal/class.json-api-site-base.php
parentUpdate akismet 4.0.7 (diff)
downloadblogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.gz
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.bz2
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.zip
Update jetpack 6.2
Diffstat (limited to 'plugins/jetpack/sal/class.json-api-site-base.php')
-rw-r--r--plugins/jetpack/sal/class.json-api-site-base.php56
1 files changed, 51 insertions, 5 deletions
diff --git a/plugins/jetpack/sal/class.json-api-site-base.php b/plugins/jetpack/sal/class.json-api-site-base.php
index 8e60b28f..cef41865 100644
--- a/plugins/jetpack/sal/class.json-api-site-base.php
+++ b/plugins/jetpack/sal/class.json-api-site-base.php
@@ -111,6 +111,14 @@ abstract class SAL_Site {
return false;
}
+ public function is_wpcom_store() {
+ return false;
+ }
+
+ public function woocommerce_is_active() {
+ return false;
+ }
+
public function get_post_by_id( $post_id, $context ) {
// Remove the skyword tracking shortcode for posts returned via the API.
remove_shortcode( 'skyword-tracking' );
@@ -185,18 +193,30 @@ abstract class SAL_Site {
// copied from class.json-api-endpoints.php
public function is_post_type_allowed( $post_type ) {
// if the post type is empty, that's fine, WordPress will default to post
- if ( empty( $post_type ) )
+ if ( empty( $post_type ) ) {
return true;
+ }
// allow special 'any' type
- if ( 'any' == $post_type )
+ if ( 'any' == $post_type ) {
return true;
+ }
// check for allowed types
- if ( in_array( $post_type, $this->get_whitelisted_post_types() ) )
+ if ( in_array( $post_type, $this->get_whitelisted_post_types() ) ) {
return true;
+ }
- return false;
+ if ( $post_type_object = get_post_type_object( $post_type ) ) {
+ if ( ! empty( $post_type_object->show_in_rest ) ) {
+ return $post_type_object->show_in_rest;
+ }
+ if ( ! empty( $post_type_object->publicly_queryable ) ) {
+ return $post_type_object->publicly_queryable;
+ }
+ }
+
+ return ! empty( $post_type_object->public );
}
// copied from class.json-api-endpoints.php
@@ -299,7 +319,6 @@ abstract class SAL_Site {
'name' => $name,
'numberposts' => 1,
'post_type' => $this->get_whitelisted_post_types(),
- 'suppress_filters' => false,
) );
if ( ! $posts || ! isset( $posts[0]->ID ) || ! $posts[0]->ID ) {
@@ -559,4 +578,31 @@ abstract class SAL_Site {
function get_blog_public() {
return (int) get_option( 'blog_public' );
}
+
+ function has_pending_automated_transfer() {
+ if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
+ require_once( WP_CONTENT_DIR . '/lib/automated-transfer/utils.php' );
+ return A8C\Automated_Transfer\Utils\has_site_pending_automated_transfer( $this->blog_id );
+ }
+
+ return false;
+ }
+
+ function signup_is_store() {
+ return $this->get_design_type() === 'store';
+ }
+
+ function get_roles() {
+ return new WP_Roles();
+ }
+
+ function get_design_type() {
+ $options = get_option( 'options' );
+ return empty( $options[ 'designType'] ) ? null : $options[ 'designType' ];
+ }
+
+ function get_site_goals() {
+ $options = get_option( 'options' );
+ return empty( $options[ 'siteGoals'] ) ? null : $options[ 'siteGoals' ];
+ }
}