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

Yoast / wordpress-seo / e2f53222cf97fe912f41d61152981b5b595f5500

01 Jul 2025 09:02AM UTC coverage: 53.694% (+0.9%) from 52.787%
e2f53222cf97fe912f41d61152981b5b595f5500

push

github

YoastBot
Bump version to 25.4 on free

8218 of 14291 branches covered (57.5%)

Branch coverage included in aggregate %.

30333 of 57507 relevant lines covered (52.75%)

41519.48 hits per line

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

0.0
/admin/views/licenses.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 * @since   5.1
7
 */
8

9
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
10

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

17
do_action( 'wpseo_install_and_activate_addons' );
×
18

19
$premium_extension = [
×
20
        'buyUrl'   => WPSEO_Shortlinker::get( 'https://yoa.st/zz' ),
×
21
        'infoUrl'  => WPSEO_Shortlinker::get( 'https://yoa.st/zy' ),
×
22
        'title'    => 'Yoast SEO Premium',
×
23
        /* translators: %1$s expands to Yoast SEO */
24
        'desc'     => sprintf( __( 'The premium version of %1$s with more features & support.', 'wordpress-seo' ), 'Yoast SEO' ),
×
25
        'image'    => plugin_dir_url( WPSEO_FILE ) . 'packages/js/images/Yoast_SEO_Icon.svg',
×
26
        'benefits' => [],
×
27
];
×
28

29
$extensions = [];
×
30

31
// Add Yoast WooCommerce SEO when WooCommerce is active.
32
if ( YoastSEO()->helpers->woocommerce->is_active() ) {
×
33
        $extensions[ WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ] = [
×
34
                'buyUrl'        => WPSEO_Shortlinker::get( 'https://yoa.st/zr' ),
×
35
                'infoUrl'       => WPSEO_Shortlinker::get( 'https://yoa.st/zq' ),
×
36
                'title'         => 'Yoast WooCommerce SEO',
×
37
                'display_title' => __( 'Drive more traffic to your online store', 'wordpress-seo' ),
×
38
                /* translators: %1$s expands to Yoast SEO */
39
                'desc'          => sprintf( __( 'Seamlessly integrate WooCommerce with %1$s and get extra features!', 'wordpress-seo' ), 'Yoast SEO' ),
×
40
                'image'         => plugins_url( 'images/woo_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ),
×
41
                'benefits'      => [
×
42
                        __( 'Write product pages that rank using the SEO analysis', 'wordpress-seo' ),
×
43
                        __( 'Increase Google clicks with rich results', 'wordpress-seo' ),
×
44
                        __( 'Add global identifiers for variable products', 'wordpress-seo' ),
×
45
                        /* translators: %1$s expands to Yoast SEO, %2$s expands to WooCommerce */
46
                        sprintf( __( 'Seamless integration between %1$s and %2$s', 'wordpress-seo' ), 'Yoast SEO', 'WooCommerce' ),
×
47
                        __( 'Turn more visitors into customers!', 'wordpress-seo' ),
×
48
                ],
×
49
                'buy_button'    => 'WooCommerce SEO',
×
50
        ];
×
51
}
52

53
// The total number of plugins to consider is the length of the array + 1 for Premium.
54
// @phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
55
$number_plugins_total = count( $extensions );
×
56
// @phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
57
$number_plugins_active          = 0;
×
58
$addon_manager                  = new WPSEO_Addon_Manager();
×
59
$has_valid_premium_subscription = YoastSEO()->helpers->product->is_premium() && $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG );
×
60

61
/* translators: %1$s expands to Yoast SEO. */
62
$wpseo_extensions_header = sprintf( __( '%1$s Extensions', 'wordpress-seo' ), 'Yoast SEO' );
×
63
$new_tab_message         = sprintf(
×
64
        '<span class="screen-reader-text">%1$s</span>',
×
65
        /* translators: Hidden accessibility text. */
66
        esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
×
67
);
×
68

69
$sale_badge         = '';
×
70
$premium_sale_badge = '';
×
71

