示例#1
0
function x_addons_theme_activation_redirect()
{
    if (isset($_GET['activated'])) {
        wp_redirect(x_addons_get_link_home());
    }
}
function x_addons_page_product_validation()
{
    ?>

  <div class="wrap x-addons-product-validation">

    <header class="x-addons-header">
      <h2>Product Validation</h2>
      <?php 
    if (x_is_validated()) {
        ?>
        <p>Yay! Automatic updates are up and running. You're also welcome to <a href="<?php 
        echo x_addons_get_link_extensions();
        ?>
">browse and install Extensions</a>.</p>
      <?php 
    } else {
        ?>
        <p>Enter your API key to validate your purchase, receive automatic updates, and unlock Extension.</p>
      <?php 
    }
    ?>
    </header>

    <div class="x-addons-postbox product-validation">
      <?php 
    x_addons_product_validation();
    ?>
      <?php 
    $name = x_addons_get_api_key_option_name();
    ?>
      <?php 
    $key = get_option($name);
    ?>
      <div class="inside">
        <form method="post" enctype="multipart/form-data">
          <?php 
    wp_nonce_field('x-addons-product-validation');
    ?>
          <input name="<?php 
    echo $name;
    ?>
" id="<?php 
    echo $name;
    ?>
" class="large-text<?php 
    echo x_is_validated() ? ' x-input-success' : '';
    ?>
" type="text" value="<?php 
    echo !empty($key) ? $key : '';
    ?>
">
          <input name="x_addons_product_validation_submitted" type="hidden" value="submitted">
          <p class="submit">
            <input type="submit" name="validate" class="button button-primary" value="<?php 
    echo x_is_validated() ? 'Update API Key' : 'Submit API Key';
    ?>
">
          </p>
        </form>
      </div>
    </div>
    <p class="x-product-validation-info">Visit the <a href="<?php 
    echo x_addons_get_link_home();
    ?>
">Addons Home</a> to learn how to find your API key. <span class="dashicons dashicons-admin-network"></span></p>

  </div>

<?php 
}
 public static function get_validation_html_plugin_update_error()
 {
     return sprintf(__('X is not validated. <a href="%s">Validate X to enable automatic updates.</a>', '__x__'), x_addons_get_link_home());
 }