PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 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 All 129 releases
wordpress-seo / admin / class-premium-popup.php

class-premium-popup.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.1, at admin/class-premium-popup.php

105 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin
6 */
7
8 /**
9 * Class WPSEO_Premium_popup.
10 */
11 class WPSEO_Premium_Popup {
12
13 /**
14 * An unique identifier for the popup
15 *
16 * @var string
17 */
18 private $identifier = '';
19
20 /**
21 * The heading level of the title of the popup.
22 *
23 * @var string
24 */
25 private $heading_level = '';
26
27 /**
28 * The title of the popup.
29 *
30 * @var string
31 */
32 private $title = '';
33
34 /**
35 * The content of the popup.
36 *
37 * @var string
38 */
39 private $content = '';
40
41 /**
42 * The URL for where the button should link to.
43 *
44 * @var string
45 */
46 private $url = '';
47
48 /**
49 * Wpseo_Premium_Popup constructor.
50 *
51 * @param string $identifier An unique identifier for the popup.
52 * @param string $heading_level The heading level for the title of the popup.
53 * @param string $title The title of the popup.
54 * @param string $content The content of the popup.
55 * @param string $url The URL for where the button should link to.
56 */
57 public function __construct( $identifier, $heading_level, $title, $content, $url ) {
58 $this->identifier = $identifier;
59 $this->heading_level = $heading_level;
60 $this->title = $title;
61 $this->content = $content;
62 $this->url = $url;
63 }
64
65 /**
66 * Returns the premium popup as an HTML string.
67 *
68 * @param bool $popup Show this message as a popup show it straight away.
69 *
70 * @return string
71 */
72 public function get_premium_message( $popup = true ) {
73 // Don't show in Premium.
74 if ( defined( 'WPSEO_PREMIUM_FILE' ) ) {
75 return '';
76 }
77
78 $assets_uri = trailingslashit( plugin_dir_url( WPSEO_FILE ) );
79
80 /* translators: %s expands to Yoast SEO Premium */
81 $cta_text = esc_html( sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ) );
82 $new_tab_message = '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>';
83 $caret_icon = '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
84 $classes = '';
85 if ( $popup ) {
86 $classes = ' hidden';
87 }
88 $micro_copy = __( '1 year free support and updates included!', 'wordpress-seo' );
89
90 $popup = <<<EO_POPUP
91 <div id="wpseo-{$this->identifier}-popup" class="wpseo-premium-popup wp-clearfix$classes">
92 <img class="alignright wpseo-premium-popup-icon" src="{$assets_uri}packages/js/images/Yoast_SEO_Icon.svg" width="150" height="150" alt="Yoast SEO"/>
93 <{$this->heading_level} id="wpseo-contact-support-popup-title" class="wpseo-premium-popup-title">{$this->title}</{$this->heading_level}>
94 {$this->content}
95 <a id="wpseo-{$this->identifier}-popup-button" class="yoast-button-upsell" href="{$this->url}" target="_blank">
96 {$cta_text} {$new_tab_message} {$caret_icon}
97 </a><br/>
98 <small>{$micro_copy}</small>
99 </div>
100 EO_POPUP;
101
102 return $popup;
103 }
104 }
105