PluginProbe ʕ •ᴥ•ʔ
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 22.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v22.0
27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 19.1 19.10 19.11 19.12 19.13 19.14 19.2 19.3 19.4 19.5 19.5.1 19.6 19.6.1 19.7 19.7.1 19.7.2 19.8 19.9 20.0 20.1 20.10 20.11 20.12 20.13 20.2 20.2.1 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.8.1 21.9 21.9.1 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.8.1 24.9 25.0 25.1 25.2 25.3 25.3.1 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.1.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.1.1 27.2 27.3 27.4
wordpress-seo / admin / class-premium-upsell-admin-block.php
wordpress-seo / admin Last commit date
ajax 2 years ago capabilities 2 years ago endpoints 2 years ago exceptions 7 years ago filters 2 years ago formatter 2 years ago google_search_console 2 years ago import 2 years ago listeners 8 years ago menu 2 years ago metabox 2 years ago notifiers 3 years ago pages 2 years ago roles 2 years ago services 5 years ago statistics 2 years ago taxonomy 2 years ago tracking 2 years ago views 2 years ago watchers 2 years ago admin-settings-changed-listener.php 2 years ago ajax.php 2 years ago class-admin-asset-analysis-worker-location.php 5 years ago class-admin-asset-dev-server-location.php 2 years ago class-admin-asset-location.php 8 years ago class-admin-asset-manager.php 2 years ago class-admin-asset-seo-location.php 4 years ago class-admin-editor-specific-replace-vars.php 2 years ago class-admin-gutenberg-compatibility-notification.php 2 years ago class-admin-help-panel.php 5 years ago class-admin-init.php 2 years ago class-admin-recommended-replace-vars.php 2 years ago class-admin-user-profile.php 2 years ago class-admin-utils.php 2 years ago class-admin.php 2 years ago class-asset.php 2 years ago class-bulk-description-editor-list-table.php 5 years ago class-bulk-editor-list-table.php 2 years ago class-bulk-title-editor-list-table.php 6 years ago class-collector.php 2 years ago class-config.php 2 years ago class-customizer.php 2 years ago class-database-proxy.php 2 years ago class-export.php 2 years ago class-expose-shortlinks.php 2 years ago class-gutenberg-compatibility.php 2 years ago class-meta-columns.php 2 years ago class-my-yoast-proxy.php 2 years ago class-option-tab.php 4 years ago class-option-tabs-formatter.php 2 years ago class-option-tabs.php 2 years ago class-paper-presenter.php 5 years ago class-plugin-availability.php 2 years ago class-plugin-conflict.php 2 years ago class-premium-popup.php 2 years ago class-premium-upsell-admin-block.php 2 years ago class-primary-term-admin.php 2 years ago class-product-upsell-notice.php 2 years ago class-remote-request.php 2 years ago class-schema-person-upgrade-notification.php 2 years ago class-suggested-plugins.php 2 years ago class-wincher-dashboard-widget.php 2 years ago class-yoast-columns.php 2 years ago class-yoast-dashboard-widget.php 2 years ago class-yoast-form.php 2 years ago class-yoast-input-validation.php 2 years ago class-yoast-network-admin.php 2 years ago class-yoast-network-settings-api.php 4 years ago class-yoast-notification-center.php 2 years ago class-yoast-notification.php 2 years ago class-yoast-notifications.php 2 years ago class-yoast-plugin-conflict.php 2 years ago index.php 10 years ago interface-collection.php 7 years ago interface-installable.php 8 years ago
class-premium-upsell-admin-block.php
166 lines
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin
6 */
7
8 use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
9
10 /**
11 * Class WPSEO_Premium_Upsell_Admin_Block
12 */
13 class WPSEO_Premium_Upsell_Admin_Block {
14
15 /**
16 * Hook to display the block on.
17 *
18 * @var string
19 */
20 protected $hook;
21
22 /**
23 * Identifier to use in the dismissal functionality.
24 *
25 * @var string
26 */
27 protected $identifier = 'premium_upsell';
28
29 /**
30 * Registers which hook the block will be displayed on.
31 *
32 * @param string $hook Hook to display the block on.
33 */
34 public function __construct( $hook ) {
35 $this->hook = $hook;
36 }
37
38 /**
39 * Registers WordPress hooks.
40 *
41 * @return void
42 */
43 public function register_hooks() {
44 add_action( $this->hook, [ $this, 'render' ] );
45 }
46
47 /**
48 * Renders the upsell block.
49 *
50 * @return void
51 */
52 public function render() {
53 $url = WPSEO_Shortlinker::get( 'https://yoa.st/17h' );
54
55 $arguments = [
56 sprintf(
57 /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
58 esc_html__( '%1$sAI%2$s: Better SEO titles and meta descriptions, faster.', 'wordpress-seo' ),
59 '<strong>',
60 '</strong>'
61 ),
62 sprintf(
63 /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
64 esc_html__( '%1$sMultiple keywords%2$s: Rank higher for more searches.', 'wordpress-seo' ),
65 '<strong>',
66 '</strong>'
67 ),
68 sprintf(
69 /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
70 esc_html__( '%1$sSuper fast%2$s internal linking suggestions.', 'wordpress-seo' ),
71 '<strong>',
72 '</strong>'
73 ),
74 sprintf(
75 /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
76 esc_html__( '%1$sNo more broken links%2$s: Automatic redirect manager.', 'wordpress-seo' ),
77 '<strong>',
78 '</strong>'
79 ),
80 sprintf(
81 /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
82 esc_html__( '%1$sAppealing social previews%2$s people actually want to click on.', 'wordpress-seo' ),
83 '<strong>',
84 '</strong>'
85 ),
86 sprintf(
87 /* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */
88 esc_html__( '%1$s24/7 support%2$s: Also on evenings and weekends.', 'wordpress-seo' ),
89 '<strong>',
90 '</strong>'
91 ),
92 '<strong>' . esc_html__( 'No ads!', 'wordpress-seo' ) . '</strong>',
93 ];
94
95 $arguments_html = implode( '', array_map( [ $this, 'get_argument_html' ], $arguments ) );
96
97 $class = $this->get_html_class();
98
99 /* translators: %s expands to Yoast SEO Premium */
100 $button_text = YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ? esc_html__( 'Claim your 30% off now!', 'wordpress-seo' ) : sprintf( esc_html__( 'Explore %s now!', 'wordpress-seo' ), 'Yoast SEO Premium' );
101 /* translators: Hidden accessibility text. */
102 $button_text .= '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
103 . '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
104
105 $upgrade_button = sprintf(
106 '<a id="%1$s" class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="%2$s" target="_blank">%3$s</a>',
107 esc_attr( 'wpseo-' . $this->identifier . '-popup-button' ),
108 esc_url( $url ),
109 $button_text
110 );
111
112 echo '<div class="' . esc_attr( $class ) . '">';
113
114 if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
115 $bf_label = esc_html__( 'BLACK FRIDAY', 'wordpress-seo' );
116 $sale_label = esc_html__( '30% OFF', 'wordpress-seo' );
117 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped above.
118 echo "<div class='black-friday-container'><span>$bf_label</span> <span style='margin-left: auto;'>$sale_label</span> </div>";
119 }
120
121 echo '<div class="' . esc_attr( $class . '--container' ) . '">';
122 echo '<h2 class="' . esc_attr( $class . '--header' ) . '">'
123 . sprintf(
124 /* translators: %s expands to Yoast SEO Premium */
125 esc_html__( 'Upgrade to %s', 'wordpress-seo' ),
126 'Yoast SEO Premium'
127 )
128 . '</h2>';
129
130 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Correctly escaped in $this->get_argument_html() method.
131 echo '<ul class="' . esc_attr( $class . '--motivation' ) . '">' . $arguments_html . '</ul>';
132
133 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Correctly escaped in $upgrade_button and $button_text above.
134 echo '<p>' . $upgrade_button . '</p>';
135 echo '</div>';
136
137 echo '</div>';
138 }
139
140 /**
141 * Formats the argument to a HTML list item.
142 *
143 * @param string $argument The argument to format.
144 *
145 * @return string Formatted argument in HTML.
146 */
147 protected function get_argument_html( $argument ) {
148 $class = $this->get_html_class();
149
150 return sprintf(
151 '<li><div class="%1$s">%2$s</div></li>',
152 esc_attr( $class . '--argument' ),
153 $argument
154 );
155 }
156
157 /**
158 * Returns the HTML base class to use.
159 *
160 * @return string The HTML base class.
161 */
162 protected function get_html_class() {
163 return 'yoast_' . $this->identifier;
164 }
165 }
166