• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 993f259bead15d3b90dcff95657b8a588f66ed76

21 Nov 2025 02:03PM UTC coverage: 52.891% (-0.5%) from 53.366%
993f259bead15d3b90dcff95657b8a588f66ed76

Pull #22743

github

web-flow
Merge 8ea181540 into 530e8fcfb
Pull Request #22743: Redesign ai brand insights button & change behavior of upgrade button

8318 of 15589 branches covered (53.36%)

Branch coverage included in aggregate %.

2 of 46 new or added lines in 4 files covered. (4.35%)

2 existing lines in 2 files now uncovered.

31815 of 60289 relevant lines covered (52.77%)

47826.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/integrations/admin/brand-insights-page.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations\Admin;
4

5
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
6
use Yoast\WP\SEO\Helpers\Product_Helper;
7
use Yoast\WP\SEO\Integrations\Integration_Interface;
8

9
/**
10
 * Brand_Insights_Page class
11
 */
12
class Brand_Insights_Page implements Integration_Interface {
13

14
        /**
15
         * The product helper.
16
         *
17
         * @var Product_Helper
18
         */
19
        private $product_helper;
20

21
        /**
22
         * External link icon SVG.
23
         *
24
         * @var string
25
         */
26
        private $external_link_icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="yst-inline" style="width: 16px; height: 16px;"><path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" /></svg>';
27

28
        /**
29
         * Constructor.
30
         *
31
         * @param Product_Helper $product_helper The product helper.
32
         */
33
        public function __construct(
×
34
                Product_Helper $product_helper
35
        ) {
36
                $this->product_helper = $product_helper;
×
37
        }
38

39
        /**
40
         * Returns the conditionals based in which this loadable should be active.
41
         *
42
         * @return array<string>
43
         */
44
        public static function get_conditionals() {
×
45
                return [
×
46
                        Admin_Conditional::class,
×
47
                ];
×
48
        }
49

50
        /**
51
         * Registers all hooks to WordPress.
52
         *
53
         * @return void
54
         */
55
        public function register_hooks() {
×
56
                // Add page with PHP_INT_MAX so it's always the last item. This is the AI Brand Insights button in the sidebar menu.
NEW
57
                \add_filter( 'wpseo_submenu_pages', [ $this, 'add_submenu_page' ], \PHP_INT_MAX );
×
58
        }
59

60
        /**
61
         * Adds the Brand Insights submenu page.
62
         *
63
         * @param string[] $submenu_pages The Yoast SEO submenu pages.
64
         *
65
         * @return string[] The filtered submenu pages.
66
         */
67
        public function add_submenu_page( $submenu_pages ) {
×
68
                $page = $this->product_helper->is_premium() ? 'wpseo_brand_insights_premium' : 'wpseo_brand_insights';
×
69

NEW
70
                $gradient_border_wrapper = '<span class="yoast-brand-insights-gradient-border">';
×
NEW
71
                $inner_content_wrapper   = '<span class="yoast-brand-insights-content">';
×
NEW
72
                $menu_title              = $gradient_border_wrapper . $inner_content_wrapper . 'AI Brand Insights ' . $this->external_link_icon . '</span></span>';
×
73

74
                $submenu_pages[] = [
×
75
                        'wpseo_dashboard',
×
76
                        '',
×
NEW
77
                        $menu_title,
×
78
                        'edit_others_posts',
×
79
                        $page,
×
80
                        [ $this, 'show_brand_insights_page' ],
×
81
                ];
×
82

83
                return $submenu_pages;
×
84
        }
85

86
        /**
87
         * The Brand Insights page render function, noop.
88
         *
89
         * @return void
90
         */
91
        public function show_brand_insights_page() {
×
92
                // Do nothing and let the redirect happen from the redirect integration.
93
        }
×
94
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc