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

Yoast / wordpress-seo / ff7fbe548e11c03015095d039b28d1168b751857

16 Feb 2026 01:09AM UTC coverage: 52.986%. Remained the same
ff7fbe548e11c03015095d039b28d1168b751857

push

github

web-flow
Merge pull request #22987 from Yoast/JRF/modernize-use-trailing-commas-in-function-calls

Modernize: use trailing comma in multi-line function call

8482 of 15955 branches covered (53.16%)

Branch coverage included in aggregate %.

396 of 875 new or added lines in 311 files covered. (45.26%)

21 existing lines in 12 files now uncovered.

32462 of 61318 relevant lines covered (52.94%)

48791.32 hits per line

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

0.0
/src/schema/application/configuration/schema-configuration.php
1
<?php
2

3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4
namespace Yoast\WP\SEO\Schema\Application\Configuration;
5

6
use Easy_Digital_Downloads;
7
use SeriouslySimplePodcasting\Integrations\Yoast\Schema\PodcastEpisode;
8
use TEC\Events\Integrations\Plugins\WordPress_SEO\Events_Schema;
9
use WP_Recipe_Maker;
10
use WPSEO_Addon_Manager;
11
use Yoast\WP\SEO\Helpers\Options_Helper;
12
use Yoast\WP\SEO\Helpers\Product_Helper;
13
use Yoast\WP\SEO\Helpers\Woocommerce_Helper;
14

15
/**
16
 * Responsible for the schema configuration.
17
 *
18
 * @makePublic
19
 */
20
class Schema_Configuration {
21

22
        /**
23
         * The WooCommerce helper.
24
         *
25
         * @var Woocommerce_Helper
26
         */
27
        private $woocommerce_helper;
28

29
        /**
30
         * The product helper.
31
         *
32
         * @var Product_Helper
33
         */
34
        private $product_helper;
35

36
        /**
37
         * The addon manager.
38
         *
39
         * @var WPSEO_Addon_Manager
40
         */
41
        private $addon_manager;
42

43
        /**
44
         * The options helper.
45
         *
46
         * @var Options_Helper
47
         */
48
        private $options_helper;
49

50
        /**
51
         * Schema_Configuration constructor.
52
         *
53
         * @param Woocommerce_Helper  $woocommerce_helper The WooCommerce helper.
54
         * @param Product_Helper      $product_helper     The product helper.
55
         * @param WPSEO_Addon_Manager $addon_manager      The addon manager.
56
         * @param Options_Helper      $options_helper     The options helper.
57
         */
58
        public function __construct(
×
59
                Woocommerce_Helper $woocommerce_helper,
60
                Product_Helper $product_helper,
61
                WPSEO_Addon_Manager $addon_manager,
62
                Options_Helper $options_helper
63
        ) {
64
                $this->woocommerce_helper = $woocommerce_helper;
×
65
                $this->product_helper     = $product_helper;
×
66
                $this->addon_manager      = $addon_manager;
×
67
                $this->options_helper     = $options_helper;
×
68
        }
69

70
        /**
71
         * Returns the schema configuration.
72
         *
73
         * @return array<string, bool|array<string, array<string, bool|string>>>
74
         */
75
        public function get_configuration(): array {
×
76
                return [
×
77
                        'isSchemaDisabledProgrammatically' => $this->is_schema_disabled_programmatically(),
×
78
                        'schemaApiIntegrations'            => $this->get_schema_api_integrations(),
×
79
                ];
×
80
        }
81

82
        /**
83
         * Gets the schema API integrations status.
84
         *
85
         * @return array<string, array<string, bool|string>> The schema API integrations status.
86
         */
87
        public function get_schema_api_integrations(): array {
×
88
                $woocommerce_seo_file      = 'wpseo-woocommerce/wpseo-woocommerce.php';
×
89
                $woocommerce_active        = $this->woocommerce_helper->is_active();
×
90
                $woocommerce_seo_active    = \is_plugin_active( $woocommerce_seo_file );
×
91
                $woocommerce_seo_installed = $this->addon_manager->is_installed( WPSEO_Addon_Manager::WOOCOMMERCE_SLUG );
×
92

93
                $woocommerce_seo_activate_url = \wp_nonce_url(
×
94
                        \self_admin_url( 'plugins.php?action=activate&plugin=' . $woocommerce_seo_file ),
×
NEW
95
                        'activate-plugin_' . $woocommerce_seo_file,
×
96
                );
×
97

98
                $is_premium = $this->product_helper->is_premium();
×
99

100
                return [
×
101
                        'tec'             => [
×
102
                                'isActive' => \class_exists( Events_Schema::class ),
×
103
                        ],
×
104
                        'ssp'             => [
×
105
                                'isActive' => \class_exists( PodcastEpisode::class ),
×
106
                        ],
×
107
                        'wp-recipe-maker' => [
×
108
                                'isActive' => \class_exists( WP_Recipe_Maker::class ),
×
109
                        ],
×
110
                        'woocommerce'     => [
×
111
                                'isPrerequisiteActive' => $woocommerce_active,
×
112
                                'isActive'             => $woocommerce_seo_active,
×
113
                                'isInstalled'          => $woocommerce_seo_installed,
×
114
                                'activationLink'       => $woocommerce_seo_activate_url,
×
115
                        ],
×
116
                        'edd'             => [
×
117
                                'isActive'  => \class_exists( Easy_Digital_Downloads::class ),
×
118
                                'isPremium' => $is_premium,
×
119
                        ],
×
120
                ];
×
121
        }
122

123
        /**
124
         * Checks if the schema is disabled programmatically via the wpseo_json_ld_output filter.
125
         *
126
         * Only returns true if schema is enabled via the option (toggle) but disabled by external code.
127
         *
128
         * @return bool Whether schema is disabled by external code.
129
         */
130
        public function is_schema_disabled_programmatically(): bool {
×
131
                $deprecated_data = [
×
132
                        '_deprecated' => 'Please use the "wpseo_schema_*" filters to extend the Yoast SEO schema data - see the WPSEO_Schema class.',
×
133
                ];
×
134

135
                /**
136
                 * Filter documented in Schema_Presenter::present().
137
                 */
138
                $filtered_schema = \apply_filters( 'wpseo_json_ld_output', $deprecated_data, '' );
×
139

140
                return ( $filtered_schema === [] || $filtered_schema === false );
×
141
        }
142
}
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

© 2026 Coveralls, Inc