From ccac40200226d1670aca054fc20afcd0e9d1f507 Mon Sep 17 00:00:00 2001 From: Staci Cooper Date: Fri, 19 Mar 2021 14:55:42 -0700 Subject: [PATCH 1/4] Remove inline styling for colors on subscription status message --- .../jetpack/modules/subscriptions/views.php | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/projects/plugins/jetpack/modules/subscriptions/views.php b/projects/plugins/jetpack/modules/subscriptions/views.php index 1cda856072143..5ede294489dae 100644 --- a/projects/plugins/jetpack/modules/subscriptions/views.php +++ b/projects/plugins/jetpack/modules/subscriptions/views.php @@ -210,43 +210,36 @@ static function render_widget_status_messages( $instance ) { if ( self::is_wpcom() && self::wpcom_has_status_message() ) { global $themecolors; + $message = ''; + switch ( $_GET['blogsub'] ) { case 'confirming': - echo "
"; - _e( 'Thanks for subscribing! You’ll get an email with a link to confirm your subscription. If you don’t get it, please contact us.' ); - echo "
"; + $message = __( 'Thanks for subscribing! You’ll get an email with a link to confirm your subscription. If you don’t get it, please contact us.', 'jetpack' ); break; case 'blocked': - echo "
"; - _e( 'Subscriptions have been blocked for this email address.' ); - echo "
"; + $message = __( 'Subscriptions have been blocked for this email address.', 'jetpack' ); break; case 'flooded': - echo "
"; - _e( 'You already have several pending email subscriptions. Approve or delete a few through your Subscription Manager before attempting to subscribe to more blogs.' ); - echo "
"; + $message = __( 'You already have several pending email subscriptions. Approve or delete a few through your Subscription Manager before attempting to subscribe to more blogs.', 'jetpack' ); break; case 'spammed': - echo "
"; - echo wp_kses_post( sprintf( __( 'Because there are many pending subscriptions for this email address, we have blocked the subscription. Please activate or delete pending subscriptions before attempting to subscribe.' ), 'https://subscribe.wordpress.com/' ) ); - echo "
"; + /* translators: %s is a URL */ + $message = sprintf( __( 'Because there are many pending subscriptions for this email address, we have blocked the subscription. Please activate or delete pending subscriptions before attempting to subscribe.', 'jetpack' ), 'https://subscribe.wordpress.com/' ); break; case 'subscribed': - echo "
"; - _e( 'You’re already subscribed to this site.' ); - echo "
"; + $message = __( 'You’re already subscribed to this site.', 'jetpack' ); break; case 'pending': - echo "
"; - _e( 'You have a pending subscription already; we just sent you another email. Click the link or contact us if you don’t receive it.' ); - echo "
"; + $message = __( 'You have a pending subscription already; we just sent you another email. Click the link or contact us if you don’t receive it.', 'jetpack' ); break; case 'confirmed': - echo "
"; - _e( 'Congrats, you’re subscribed! You’ll get an email with the details of your subscription and an unsubscribe link.' ); - echo "
"; + $message = __( 'Congrats, you’re subscribed! You’ll get an email with the details of your subscription and an unsubscribe link.', 'jetpack' ); break; } + + echo sprintf( "
", esc_attr( $themecolors['border'] ) ); + echo wp_kses_post( $message ); + echo '
'; } } From 061e3ea923c1413247167616145f525991b9ef96 Mon Sep 17 00:00:00 2001 From: Staci Cooper Date: Mon, 22 Mar 2021 14:02:28 -0700 Subject: [PATCH 2/4] Only set border color when defined in theme --- projects/plugins/jetpack/modules/subscriptions/views.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/modules/subscriptions/views.php b/projects/plugins/jetpack/modules/subscriptions/views.php index 5ede294489dae..58eee731dfc69 100644 --- a/projects/plugins/jetpack/modules/subscriptions/views.php +++ b/projects/plugins/jetpack/modules/subscriptions/views.php @@ -237,7 +237,8 @@ static function render_widget_status_messages( $instance ) { break; } - echo sprintf( "
", esc_attr( $themecolors['border'] ) ); + $border_color = isset( $themecolors['border'] ) ? " #{$themecolors['border']}" : ''; + echo sprintf( "
", esc_attr( $border_color ) ); echo wp_kses_post( $message ); echo '
'; } From 45208cdb2ecdffd689c4e4a84bbb982edcbe4e1e Mon Sep 17 00:00:00 2001 From: Staci Cooper Date: Mon, 22 Mar 2021 14:22:13 -0700 Subject: [PATCH 3/4] Add changelog --- .../fix-remove-inline-style-theme-color-for-subscriptions | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/fix-remove-inline-style-theme-color-for-subscriptions diff --git a/projects/plugins/jetpack/changelog/fix-remove-inline-style-theme-color-for-subscriptions b/projects/plugins/jetpack/changelog/fix-remove-inline-style-theme-color-for-subscriptions new file mode 100644 index 0000000000000..1579acbde77e2 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-remove-inline-style-theme-color-for-subscriptions @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Subscriptions Block: allow block to override color styles, falling back to theme defaults. From 6a0a96b1ffb94e10713a6c7e6560a5234882cf2d Mon Sep 17 00:00:00 2001 From: Staci Cooper Date: Wed, 24 Mar 2021 17:13:53 -0700 Subject: [PATCH 4/4] Clean up with printf --- projects/plugins/jetpack/modules/subscriptions/views.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/plugins/jetpack/modules/subscriptions/views.php b/projects/plugins/jetpack/modules/subscriptions/views.php index 58eee731dfc69..77d249eb289b6 100644 --- a/projects/plugins/jetpack/modules/subscriptions/views.php +++ b/projects/plugins/jetpack/modules/subscriptions/views.php @@ -238,9 +238,11 @@ static function render_widget_status_messages( $instance ) { } $border_color = isset( $themecolors['border'] ) ? " #{$themecolors['border']}" : ''; - echo sprintf( "
", esc_attr( $border_color ) ); - echo wp_kses_post( $message ); - echo '
'; + printf( + '
%2$s
', + esc_attr( $border_color ), + wp_kses_post( $message ) + ); } }