Skip to content

Commit

Permalink
Added: new icons to manage license interface.
Browse files Browse the repository at this point in the history
Improved: export functionality in manage license page
Added: activation email - the user will get notified once the license key is activated
Added: icon thumbnails to api response (for domain and devices)
Added: slm_info action to api (when called it only returns license information it ignores domains and devices)
Added: Conflict mode tweak (if un-checked it will remove the bootstrap library)

Signed-off-by: Michel Velis <michel@epikly.com>
  • Loading branch information
michelve committed Apr 27, 2020
1 parent 073b735 commit 1f672fc
Show file tree
Hide file tree
Showing 12 changed files with 933 additions and 129 deletions.
98 changes: 61 additions & 37 deletions admin/slm-add-licenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ function slm_add_licenses_menu()

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

<?php
if(SLM_Helper_Class::slm_get_option('slm_conflictmode') == 1){
echo '<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>';
}
?>


<style>
.wp-admin select {
Expand Down Expand Up @@ -299,7 +305,14 @@ function slm_add_licenses_menu()
<div class="tab-content col-md-12" id="slm_manage_licenseContent">
<div class="tab-pane fade show active" id="license" role="tabpanel" aria-labelledby="license-tab">
<div class="license col-full">
<h3><?php _e('License key and status');?></h3>

<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'locked.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('License key and status');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>

<div class="form-group">
<label for="license_key"><?php _e('License Key');?></label>
<input name="license_key" class="form-control" aria-describedby="licInfo" type="text" id="license_key" value="<?php echo $license_key; ?>" readonly />
Expand Down Expand Up @@ -350,7 +363,14 @@ function slm_add_licenses_menu()

<div class="tab-pane fade show" id="userinfo" role="tabpanel" aria-labelledby="userinfo-tab">
<div class="col-full">
<h3><?php _e('User Information');?></h3>

<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'circle-09.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('User Information');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>

<div class="row">
<div class="form-group col-md-6">
<label for="first_name"><?php _e('First Name');?></label>
Expand Down Expand Up @@ -399,7 +419,13 @@ function slm_add_licenses_menu()

<div class="tab-pane fade show " id="devicesinfo" role="tabpanel" aria-labelledby="devicesinfo-tab">
<div class="devicesinfo col-full">
<h3><?php _e('Allowed Activations');?></h3>
<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'l-system-update.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('Allowed Activations');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>

<div class="row">
<div class="form-group col-md-6">
<label for="max_allowed_domains"><?php _e('Maximum Allowed Domains');?></label>
Expand Down Expand Up @@ -483,7 +509,13 @@ function slm_add_licenses_menu()
<div class="tab-pane fade show " id="transaction" role="tabpanel" aria-labelledby="transaction-tab">

<div class="col-full">
<h3>Advanced Details</h3>
<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'detail.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('Advanced Details');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>

<div class="form-group">
<label for="order_date">Manual Reset Count</label>
<input name="manual_reset_count" class="form-control" type="text" id="manual_reset_count" value="<?php echo $reset_count; ?>" />
Expand Down Expand Up @@ -537,7 +569,13 @@ function slm_add_licenses_menu()
<div class="tab-pane fade show " id="productinfo" role="tabpanel" aria-labelledby="productinfo-tab">

<div class="col-full">
<h3>Product Information</h3>
<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'box-2.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('Product Informations');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>

<div class="form-group">
<label for="product_ref">Product</label>
<input name="product_ref" class="form-control" type="text" id="product_ref" value="<?php echo $product_ref; ?>" />
Expand Down Expand Up @@ -585,49 +623,35 @@ function slm_add_licenses_menu()
if (isset($_GET['edit_record']) && !empty($_GET['edit_record'])) : ?>
<div class="tab-pane fade show " id="export-license" role="tabpanel" aria-labelledby="export-license-tab">

<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'share-right.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('Export License');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>

<div class="export-license col-full">
<div class="license_export_info" style="min-width: 100%; max-width: 900px">
<?php
$api_params = array(
'slm_action' => 'slm_check',
'secret_key' => SLM_Helper_Class::slm_get_option('lic_verification_secret'),
'license_key' => $license_key,
);
// Send query to the license manager server
$response = wp_remote_get(add_query_arg($api_params, SLM_SITE_URL), array('timeout' => 20, 'sslverify' => false));

$data = $response['body'];

// parsing json
$arr = json_decode($data, true);

// removing the value
unset($arr['result']);
unset($arr['code']);
unset($arr['message']);

// and back to json
$response = utf8_encode(json_encode($arr, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
echo '<figure class="highlight"><pre><code id="lic-json-data" data-lickey="'.$license_key.'">' . $response . '</code></pre></figure>';
$lic_info = SLM_Utility::slm_get_licinfo ('slm_info', $license_key);

echo '<figure class="highlight"><pre><code id="lic-json-data" data-lickey="'.$license_key.'">' . json_encode($lic_info, JSON_PRETTY_PRINT) . '</code></pre></figure>';
?>
<a href="#" class="button-secondary" onclick="slm_exportlicense()">Export License</a>
</div>
</div>

</div>

<div class="tab-pane fade show " id="activity-log" role="tabpanel" aria-labelledby="activity-log-tab">

<div class="activity-log col-full">
<div class="lic-activity-log" style="min-height: 325px; min-width: 100%; max-width: 900px">
<?php
SLM_Utility::get_lic_activity($license_key);
?>

</div>
<div class="slm-img-ico">
<img src="<?php echo SLM_Utility::slm_get_icon_url('1x', 'server-rack.png');?>" alt="">
</div>
<h3 class="slm-tab-title"><?php _e('Activity Log');?></h3>
<div class="clear clear-fix"></div>
<div class="sml-sep"></div>
<div class="lic-activity-log" style="min-height: 325px; min-width: 100%; max-width: 900px">
<?php SLM_Utility::get_lic_activity($license_key); ?>
</div>

</div>
<?php endif; ?>

Expand Down
26 changes: 14 additions & 12 deletions admin/slm-lic-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
die;
}

function slm_settings_menu()
{
function slm_settings_menu(){
slm_general_settings();
}

function slm_general_settings()
{

function slm_general_settings(){
?>
<?php

Expand Down Expand Up @@ -45,17 +42,15 @@ function slm_general_settings()
'slm_woo' => isset($_POST['slm_woo']) ? '1' : '',
'slm_woo_downloads' => isset($_POST['slm_woo_downloads']) ? '1' : '',
'slm_stats' => isset($_POST['slm_stats']) ? '1' : '',
'slm_adminbar' => isset($_POST['slm_adminbar']) ? '1' : '',
'slm_adminbar' => isset($_POST['slm_adminbar']) ? '1' : '',
'slm_conflictmode' => isset($_POST['slm_conflictmode']) ? '1' : '',
'slm_wpestores' => isset($_POST['slm_wpestores']) ? '1' : '',
'slm_dl_manager' => isset($_POST['slm_dl_manager']) ? '1' : '',
'expiration_reminder_text' => sanitize_text_field($_POST['expiration_reminder_text'])
);
update_option('slm_plugin_options', $options);

echo '
<div id="message" class="updated fade">
<p>Options Updated!</p>
</div>';
echo ' <div id="message" class="updated fade"> <p>Options Updated!</p> </div>';
}

$options = get_option('slm_plugin_options');
Expand All @@ -78,7 +73,7 @@ function slm_general_settings()
$tab = 'general_settings';
}

?>
?>
<div class="wrap">
<h1>Settings - Software License Manager </h1>

Expand Down Expand Up @@ -174,6 +169,14 @@ function slm_general_settings()
<input name="slm_adminbar" type="checkbox" <?php if ($options['slm_adminbar'] != '') echo ' checked="checked"'; ?> value="1" />
<?php _e('Disable stats in licenses overview page.', 'softwarelicensemanager'); ?></td>
</tr>

<tr>
<th scope="row"></th>
<td>
<input name="slm_conflictmode" type="checkbox" <?php if ($options['slm_conflictmode'] != '') echo ' checked="checked"'; ?> value="1" />
<?php _e('Enable Bootstrap javascript libray.', 'softwarelicensemanager'); ?></td>
</tr>

</table>
</div>

Expand Down Expand Up @@ -245,6 +248,5 @@ function slm_general_settings()
</div>
</form>
</div>

<?php
}
1 change: 1 addition & 0 deletions includes/class-slm-installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
'slm_woo_downloads' => '',
'slm_stats' => '1',
'slm_adminbar' => '1',
'slm_conflictmode' => '1',
'enable_auto_key_expiration' => '1',
'slm_dl_manager' => '',
'expiration_reminder_text' => 'Your account has reverted to Basic with limited functionality. Renew today to keep using it on all of your devices and enjoy the valuable features. It鈥檚 a smart investment');
Expand Down
Loading

0 comments on commit 1f672fc

Please sign in to comment.