| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSEO plugin file. |
| 4 |
* |
| 5 |
* @package WPSEO\Admin |
| 6 |
* @since 5.1 |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'WPSEO_VERSION' ) ) { |
| 10 |
header( 'Status: 403 Forbidden' ); |
| 11 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 12 |
exit(); |
| 13 |
} |
| 14 |
|
| 15 |
do_action( 'wpseo_install_and_activate_addons' ); |
| 16 |
|
| 17 |
$premium_extension = [ |
| 18 |
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zz' ), |
| 19 |
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zy' ), |
| 20 |
'title' => 'Yoast SEO Premium', |
| 21 |
/* translators: %1$s expands to Yoast SEO */ |
| 22 |
'desc' => sprintf( __( 'The premium version of %1$s with more features & support.', 'wordpress-seo' ), 'Yoast SEO' ), |
| 23 |
'benefits' => [], |
| 24 |
]; |
| 25 |
|
| 26 |
$extensions = [ |
| 27 |
WPSEO_Addon_Manager::LOCAL_SLUG => [ |
| 28 |
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zt' ), |
| 29 |
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zs' ), |
| 30 |
'title' => 'Local SEO', |
| 31 |
'display_title' => __( 'Stop losing customers to other local businesses', 'wordpress-seo' ), |
| 32 |
'desc' => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ), |
| 33 |
'image' => plugins_url( 'images/local_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ), |
| 34 |
'benefits' => [ |
| 35 |
__( 'Get better search results in local search', 'wordpress-seo' ), |
| 36 |
__( 'Easily insert Google Maps, a store locator, opening hours and more', 'wordpress-seo' ), |
| 37 |
/* translators: %1$s expands to WooCommerce */ |
| 38 |
sprintf( __( 'Allow customers to pick up their %s order locally', 'wordpress-seo' ), 'WooCommerce' ), |
| 39 |
], |
| 40 |
], |
| 41 |
WPSEO_Addon_Manager::VIDEO_SLUG => [ |
| 42 |
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zx/' ), |
| 43 |
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zw/' ), |
| 44 |
'title' => 'Video SEO', |
| 45 |
'display_title' => __( 'Start ranking better for your videos', 'wordpress-seo' ), |
| 46 |
'desc' => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ), |
| 47 |
'image' => plugins_url( 'images/video_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ), |
| 48 |
'benefits' => [ |
| 49 |
__( 'Show your videos in Google Videos', 'wordpress-seo' ), |
| 50 |
__( 'Enhance the experience of sharing posts with videos', 'wordpress-seo' ), |
| 51 |
__( 'Make videos responsive through enabling fitvids.js', 'wordpress-seo' ), |
| 52 |
], |
| 53 |
], |
| 54 |
WPSEO_Addon_Manager::NEWS_SLUG => [ |
| 55 |
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zv/' ), |
| 56 |
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zu/' ), |
| 57 |
'title' => 'News SEO', |
| 58 |
'display_title' => __( 'Everything you need for Google News', 'wordpress-seo' ), |
| 59 |
'desc' => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ), |
| 60 |
'image' => plugins_url( 'images/news_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ), |
| 61 |
'benefits' => [ |
| 62 |
__( 'Optimize your site for Google News', 'wordpress-seo' ), |
| 63 |
__( 'Immediately pings Google on the publication of a new post', 'wordpress-seo' ), |
| 64 |
__( 'Creates XML News Sitemaps', 'wordpress-seo' ), |
| 65 |
], |
| 66 |
], |
| 67 |
]; |
| 68 |
|
| 69 |
// Add Yoast WooCommerce SEO when WooCommerce is active. |
| 70 |
if ( YoastSEO()->helpers->woocommerce->is_active() ) { |
| 71 |
$extensions[ WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ] = [ |
| 72 |
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zr' ), |
| 73 |
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zq' ), |
| 74 |
'title' => 'Yoast WooCommerce SEO', |
| 75 |
'display_title' => __( 'Make your products stand out in Google', 'wordpress-seo' ), |
| 76 |
/* translators: %1$s expands to Yoast SEO */ |
| 77 |
'desc' => sprintf( __( 'Seamlessly integrate WooCommerce with %1$s and get extra features!', 'wordpress-seo' ), 'Yoast SEO' ), |
| 78 |
'image' => plugins_url( 'images/woo_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ), |
| 79 |
'benefits' => [ |
| 80 |
sprintf( __( 'Improve sharing on Facebook and Pinterest', 'wordpress-seo' ) ), |
| 81 |
/* translators: %1$s expands to Yoast, %2$s expands to WooCommerce */ |
| 82 |
sprintf( __( 'Use %1$s breadcrumbs instead of %2$s ones', 'wordpress-seo' ), 'Yoast', 'WooCommerce' ), |
| 83 |
/* translators: %1$s expands to Yoast SEO, %2$s expands to WooCommerce */ |
| 84 |
sprintf( __( 'A seamless integration between %1$s and %2$s', 'wordpress-seo' ), 'Yoast SEO', 'WooCommerce' ), |
| 85 |
], |
| 86 |
'buy_button' => 'WooCommerce SEO', |
| 87 |
]; |
| 88 |
} |
| 89 |
|
| 90 |
$addon_manager = new WPSEO_Addon_Manager(); |
| 91 |
$has_valid_premium_subscription = YoastSEO()->helpers->product->is_premium() && $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG ); |
| 92 |
|
| 93 |
/* translators: %1$s expands to Yoast SEO. */ |
| 94 |
$wpseo_extensions_header = sprintf( __( '%1$s Extensions', 'wordpress-seo' ), 'Yoast SEO' ); |
| 95 |
$new_tab_message = sprintf( |
| 96 |
'<span class="screen-reader-text">%1$s</span>', |
| 97 |
esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) |
| 98 |
); |
| 99 |
|
| 100 |
?> |
| 101 |
|
| 102 |
<div class="wrap yoast wpseo_table_page"> |
| 103 |
|
| 104 |
<h1 id="wpseo-title" class="yoast-h1"><?php echo esc_html( $wpseo_extensions_header ); ?></h1> |
| 105 |
|
| 106 |
<div id="extensions"> |
| 107 |
<section class="yoast-seo-premium-extension"> |
| 108 |
<h2> |
| 109 |
<?php |
| 110 |
printf( |
| 111 |
/* translators: 1: expands to Yoast SEO Premium */ |
| 112 |
esc_html__( '%1$s, take your optimization to the next level!', 'wordpress-seo' ), |
| 113 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class. |
| 114 |
'<span class="yoast-heading-highlight">' . $premium_extension['title'] . '</span>' |
| 115 |
); |
| 116 |
?> |
| 117 |
</h2> |
| 118 |
|
| 119 |
<?php |
| 120 |
if ( ! $has_valid_premium_subscription ) : |
| 121 |
?> |
| 122 |
<ul class="yoast-seo-premium-benefits yoast-list--usp"> |
| 123 |
<li class="yoast-seo-premium-benefits__item"> |
| 124 |
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Redirect manager', 'wordpress-seo' ); ?></span> |
| 125 |
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'create and manage redirects from within your WordPress install.', 'wordpress-seo' ); ?></span> |
| 126 |
</li> |
| 127 |
<li class="yoast-seo-premium-benefits__item"> |
| 128 |
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Synonyms & related keyphrases', 'wordpress-seo' ); ?></span> |
| 129 |
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'optimize a single post for synonyms and related keyphrases.', 'wordpress-seo' ); ?></span> |
| 130 |
</li> |
| 131 |
<li class="yoast-seo-premium-benefits__item"> |
| 132 |
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Social previews', 'wordpress-seo' ); ?></span> |
| 133 |
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'check what your Facebook or Twitter post will look like.', 'wordpress-seo' ); ?></span> |
| 134 |
</li> |
| 135 |
<li class="yoast-seo-premium-benefits__item"> |
| 136 |
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Premium support', 'wordpress-seo' ); ?></span> |
| 137 |
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'gain access to our 24/7 support team.', 'wordpress-seo' ); ?></span> |
| 138 |
</li> |
| 139 |
</ul> |
| 140 |
<?php endif; ?> |
| 141 |
<?php if ( $addon_manager->is_installed( WPSEO_Addon_Manager::PREMIUM_SLUG ) ) : ?> |
| 142 |
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div> |
| 143 |
|
| 144 |
<?php if ( $has_valid_premium_subscription ) : ?> |
| 145 |
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div> |
| 146 |
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" |
| 147 |
class="yoast-link--license"> |
| 148 |
<?php |
| 149 |
printf( |
| 150 |
/* translators: %s expands to the extension title */ |
| 151 |
esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), |
| 152 |
esc_html( $premium_extension['title'] ) |
| 153 |
); |
| 154 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 155 |
echo $new_tab_message; |
| 156 |
?> |
| 157 |
</a> |
| 158 |
<?php else : ?> |
| 159 |
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div> |
| 160 |
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>" |
| 161 |
class="yoast-link--license"> |
| 162 |
<?php |
| 163 |
printf( |
| 164 |
/* translators: %s expands to the extension title */ |
| 165 |
esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), |
| 166 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class. |
| 167 |
esc_html( $premium_extension['title'] ) |
| 168 |
); |
| 169 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 170 |
echo $new_tab_message; |
| 171 |
?> |
| 172 |
</a> |
| 173 |
<?php endif; ?> |
| 174 |
|
| 175 |
<?php else : ?> |
| 176 |
|
| 177 |
<a target="_blank" href="<?php echo esc_url( $premium_extension['buyUrl'] ); ?>" |
| 178 |
class="yoast-button-upsell"> |
| 179 |
<?php |
| 180 |
printf( |
| 181 |
/* translators: $s expands to Yoast SEO Premium */ |
| 182 |
esc_html__( 'Buy %s', 'wordpress-seo' ), |
| 183 |
esc_html( $premium_extension['title'] ) |
| 184 |
); |
| 185 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 186 |
echo $new_tab_message; |
| 187 |
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'; |
| 188 |
?> |
| 189 |
</a> |
| 190 |
|
| 191 |
<a target="_blank" href="<?php echo esc_url( $premium_extension['infoUrl'] ); ?>" |
| 192 |
class="yoast-link--more-info"> |
| 193 |
<?php |
| 194 |
printf( |
| 195 |
/* translators: Text between 1: and 2: will only be shown to screen readers. 3: expands to the product name. */ |
| 196 |
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ), |
| 197 |
'<span class="screen-reader-text">', |
| 198 |
'</span>', |
| 199 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class. |
| 200 |
$premium_extension['title'] |
| 201 |
); |
| 202 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 203 |
echo $new_tab_message; |
| 204 |
?> |
| 205 |
</a> |
| 206 |
<?php endif; ?> |
| 207 |
<?php if ( ! $has_valid_premium_subscription ) { ?> |
| 208 |
<p> |
| 209 |
<small class="yoast-money-back-guarantee"><?php esc_html_e( 'Comes with our 30-day no questions asked money back guarantee', 'wordpress-seo' ); ?></small> |
| 210 |
</p> |
| 211 |
<?php } ?> |
| 212 |
</section> |
| 213 |
|
| 214 |
<hr class="yoast-hr" aria-hidden="true"/> |
| 215 |
|
| 216 |
<section class="yoast-promo-extensions"> |
| 217 |
<h2> |
| 218 |
<?php |
| 219 |
/* translators: 1: expands to Yoast SEO */ |
| 220 |
$yoast_seo_extensions = sprintf( esc_html__( '%1$s extensions', 'wordpress-seo' ), 'Yoast SEO' ); |
| 221 |
$yoast_seo_extensions = '<span class="yoast-heading-highlight">' . $yoast_seo_extensions . '</span>'; |
| 222 |
|
| 223 |
printf( |
| 224 |
/* translators: 1: expands to Yoast SEO extensions */ |
| 225 |
esc_html__( '%1$s to optimize your site even further', 'wordpress-seo' ), |
| 226 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $yoast_seo_extensions is properly escaped. |
| 227 |
$yoast_seo_extensions |
| 228 |
); |
| 229 |
?> |
| 230 |
</h2> |
| 231 |
|
| 232 |
<?php foreach ( $extensions as $slug => $extension ) : ?> |
| 233 |
<section class="yoast-promoblock secondary yoast-promo-extension"> |
| 234 |
<h3> |
| 235 |
<img alt="" width="100" height="100" src="<?php echo esc_url( $extension['image'] ); ?>"/> |
| 236 |
<?php echo esc_html( $extension['display_title'] ); ?> |
| 237 |
</h3> |
| 238 |
<ul class="yoast-list--usp"> |
| 239 |
<?php foreach ( $extension['benefits'] as $benefit ) : ?> |
| 240 |
<li><?php echo esc_html( $benefit ); ?></li> |
| 241 |
<?php endforeach; ?> |
| 242 |
</ul> |
| 243 |
|
| 244 |
<div class="yoast-button-container"> |
| 245 |
<?php if ( $addon_manager->is_installed( $slug ) ) : ?> |
| 246 |
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div> |
| 247 |
|
| 248 |
<?php if ( $addon_manager->has_valid_subscription( $slug ) ) : ?> |
| 249 |
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div> |
| 250 |
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" |
| 251 |
class="yoast-link--license"> |
| 252 |
<?php |
| 253 |
printf( |
| 254 |
/* translators: %s expands to the extension title */ |
| 255 |
esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), |
| 256 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class. |
| 257 |
$extension['title'] |
| 258 |
); |
| 259 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 260 |
echo $new_tab_message; |
| 261 |
?> |
| 262 |
</a> |
| 263 |
<?php else : ?> |
| 264 |
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div> |
| 265 |
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>" |
| 266 |
class="yoast-link--license"> |
| 267 |
<?php |
| 268 |
printf( |
| 269 |
/* translators: %s expands to the extension title */ |
| 270 |
esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), |
| 271 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class. |
| 272 |
$extension['title'] |
| 273 |
); |
| 274 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 275 |
echo $new_tab_message; |
| 276 |
?> |
| 277 |
</a> |
| 278 |
<?php endif; ?> |
| 279 |
<?php else : ?> |
| 280 |
<a target="_blank" class="yoast-button-upsell" |
| 281 |
href="<?php echo esc_url( $extension['buyUrl'] ); ?>"> |
| 282 |
<?php |
| 283 |
printf( |
| 284 |
/* translators: %s expands to the product name */ |
| 285 |
esc_html__( 'Buy %s', 'wordpress-seo' ), |
| 286 |
// 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. |
| 287 |
( isset( $extension['buy_button'] ) ) ? $extension['buy_button'] : $extension['title'] |
| 288 |
); |
| 289 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 290 |
echo $new_tab_message; |
| 291 |
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'; |
| 292 |
?> |
| 293 |
</a> |
| 294 |
|
| 295 |
<a target="_blank" class="yoast-link--more-info" |
| 296 |
href="<?php echo esc_url( $extension['infoUrl'] ); ?>"> |
| 297 |
<?php |
| 298 |
printf( |
| 299 |
/* translators: Text between 1: and 2: will only be shown to screen readers. 3: expands to the product name. */ |
| 300 |
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ), |
| 301 |
'<span class="screen-reader-text">', |
| 302 |
'</span>', |
| 303 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class. |
| 304 |
$extension['title'] |
| 305 |
); |
| 306 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped. |
| 307 |
echo $new_tab_message; |
| 308 |
?> |
| 309 |
</a> |
| 310 |
<?php endif; ?> |
| 311 |
</div> |
| 312 |
</section> |
| 313 |
<?php endforeach; ?> |
| 314 |
</section> |
| 315 |
</div> |
| 316 |
|
| 317 |
</div> |
| 318 |
|