72
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2024-promotion' ) ) {
×
73
        /* translators: %1$s expands to opening span, %2$s expands to closing span */
74
        $sale_badge_span = sprintf( esc_html__( '%1$s30%% OFF%2$s', 'wordpress-seo' ), '<span>', '</span>' );
×
75

76
        $sale_badge = '<div class="yoast-seo-premium-extension-sale-badge">' . $sale_badge_span . '</div>';
×
77

78
        $premium_sale_badge = ( $has_valid_premium_subscription ) ? '' : $sale_badge;
×
79
}
80

81
?>
82

83
<div class="wrap yoast wpseo_table_page">
×
84

85
        <h1 id="wpseo-title" class="yoast-h1"><?php echo esc_html( $wpseo_extensions_header ); ?></h1>
×
86

87
        <div id="extensions">
88
                <section class="yoast-seo-premium-extension">
89
                        <?php echo $premium_sale_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: Output is already escaped ?>
×
90
                        <h2>
×
91
                                <?php esc_html_e( 'Rank higher in search results', 'wordpress-seo' ); ?>
×
92
                                <img alt="" width="100" height="100" src="<?php echo esc_url( $premium_extension['image'] ); ?>"/>
×
93
                        </h2>
94
                        <?php
95
                        if ( ! $has_valid_premium_subscription ) :
×
96
                                ?>
97
                                <ul class="yoast-seo-premium-benefits yoast-list--usp">
×
98
                                        <li class="yoast-seo-premium-benefits__item">
×
99
                                                <?php
×
100
                                                printf(
×
101
                                                        /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
102
                                                        esc_html__( '%1$sAI%2$s: Better SEO titles and meta descriptions, faster.', 'wordpress-seo' ),
×
103
                                                        '<strong>',
×
104
                                                        '</strong>'
×
105
                                                );
×
106
                                                ?>
107
                                        </li>
×
108
                                        <li class="yoast-seo-premium-benefits__item">
×
109
                                                <?php
×
110
                                                printf(
×
111
                                                        /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
112
                                                        esc_html__( '%1$sMultiple keywords%2$s: Rank higher for more searches.', 'wordpress-seo' ),
×
113
                                                        '<strong>',
×
114
                                                        '</strong>'
×
115
                                                );
×
116
                                                ?>
117
                                        </li>
×
118
                                        <li class="yoast-seo-premium-benefits__item">
×
119
                                                <?php
×
120
                                                printf(
×
121
                                                        /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
122
                                                        esc_html__( '%1$sSuper fast%2$s internal linking suggestions.', 'wordpress-seo' ),
×
123
                                                        '<strong>',
×
124
                                                        '</strong>'
×
125
                                                );
×
126
                                                ?>
127
                                        </li>
×
128
                                        <li class="yoast-seo-premium-benefits__item">
×
129
                                                <?php
×
130
                                                printf(
×
131
                                                        /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
132
                                                        esc_html__( '%1$sNo more broken links%2$s: Automatic redirect manager.', 'wordpress-seo' ),
×
133
                                                        '<strong>',
×
134
                                                        '</strong>'
×
135
                                                );
×
136
                                                ?>
137
                                        </li>
×
138
                                        <li class="yoast-seo-premium-benefits__item">
×
139
                                                <?php
×
140
                                                printf(
×
141
                                                        /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
142
                                                        esc_html__( '%1$sAppealing social previews%2$s people actually want to click on.', 'wordpress-seo' ),
×
143
                                                        '<strong>',
×
144
                                                        '</strong>'
×
145
                                                );
×
146
                                                ?>
147
                                        </li>
×
148
                                        <li class="yoast-seo-premium-benefits__item">
×
149
                                                <?php
×
150
                                                printf(
×
151
                                                        /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
152
                                                        esc_html__( '%1$s24/7 support%2$s: Also on evenings and weekends.', 'wordpress-seo' ),
×
153
                                                        '<strong>',
×
154
                                                        '</strong>'
×
155
                                                );
×
156
                                                ?>
157
                                        </li>
×
158
                                </ul>
