GF_Installation_Wizard_Step_License_Key

The Gravity Forms GF Installation Wizard Step License Key class.

Defined (1)

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

/includes/wizard/steps/class-gf-installation-wizard-step-license-key.php  
  1. class GF_Installation_Wizard_Step_License_Key extends GF_Installation_Wizard_Step { 
  2. public $required = true; 
  3.  
  4. protected $_name = 'license_key'; 
  5.  
  6. public $defaults = array( 
  7. 'license_key' => '',  
  8. 'accept_terms' => false,  
  9. ); 
  10.  
  11. function display() { 
  12.  
  13. if ( ! $this->license_key && defined( 'GF_LICENSE_KEY' ) ) { 
  14. $this->license_key = GF_LICENSE_KEY; 
  15.  
  16. ?> 
  17. <p> 
  18. <?php echo sprintf( esc_html__( 'Enter your Gravity Forms License Key below. Your key unlocks access to automatic updates, the add-on installer, and support. You can find your key on the My Account page on the %sGravity Forms%s site.', 'gravityforms' ), '<a href="http://www.gravityforms.com">', '</a>' ); ?> 
  19.  
  20. </p> 
  21. <div> 
  22. <input type="text" class="regular-text" id="license_key" value="<?php echo esc_attr( $this->license_key ); ?>" name="license_key" placeholder="<?php esc_attr_e('Enter Your License Key', 'gravityforms'); ?>" /> 
  23. <?php 
  24. $key_error = $this->validation_message( 'license_key', false ); 
  25. if ( $key_error ) { 
  26. echo $key_error; 
  27. ?> 
  28. </div> 
  29.  
  30. <?php 
  31. $message = $this->validation_message( 'accept_terms', false ); 
  32. if ( $message || $key_error || $this->accept_terms ) { 
  33. ?> 
  34. <p> 
  35. <?php esc_html_e( "If you don't enter a valid license key, you will not be able to update Gravity Forms when important bug fixes and security enhancements are released. This can be a serious security risk for your site.", 'gravityforms' ); ?> 
  36. </p> 
  37. <div> 
  38. <label> 
  39. <input type="checkbox" id="accept_terms" value="1" <?php checked( 1, $this->accept_terms ); ?> name="accept_terms" /> 
  40. <?php esc_html_e( 'I understand the risks', 'gravityforms' ); ?> <span class="gfield_required">*</span> 
  41. </label> 
  42. <?php echo $message ?> 
  43. </div> 
  44. <?php 
  45.  
  46. function get_title() { 
  47. return esc_html__( 'License Key', 'gravityforms' ); 
  48.  
  49. function validate() { 
  50.  
  51. $this->is_valid_key = true; 
  52. $license_key = $this->license_key; 
  53.  
  54. if ( empty ( $license_key ) ) { 
  55. $message = esc_html__( 'Please enter a valid license key.', 'gravityforms' ) . '</span>'; 
  56. $this->set_field_validation_result( 'license_key', $message ); 
  57. $this->is_valid_key = false; 
  58. } else { 
  59. $key_info = GFCommon::get_key_info( $license_key ); 
  60. if ( empty( $key_info ) || ( ! $key_info['is_active'] ) ) { 
  61. $message = " <i class='fa fa-times gf_keystatus_invalid'></i> <span class='gf_keystatus_invalid_text'>" . __( 'Invalid or Expired Key : Please make sure you have entered the correct value and that your key is not expired.', 'gravityforms' ) . '</span>'; 
  62. $this->set_field_validation_result( 'license_key', $message ); 
  63. $this->is_valid_key = false; 
  64.  
  65. if ( ! $this->is_valid_key && ! $this->accept_terms ) { 
  66. $this->set_field_validation_result( 'accept_terms', __( 'Please accept the terms', 'gravityforms' ) ); 
  67.  
  68. $valid = $this->is_valid_key || ( ! $this->is_valid_key && $this->accept_terms ); 
  69. return $valid; 
  70.  
  71. function install() { 
  72. if ( $this->license_key ) { 
  73. $key = trim( $this->license_key ); 
  74. update_option( 'rg_gforms_key', md5( $key ) ); 
  75.  
  76. $version_info = GFCommon::get_version_info( false ); 
  77.  
  78. function get_previous_button_text() { 
  79. return ''; 
  80.