| @@ -4,8 +4,10 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package WPSEO\Admin\Menu |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +use Yoast\WP\SEO\Promotions\Application\Promotion_Manager; | |
| 9 | + | |
| 8 | 10 | /** |
| 9 | 11 | * Admin menu base class. |
| 10 | 12 | */ |
| 11 | 13 | abstract class WPSEO_Base_Menu implements WPSEO_WordPress_Integration { |
| @@ -43,11 +45,9 @@ | ||
| 43 | 45 | * |
| 44 | 46 | * @return array Formatted submenu. |
| 45 | 47 | */ |
| 46 | 48 | protected function get_submenu_page( $page_title, $page_slug, $callback = null, $hook = null ) { |
| 47 | - if ( $callback === null ) { | |
| 48 | - $callback = $this->get_admin_page_callback(); | |
| 49 | - } | |
| 49 | + $callback ??= $this->get_admin_page_callback(); | |
| 50 | 50 | |
| 51 | 51 | return [ |
| 52 | 52 | $this->get_page_identifier(), |
| 53 | 53 | '', |
| @@ -130,9 +130,9 @@ | ||
| 130 | 130 | $submenu_page[3], |
| 131 | 131 | $submenu_page[4], |
| 132 | 132 | $submenu_page[5], |
| 133 | 133 | $this->get_icon_svg(), |
| 134 | - 99 | |
| 134 | + 99, | |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | 137 | // If necessary, add hooks for the submenu page. |
| 138 | 138 | if ( isset( $submenu_page[6] ) && ( is_array( $submenu_page[6] ) ) ) { |
| @@ -163,13 +163,8 @@ | ||
| 163 | 163 | */ |
| 164 | 164 | protected function register_submenu_page( $submenu_page ) { |
| 165 | 165 | $page_title = $submenu_page[2]; |
| 166 | 166 | |
| 167 | - // We cannot use $submenu_page[1] because add-ons define that, so hard-code this value. | |
| 168 | - if ( $submenu_page[4] === 'wpseo_licenses' ) { | |
| 169 | - $page_title = $this->get_license_page_title(); | |
| 170 | - } | |
| 171 | - | |
| 172 | 167 | /* |
| 173 | 168 | * Handle the Google Search Console special case by passing a fake parent |
| 174 | 169 | * page slug. This way, the sub-page is stil registered and can be accessed |
| 175 | 170 | * directly. Its menu item won't be displayed. |
| @@ -187,9 +182,9 @@ | ||
| 187 | 182 | $page_title, |
| 188 | 183 | $submenu_page[2], |
| 189 | 184 | $submenu_page[3], |
| 190 | 185 | $submenu_page[4], |
| 191 | - $submenu_page[5] | |
| 186 | + $submenu_page[5], | |
| 192 | 187 | ); |
| 193 | 188 | |
| 194 | 189 | // If necessary, add hooks for the submenu page. |
| 195 | 190 | if ( isset( $submenu_page[6] ) && ( is_array( $submenu_page[6] ) ) ) { |
| @@ -248,15 +243,22 @@ | ||
| 248 | 243 | |
| 249 | 244 | /** |
| 250 | 245 | * Returns the page title to use for the licenses page. |
| 251 | 246 | * |
| 247 | + * @deprecated 25.5 | |
| 248 | + * @codeCoverageIgnore | |
| 249 | + * | |
| 252 | 250 | * @return string The title for the license page. |
| 253 | 251 | */ |
| 254 | 252 | protected function get_license_page_title() { |
| 255 | 253 | static $title = null; |
| 256 | 254 | |
| 257 | - if ( $title === null ) { | |
| 258 | - $title = __( 'Premium', 'wordpress-seo' ); | |
| 255 | + _deprecated_function( __METHOD__, 'Yoast SEO 25.5' ); | |
| 256 | + | |
| 257 | + $title ??= __( 'Upgrades', 'wordpress-seo' ); | |
| 258 | + | |
| 259 | + if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-promotion' ) && ! YoastSEO()->helpers->product->is_premium() ) { | |
| 260 | + $title = __( 'Upgrades', 'wordpress-seo' ) . '<span class="yoast-menu-bf-sale-badge">' . __( '30% OFF', 'wordpress-seo' ) . '</span>'; | |
| 259 | 261 | } |
| 260 | 262 | |
| 261 | 263 | return $title; |
| 262 | 264 | } |