×
159
                        <?php endif; ?>
×
160
                        <?php if ( $addon_manager->is_installed( WPSEO_Addon_Manager::PREMIUM_SLUG ) ) : ?>
×
161
                                <div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div>
×
162

163
                                <?php
164
                                if ( $has_valid_premium_subscription ) :
×
165
                                        ++$number_plugins_active;
×
166
                                        ?>
167
                                        <div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
×
168
                                        <a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" class="yoast-link--license">
×
169
                                                <?php
170
                                                printf(
×
171
                                                        /* translators: %s expands to the extension title */
172
                                                        esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ),
×
173
                                                        esc_html( $premium_extension['title'] )
×
174
                                                );
×
175
                                                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
176
                                                echo $new_tab_message;
×
177
                                                ?>
178
                                        </a>
×
179
                                <?php else : ?>
×
180
                                        <div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div>
×
181
                                        <a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>" class="yoast-link--license">
×
182
                                                <?php
183
                                                printf(
×
184
                                                        /* translators: %s expands to the extension title */
185
                                                        esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ),
×
186
                                                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
187
                                                        esc_html( $premium_extension['title'] )
×
188
                                                );
×
189
                                                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
190
                                                echo $new_tab_message;
×
191
                                                ?>
192
                                        </a>
×
193
                                <?php endif; ?>
×
194

195
                        <?php else : ?>
×
196

197
                                <a target="_blank" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo esc_url( $premium_extension['buyUrl'] ); ?>" class="yoast-button-upsell">
×
198
                                        <?php
199
                                        printf(
×
200
                                                /* translators: $s expands to Yoast SEO Premium */
201
                                                esc_html__( 'Buy %s', 'wordpress-seo' ),
×
202
                                                esc_html( $premium_extension['title'] )
×
203
                                        );
×
204
                                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
205
                                        echo $new_tab_message;
×
206
                                        echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
×
207
                                        ?>
208
                                </a>
×
209

210
                                <a target="_blank"  href="<?php echo esc_url( $premium_extension['infoUrl'] ); ?>" class="yoast-link--more-info">
×
211
                                        <?php
212
                                        esc_html_e( 'Explore now', 'wordpress-seo' );
×
213
                                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
214
                                        echo $new_tab_message;
×
215
                                        ?>
216
                                </a>
×
217
                        <?php endif; ?>
×
218
                        <?php if ( ! $has_valid_premium_subscription ) { ?>
×
219
                                <p>
×
220
                                        <small class="yoast-money-back-guarantee"><?php esc_html_e( 'With a 30-day money-back guarantee. No questions asked.', 'wordpress-seo' ); ?></small>
×
221
                                </p>
222
                        <?php } ?>
223
                </section>
×
224

225
                <hr class="yoast-hr" aria-hidden="true"/>
×
226

227
                <section class="yoast-promo-extensions">
×
228
                        <?php if ( count( $extensions ) >= 1 ) : ?>
×
229
                        <h2>
×
230
                                <?php
×
231
                                printf(
×
232
                                        /* translators: %1$s expands to a span opening tag, %2$s expands to a span closing tag, %3$s expands to Yoast SEO */
233
                                        esc_html__( '%1$sOutrank your competitors even further%2$s with these %3$s plugins', 'wordpress-seo' ),
×
234
                                        '<span class="yoast-heading-highlight">',
×
235
                                        '</span>',
×
236
                                        'Yoast SEO'
×
237
                                );
×
238
                                ?>
239
                        </h2>
×
240
                        <?php endif; ?>
×
241
                        <?php
×
242
                        foreach ( $extensions as $slug => $extension ) :
×
243

244
                                // Skip the "All the plugins" card if the user has already all the plugins active.
245
                                if ( $slug === 'yoast-seo-plugin-subscription' && $number_plugins_active === $number_plugins_total ) {
×
246
                                        continue;
×
247
                                }
248
                                ?>
249
                                <section class="yoast-promoblock secondary yoast-promo-extension">
×
250
                                        <?php if ( ! $addon_manager->has_valid_subscription( $slug ) || ! $addon_manager->is_installed( $slug ) ) : ?>
