Skip to content

Commit

Permalink
Merge branch 'trunk' into 21333-use-wp_is_serving_rest_request
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi committed Oct 2, 2024
2 parents c20a976 + a6034e9 commit d421ba2
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 92 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
matrix:
include:
- php_version: "7.2"
wp_version: "6.4"
wp_version: "6.5"
multisite: true
coverage: true

Expand All @@ -151,7 +151,7 @@ jobs:
coverage: false

- php_version: "8.0"
wp_version: "6.4"
wp_version: "6.5"
multisite: false
coverage: false

Expand All @@ -161,7 +161,7 @@ jobs:
coverage: false

- php_version: '8.2'
wp_version: '6.4'
wp_version: '6.5'
multisite: true
coverage: false

Expand Down
4 changes: 2 additions & 2 deletions admin/class-gutenberg-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
*
* @var string
*/
public const CURRENT_RELEASE = '19.2.0';
public const CURRENT_RELEASE = '19.3.0';

/**
* The minimally supported version of Gutenberg by the plugin.
*
* @var string
*/
public const MINIMUM_SUPPORTED = '19.2.0';
public const MINIMUM_SUPPORTED = '19.3.0';

/**
* Holds the current version.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"webpack-bundle-analyzer": "^4.9.1"
},
"yoast": {
"pluginVersion": "23.6-RC1"
"pluginVersion": "23.6-RC2"
},
"version": "0.0.0"
}
7 changes: 4 additions & 3 deletions packages/js/src/components/UpsellBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ class UpsellBox extends Component {
return (
<Fragment>
{ isBlackFriday &&
<div className="yst-flex yst-items-center yst-text-lg yst-content-between yst-bg-black yst-text-amber-300 yst-h-9 yst-border-amber-300 yst-border-y yst-border-x-0 yst-border-solid yst-px-6">
<div className="yst-mx-auto">{ __( "BLACK FRIDAY | 30% OFF", "wordpress-seo" ) }</div>
</div> }
<div className="yst-flex yst-flex-col yst-items-center yst-bg-black yst-border-amber-300 yst-border-y yst-border-x-0 yst-border-solid yst-gap-2 yst-py-2 yst-leading-5">
<div className="yst-mx-auto yst-text-amber-300 yst-text-lg">{ __( "BLACK FRIDAY | 30% OFF", "wordpress-seo" ) }</div>
<div className="yst-text-white yst-text-base yst-font-semibold">{ __( "Promo code", "wordpress-seo" ) }: BF2024</div>
</div> }
<Container>
<Heading>{ this.props.title }</Heading>
<Description>{ this.props.description }</Description>
Expand Down
57 changes: 36 additions & 21 deletions src/editors/framework/site/base-site-information.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Yoast\WP\SEO\Helpers\Product_Helper;
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
use Yoast\WP\SEO\Introductions\Infrastructure\Wistia_Embed_Permission_Repository;
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
use Yoast\WP\SEO\Surfaces\Meta_Surface;

/**
Expand Down Expand Up @@ -49,6 +50,13 @@ abstract class Base_Site_Information {
*/
protected $options_helper;

/**
* The promotion manager.
*
* @var Promotion_Manager $promotion_manager
*/
protected $promotion_manager;

/**
* The constructor.
*
Expand All @@ -58,19 +66,22 @@ abstract class Base_Site_Information {
* @param Meta_Surface $meta The meta surface.
* @param Product_Helper $product_helper The product helper.
* @param Options_Helper $options_helper The options helper.
* @param Promotion_Manager $promotion_manager The promotion manager.
*/
public function __construct(
Short_Link_Helper $short_link_helper,
Wistia_Embed_Permission_Repository $wistia_embed_permission_repository,
Meta_Surface $meta,
Product_Helper $product_helper,
Options_Helper $options_helper
Options_Helper $options_helper,
Promotion_Manager $promotion_manager
) {
$this->short_link_helper = $short_link_helper;
$this->wistia_embed_permission_repository = $wistia_embed_permission_repository;
$this->meta = $meta;
$this->product_helper = $product_helper;
$this->options_helper = $options_helper;
$this->promotion_manager = $promotion_manager;
}

