| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Presenters\Admin; |
| 4 |
|
| 5 |
use WPSEO_Shortlinker; |
| 6 |
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional; |
| 7 |
use Yoast\WP\SEO\Presenters\Abstract_Presenter; |
| 8 |
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager; |
| 9 |
|
| 10 |
/** |
| 11 |
* Presenter class for the Yoast SEO sidebar. |
| 12 |
*/ |
| 13 |
class Sidebar_Presenter extends Abstract_Presenter { |
| 14 |
|
| 15 |
/** |
| 16 |
* Presents the sidebar. |
| 17 |
* |
| 18 |
* @return string The sidebar HTML. |
| 19 |
*/ |
| 20 |
public function present() { |
| 21 |
$title = \__( 'BLACK FRIDAY | 30% OFF', 'wordpress-seo' ); |
| 22 |
|
| 23 |
$assets_uri = \trailingslashit( \plugin_dir_url( \WPSEO_FILE ) ); |
| 24 |
$is_woocommerce_active = ( new WooCommerce_Conditional() )->is_met(); |
| 25 |
$shortlink = ( $is_woocommerce_active ) ? WPSEO_Shortlinker::get( 'https://yoa.st/admin-sidebar-upsell-woocommerce' ) : WPSEO_Shortlinker::get( 'https://yoa.st/jj' ); |
| 26 |
|
| 27 |
\ob_start(); |
| 28 |
?> |
| 29 |
<div class="wpseo_content_cell" id="sidebar-container"> |
| 30 |
<div id="sidebar" class="yoast-sidebar"> |
| 31 |
<div class="wpseo_content_cell_title yoast-sidebar__title"> |
| 32 |
<?php |
| 33 |
/* translators: %1$s expands to Yoast */ |
| 34 |
\printf( \esc_html__( '%1$s recommendations for you', 'wordpress-seo' ), 'Yoast' ); |
| 35 |
?> |
| 36 |
</div> |
| 37 |
|
| 38 |
<div class="yoast-sidebar__product<?php echo ( $is_woocommerce_active ) ? ' woocommerce' : ''; ?>"> |
| 39 |
<figure class="product-image"> |
| 40 |
<figure class="product-image"> |
| 41 |
<img |
| 42 |
width="64" height="64" |
| 43 |
src="<?php echo ( $is_woocommerce_active ) ? \esc_url( $assets_uri . 'packages/js/images/woo-seo-logo-new.svg' ) : \esc_url( $assets_uri . 'packages/js/images/yoast-premium-logo-new.svg' ); ?>" |
| 44 |
class="attachment-full size-full content-visible" |
| 45 |
alt="Yoast SEO logo" |
| 46 |
loading="lazy" |
| 47 |
decoding="async" |
| 48 |
fetchpriority="low" |
| 49 |
sizes="(min-width: 1321px) 64"> |
| 50 |
</figure> |
| 51 |
</figure> |
| 52 |
<?php |
| 53 |
if ( |
| 54 |
\YoastSEO()->classes->get( Promotion_Manager::class ) |
| 55 |
->is( 'black-friday-promotion' ) ) : |
| 56 |
?> |
| 57 |
<div class="sidebar__sale_banner_container"> |
| 58 |
<div class="sidebar__sale_banner"> |
| 59 |
<span class="banner_text"><?php echo \esc_html( $title ); ?></span> |
| 60 |
</div> |
| 61 |
</div> |
| 62 |
<?php endif; ?> |
| 63 |
<h2 class="yoast-get-premium-title"> |
| 64 |
<?php |
| 65 |
/* translators: %1$s and %2$s expand to a span wrap to avoid linebreaks. %3$s expands to "Yoast SEO Premium". */ |
| 66 |
echo ( $is_woocommerce_active ) ? \sprintf( \esc_html__( '%1$s%2$s %3$s', 'wordpress-seo' ), '<span>', '</span>', 'Yoast WooCommerce SEO' ) : \sprintf( \esc_html__( '%1$s%2$s %3$s', 'wordpress-seo' ), '<span>', '</span>', 'Yoast SEO Premium' ); |
| 67 |
?> |
| 68 |
</h2> |
| 69 |
<div> |
| 70 |
<p class="info-header"> |
| 71 |
<?php |
| 72 |
echo ( $is_woocommerce_active ) ? \esc_html__( "Grow your store's visibility!", 'wordpress-seo' ) : \esc_html__( 'Spend less time on SEO tasks!', 'wordpress-seo' ); |
| 73 |
?> |
| 74 |
</p> |
| 75 |
<p class="info"> |
| 76 |
<?php |
| 77 |
echo ( $is_woocommerce_active ) ? \esc_html__( 'Help ready-to-buy shoppers and search engines find your product.', 'wordpress-seo' ) : \esc_html__( 'Optimize your site faster, smarter, and with more confidence.', 'wordpress-seo' ); |
| 78 |
?> |
| 79 |
</p> |
| 80 |
<ul class="yoast-features-list"> |
| 81 |
<?php |
| 82 |
if ( $is_woocommerce_active ) { |
| 83 |
echo '<li>' . \esc_html__( 'Add product details to help your listings stand out', 'wordpress-seo' ) . '</li>'; |
| 84 |
echo '<li>' . \esc_html__( 'Make sure search engines show the right version of your product page', 'wordpress-seo' ) . '</li>'; |
| 85 |
echo '<li>' . \esc_html__( 'Create optimized SEO titles & meta descriptions with AI', 'wordpress-seo' ) . '</li>'; |
| 86 |
echo '<li>' . \esc_html__( 'Receive clear SEO and readability guidance to optimize your products', 'wordpress-seo' ) . '</li>'; |
| 87 |
} |
| 88 |
else { |
| 89 |
echo '<li>' . \esc_html__( 'Create optimized SEO titles & meta descriptions in seconds', 'wordpress-seo' ) . '</li>'; |
| 90 |
echo '<li>' . \esc_html__( 'Apply AI suggestions to improve content in 1 click', 'wordpress-seo' ) . '</li>'; |
| 91 |
echo '<li>' . \esc_html__( 'Manage redirects with ease and without extra plugins', 'wordpress-seo' ) . '</li>'; |
| 92 |
echo '<li>' . \esc_html__( 'Optimize pages for multiple keywords with guidance', 'wordpress-seo' ) . '</li>'; |
| 93 |
} |
| 94 |
?> |
| 95 |
</ul> |
| 96 |
<p class="plugin-buy-button"> |
| 97 |
<a class="yoast-button-upsell" data-action="load-nfd-ctb" |
| 98 |
data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" target="_blank" |
| 99 |
href="<?php echo \esc_url( $shortlink ); ?>"> |
| 100 |
<?php |
| 101 |
if ( |
| 102 |
\YoastSEO()->classes->get( Promotion_Manager::class ) |
| 103 |
->is( 'black-friday-promotion' ) ) { |
| 104 |
echo \esc_html__( 'Buy now for 30% off', 'wordpress-seo' ); |
| 105 |
} |
| 106 |
else { |
| 107 |
echo \esc_html__( 'Buy now', 'wordpress-seo' ); |
| 108 |
} |
| 109 |
?> |
| 110 |
<span aria-hidden="true" class="yoast-button-upsell__caret"></span> |
| 111 |
</a> |
| 112 |
</p> |
| 113 |
<p class="yoast-price-micro-copy"> |
| 114 |
<?php |
| 115 |
echo ( $is_woocommerce_active ) ? \esc_html__( 'Less friction. Smarter optimization.', 'wordpress-seo' ) : \esc_html__( 'Less friction. Faster publishing.', 'wordpress-seo' ); |
| 116 |
?> |
| 117 |
</p> |
| 118 |
<hr class="yoast-upsell-hr" aria-hidden="true"> |
| 119 |
<ul class="yoast-guarantees-list"> |
| 120 |
<li> |
| 121 |
<?php |
| 122 |
echo \esc_html__( '30-day money back guarantee', 'wordpress-seo' ); |
| 123 |
?> |
| 124 |
</li> |
| 125 |
<li> |
| 126 |
<?php |
| 127 |
echo \esc_html__( '24/7 support', 'wordpress-seo' ); |
| 128 |
?> |
| 129 |
</li> |
| 130 |
</ul> |
| 131 |
</div> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
<div class="yoast-sidebar__section"> |
| 135 |
<h2> |
| 136 |
<?php |
| 137 |
\esc_html_e( 'Learn SEO', 'wordpress-seo' ); |
| 138 |
?> |
| 139 |
</h2> |
| 140 |
<p> |
| 141 |
<?php |
| 142 |
$academy_shortlink = WPSEO_Shortlinker::get( 'https://yoa.st/3t6' ); |
| 143 |
|
| 144 |
/* translators: %1$s expands to Yoast SEO academy, which is a clickable link. */ |
| 145 |
\printf( \esc_html__( 'Want to learn SEO from Team Yoast? Check out our %1$s!', 'wordpress-seo' ), '<a href="' . \esc_url( $academy_shortlink ) . '" target="_blank"><strong>Yoast SEO academy</strong></a>' ); |
| 146 |
echo '<br/>'; |
| 147 |
\esc_html_e( 'We have both free and premium online courses to learn everything you need to know about SEO.', 'wordpress-seo' ); |
| 148 |
?> |
| 149 |
</p> |
| 150 |
<p> |
| 151 |
<a href="<?php echo \esc_url( $academy_shortlink ); ?>" style="font-weight: 500" target="_blank"> |
| 152 |
<?php |
| 153 |
/* translators: %1$s expands to Yoast SEO academy */ |
| 154 |
\printf( \esc_html__( 'Check out %1$s', 'wordpress-seo' ), 'Yoast SEO academy' ); |
| 155 |
?> |
| 156 |
<span class="screen-reader-text"> |
| 157 |
<?php |
| 158 |
/* translators: Hidden accessibility text. */ |
| 159 |
\printf( \esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) ); |
| 160 |
?> |
| 161 |
</span> |
| 162 |
<img |
| 163 |
src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="9" viewBox="0 0 10 9" fill="none"><path d="M3.99951 1.49988H1.99951C1.44723 1.49988 0.999512 1.94759 0.999512 2.49988V7.49988C0.999512 8.05216 1.44723 8.49988 1.99951 8.49988H6.99951C7.5518 8.49988 7.99951 8.05216 7.99951 7.49988V5.49988M5.99951 0.499878H8.99951M8.99951 0.499878V3.49988M8.99951 0.499878L3.99951 5.49988" stroke="%230085ba" stroke-linecap="round" stroke-linejoin="round"/></svg>' |
| 164 |
alt="" aria-hidden="true" width="10" height="9" |
| 165 |
/> |
| 166 |
</a> |
| 167 |
</p> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
<?php |
| 171 |
return \ob_get_clean(); |
| 172 |
} |
| 173 |
} |
| 174 |
|