×
251
                                                <?php echo $sale_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: Output already escaped ?>
×
252
                                        <?php endif; ?>
×
253
                                        <h3>
×
254
                                                <img alt="" width="100" height="100" src="<?php echo esc_url( $extension['image'] ); ?>"/>
×
255
                                                <?php echo esc_html( $extension['display_title'] ); ?>
×
256
                                        </h3>
×
257
                                        <ul class="yoast-list--usp">
×
258
                                                <?php foreach ( $extension['benefits'] as $benefit ) : ?>
×
259
                                                        <li><?php echo esc_html( $benefit ); ?></li>
×
260
                                                <?php endforeach; ?>
261
                                        </ul>
×
262

263
                                        <div class="yoast-button-container">
×
264
                                                <?php if ( $addon_manager->is_installed( $slug ) ) : ?>
×
265
                                                        <div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div>
×
266

267
                                                        <?php
268
                                                        if ( $addon_manager->has_valid_subscription( $slug ) ) :
×
269
                                                                ++$number_plugins_active;
×
270
                                                                ?>
271
                                                                <div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
×
272
                                                                <a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" class="yoast-link--license">
×
273
                                                                        <?php
274
                                                                        printf(
×
275
                                                                                /* translators: %s expands to the extension title */
276
                                                                                esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ),
×
277
                                                                                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
278
                                                                                $extension['title']
×
279
                                                                        );
×
280
                                                                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
281
                                                                        echo $new_tab_message;
×
282
                                                                        ?>
283
                                                                </a>
×
284
                                                        <?php else : ?>
×
285
                                                                <div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div>
×
286
                                                                <a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>" class="yoast-link--license">
×
287
                                                                        <?php
288
                                                                        printf(
×
289
                                                                                /* translators: %s expands to the extension title */
290
                                                                                esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ),
×
291
                                                                                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
292
                                                                                $extension['title']
×
293
                                                                        );
×
294
                                                                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
295
                                                                        echo $new_tab_message;
×
296
                                                                        ?>
297
                                                                </a>
×
298
                                                        <?php endif; ?>
×
299
                                                <?php else : ?>
×
300
                                                        <a target="_blank" class="yoast-button-upsell" href="<?php echo esc_url( $extension['buyUrl'] ); ?>">
×
301
                                                                <?php
302
                                                                printf(
×
303
                                                                        /* translators: %s expands to the product name, e.g. "News SEO" or "all the Yoast Plugins" */
304
                                                                        esc_html__( 'Buy %s', 'wordpress-seo' ),
×
305
                                                                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The possible `get_buy_button` values are hardcoded (buy_button or title); only passed through the WPSEO_Extensions class.
306
                                                                        ( isset( $extension['buy_button'] ) ) ? $extension['buy_button'] : $extension['title']
×
307
                                                                );
×
308
                                                                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
309
                                                                echo $new_tab_message;
×
310
                                                                echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
×
311
                                                                ?>
312
                                                        </a>
×
313
                                                        <?php if ( $slug === 'yoast-seo-plugin-subscription' ) : ?>
×
314
                                                                <p class="yoast-subscription-discount">
×
315
                                                                        <?php esc_html_e( 'Only $/€/£229 per year (ex VAT). Save over 40% with this subscription!', 'wordpress-seo' ); ?>
×
316
                                                                </p>
×
317
                                                        <?php endif; ?>
×
318
                                                        <a target="_blank" class="yoast-link--more-info" href="<?php echo esc_url( $extension['infoUrl'] ); ?>">
×
319
                                                                <?php
320
                                                                esc_html_e( 'Explore now', 'wordpress-seo' );
×
321
                                                                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
322
                                                                echo $new_tab_message;
×
323
                                                                ?>
324
                                                        </a>
×
325
                                                <?php endif; ?>
×
326
                                        </div>
×
327
                                </section>
×
328
                        <?php endforeach; ?>
×
329
                </section>
×
330
        </div>
×
331

332
</div>
×
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