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

Yoast / wordpress-seo / 2e6135b3e2fceb79e8def6eba98cdd15ebb7ca68

31 Jul 2026 12:56PM UTC coverage: 54.947% (-0.5%) from 55.405%
2e6135b3e2fceb79e8def6eba98cdd15ebb7ca68

Pull #23510

github

web-flow
Merge ffee2ccb5 into 9d8c9bf96
Pull Request #23510: Serve the aggregated schema map at /schemamap.xml

9582 of 17324 branches covered (55.31%)

Branch coverage included in aggregate %.

39 of 44 new or added lines in 3 files covered. (88.64%)

419 existing lines in 8 files now uncovered.

38637 of 70432 relevant lines covered (54.86%)

42729.8 hits per line

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

96.39
/src/general/user-interface/general-page-integration.php
1
<?php
2

3
namespace Yoast\WP\SEO\General\User_Interface;
4

5
use WPSEO_Addon_Manager;
6
use WPSEO_Admin_Asset_Manager;
7
use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
8
use Yoast\WP\SEO\Conditionals\Admin\Non_Network_Admin_Conditional;
9
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
10
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
11
use Yoast\WP\SEO\Dashboard\Application\Configuration\Dashboard_Configuration;
12
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
13
use Yoast\WP\SEO\Helpers\Notification_Helper;
14
use Yoast\WP\SEO\Helpers\Options_Helper;
15
use Yoast\WP\SEO\Helpers\Product_Helper;
16
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
17
use Yoast\WP\SEO\Helpers\User_Helper;
18
use Yoast\WP\SEO\Integrations\Integration_Interface;
19
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
20
use Yoast\WP\SEO\Task_List\Application\Configuration\Task_List_Configuration;
21

22
/**
23
 * Class General_Page_Integration.
24
 */
