summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2022-06-15 12:08:35 -0400
committerYury German <blueknight@gentoo.org>2022-06-15 12:08:35 -0400
commit36d7691c33cb64ece817246e47a779ec648d10b0 (patch)
tree08f2fb95303a1d8eeba2c8629a24b35a91fb1cac /plugins/jetpack/extensions
parenttwentyfourteen upg 2.7 to 3.2 and twentysixteen from 2.0 to 2.5 (diff)
downloadblogs-gentoo-36d7691c33cb64ece817246e47a779ec648d10b0.tar.gz
blogs-gentoo-36d7691c33cb64ece817246e47a779ec648d10b0.tar.bz2
blogs-gentoo-36d7691c33cb64ece817246e47a779ec648d10b0.zip
Openid-3.6.1 and jetpack-11.0 upgrade
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'plugins/jetpack/extensions')
-rw-r--r--plugins/jetpack/extensions/blocks/anchor-fm/anchor-fm.php4
-rw-r--r--plugins/jetpack/extensions/blocks/business-hours/business-hours.php26
-rw-r--r--plugins/jetpack/extensions/blocks/button/button.php4
-rw-r--r--plugins/jetpack/extensions/blocks/calendly/calendly.php4
-rw-r--r--plugins/jetpack/extensions/blocks/donations/donations.php29
-rw-r--r--plugins/jetpack/extensions/blocks/instagram-gallery/instagram-gallery.php1
-rw-r--r--plugins/jetpack/extensions/blocks/mailchimp/mailchimp.php19
-rw-r--r--plugins/jetpack/extensions/blocks/opentable/opentable.php11
-rw-r--r--plugins/jetpack/extensions/blocks/payments-intro/payments-intro.php27
-rw-r--r--plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php15
-rw-r--r--plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php2
-rw-r--r--plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header-title.php8
-rw-r--r--plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header.php2
-rw-r--r--plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-title.php2
-rw-r--r--plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-jwt.php2
-rw-r--r--plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-token-subscription-service.php4
-rw-r--r--plugins/jetpack/extensions/blocks/premium-content/login-button/login-button.php7
-rw-r--r--plugins/jetpack/extensions/blocks/premium-content/premium-content.php2
-rw-r--r--plugins/jetpack/extensions/blocks/revue/revue.php2
-rw-r--r--plugins/jetpack/extensions/blocks/simple-payments/simple-payments.php7
-rw-r--r--plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php11
-rw-r--r--plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php4
-rw-r--r--plugins/jetpack/extensions/plugins/payments/payments.php35
-rw-r--r--plugins/jetpack/extensions/plugins/post-publish-qr-post-panel/post-publish-qr-post-panel.php30
24 files changed, 210 insertions, 48 deletions
diff --git a/plugins/jetpack/extensions/blocks/anchor-fm/anchor-fm.php b/plugins/jetpack/extensions/blocks/anchor-fm/anchor-fm.php
index f3e0bafe..7eddfa6c 100644
--- a/plugins/jetpack/extensions/blocks/anchor-fm/anchor-fm.php
+++ b/plugins/jetpack/extensions/blocks/anchor-fm/anchor-fm.php
@@ -62,7 +62,7 @@ function register_extension() {
function process_anchor_params() {
if (
! function_exists( 'get_current_screen' )
- || is_null( \get_current_screen() )
+ || \get_current_screen() === null
) {
return;
}
@@ -80,7 +80,7 @@ function process_anchor_params() {
// phpcs:disable WordPress.Security.NonceVerification.Recommended
$podcast_id = isset( $_GET['anchor_podcast'] ) ? sanitize_text_field( wp_unslash( $_GET['anchor_podcast'] ) ) : null;
$episode_id = isset( $_GET['anchor_episode'] ) ? sanitize_text_field( wp_unslash( $_GET['anchor_episode'] ) ) : null;
- $spotify_url = isset( $_GET['spotify_url'] ) ? wp_unslash( $_GET['spotify_url'] ) : null;
+ $spotify_url = isset( $_GET['spotify_url'] ) ? esc_url_raw( wp_unslash( $_GET['spotify_url'] ) ) : null;
// phpcs:enable WordPress.Security.NonceVerification.Recommended
$data = array(
diff --git a/plugins/jetpack/extensions/blocks/business-hours/business-hours.php b/plugins/jetpack/extensions/blocks/business-hours/business-hours.php
index 4de0593a..260cbef2 100644
--- a/plugins/jetpack/extensions/blocks/business-hours/business-hours.php
+++ b/plugins/jetpack/extensions/blocks/business-hours/business-hours.php
@@ -23,7 +23,23 @@ const BLOCK_NAME = 'jetpack/' . FEATURE_NAME;
function register_block() {
Blocks::jetpack_register_block(
BLOCK_NAME,
- array( 'render_callback' => __NAMESPACE__ . '\render' )
+ array(
+ 'render_callback' => __NAMESPACE__ . '\render',
+ 'supports' => array(
+ 'color' => array(
+ 'gradients' => true,
+ ),
+ 'spacing' => array(
+ 'margin' => true,
+ 'padding' => true,
+ ),
+ 'typography' => array(
+ 'fontSize' => true,
+ 'lineHeight' => true,
+ ),
+ 'align' => array( 'wide', 'full' ),
+ ),
+ )
);
}
add_action( 'init', __NAMESPACE__ . '\register_block' );
@@ -105,11 +121,15 @@ function render( $attributes ) {
$attributes['days'] = get_default_days();
}
+ $wrapper_attributes = \WP_Block_Supports::get_instance()->apply_block_supports();
+
$start_of_week = (int) get_option( 'start_of_week', 0 );
$time_format = get_option( 'time_format' );
$content = sprintf(
- '<dl class="jetpack-business-hours %s">',
- ! empty( $attributes['className'] ) ? esc_attr( $attributes['className'] ) : ''
+ '<dl class="jetpack-business-hours%s%s"%s>',
+ ! empty( $attributes['className'] ) ? ' ' . esc_attr( $attributes['className'] ) : '',
+ ! empty( $wrapper_attributes['class'] ) ? ' ' . esc_attr( $wrapper_attributes['class'] ) : '',
+ ! empty( $wrapper_attributes['style'] ) ? ' style="' . esc_attr( $wrapper_attributes['style'] ) . '"' : ''
);
$days = array( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' );
diff --git a/plugins/jetpack/extensions/blocks/button/button.php b/plugins/jetpack/extensions/blocks/button/button.php
index 451a2938..8aaa892f 100644
--- a/plugins/jetpack/extensions/blocks/button/button.php
+++ b/plugins/jetpack/extensions/blocks/button/button.php
@@ -129,7 +129,7 @@ function get_button_classes( $attributes ) {
$classes[] = sprintf( 'has-%s-gradient-background', $attributes['gradient'] );
}
- // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
if ( $has_border_radius && 0 == $attributes['borderRadius'] ) {
$classes[] = 'no-border-radius';
}
@@ -172,7 +172,7 @@ function get_button_styles( $attributes ) {
$styles[] = sprintf( 'background-color: %s;', $attributes['customBackgroundColor'] );
}
- // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // phpcs:ignore Universal.Operators.StrictComparisons.LooseNotEqual
if ( $has_border_radius && 0 != $attributes['borderRadius'] ) {
$styles[] = sprintf( 'border-radius: %spx;', $attributes['borderRadius'] );
}
diff --git a/plugins/jetpack/extensions/blocks/calendly/calendly.php b/plugins/jetpack/extensions/blocks/calendly/calendly.php
index 42653ff5..75c63a5c 100644
--- a/plugins/jetpack/extensions/blocks/calendly/calendly.php
+++ b/plugins/jetpack/extensions/blocks/calendly/calendly.php
@@ -186,7 +186,9 @@ function enqueue_calendly_js() {
jQuery( 'body' ).on( 'ready_o2', function() { initCalendlyWidget() } );
// Else initialize widget without waiting.
} else {
- initCalendlyWidget();
+ document.addEventListener('DOMContentLoaded', function() {
+ initCalendlyWidget();
+ });
}
};
diff --git a/plugins/jetpack/extensions/blocks/donations/donations.php b/plugins/jetpack/extensions/blocks/donations/donations.php
index e93a1fe4..f4f2c08e 100644
--- a/plugins/jetpack/extensions/blocks/donations/donations.php
+++ b/plugins/jetpack/extensions/blocks/donations/donations.php
@@ -99,10 +99,16 @@ function render_block( $attr, $content ) {
return $content;
}
+ require_once JETPACK__PLUGIN_DIR . 'modules/memberships/class-jetpack-memberships.php';
+
+ // If stripe isn't connected don't show anything to potential donors - they can't actually make a donation.
+ if ( ! \Jetpack_Memberships::get_connected_account_id() ) {
+ return '';
+ }
+
Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME, array( 'thickbox' ) );
add_thickbox();
- require_once JETPACK__PLUGIN_DIR . 'modules/memberships/class-jetpack-memberships.php';
jetpack_require_lib( 'class-jetpack-currencies' );
$donations = array(
@@ -211,16 +217,17 @@ function render_block( $attr, $content ) {
'
<div class="%1$s">
<div class="donations__container">
- %2$s
- <div class="donations__content">
- <div class="donations__tab">
- %3$s
- <p>%4$s</p>
- %5$s
- %6$s
- <hr class="donations__separator">
- %7$s
- %8$s
+ %2$s
+ <div class="donations__content">
+ <div class="donations__tab">
+ %3$s
+ <p>%4$s</p>
+ %5$s
+ %6$s
+ <hr class="donations__separator">
+ %7$s
+ %8$s
+ </div>
</div>
</div>
</div>
diff --git a/plugins/jetpack/extensions/blocks/instagram-gallery/instagram-gallery.php b/plugins/jetpack/extensions/blocks/instagram-gallery/instagram-gallery.php
index 586c71e1..59a56654 100644
--- a/plugins/jetpack/extensions/blocks/instagram-gallery/instagram-gallery.php
+++ b/plugins/jetpack/extensions/blocks/instagram-gallery/instagram-gallery.php
@@ -116,6 +116,7 @@ function render_block( $attributes, $content ) { // phpcs:ignore VariableAnalysi
<img
alt="<?php echo esc_attr( $image->title ? $image->title : $image->link ); ?>"
src="<?php echo esc_url( $image->url ); ?>"
+ loading="lazy"
/>
</a>
<?php endforeach; ?>
diff --git a/plugins/jetpack/extensions/blocks/mailchimp/mailchimp.php b/plugins/jetpack/extensions/blocks/mailchimp/mailchimp.php
index 1640e136..a4405a4e 100644
--- a/plugins/jetpack/extensions/blocks/mailchimp/mailchimp.php
+++ b/plugins/jetpack/extensions/blocks/mailchimp/mailchimp.php
@@ -31,6 +31,16 @@ function register_block() {
BLOCK_NAME,
array(
'render_callback' => __NAMESPACE__ . '\load_assets',
+ 'supports' => array(
+ 'align' => array( 'wide', 'full' ),
+ 'color' => array(
+ 'gradients' => true,
+ ),
+ 'spacing' => array(
+ 'padding' => true,
+ 'margin' => true,
+ ),
+ ),
)
);
}
@@ -56,14 +66,15 @@ function load_assets( $attr, $content ) {
? get_current_blog_id()
: Jetpack_Options::get_option( 'id' );
Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
- $classes = Blocks::classes( FEATURE_NAME, $attr );
- $amp_form_action = sprintf( 'https://public-api.wordpress.com/rest/v1.1/sites/%s/email_follow/amp/subscribe/', $blog_id );
- $is_amp_request = Blocks::is_amp_request();
+ $wrapper_attributes = \WP_Block_Supports::get_instance()->apply_block_supports();
+ $classes = ! empty( $wrapper_attributes['class'] ) ? $wrapper_attributes['class'] : '';
+ $amp_form_action = sprintf( 'https://public-api.wordpress.com/rest/v1.1/sites/%s/email_follow/amp/subscribe/', $blog_id );
+ $is_amp_request = Blocks::is_amp_request();
ob_start();
?>
- <div class="<?php echo esc_attr( $classes ); ?>" data-blog-id="<?php echo esc_attr( $blog_id ); ?>">
+ <div class="<?php echo esc_attr( $classes ); ?>"<?php echo ! empty( $wrapper_attributes['style'] ) ? ' style="' . esc_attr( $wrapper_attributes['style'] ) . '"' : ''; ?> data-blog-id="<?php echo esc_attr( $blog_id ); ?>">
<form
aria-describedby="wp-block-jetpack-mailchimp_consent-text"
<?php if ( $is_amp_request ) : ?>
diff --git a/plugins/jetpack/extensions/blocks/opentable/opentable.php b/plugins/jetpack/extensions/blocks/opentable/opentable.php
index e92f9308..b537d717 100644
--- a/plugins/jetpack/extensions/blocks/opentable/opentable.php
+++ b/plugins/jetpack/extensions/blocks/opentable/opentable.php
@@ -32,17 +32,6 @@ function register_block() {
add_action( 'init', __NAMESPACE__ . '\register_block' );
/**
- * Adds an inline script which updates the block editor settings to
- * add the site locale. This feels sligktly better than calling back
- * to the API before registering the block. It also seemed better than
- * creating a global
- */
-function add_language_setting() {
- wp_add_inline_script( 'jetpack-blocks-editor', sprintf( "wp.data.dispatch( 'core/block-editor' ).updateSettings( { siteLocale: '%s' } )", str_replace( '_', '-', get_locale() ) ), 'before' );
-}
-add_action( 'enqueue_block_assets', __NAMESPACE__ . '\add_language_setting' );
-
-/**
* OpenTable block registration/dependency declaration.
*
* @param array $attributes Array containing the OpenTable block attributes.
diff --git a/plugins/jetpack/extensions/blocks/payments-intro/payments-intro.php b/plugins/jetpack/extensions/blocks/payments-intro/payments-intro.php
new file mode 100644
index 00000000..d12ac35c
--- /dev/null
+++ b/plugins/jetpack/extensions/blocks/payments-intro/payments-intro.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Payments Intro Block.
+ *
+ * Acts as a menu for select payments blocks
+ *
+ * @since 10.x
+ *
+ * @package automattic/jetpack
+ */
+
+namespace Automattic\Jetpack\Extensions\PaymentsIntro;
+
+use Automattic\Jetpack\Blocks;
+
+const FEATURE_NAME = 'payments-intro';
+const BLOCK_NAME = 'jetpack/' . FEATURE_NAME;
+
+/**
+ * Registers the block for use in Gutenberg
+ * This is done via an action so that we can disable
+ * registration if we need to.
+ */
+function register_block() {
+ Blocks::jetpack_register_block( BLOCK_NAME );
+}
+add_action( 'init', __NAMESPACE__ . '\register_block' );
diff --git a/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php b/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php
index 9b3af865..92df64dd 100644
--- a/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php
+++ b/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php
@@ -50,6 +50,13 @@ function register_block() {
),
),
'render_callback' => __NAMESPACE__ . '\render_block',
+ 'supports' => array(
+ 'align' => array( 'wide', 'full' ),
+ 'spacing' => array(
+ 'padding' => true,
+ 'margin' => true,
+ ),
+ ),
// Since Gutenberg #31873.
'style' => 'wp-mediaelement',
@@ -159,13 +166,13 @@ function render_player( $player_data, $attributes ) {
$player_classes_name = trim( "{$secondary_colors['class']} {$background_colors['class']}" );
$player_inline_style = trim( "{$secondary_colors['style']} ${background_colors['style']}" );
$player_inline_style .= get_css_vars( $attributes );
-
- $block_classname = Blocks::classes( FEATURE_NAME, $attributes, array( 'is-default' ) );
- $is_amp = Blocks::is_amp_request();
+ $wrapper_attributes = \WP_Block_Supports::get_instance()->apply_block_supports();
+ $block_classname = Blocks::classes( FEATURE_NAME, $attributes, array( 'is-default' ) );
+ $is_amp = Blocks::is_amp_request();
ob_start();
?>
- <div class="<?php echo esc_attr( $block_classname ); ?>" id="<?php echo esc_attr( $instance_id ); ?>">
+ <div class="<?php echo esc_attr( $block_classname ); ?>"<?php echo ! empty( $wrapper_attributes['style'] ) ? ' style="' . esc_attr( $wrapper_attributes['style'] ) . '"' : ''; ?> id="<?php echo esc_attr( $instance_id ); ?>">
<section
class="jetpack-podcast-player <?php echo esc_attr( $player_classes_name ); ?>"
style="<?php echo esc_attr( $player_inline_style ); ?>"
diff --git a/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php b/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php
index 0789816e..f4938718 100644
--- a/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php
+++ b/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php
@@ -5,6 +5,8 @@
* @package automattic/jetpack
*/
+// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file.
+
namespace Automattic\Jetpack\Extensions\Podcast_Player;
/**
diff --git a/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header-title.php b/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header-title.php
index 763aa83a..1b897d6a 100644
--- a/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header-title.php
+++ b/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header-title.php
@@ -5,6 +5,8 @@
* @package automattic/jetpack
*/
+//phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file.
+
namespace Automattic\Jetpack\Extensions\Podcast_Player;
/**
@@ -43,7 +45,11 @@ $track_link = empty( $template_props['track']['link'] ) ? $template_props['track
<?php endif; // phpcs:enable ?>
</span>
- <?php if ( ! empty( $template_props['title'] ) ) : ?>
+ <?php
+ // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file.
+
+ if ( ! empty( $template_props['title'] ) ) :
+ ?>
<span class="jetpack-podcast-player--visually-hidden"> - </span>
<?php
diff --git a/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header.php b/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header.php
index b6167df2..dd64d63f 100644
--- a/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header.php
+++ b/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header.php
@@ -5,6 +5,8 @@
* @package automattic/jetpack
*/
+// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file.
+
namespace Automattic\Jetpack\Extensions\Podcast_Player;
/**
diff --git a/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-title.php b/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-title.php
index ce5b59ca..8f2d194d 100644
--- a/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-title.php
+++ b/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-title.php
@@ -5,6 +5,8 @@
* @package automattic/jetpack
*/
+// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file.
+
namespace Automattic\Jetpack\Extensions\Podcast_Player;
/**
diff --git a/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-jwt.php b/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-jwt.php
index f2d1f1d8..8f5b9b31 100644
--- a/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-jwt.php
+++ b/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-jwt.php
@@ -81,7 +81,7 @@ class JWT {
* @uses urlsafe_b64_decode
*/
public static function decode( $jwt, $key, array $allowed_algs = array() ) {
- $timestamp = is_null( static::$timestamp ) ? time() : static::$timestamp;
+ $timestamp = static::$timestamp === null ? time() : static::$timestamp;
if ( empty( $key ) ) {
throw new InvalidArgumentException( 'Key may not be empty' );
diff --git a/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-token-subscription-service.php b/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-token-subscription-service.php
index 05791022..5ab97af7 100644
--- a/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-token-subscription-service.php
+++ b/plugins/jetpack/extensions/blocks/premium-content/_inc/subscription-service/class-token-subscription-service.php
@@ -174,7 +174,7 @@ abstract class Token_Subscription_Service implements Subscription_Service {
*/
private function set_token_cookie( $token ) {
if ( ! empty( $token ) ) {
- setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, $token, 0, '/' );
+ setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, $token, 0, '/', COOKIE_DOMAIN, is_ssl(), true ); // httponly -- used by visitor_can_view_content() within the PHP context.
}
}
@@ -234,6 +234,8 @@ abstract class Token_Subscription_Service implements Subscription_Service {
* @return string URL of the JWT endpoint.
*/
private function get_rest_api_token_url( $site_id, $redirect_url ) {
+ // The redirect url might have a part URL encoded but not the whole URL.
+ $redirect_url = rawurldecode( $redirect_url );
return sprintf( '%smemberships/jwt?site_id=%d&redirect_url=%s', self::REST_URL_ORIGIN, $site_id, rawurlencode( $redirect_url ) );
}
diff --git a/plugins/jetpack/extensions/blocks/premium-content/login-button/login-button.php b/plugins/jetpack/extensions/blocks/premium-content/login-button/login-button.php
index 3238d8a9..535dd3d5 100644
--- a/plugins/jetpack/extensions/blocks/premium-content/login-button/login-button.php
+++ b/plugins/jetpack/extensions/blocks/premium-content/login-button/login-button.php
@@ -8,6 +8,7 @@
namespace Automattic\Jetpack\Extensions\Premium_Content;
use Automattic\Jetpack\Blocks;
+use Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service\Token_Subscription_Service;
use Automattic\Jetpack\Status\Host;
use Jetpack_Gutenberg;
@@ -46,7 +47,11 @@ function render_login_button_block( $attributes, $content ) {
return '';
}
- if ( is_user_logged_in() ) {
+ $has_auth_cookie = isset( $_COOKIE[ Token_Subscription_Service::JWT_AUTH_TOKEN_COOKIE_NAME ] );
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ $has_token_parameter = isset( $_GET['token'] );
+
+ if ( is_user_logged_in() || $has_auth_cookie || $has_token_parameter ) {
// The viewer is logged it, so they shouldn't see the login button.
return '';
}
diff --git a/plugins/jetpack/extensions/blocks/premium-content/premium-content.php b/plugins/jetpack/extensions/blocks/premium-content/premium-content.php
index 41915978..be10198d 100644
--- a/plugins/jetpack/extensions/blocks/premium-content/premium-content.php
+++ b/plugins/jetpack/extensions/blocks/premium-content/premium-content.php
@@ -75,7 +75,7 @@ function render_block( $attributes, $content ) {
}
// We don't use FEATURE_NAME here because styles are not in /container folder.
- Jetpack_Gutenberg::load_styles_as_required( 'premium-content' );
+ Jetpack_Gutenberg::load_assets_as_required( 'premium-content' );
return $content;
}
diff --git a/plugins/jetpack/extensions/blocks/revue/revue.php b/plugins/jetpack/extensions/blocks/revue/revue.php
index d0313af0..b726edd9 100644
--- a/plugins/jetpack/extensions/blocks/revue/revue.php
+++ b/plugins/jetpack/extensions/blocks/revue/revue.php
@@ -226,7 +226,7 @@ function get_deprecated_v1_revue_button( $attributes ) {
}
if ( $has_border_radius ) {
- // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
if ( 0 == $attributes['borderRadius'] ) {
$classes[] = 'no-border-radius';
} else {
diff --git a/plugins/jetpack/extensions/blocks/simple-payments/simple-payments.php b/plugins/jetpack/extensions/blocks/simple-payments/simple-payments.php
index b30d3045..3bdabbd2 100644
--- a/plugins/jetpack/extensions/blocks/simple-payments/simple-payments.php
+++ b/plugins/jetpack/extensions/blocks/simple-payments/simple-payments.php
@@ -50,7 +50,12 @@ function render_block( $attr, $content ) {
return $content;
}
- $simple_payments = Jetpack_Simple_Payments::getInstance();
+ $simple_payments = Jetpack_Simple_Payments::get_instance();
+
+ if ( ! $simple_payments->is_valid( $attr ) ) {
+ return '';
+ }
+
$simple_payments->enqueue_frontend_assets();
// For AMP requests, make sure the purchase link redirects to the non-AMP post URL.
diff --git a/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php b/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php
index 9fa2ab3c..868203f1 100644
--- a/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php
+++ b/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php
@@ -26,7 +26,16 @@ function register_block() {
) {
Blocks::jetpack_register_block(
BLOCK_NAME,
- array( 'render_callback' => __NAMESPACE__ . '\render_block' )
+ array(
+ 'render_callback' => __NAMESPACE__ . '\render_block',
+ 'supports' => array(
+ 'spacing' => array(
+ 'margin' => true,
+ 'padding' => true,
+ ),
+ 'align' => array( 'wide', 'full' ),
+ ),
+ )
);
}
}
diff --git a/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php b/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php
index bd7cb88b..183ed0b0 100644
--- a/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php
+++ b/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php
@@ -61,8 +61,8 @@ class Tiled_Gallery {
$is_squareish_layout = self::is_squareish_layout( $attr );
- // Jetpack_Plan does not exist on WordPress.com.
- if ( class_exists( 'Jetpack_Plan' ) ) {
+ // Jetpack_Plan::get does not exist on WordPress.com.
+ if ( method_exists( 'Jetpack_Plan', 'get' ) ) {
$jetpack_plan = Jetpack_Plan::get();
wp_localize_script( 'jetpack-gallery-settings', 'jetpack_plan', array( 'data' => $jetpack_plan['product_slug'] ) );
}
diff --git a/plugins/jetpack/extensions/plugins/payments/payments.php b/plugins/jetpack/extensions/plugins/payments/payments.php
new file mode 100644
index 00000000..42838964
--- /dev/null
+++ b/plugins/jetpack/extensions/plugins/payments/payments.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Payments plugin.
+ *
+ * @since 10.8
+ *
+ * @package automattic/jetpack
+ */
+
+namespace Automattic\Jetpack\Extensions\Payments;
+
+use Jetpack_Gutenberg;
+
+const FEATURE_NAME = 'payments';
+
+// Populate the available extensions with our feature.
+add_filter(
+ 'jetpack_set_available_extensions',
+ function ( $extensions ) {
+ return array_merge(
+ $extensions,
+ array(
+ FEATURE_NAME,
+ )
+ );
+ }
+);
+
+// Set the feature availability, depending on the site plan.
+add_action(
+ 'jetpack_register_gutenberg_extensions',
+ function () {
+ Jetpack_Gutenberg::set_availability_for_plan( FEATURE_NAME );
+ }
+);
diff --git a/plugins/jetpack/extensions/plugins/post-publish-qr-post-panel/post-publish-qr-post-panel.php b/plugins/jetpack/extensions/plugins/post-publish-qr-post-panel/post-publish-qr-post-panel.php
new file mode 100644
index 00000000..40e28e3e
--- /dev/null
+++ b/plugins/jetpack/extensions/plugins/post-publish-qr-post-panel/post-publish-qr-post-panel.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Block Editor - QR Post feature.
+ *
+ * @package automattic/jetpack
+ */
+
+// Feature name.
+const FEATURE_NAME = 'post-publish-qr-post-panel';
+
+// Populate the available extensions with post-publish-qr-post-panel.
+add_filter(
+ 'jetpack_set_available_extensions',
+ function ( $extensions ) {
+ return array_merge(
+ $extensions,
+ array(
+ FEATURE_NAME,
+ )
+ );
+ }
+);
+
+// Set the post-publish-qr-post-panel availability, depending on the site plan.
+add_action(
+ 'jetpack_register_gutenberg_extensions',
+ function () {
+ \Jetpack_Gutenberg::set_extension_available( FEATURE_NAME );
+ }
+);