| @@ -4,9 +4,8 @@ | ||
| 4 | 4 | |
| 5 | 5 | use WPSEO_Addon_Manager; |
| 6 | 6 | use WPSEO_Admin_Asset_Manager; |
| 7 | 7 | use Yoast\WP\SEO\Conditionals\Admin_Conditional; |
| 8 | -use Yoast\WP\SEO\Helpers\Indexing_Helper; | |
| 9 | 8 | use Yoast\WP\SEO\Helpers\Options_Helper; |
| 10 | 9 | use Yoast\WP\SEO\Helpers\Product_Helper; |
| 11 | 10 | use Yoast\WP\SEO\Integrations\Integration_Interface; |
| 12 | 11 | use Yoast\WP\SEO\Presenters\Admin\Notice_Presenter; |
| @@ -128,8 +127,10 @@ | ||
| 128 | 127 | } |
| 129 | 128 | |
| 130 | 129 | /** |
| 131 | 130 | * Enqueue the workouts app. |
| 131 | + * | |
| 132 | + * @return void | |
| 132 | 133 | */ |
| 133 | 134 | public function enqueue_assets() { |
| 134 | 135 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved. |
| 135 | 136 | if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_workouts' ) { |
| @@ -142,8 +143,9 @@ | ||
| 142 | 143 | |
| 143 | 144 | $this->admin_asset_manager->enqueue_style( 'workouts' ); |
| 144 | 145 | |
| 145 | 146 | $workouts_option = $this->get_workouts_option(); |
| 147 | + $ftc_url = \esc_url( \admin_url( 'admin.php?page=wpseo_dashboard#/first-time-configuration' ) ); | |
| 146 | 148 | |
| 147 | 149 | $this->admin_asset_manager->enqueue_script( 'workouts' ); |
| 148 | 150 | $this->admin_asset_manager->localize_script( |
| 149 | 151 | 'workouts', |
| @@ -153,21 +155,20 @@ | ||
| 153 | 155 | 'homeUrl' => \home_url(), |
| 154 | 156 | 'pluginUrl' => \esc_url( \plugins_url( '', \WPSEO_FILE ) ), |
| 155 | 157 | 'toolsPageUrl' => \esc_url( \admin_url( 'admin.php?page=wpseo_tools' ) ), |
| 156 | 158 | 'usersPageUrl' => \esc_url( \admin_url( 'users.php' ) ), |
| 157 | - 'firsttimeConfigurationUrl' => \esc_url( \admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ) ), | |
| 159 | + 'firstTimeConfigurationUrl' => $ftc_url, | |
| 158 | 160 | 'isPremium' => $this->product_helper->is_premium(), |
| 159 | - 'shouldUpdatePremium' => $this->should_update_premium(), | |
| 160 | 161 | 'upsellText' => $this->get_upsell_text(), |
| 161 | 162 | 'upsellLink' => $this->get_upsell_link(), |
| 162 | - 'canDoConfigurationWorkout' => $this->user_can_do_configuration_workout(), | |
| 163 | - 'canEditWordPressOptions' => $this->user_can_edit_wordpress_options(), | |
| 164 | - ] | |
| 163 | + ], | |
| 165 | 164 | ); |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | 167 | /** |
| 169 | 168 | * Renders the target for the React to mount to. |
| 169 | + * | |
| 170 | + * @return void | |
| 170 | 171 | */ |
| 171 | 172 | public function render_target() { |
| 172 | 173 | if ( $this->should_update_premium() ) { |
| 173 | 174 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped in get_update_premium_notice. |
| @@ -203,14 +204,15 @@ | ||
| 203 | 204 | $copy = \sprintf( |
| 204 | 205 | /* translators: %s: expands to 'Yoast SEO Premium'. */ |
| 205 | 206 | \esc_html__( |
| 206 | 207 | 'Accessing the latest workouts requires an updated version of %s (at least 17.7), but it looks like your subscription has expired. Please renew your subscription to update and gain access to all the latest features.', |
| 207 | - 'wordpress-seo' | |
| 208 | + 'wordpress-seo', | |
| 208 | 209 | ), |
| 209 | - 'Yoast SEO Premium' | |
| 210 | + 'Yoast SEO Premium', | |
| 210 | 211 | ); |
| 211 | 212 | $button = '<a class="yoast-button yoast-button-upsell yoast-button--small" href="' . \esc_url( $url ) . '" target="_blank">' |
| 212 | 213 | . \esc_html__( 'Renew your subscription', 'wordpress-seo' ) |
| 214 | + /* translators: Hidden accessibility text. */ | |
| 213 | 215 | . '<span class="screen-reader-text">' . \__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' |
| 214 | 216 | . '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>' |
| 215 | 217 | . '</a>'; |
| 216 | 218 | } |
| @@ -221,9 +223,9 @@ | ||
| 221 | 223 | /* translators: 1: expands to 'Yoast SEO Premium', 2: Link start tag to the page to update Premium, 3: Link closing tag. */ |
| 222 | 224 | \esc_html__( 'It looks like you\'re running an outdated version of %1$s, please %2$supdate to the latest version (at least 17.7)%3$s to gain access to our updated workouts section.', 'wordpress-seo' ), |
| 223 | 225 | 'Yoast SEO Premium', |
| 224 | 226 | '<a href="' . \esc_url( $url ) . '">', |
| 225 | - '</a>' | |
| 227 | + '</a>', | |
| 226 | 228 | ); |
| 227 | 229 | $button = null; |
| 228 | 230 | } |
| 229 | 231 | else { |
| @@ -234,12 +236,13 @@ | ||
| 234 | 236 | /* translators: 1: expands to 'Yoast SEO Premium', 2: Link start tag to the page to update Premium, 3: Link closing tag. */ |
| 235 | 237 | \esc_html__( 'It looks like you’re running an outdated and unactivated version of %1$s, please activate your subscription in %2$sMyYoast%3$s and update to the latest version (at least 17.7) to gain access to our updated workouts section.', 'wordpress-seo' ), |
| 236 | 238 | 'Yoast SEO Premium', |
| 237 | 239 | '<a href="' . \esc_url( $url ) . '">', |
| 238 | - '</a>' | |
| 240 | + '</a>', | |
| 239 | 241 | ); |
| 240 | 242 | $button = '<a class="yoast-button yoast-button--primary yoast-button--small" href="' . \esc_url( $url_button ) . '" target="_blank">' |
| 241 | 243 | . \esc_html__( 'Get help activating your subscription', 'wordpress-seo' ) |
| 244 | + /* translators: Hidden accessibility text. */ | |
| 242 | 245 | . '<span class="screen-reader-text">' . \__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' |
| 243 | 246 | . '</a>'; |
| 244 | 247 | } |
| 245 | 248 | |
| @@ -245,10 +248,10 @@ | ||
| 245 | 248 | |
| 246 | 249 | $notice = new Notice_Presenter( |
| 247 | 250 | $title, |
| 248 | 251 | $copy, |
| 249 | - 'Assistent_Time_bubble_500x570.png', | |
| 250 | - $button | |
| 252 | + null, | |
| 253 | + $button, | |
| 251 | 254 | ); |
| 252 | 255 | |
| 253 | 256 | return $notice->present(); |
| 254 | 257 | } |
| @@ -296,9 +299,9 @@ | ||
| 296 | 299 | if ( $this->has_premium_subscription_expired() ) { |
| 297 | 300 | return \sprintf( |
| 298 | 301 | /* translators: %s: expands to 'Yoast SEO Premium'. */ |
| 299 | 302 | \__( 'Renew %s', 'wordpress-seo' ), |
| 300 | - 'Yoast SEO Premium' | |
| 303 | + 'Yoast SEO Premium', | |
| 301 | 304 | ); |
| 302 | 305 | } |
| 303 | 306 | if ( $this->has_premium_subscription_activated() ) { |
| 304 | 307 | return \sprintf( |
| @@ -303,15 +306,15 @@ | ||
| 303 | 306 | if ( $this->has_premium_subscription_activated() ) { |
| 304 | 307 | return \sprintf( |
| 305 | 308 | /* translators: %s: expands to 'Yoast SEO Premium'. */ |
| 306 | 309 | \__( 'Update %s', 'wordpress-seo' ), |
| 307 | - 'Yoast SEO Premium' | |
| 310 | + 'Yoast SEO Premium', | |
| 308 | 311 | ); |
| 309 | 312 | } |
| 310 | 313 | return \sprintf( |
| 311 | 314 | /* translators: %s: expands to 'Yoast SEO Premium'. */ |
| 312 | 315 | \__( 'Activate %s', 'wordpress-seo' ), |
| 313 | - 'Yoast SEO Premium' | |
| 316 | + 'Yoast SEO Premium', | |
| 314 | 317 | ); |
| 315 | 318 | } |
| 316 | 319 | |
| 317 | 320 | /** |
| @@ -330,24 +333,6 @@ | ||
| 330 | 333 | if ( $this->has_premium_subscription_activated() ) { |
| 331 | 334 | return \wp_nonce_url( \self_admin_url( 'update.php?action=upgrade-plugin&plugin=wordpress-seo-premium/wp-seo-premium.php' ), 'upgrade-plugin_wordpress-seo-premium/wp-seo-premium.php' ); |
| 332 | 335 | } |
| 333 | 336 | return 'https://yoa.st/workouts-activate-notice-myyoast'; |
| 334 | - } | |
| 335 | - | |
| 336 | - /** | |
| 337 | - * Whether the user can do the configuration workout. | |
| 338 | - * | |
| 339 | - * @return bool Whether the current user can do the configuration workout. | |
| 340 | - */ | |
| 341 | - private function user_can_do_configuration_workout() { | |
| 342 | - return \current_user_can( 'wpseo_manage_options' ); | |
| 343 | - } | |
| 344 | - | |
| 345 | - /** | |
| 346 | - * Whether the user can edit WordPress options. | |
| 347 | - * | |
| 348 | - * @return bool Whether the current user can edit WordPress options. | |
| 349 | - */ | |
| 350 | - private function user_can_edit_wordpress_options() { | |
| 351 | - return \current_user_can( 'manage_options' ); | |
| 352 | 337 | } |
| 353 | 338 | } |