25
class General_Page_Integration implements Integration_Interface {
26

27
        /**
28
         * The page name.
29
         */
30
        public const PAGE = 'wpseo_dashboard';
31

32
        /**
33
         * The notification helper.
34
         *
35
         * @var Notification_Helper
36
         */
37
        protected $notification_helper;
38

39
        /**
40
         * The dashboard configuration.
41
         *
42
         * @var Dashboard_Configuration
43
         */
44
        private $dashboard_configuration;
45

46
        /**
47
         * The task list configuration.
48
         *
49
         * @var Task_List_Configuration
50
         */
51
        private $task_list_configuration;
52

53
        /**
54
         * Holds the WPSEO_Admin_Asset_Manager.
55
         *
56
         * @var WPSEO_Admin_Asset_Manager
57
         */
58
        private $asset_manager;
59

60
        /**
61
         * Holds the Current_Page_Helper.
62
         *
63
         * @var Current_Page_Helper
64
         */
65
        private $current_page_helper;
66

67
        /**
68
         * Holds the Product_Helper.
69
         *
70
         * @var Product_Helper
71
         */
72
        private $product_helper;
73

74
        /**
75
         * Holds the Short_Link_Helper.
76
         *
77
         * @var Short_Link_Helper
78
         */
79
        private $shortlink_helper;
80

81
        /**
82
         * The promotion manager.
83
         *
84
         * @var Promotion_Manager
85
         */
86
        private $promotion_manager;
87

88
        /**
89
         * The alert dismissal action.
90
         *
91
         * @var Alert_Dismissal_Action
92
         */
93
        private $alert_dismissal_action;
94

95
        /**
96
         * Holds the options helper.
97
         *
98
         * @var Options_Helper
99
         */
100
        private $options_helper;
101

102
        /**
103
         * Holds the user helper.
104
         *
105
         * @var User_Helper
106
         */
107
        private $user_helper;
108

109
        /**
110
         * Holds the WooCommerce conditional.
111
         *
112
         * @var WooCommerce_Conditional
113
         */
114
        private $woocommerce_conditional;
115

116
        /**
117
         * Holds the WPSEO_Addon_Manager.
118
         *
119
         * @var WPSEO_Addon_Manager
120
         */
121
        private $addon_manager;
122

123
        /**
124
         * Constructs Academy_Integration.
125
         *
126
         * @param WPSEO_Admin_Asset_Manager $asset_manager           The WPSEO_Admin_Asset_Manager.
127
         * @param Current_Page_Helper       $current_page_helper     The Current_Page_Helper.
128
         * @param Product_Helper            $product_helper          The Product_Helper.
129
         * @param Short_Link_Helper         $shortlink_helper        The Short_Link_Helper.
130
         * @param Notification_Helper       $notification_helper     The Notification_Helper.
131
         * @param Alert_Dismissal_Action    $alert_dismissal_action  The alert dismissal action.
132
         * @param Promotion_Manager         $promotion_manager       The promotion manager.
133
         * @param Dashboard_Configuration   $dashboard_configuration The dashboard configuration.
134
         * @param Options_Helper            $options_helper          The options helper.
135
         * @param User_Helper               $user_helper             The user helper.
136
         * @param WooCommerce_Conditional   $woocommerce_conditional The WooCommerce conditional.
137
         * @param WPSEO_Addon_Manager       $addon_manager           The WPSEO_Addon_Manager.
138
         * @param Task_List_Configuration   $task_list_configuration The task list configuration.
139
         */
140
        public function __construct(
2✔
141
                WPSEO_Admin_Asset_Manager $asset_manager,
142
                Current_Page_Helper $current_page_helper,
143
                Product_Helper $product_helper,
144
                Short_Link_Helper $shortlink_helper,
145
                Notification_Helper $notification_helper,
146
                Alert_Dismissal_Action $alert_dismissal_action,
147
                Promotion_Manager $promotion_manager,
148
                Dashboard_Configuration $dashboard_configuration,
149
                Options_Helper $options_helper,
150
                User_Helper $user_helper,
151
                WooCommerce_Conditional $woocommerce_conditional,
152
                WPSEO_Addon_Manager $addon_manager,
153
                Task_List_Configuration $task_list_configuration
154
        ) {
155
                $this->asset_manager           = $asset_manager;
2✔
156
                $this->current_page_helper     = $current_page_helper;
2✔
157
                $this->product_helper          = $product_helper;
2✔
158
                $this->shortlink_helper        = $shortlink_helper;
2✔
159
                $this->notification_helper     = $notification_helper;
2✔
160
                $this->alert_dismissal_action  = $alert_dismissal_action;
2✔
161
                $this->promotion_manager       = $promotion_manager;
2✔
162
                $this->dashboard_configuration = $dashboard_configuration;
2✔
163
                $this->options_helper          = $options_helper;
2✔
164
                $this->user_helper             = $user_helper;
2✔
165
                $this->woocommerce_conditional = $woocommerce_conditional;
2✔
166
                $this->addon_manager           = $addon_manager;
2✔
167
                $this->task_list_configuration = $task_list_configuration;
2✔
168
        }
169

170
        /**
171
         * Returns the conditionals based on which this loadable should be active.
172
         *
173
         * @return array<string>
174
         */
175
        public static function get_conditionals() {
2✔
176
                return [ Admin_Conditional::class, Non_Network_Admin_Conditional::class ];
2✔
177
        }
178

179
        /**
180
         * Initializes the integration.
181
         *
182
         * This is the place to register hooks and filters.
183
         *
184
         * @return void
185
         */
186
        public function register_hooks() {
4✔
187

188
                // Add page.
189
                \add_filter( 'wpseo_submenu_pages', [ $this, 'add_page' ] );
4✔
190

191
                // Are we on the dashboard page?
192
                if ( $this->current_page_helper->get_current_yoast_seo_page() === self::PAGE ) {
4✔
193
                        \add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
2✔
194
                }
195
        }
196

197
        /**
198
         * Adds the page.
199
         *
200
         * @param array<string, array<string>> $pages The pages.
201
         *
202
         * @return array<string, array<string>> The pages.
203
         */
204
        public function add_page( $pages ) {
2✔
205
                \array_splice(
2✔
206
                        $pages,
2✔
207
                        0,
2✔
208
                        0,
2✔
209
                        [
2✔
210
                                [
2✔
211
                                        self::PAGE,
2✔
212
                                        '',
2✔
213
                                        \__( 'General', 'wordpress-seo' ),
2✔
214
                                        'wpseo_manage_options',
2✔
215
                                        self::PAGE,
2✔
216
                                        [ $this, 'display_page' ],
2✔
217
                                ],
2✔
218
                        ],
2✔
219
                );
2✔
220

221
                return $pages;
2✔
222
        }
223

224
        /**
225
         * Displays the page.
226
         *
227
         * @return void
228
         */
229
        public function display_page() {
2✔
230
                echo '<div id="yoast-seo-general"></div>';
2✔
231
        }
232

233
        /**
234
         * Enqueues the assets.
235
         *
236
         * @return void
237
         */
238
        public function enqueue_assets() {
2✔
239
                // Remove the emoji script as it is incompatible with both React and any contenteditable fields.
240
                \remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
2✔
241
                \wp_enqueue_media();
2✔
242
                $this->asset_manager->enqueue_script( 'general-page' );
2✔
243
                $this->asset_manager->enqueue_style( 'general-page' );
2✔
244
                if ( $this->promotion_manager->is( 'black-friday-promotion' ) ) {
2✔
245
                        $this->asset_manager->enqueue_style( 'black-friday-banner' );
2✔
246
                }
247
                $this->asset_manager->localize_script( 'general-page', 'wpseoScriptData', $this->get_script_data() );
2✔
248
        }
249

250
        /**
251
         * Creates the script data.
252
         *
253
         * @return array<string, string|array<string, string|bool|array<string, string|bool>>> The script data.
254
         */
255
        private function get_script_data() {
2✔
256
                return [
2✔
257
                        'preferences'           => [
2✔
258
                                'isPremium'              => $this->product_helper->is_premium(),
2✔
259
                                'isRtl'                  => \is_rtl(),
2✔
260
                                'userLocale'             => \get_user_locale(),
2✔
261
                                'pluginUrl'              => \plugins_url( '', \WPSEO_FILE ),
2✔
262
                                'upsellSettings'         => [
2✔
263
                                        'actionId'     => 'load-nfd-ctb',
2✔
264
                                        'premiumCtbId' => 'f6a84663-465f-4cb5-8ba5-f7a6d72224b2',
2✔
265
                                ],
2✔
266
                                'llmTxtEnabled'          => $this->options_helper->get( 'enable_llms_txt', true ),
2✔
267
                                'isWooCommerceActive'    => $this->woocommerce_conditional->is_met(),
2✔
268
                                'addonsStatus'           => [
2✔
269
                                        'isWooSeoActive'         => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ) ),
2✔
270
                                        'isLocalSEOActive'       => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::LOCAL_SLUG ) ),
2✔
271
                                        'isNewsSEOActive'        => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::NEWS_SLUG ) ),
