Skip to content

Commit 6a5bfbd

Browse files
committed
1.3 - Added support for purchase time and license expiration time
1.3 - Added support for purchase time and license expiration time
1 parent 5e88be7 commit 6a5bfbd

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

Libraries/EnvatoEdgeAPI.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if(!class_exists('EnvatoEdgeAPI')):
1313
class EnvatoEdgeAPI
1414
{
15-
const VERSION = '1.2';
15+
const VERSION = '1.3';
1616
const API_AGENT = 'EnvatoToolkit/%s';
1717

1818
protected $debugMode = 0;
@@ -112,6 +112,7 @@ public function getLicenseDetails($paramPurchaseCode)
112112
* [item_name] => "Great Plugin for Universal Use"
113113
* [item_id] => 5001000
114114
* [created_at] => Tue Jun 09 20:00:00 +1100 2015
115+
* [supported_until] => Tue Jun 09 20:00:00 +1100 2017
115116
* [buyer] => CUSTOMER_ENVATO_USERNAME
116117
* [licence] => Regular License
117118
* )
@@ -153,7 +154,9 @@ public function normalizeLicense(array $paramPurchase, $paramPurchaseCode)
153154
'purchase_code' => sanitize_text_field($paramPurchaseCode),
154155
);
155156
$normalizedLicense['license_purchase_date'] = (new \DateTime($normalizedLicense['license_sold']))->format('Y-m-d');
157+
$normalizedLicense['license_purchase_time'] = (new \DateTime($normalizedLicense['license_sold']))->format('H:i:s');
156158
$normalizedLicense['support_expiration_date'] = (new \DateTime($normalizedLicense['license_supported']))->format('Y-m-d');
159+
$normalizedLicense['support_expiration_time'] = (new \DateTime($normalizedLicense['license_supported']))->format('H:i:s');
157160
if((new \DateTime($normalizedLicense['license_supported']))->getTimestamp() < (new \DateTime('now'))->getTimestamp())
158161
{
159162
// Already expired

Libraries/EnvatoMarketAPI.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if(!class_exists('EnvatoMarketAPI')):
1717
class EnvatoMarketAPI
1818
{
19-
const VERSION = '1.2';
19+
const VERSION = '1.3';
2020
const API_AGENT = 'EnvatoToolkit/%s';
2121

2222
protected $debugMode = 0;
@@ -362,7 +362,9 @@ public function normalizeLicense(array $paramPurchase, $paramBuyerUsername)
362362
'purchase_code' => (!empty($paramPurchase['code']) ? $paramPurchase['code'] : ''),
363363
);
364364
$normalizedLicense['license_purchase_date'] = (new \DateTime($normalizedLicense['license_sold']))->format('Y-m-d');
365+
$normalizedLicense['license_purchase_time'] = (new \DateTime($normalizedLicense['license_sold']))->format('H:i:s');
365366
$normalizedLicense['support_expiration_date'] = (new \DateTime($normalizedLicense['license_supported']))->format('Y-m-d');
367+
$normalizedLicense['support_expiration_time'] = (new \DateTime($normalizedLicense['license_supported']))->format('H:i:s');
366368
if((new \DateTime($normalizedLicense['license_supported']))->getTimestamp() < (new \DateTime('now'))->getTimestamp())
367369
{
368370
// Already expired

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ $view->targetPurchaseCode = esc_html($sanitizedTargetPurchaseCode); // Ready for
302302
$view->isValidTargetLicense = $objToolkit->isValidLicense($sanitizedTargetPurchaseCode);
303303
$view->targetLicenseBuyer = $targetLicenseDetails['buyer_username'];
304304
$view->targetLicenseType = $targetLicenseDetails['license_type'];
305-
$view->targetLicensePurchaseDate = $targetLicenseDetails['license_purchase_date'];
306-
$view->targetLicenseSupportExpiration = $targetLicenseDetails['support_expiration_date'];
305+
$view->targetLicensePurchaseDate = $targetLicenseDetails['license_purchase_date'].' '.$targetLicenseDetails['license_purchase_time'];
306+
$view->targetLicenseSupportExpiration = $targetLicenseDetails['support_expiration_date'].' '.$targetLicenseDetails['support_expiration_time'];
307307
$view->targetLicenseSupportActive = $targetLicenseDetails['support_active'];
308308
309309
// 2. Details About Target Envato User
@@ -369,6 +369,9 @@ So there is no need to save your head revision number or last version on your se
369369

370370
## Changelog ##
371371

372+
### 1.3 ###
373+
* Added support for purchase time and license expiration time.
374+
372375
### 1.2 ###
373376
* Added support for the situations if Envato API is down, plus added detailed error message handler.
374377

@@ -381,6 +384,9 @@ So there is no need to save your head revision number or last version on your se
381384

382385
## Upgrade Notice ##
383386

387+
### 1.3 ###
388+
* Just drag and drop new code folder.
389+
384390
### 1.2 ###
385391
* Just drag and drop new code folder.
386392

824 Bytes
Loading

Test/EnvatoAPIManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
{
101101
$targetLicenseBuyer = $targetLicenseDetails['buyer_username'];
102102
$targetLicenseType = $targetLicenseDetails['license_type'];
103-
$targetLicensePurchaseDate = $targetLicenseDetails['license_purchase_date'];
104-
$targetLicenseSupportExpiration = $targetLicenseDetails['support_expiration_date'];
103+
$targetLicensePurchaseDate = $targetLicenseDetails['license_purchase_date'].' '.$targetLicenseDetails['license_purchase_time'];
104+
$targetLicenseSupportExpiration = $targetLicenseDetails['support_expiration_date'].' '.$targetLicenseDetails['support_expiration_time'];
105105
$targetLicenseSupportActive = $targetLicenseDetails['support_active'];
106106
} else
107107
{

0 commit comments

Comments
 (0)