Skip to content

Commit

Permalink
v1.8 released
Browse files Browse the repository at this point in the history
  • Loading branch information
amin0_000 authored and amin0_000 committed Aug 7, 2015
1 parent 502f350 commit 86cbca0
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
52 changes: 49 additions & 3 deletions software-license-manager/includes/slm-api-listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ function creation_api_listener() {

SLM_API_Utility::verify_secret_key_for_creation(); //Verify the secret key first.

$slm_debug_logger->log_debug("API - license creation request received.");
$slm_debug_logger->log_debug("API - license creation (slm_create_new) request received.");

//Action hook
do_action('slm_api_listener_slm_create_new');

$fields = array();
if (isset($_REQUEST['license_key']) && !empty($_REQUEST['license_key'])){
Expand Down Expand Up @@ -83,7 +86,10 @@ function activation_api_listener() {

SLM_API_Utility::verify_secret_key(); //Verify the secret key first.

$slm_debug_logger->log_debug("API - license activation request received.");
$slm_debug_logger->log_debug("API - license activation (slm_activate) request received.");

//Action hook
do_action('slm_api_listener_slm_activate');

$fields = array();
$fields['lic_key'] = trim(strip_tags($_REQUEST['license_key']));
Expand Down Expand Up @@ -149,7 +155,10 @@ function deactivation_api_listener() {

SLM_API_Utility::verify_secret_key(); //Verify the secret key first.

$slm_debug_logger->log_debug("API - license deactivation request received.");
$slm_debug_logger->log_debug("API - license deactivation (slm_deactivate) request received.");

//Action hook
do_action('slm_api_listener_slm_deactivate');

if (empty($_REQUEST['registered_domain'])) {
$args = (array('result' => 'error', 'message' => 'Registered domain information is missing'));
Expand Down Expand Up @@ -178,6 +187,43 @@ function deactivation_api_listener() {
function check_api_listener() {
if (isset($_REQUEST['slm_action']) && trim($_REQUEST['slm_action']) == 'slm_check') {
//Handle the license check API query
global $slm_debug_logger;

SLM_API_Utility::verify_secret_key(); //Verify the secret key first.

$slm_debug_logger->log_debug("API - license check (slm_check) request received.");

$fields = array();
$fields['lic_key'] = trim(strip_tags($_REQUEST['license_key']));
$slm_debug_logger->log_debug("License key: " . $fields['lic_key']);

//Action hook
do_action('slm_api_listener_slm_check');

global $wpdb;
$tbl_name = SLM_TBL_LICENSE_KEYS;
$reg_table = SLM_TBL_LIC_DOMAIN;
$key = $fields['lic_key'];
$sql_prep1 = $wpdb->prepare("SELECT * FROM $tbl_name WHERE license_key = %s", $key);
$retLic = $wpdb->get_row($sql_prep1, OBJECT);

$sql_prep2 = $wpdb->prepare("SELECT * FROM $reg_table WHERE lic_key = %s", $key);
$reg_domains = $wpdb->get_results($sql_prep2, OBJECT);
if ($retLic) {//A license key exists
$args = (array(
'result' => 'success',
'message' => 'License key details retrieved.',
'status' => $retLic->lic_status,
'max_allowed_domains' => $retLic->max_allowed_domains,
'email' => $retLic->email,
'registered_domains' => $reg_domains,
));
//Output the license details
SLM_API_Utility::output_api_response($args);
} else {
$args = (array('result' => 'error', 'message' => 'Invalid license key'));
SLM_API_Utility::output_api_response($args);
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions software-license-manager/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: Tips and Tricks HQ, Peter Petreski, Ruhul Amin
Donate link: https://www.tipsandtricks-hq.com/software-license-manager-plugin-for-wordpress
Tags: license key, serial key, manager, license, serial, key, selling, sell, license activation, manage license, software license, software license manager
Requires at least: 3.0
Tested up to: 4.2
Stable tag: 1.7
Tested up to: 4.3
Stable tag: 1.8
License: GPLv2 or later

Create and manage license keys for your software applications easily
Expand All @@ -19,6 +19,7 @@ This plugin is very useful for creating a license server and doing the following
- Check the status of a license key from from your application (remotely)
- Activate a license key from your application (remotely)
- Deactivate a license key (remotely)
- Check a license key (remotely)
- Track where the license key is being used.

You can also create license keys manually from the admin dashboard of this plugin.
Expand All @@ -45,6 +46,11 @@ See the following page:
https://www.tipsandtricks-hq.com/software-license-manager-plugin-for-wordpress

== Changelog ==

= 1.8 =
- Added new hooks before the API query is executed. This allows a developer to override the API query and do custom stuff.
- Added a new API to check the details of an existing license key.

= 1.7 =
* The license key is also included with the response sent to the new license creation request. Below is an example response:
{"result":"success","message":"License successfully created","key":"5580effe188d3"}
Expand Down
4 changes: 2 additions & 2 deletions software-license-manager/slm_bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Software License Manager
Version: v1.7
Version: 1.8
Plugin URI: https://www.tipsandtricks-hq.com/software-license-manager-plugin-for-wordpress
Author: Tips and Tricks HQ
Author URI: https://www.tipsandtricks-hq.com/
Expand All @@ -14,7 +14,7 @@

//Short name/slug "SLM" or "slm"

define('WP_LICENSE_MANAGER_VERSION', "1.7");
define('WP_LICENSE_MANAGER_VERSION', "1.8");
define('WP_LICENSE_MANAGER_DB_VERSION', '1.2');
define('WP_LICENSE_MANAGER_FOLDER', dirname(plugin_basename(__FILE__)));
define('WP_LICENSE_MANAGER_URL', plugins_url('',__FILE__));
Expand Down

0 comments on commit 86cbca0

Please sign in to comment.