WPSEO_Premium_Popup

Class WPSEO_Premium_popup.

Defined (1)

The class is defined in the following location(s).

/admin/class-premium-popup.php  
  1. class WPSEO_Premium_Popup { 
  2. /** 
  3. * An unique identifier for the popup 
  4. * @var string 
  5. */ 
  6. private $identifier = ''; 
  7.  
  8. /** 
  9. * The heading level of the title of the popup. 
  10. * @var String 
  11. */ 
  12. private $heading_level = ''; 
  13.  
  14. /** 
  15. * The title of the popup 
  16. * @var String 
  17. */ 
  18. private $title = ''; 
  19.  
  20. /** 
  21. * The content of the popup 
  22. * @var String 
  23. */ 
  24. private $content = ''; 
  25.  
  26. /** 
  27. * Wpseo_Premium_Popup constructor. 
  28. * @param String $identifier An unique identifier for the popup. 
  29. * @param String $heading_level The heading level for the title of the popup. 
  30. * @param String $title The title of the popup. 
  31. * @param String $content The content of the popup. 
  32. */ 
  33. public function __construct( $identifier, $heading_level, $title, $content ) { 
  34. $this->identifier = $identifier; 
  35. $this->heading_level = $heading_level; 
  36. $this->title = $title; 
  37. $this->content = $content; 
  38.  
  39. /** 
  40. * Returns the premium popup as an HTML string. 
  41. * @param bool $popup Show this message as a popup show it straight away. 
  42. * @return string 
  43. */ 
  44. public function get_premium_message( $popup = true ) { 
  45. // Don't show in Premium. 
  46. if ( defined( 'WPSEO_PREMIUM_FILE' ) ) { 
  47. return ''; 
  48.  
  49. $assets_uri = trailingslashit( plugin_dir_url( WPSEO_FILE ) ); 
  50. $premium_uri = WPSEO_Shortlinker::get( 'https://yoa.st/contact-support' ); 
  51.  
  52. /** translators: %s expands to Yoast SEO Premium */ 
  53. $cta_text = sprintf( __( 'Get %s now!', 'wordpress-seo' ), 'Yoast SEO Premium' ); 
  54. $classes = ''; 
  55. if ( $popup ) { 
  56. $classes = ' hidden'; 
  57. $micro_copy = __( '1 year free updates and upgrades included!', 'wordpress-seo' ); 
  58.  
  59. $popup = <<<EO_POPUP 
  60. <div id="wpseo-{$this->identifier}-popup" class="wpseo-premium-popup wp-clearfix$classes"> 
  61. <img class="alignright wpseo-premium-popup-icon" src="{$assets_uri}images/Yoast_SEO_Icon.svg" width="150" height="150" alt="Yoast SEO"/> 
  62. <{$this->heading_level} id="wpseo-contact-support-popup-title" class="wpseo-premium-popup-title">{$this->title}</{$this->heading_level}> 
  63. {$this->content} 
  64. <a id="wpseo-{$this->identifier}-popup-button" class="button button-primary" href="{$premium_uri}">{$cta_text}</a><br/> 
  65. <small>{$micro_copy}</small> 
  66. </div> 
  67. EO_POPUP; 
  68.  
  69. return $popup;