/**
Expand All @@ -81,23 +92,25 @@ public function __construct(
*/
public function get_site_information(): array {
return [
'adminUrl' => \admin_url( 'admin.php' ),
'linkParams' => $this->short_link_helper->get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => $this->wistia_embed_permission_repository->get_value_for_user( \get_current_user_id() ),
'site_name' => $this->meta->for_current_page()->site_name,
'contentLocale' => \get_locale(),
'userLocale' => \get_user_locale(),
'isRtl' => \is_rtl(),
'isPremium' => $this->product_helper->is_premium(),
'siteIconUrl' => \get_site_icon_url(),
'showSocial' => [
'adminUrl' => \admin_url( 'admin.php' ),
'linkParams' => $this->short_link_helper->get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => $this->wistia_embed_permission_repository->get_value_for_user( \get_current_user_id() ),
'site_name' => $this->meta->for_current_page()->site_name,
'contentLocale' => \get_locale(),
'userLocale' => \get_user_locale(),
'isRtl' => \is_rtl(),
'isPremium' => $this->product_helper->is_premium(),
'siteIconUrl' => \get_site_icon_url(),
'showSocial' => [
'facebook' => $this->options_helper->get( 'opengraph', false ),
'twitter' => $this->options_helper->get( 'twitter', false ),
],
'sitewideSocialImage' => $this->options_helper->get( 'og_default_image' ),
'sitewideSocialImage' => $this->options_helper->get( 'og_default_image' ),
// phpcs:ignore Generic.ControlStructures.DisallowYodaConditions -- Bug: squizlabs/PHP_CodeSniffer#2962.
'isPrivateBlog' => ( (string) \get_option( 'blog_public' ) ) === '0',
'isPrivateBlog' => ( (string) \get_option( 'blog_public' ) ) === '0',
'currentPromotions' => $this->promotion_manager->get_current_promotions(),
'blackFridayBlockEditorUrl' => ( $this->promotion_manager->is( 'black-friday-2023-checklist' ) ) ? $this->short_link_helper->get( 'https://yoa.st/black-friday-checklist' ) : '',
];
}

Expand All @@ -109,14 +122,16 @@ public function get_site_information(): array {
*/
public function get_legacy_site_information(): array {
return [
'adminUrl' => \admin_url( 'admin.php' ),
'linkParams' => $this->short_link_helper->get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => $this->wistia_embed_permission_repository->get_value_for_user( \get_current_user_id() ),
'sitewideSocialImage' => $this->options_helper->get( 'og_default_image' ),
'adminUrl' => \admin_url( 'admin.php' ),
'linkParams' => $this->short_link_helper->get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => $this->wistia_embed_permission_repository->get_value_for_user( \get_current_user_id() ),
'sitewideSocialImage' => $this->options_helper->get( 'og_default_image' ),
// phpcs:ignore Generic.ControlStructures.DisallowYodaConditions -- Bug: squizlabs/PHP_CodeSniffer#2962.
'isPrivateBlog' => ( (string) \get_option( 'blog_public' ) ) === '0',
'metabox' => [
'isPrivateBlog' => ( (string) \get_option( 'blog_public' ) ) === '0',
'currentPromotions' => $this->promotion_manager->get_current_promotions(),
'blackFridayBlockEditorUrl' => ( $this->promotion_manager->is( 'black-friday-2023-checklist' ) ) ? $this->short_link_helper->get( 'https://yoa.st/black-friday-checklist' ) : '',
'metabox' => [
'site_name' => $this->meta->for_current_page()->site_name,
'contentLocale' => \get_locale(),
'userLocale' => \get_user_locale(),
Expand Down
20 changes: 4 additions & 16 deletions src/editors/framework/site/post-site-information.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,30 @@ class Post_Site_Information extends Base_Site_Information {
*/
private $alert_dismissal_action;

/**
* The promotion manager.
*
* @var Promotion_Manager $promotion_manager
*/
private $promotion_manager;

/**
* Constructs the class.
*
* @param Promotion_Manager $promotion_manager The promotion manager.
* @param Short_Link_Helper $short_link_helper The short link helper.
* @param Wistia_Embed_Permission_Repository $wistia_embed_permission_repository The wistia embed permission
* repository.
* @param Meta_Surface $meta The meta surface.
* @param Product_Helper $product_helper The product helper.
* @param Alert_Dismissal_Action $alert_dismissal_action The alert dismissal action.
* @param Options_Helper $options_helper The options helper.
* @param Promotion_Manager $promotion_manager The promotion manager.
*
* @return void
*/
public function __construct(
Promotion_Manager $promotion_manager,
Short_Link_Helper $short_link_helper,
Wistia_Embed_Permission_Repository $wistia_embed_permission_repository,
Meta_Surface $meta,
Product_Helper $product_helper,
Alert_Dismissal_Action $alert_dismissal_action,
Options_Helper $options_helper
Options_Helper $options_helper,
Promotion_Manager $promotion_manager
) {
parent::__construct( $short_link_helper, $wistia_embed_permission_repository, $meta, $product_helper, $options_helper );
$this->promotion_manager = $promotion_manager;
parent::__construct( $short_link_helper, $wistia_embed_permission_repository, $meta, $product_helper, $options_helper, $promotion_manager );
$this->alert_dismissal_action = $alert_dismissal_action;
}

Expand All @@ -85,9 +77,7 @@ public function get_legacy_site_information(): array {

$data = [
'dismissedAlerts' => $dismissed_alerts,
'currentPromotions' => $this->promotion_manager->get_current_promotions(),
'webinarIntroBlockEditorUrl' => $this->short_link_helper->get( 'https://yoa.st/webinar-intro-block-editor' ),
'blackFridayBlockEditorUrl' => ( $this->promotion_manager->is( 'black-friday-2023-checklist' ) ) ? $this->short_link_helper->get( 'https://yoa.st/black-friday-checklist' ) : '',
'metabox' => [
'search_url' => $this->search_url(),
'post_edit_url' => $this->edit_url(),
Expand All @@ -108,9 +98,7 @@ public function get_site_information(): array {

$data = [
'dismissedAlerts' => $dismissed_alerts,
'currentPromotions' => $this->promotion_manager->get_current_promotions(),
'webinarIntroBlockEditorUrl' => $this->short_link_helper->get( 'https://yoa.st/webinar-intro-block-editor' ),
'blackFridayBlockEditorUrl' => ( $this->promotion_manager->is( 'black-friday-2023-checklist' ) ) ? $this->short_link_helper->get( 'https://yoa.st/black-friday-checklist' ) : '',
'search_url' => $this->search_url(),
'post_edit_url' => $this->edit_url(),
'base_url' => $this->base_url_for_js(),
Expand Down
22 changes: 11 additions & 11 deletions tests/Unit/Editors/Framework/Site/Post_Site_Information_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function set_up() {
$this->alert_dismissal_action = Mockery::mock( Alert_Dismissal_Action::class );
$this->options_helper = Mockery::mock( Options_Helper::class );

$this->instance = new Post_Site_Information( $this->promotion_manager, $this->short_link_helper, $this->wistia_embed_repo, $this->meta_surface, $this->product_helper, $this->alert_dismissal_action, $this->options_helper );
$this->instance = new Post_Site_Information( $this->short_link_helper, $this->wistia_embed_repo, $this->meta_surface, $this->product_helper, $this->alert_dismissal_action, $this->options_helper, $this->promotion_manager );
$this->instance->set_permalink( 'perma' );
$this->set_mocks();
}
Expand All @@ -120,12 +120,7 @@ public function test_legacy_site_information() {
'dismissedAlerts' => [
'the alert',
],
'currentPromotions' => [
'the promotion',
'another one',
],
'webinarIntroBlockEditorUrl' => 'https://expl.c',
'blackFridayBlockEditorUrl' => '',
'metabox' => [
'search_url' => 'https://example.org',
'post_edit_url' => 'https://example.org',
Expand All @@ -151,6 +146,11 @@ public function test_legacy_site_information() {
'wistiaEmbedPermission' => true,
'sitewideSocialImage' => null,
'isPrivateBlog' => false,
'currentPromotions' => [
'the promotion',
'another one',
],
'blackFridayBlockEditorUrl' => '',

];

Expand Down Expand Up @@ -186,12 +186,7 @@ public function test_site_information() {
'dismissedAlerts' => [
'the alert',
],
'currentPromotions' => [
'the promotion',
'another one',
],
'webinarIntroBlockEditorUrl' => 'https://expl.c',
'blackFridayBlockEditorUrl' => '',
'search_url' => 'https://example.org',
'post_edit_url' => 'https://example.org',
'base_url' => 'https://example.org',
Expand All @@ -215,6 +210,11 @@ public function test_site_information() {
],
'sitewideSocialImage' => null,
'isPrivateBlog' => false,
'currentPromotions' => [
'the promotion',
'another one',
],
'blackFridayBlockEditorUrl' => '',
];

Monkey\Functions\expect( 'admin_url' )->andReturn( 'https://example.org' );
Expand Down
Loading

0 comments on commit d421ba2

Please sign in to comment.