Ejemplo n.º 1
0
function zerif_pro_notice()
{
    $status = zerif_pro_get_status();
    $admin_url = admin_url("options-general.php");
    $theme_data = wp_get_theme(basename(get_template_directory()));
    if ($status != 'valid') {
        if (zerif_pro_check_activation()) {
            if (zerif_pro_check_hide('activation')) {
                ?>
                <div class="error">
                    <p><strong>No activations left for <?php 
                echo $theme_data->get('Name');
                ?>
  !!!. You need to upgrade your plan in order to use <?php 
                echo $theme_data->get('Name');
                ?>
 on more websites. Please <a href="mailto:friends@themeisle.com">contact</a> the ThemeIsle Staff for more details.</strong>| <a href="<?php 
                echo $admin_url;
                ?>
?zerif_pro_hide_activation=yes">Hide Notice</a></p>
                </div>
                <?php 
                return false;
            }
        }
        ?>
        <?php 
        if (zerif_pro_check_hide('valid')) {
            ?>
            <div class="error">
                <p><strong>You do not have a valid license for <?php 
            echo $theme_data->get('Name');
            ?>
  theme !!!. You can get the license code from your purchase history on <a href="https://themeisle.com/purchase-history" >themeisle.com</a> and validate it <a href="<?php 
            echo admin_url("options-general.php");
            ?>
#zerif_pro_license">here</a> </strong>| <a href="<?php 
            echo $admin_url;
            ?>
?zerif_pro_hide_valid=yes">Hide Notice</a></p>
            </div>
        <?php 
        }
        ?>
    <?php 
    } else {
        if (zerif_pro_check_expiration()) {
            if (zerif_pro_check_hide('expiration')) {
                ?>
                ?>
                <div class="update-nag">
                    <p><strong>Your license is about to expire for <?php 
                echo $theme_data->get('Name');
                ?>
   theme !!!. You can go to  <a href="https://themeisle.com/" >themeisle.com</a> and  renew it.</strong>| <a href="<?php 
                echo $admin_url;
                ?>
?zerif_pro_hide_expiration=yes">Hide Notice</a></p>
                </div>
            <?php 
            }
        }
    }
}
Ejemplo n.º 2
0
function zerif_pro_check_license()
{
    global $wp_version;
    $status = zerif_pro_get_status();
    if ($status != "valid") {
        $license_data = new stdClass();
        $license_data->license = "invalid";
        return $license_data;
    }
    $theme_data = wp_get_theme(basename(get_template_directory()));
    $license = trim(zerif_pro_get_license());
    $api_params = array('edd_action' => 'check_license', 'license' => $license, 'item_name' => urlencode($theme_data->get('Name')), 'url' => home_url());
    // Call the custom API.
    $response = wp_remote_get(add_query_arg($api_params, TI_SL_STORE_URL), array('timeout' => 15, 'sslverify' => false));
    if (is_wp_error($response)) {
        $license_data = new stdClass();
        $license_data->license = "valid";
    } else {
        $license_data = json_decode(wp_remote_retrieve_body($response));
        if (!is_object($license_data)) {
            $license_data = new stdClass();
            $license_data->license = "valid";
        }
    }
    $license_old = get_option('zerif_pro_license_data', '');
    if (isset($license_old->hide_valid)) {
        $license_data->hide_valid = true;
    }
    if (!isset($license_data->key)) {
        $license_data->key = isset($license_old->key) ? $license_old->key : "";
    }
    if (isset($license_old->hide_expiration)) {
        $license_data->hide_expiration = true;
    }
    if (isset($license_old->hide_activation)) {
        $license_data->hide_activation = true;
    }
    return $license_data;
}