2✔
272
                                        'isVideoSEOActive'       => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::VIDEO_SLUG ) ),
2✔
273
                                        'isDuplicatePostActive'  => \defined( 'DUPLICATE_POST_FILE' ),
2✔
274
                                ],
2✔
275
                        ],
2✔
276
                        'adminUrl'              => \admin_url( 'admin.php' ),
2✔
277
                        'linkParams'            => $this->shortlink_helper->get_query_params(),
2✔
278
                        'userEditUrl'           => \add_query_arg( 'user_id', '{user_id}', \admin_url( 'user-edit.php' ) ),
2✔
279
                        'alerts'                => $this->notification_helper->get_alerts(),
2✔
280
                        'currentPromotions'     => $this->promotion_manager->get_current_promotions(),
2✔
281
                        'dismissedAlerts'       => $this->alert_dismissal_action->all_dismissed(),
2✔
282
                        'dashboard'             => $this->dashboard_configuration->get_configuration(),
2✔
283
                        'taskListConfiguration' => $this->task_list_configuration->get_configuration(),
2✔
284
                        'optInNotificationSeen' => [
2✔
285
                                'bulk_editor_tour' => $this->is_bulk_editor_tour_seen(),
2✔
286
                        ],
2✔
287
                ];
2✔
288
        }
289

290
        /**
291
         * Gets whether the bulk editor guided tour has been seen by the current user.
292
         *
293
         * @return bool True when the tour has been seen, false otherwise.
294
         */
UNCOV
295
        private function is_bulk_editor_tour_seen(): bool {
×
UNCOV
296
                $current_user_id = $this->user_helper->get_current_user_id();
×
297

UNCOV
298
                return (bool) $this->user_helper->get_meta( $current_user_id, '_yoast_wpseo_bulk_editor_tour_opt_in_notification_seen', true );
×
299
        }
300
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc