html-settings-updates.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. // vars
  3. $active = $license ? true : false;
  4. $nonce = $active ? 'deactivate_pro_license' : 'activate_pro_license';
  5. $button = $active ? __( 'Deactivate License', 'acf' ) : __( 'Activate License', 'acf' );
  6. $readonly = $active ? 1 : 0;
  7. ?>
  8. <div class="wrap acf-settings-wrap acf-updates">
  9. <h1><?php _e( 'Updates', 'acf' ); ?></h1>
  10. <div class="acf-box" id="acf-license-information">
  11. <div class="title">
  12. <h3><?php _e( 'License Information', 'acf' ); ?></h3>
  13. </div>
  14. <div class="inner">
  15. <?php if ( $is_defined_license ) { ?>
  16. <p>
  17. <?php echo acf_esc_html( apply_filters( 'acf/admin/license_key_constant_message', __( 'Your license key is defined in wp-config.php.', 'acf' ) ) ); ?>
  18. </p>
  19. <?php if ( ! $active ) { ?>
  20. <form action="" method="post">
  21. <?php acf_nonce_input( 'acf_delete_activation_transient' ); ?>
  22. <input type="submit" value="<?php echo esc_attr( __( 'Retry Activation', 'acf' ) ); ?>" class="button button-primary">
  23. </form>
  24. <?php } ?>
  25. <?php } else { ?>
  26. <p><?php printf( __( 'To unlock updates, please enter your license key below. If you don\'t have a licence key, please see <a href="%s" target="_blank">details & pricing</a>.', 'acf' ), acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'license activations' ) ); ?></p>
  27. <form action="" method="post" class="acf-activation-form">
  28. <?php acf_nonce_input( $nonce ); ?>
  29. <label for="acf-field-acf_pro_license"><?php _e( 'License Key', 'acf' ); ?></label>
  30. <?php
  31. // render field
  32. acf_render_field(
  33. array(
  34. 'type' => 'text',
  35. 'name' => 'acf_pro_license',
  36. 'value' => str_repeat( '*', strlen( $license ) ),
  37. 'readonly' => $readonly,
  38. )
  39. );
  40. ?>
  41. <input type="submit" value="<?php echo esc_attr( $button ); ?>" class="acf-btn">
  42. </form>
  43. <?php } ?>
  44. </div>
  45. </div>
  46. <div class="acf-box" id="acf-update-information">
  47. <div class="title">
  48. <h3><?php _e( 'Update Information', 'acf' ); ?></h3>
  49. </div>
  50. <div class="inner">
  51. <table class="form-table">
  52. <tbody>
  53. <tr>
  54. <th>
  55. <label><?php _e( 'Current Version', 'acf' ); ?></label>
  56. </th>
  57. <td>
  58. <?php echo esc_html( $current_version ); ?>
  59. </td>
  60. </tr>
  61. <tr>
  62. <th>
  63. <label><?php _e( 'Latest Version', 'acf' ); ?></label>
  64. </th>
  65. <td>
  66. <?php echo esc_html( $remote_version ); ?>
  67. </td>
  68. </tr>
  69. <tr>
  70. <th>
  71. <label><?php _e( 'Update Available', 'acf' ); ?></label>
  72. </th>
  73. <td>
  74. <?php if ( $update_available ) : ?>
  75. <span style="margin-right: 5px;"><?php _e( 'Yes', 'acf' ); ?></span>
  76. <?php else : ?>
  77. <span style="margin-right: 5px;"><?php _e( 'No', 'acf' ); ?></span>
  78. <?php endif; ?>
  79. </td>
  80. </tr>
  81. <?php if ( $upgrade_notice ) : ?>
  82. <tr>
  83. <th>
  84. <label><?php _e( 'Upgrade Notice', 'acf' ); ?></label>
  85. </th>
  86. <td>
  87. <?php echo acf_esc_html( $upgrade_notice ); ?>
  88. </td>
  89. </tr>
  90. <?php endif; ?>
  91. </tbody>
  92. </table>
  93. <?php if ( $changelog ) : ?>
  94. <div class="acf-update-changelog">
  95. <?php echo acf_esc_html( $changelog ); ?>
  96. </div>
  97. <?php endif; ?>
  98. <?php if ( $update_available ) : ?>
  99. <?php if ( $license_error ) : ?>
  100. <a class="button" disabled="disabled" href="#"><?php _e( 'Please reactivate your license to unlock updates', 'acf' ); ?></a>
  101. <?php elseif ( $active ) : ?>
  102. <a class="acf-btn" href="<?php echo esc_attr( admin_url( 'plugins.php?s=Advanced+Custom+Fields+Pro' ) ); ?>"><?php _e( 'Update Plugin', 'acf' ); ?></a>
  103. <?php else : ?>
  104. <a class="button" disabled="disabled" href="#"><?php _e( 'Enter your license key to unlock updates', 'acf' ); ?></a>
  105. <?php endif; ?>
  106. <?php else : ?>
  107. <a class="acf-btn acf-btn-secondary" href="<?php echo esc_attr( add_query_arg( 'force-check', 1 ) ); ?>"><?php _e( 'Check For Updates', 'acf' ); ?></a>
  108. <?php endif; ?>
  109. </div>
  110. </div>
  111. </div>
  112. <style type="text/css">
  113. #acf_pro_license {
  114. width: 75%;
  115. }
  116. #acf-update-information td h4 {
  117. display: none;
  118. }
  119. </style>