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

Yoast / wordpress-seo / d5c0395617268a4e44627c6847bf3faa0a6cc695

15 Apr 2025 07:12AM UTC coverage: 52.454% (-2.1%) from 54.595%
d5c0395617268a4e44627c6847bf3faa0a6cc695

push

github

web-flow
Merge pull request #22077 from Yoast/feature/drop-php-7.2-7.3

Drop compatibility with PHP 7.2 and 7.3

7826 of 13877 branches covered (56.4%)

Branch coverage included in aggregate %.

29028 of 56382 relevant lines covered (51.48%)

42273.52 hits per line

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

0.0
/admin/views/tabs/network/features.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Views
6
 *
7
 * @uses Yoast_Form $yform Form object.
8
 */
9

10
use Yoast\WP\SEO\Presenters\Admin\Beta_Badge_Presenter;
11
use Yoast\WP\SEO\Presenters\Admin\Premium_Badge_Presenter;
12

13
if ( ! defined( 'WPSEO_VERSION' ) ) {
×
14
        header( 'Status: 403 Forbidden' );
×
15
        header( 'HTTP/1.1 403 Forbidden' );
×
16
        exit();
×
17
}
18

19
$feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
×
20

21
?>
22
<h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2>
×
23
<div class="yoast-measure">
24
        <?php
25
        printf(
×
26
                /* translators: %s expands to Yoast SEO */
27
                esc_html__( 'This tab allows you to selectively disable %s features for all sites in the network. By default all features are enabled, which allows site admins to choose for themselves if they want to toggle a feature on or off for their site. When you disable a feature here, site admins will not be able to use that feature at all.', 'wordpress-seo' ),
×
28
                'Yoast SEO'
×
29
        );
×
30

31
        foreach ( $feature_toggles as $feature ) {
×
32
                $is_premium      = YoastSEO()->helpers->product->is_premium();
×
33
                $premium_version = YoastSEO()->helpers->product->get_premium_version();
×
34

35
                if ( $feature->premium && $feature->premium_version ) {
×
36
                        $not_supported_in_current_premium_version = $is_premium && version_compare( $premium_version, $feature->premium_version, '<' );
×
37

38
                        if ( $not_supported_in_current_premium_version ) {
×
39
                                continue;
×
40
                        }
41
                }
42

43
                $help_text = esc_html( $feature->label );
×
44
                if ( ! empty( $feature->extra ) ) {
×
45
                        $help_text .= ' ' . $feature->extra;
×
46
                }
47
                if ( ! empty( $feature->read_more_label ) ) {
×
48
                        $url = $feature->read_more_url;
×
49
                        if ( ! empty( $feature->premium ) && $feature->premium === true ) {
×
50
                                $url = $feature->premium_url;
×
51
                        }
52
                        $help_text .= sprintf(
×
53
                                '<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
×
54
                                esc_url( WPSEO_Shortlinker::get( $url ) ),
×
55
                                esc_html( $feature->read_more_label )
×
56
                        );
×
57
                }
58

59
                $feature_help = new WPSEO_Admin_Help_Panel(
×
60
                        WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
×
61
                        /* translators: Hidden accessibility text; %s expands to a feature's name. */
62
                        sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
×
63
                        $help_text
×
64
                );
×
65

66
                $name = $feature->name;
×
67
                if ( ! empty( $feature->premium ) && $feature->premium === true ) {
×
68
                        $name .= ' ' . new Premium_Badge_Presenter( $feature->name );
×
69
                }
70

71
                if ( ! empty( $feature->in_beta ) && $feature->in_beta === true ) {
×
72
                        $name .= ' ' . new Beta_Badge_Presenter( $feature->name );
×
73
                }
74

75
                $disabled            = false;
×
76
                $show_premium_upsell = false;
×
77
                $premium_upsell_url  = '';
×
78
                $note_when_disabled  = '';
×
79

80
                if ( $feature->premium === true && YoastSEO()->helpers->product->is_premium() === false ) {
×
81
                        $disabled            = true;
×
82
                        $show_premium_upsell = true;
×
83
                        $premium_upsell_url  = WPSEO_Shortlinker::get( $feature->premium_upsell_url );
×
84
                }
85

86
                $preserve_disabled_value = false;
×
87
                if ( $disabled ) {
×
88
                        $preserve_disabled_value = true;
×
89
                }
90

91
                $yform->toggle_switch(
×
92
                        WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
×
93
                        [
×
94
                                'on'  => __( 'Allow Control', 'wordpress-seo' ),
×
95
                                'off' => __( 'Disable', 'wordpress-seo' ),
×
96
                        ],
×
97
                        $name,
×
98
                        $feature_help->get_button_html() . $feature_help->get_panel_html(),
×
99
                        [
×
100
                                'disabled'                => $disabled,
×
101
                                'preserve_disabled_value' => $preserve_disabled_value,
×
102
                                'show_premium_upsell'     => $show_premium_upsell,
×
103
                                'premium_upsell_url'      => $premium_upsell_url,
×
104
                                'note_when_disabled'      => $note_when_disabled,
×
105
                        ]
×
106
                );
×
107
        }
108
        ?>
109
</div>
×
110
<?php
×
111
/*
112
 * Required to prevent our settings framework from saving the default because the field
113
 * isn't explicitly set when saving the Dashboard page.
114
 */
115
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );
×
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