Skip to content

Commit 452c952

Browse files
authored
Merge pull request #2 from kestrelwp/release/2.9.3
Release 2.9.3
2 parents a1c83d7 + 6714311 commit 452c952

File tree

4 files changed

+45
-38
lines changed

4 files changed

+45
-38
lines changed

changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
*** WooCommerce API Manager PHP Library for Plugins and Themes Changelog ***
22

3+
2024.04.26 - version 2.9.3
4+
* Tweak: Update brand to Kestrel
5+
* Fix: Fix PHP warnings for certain failed update checks
6+
37
2024.03.18 - version 2.9.2
8+
* Fix: Set instance ID property after generating it
9+
* New: Add wc_am_api_key_field_value filter to allow setting a default API key
10+
* New: Add activate_new_key() method for programmatic activation of a new key
411

512
2023.08.14 - version 2.9.1
613
* Fix: Process custom menu array using if > elseif > else rather than switch to fix PHP notices: Undefined index, Undefined array key.

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
See documentation at
22

3-
https://www.toddlahman.com/woocommerce-api-manager-php-library-for-plugins-and-themes-documentation/
3+
https://kestrelwp.com/docs/woocommerce-api-manager-php-library-for-plugins-and-themes-documentation/

wc-am-client.php

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
<?php
2-
32
/**
4-
* The WooCommerce API Manager PHP Client Library is designed to be droppped into a WordPress plugin or theme.
5-
* This version is designed to be used with the WooCommerce API Manager version 2.x.
3+
* WooCommerce API Manager PHP Client Library
4+
*
5+
* Designed to be used with WooCommerce API Manager 2.x, and dropped into a WordPress plugin or theme.
6+
*
7+
* This source file is subject to the GNU General Public License v3.0
8+
* that is bundled with this plugin in the file license.txt
69
*
7-
* Intellectual Property rights, and copyright, reserved by Todd Lahman, LLC as allowed by law include,
8-
* but are not limited to, the working concept, function, and behavior of this software,
9-
* the logical code structure and expression as written.
10+
* Please do not modify this file if you want to upgrade the SDK to newer
11+
* versions in the future. If you want to customize the SDK for your needs,
12+
* please review our developer documentation at https://kestrelwp.com/docs/woocommerce-api-manager-php-library-for-plugins-and-themes-documentation/
13+
* and join our developer program at https://kestrelwp.com/developers
1014
*
11-
* @version 2.9.2
12-
* @author Todd Lahman LLC https://www.toddlahman.com/
13-
* @copyright Copyright (c) Todd Lahman LLC ([email protected])
14-
* @package WooCommerce API Manager plugin and theme library
15-
* @license Copyright Todd Lahman LLC
15+
* @version 2.9.3
16+
* @author Kestrel
17+
* @copyright Copyright (c) 2013-2024 Kestrel
18+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
1619
*/
1720

1821
defined( 'ABSPATH' ) || exit;
1922

20-
if ( ! class_exists( 'WC_AM_Client_2_9_2' ) ) {
21-
class WC_AM_Client_2_9_2 {
23+
if ( ! class_exists( 'WC_AM_Client_2_9_3' ) ) {
24+
class WC_AM_Client_2_9_3 {
2225

2326
/**
2427
* Class args
@@ -718,14 +721,14 @@ public function wc_am_activation_info() {
718721
$live_status = json_decode( $this->status(), true );
719722
$line_break = wp_kses_post( '<br>' );
720723

721-
if ( ! empty( $live_status ) && $live_status[ 'success' ] == false ) {
724+
if ( ! empty( $live_status ) && isset( $live_status['success'] ) && $live_status[ 'success' ] == false ) {
722725
echo esc_html( 'Error: ' . $live_status[ 'data' ][ 'error' ] );
723726
}
724727

725728
if ( $this->get_api_key_status() ) {
726729
$result_success = get_option( 'wc_am_' . $this->product_id . '_activate_success' );
727730

728-
if ( ! empty( $live_status ) && $live_status[ 'status_check' ] == 'active' ) {
731+
if ( ! empty( $live_status ) && isset( $live_status['status_check'] ) && $live_status[ 'success' ] == 'active' ) {
729732
echo esc_html( 'Activations purchased: ' . $live_status[ 'data' ][ 'total_activations_purchased' ] );
730733
echo $line_break;
731734
echo esc_html( 'Total Activations: ' . $live_status[ 'data' ][ 'total_activations' ] );
@@ -736,7 +739,7 @@ public function wc_am_activation_info() {
736739
} else {
737740
echo '';
738741
}
739-
} elseif ( ! $this->get_api_key_status() && ! empty( $live_status ) && $live_status[ 'status_check' ] == 'inactive' ) {
742+
} elseif ( ! $this->get_api_key_status() && ! empty( $live_status ) && isset( $live_status['status_check'] ) && $live_status[ 'status_check' ] == 'inactive' ) {
740743
echo esc_html( 'Activations purchased: ' . $live_status[ 'data' ][ 'total_activations_purchased' ] );
741744
echo $line_break;
742745
echo esc_html( 'Total Activations: ' . $live_status[ 'data' ][ 'total_activations' ] );
@@ -1181,7 +1184,7 @@ public function update_check( $transient ) {
11811184
add_settings_error( 'wc_am_client_error_text', 'wc_am_client_error', "{$response['data']['error']}", 'error' );
11821185
}
11831186

1184-
if ( $response !== false && $response[ 'success' ] === true ) {
1187+
if ( $response !== false && isset( $response['success'] ) && $response['success'] === true ) {
11851188
// New plugin version from the API
11861189
$new_ver = (string) $response[ 'data' ][ 'package' ][ 'new_version' ];
11871190
// Current installed plugin version
@@ -1216,7 +1219,7 @@ public function update_check( $transient ) {
12161219
}
12171220

12181221
/**
1219-
* API request for informatin.
1222+
* API request for information.
12201223
*
12211224
* If `$action` is 'query_plugins' or 'plugin_information', an object MUST be passed.
12221225
* If `$action` is 'hot_tags` or 'hot_categories', an array should be passed.

wc-api-manager-php-library.php

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@
22

33
/**
44
* Plugin Name: WooCommerce API Manager PHP Library for Plugins and Themes Example
5-
* Plugin URI: https://toddlahman.com/shop/woocommerce-api-manager-php-library-for-plugins-and-themes/
5+
* Plugin URI: https://kestrelwp.com/product/woocommerce-api-manager-php-library-for-plugins-and-themes/
66
* Description: Drop the wc-am-client.php library into a plugin or theme, and use the example code below after line 26.
7-
* Version: 2.9.1
8-
* Author: Todd Lahman LLC
9-
* Author URI: https://www.toddlahman.com/
10-
* License: Copyright Todd Lahman LLC
7+
* Version: 2.9.3
8+
* Author: Kestrel
9+
* Author URI: https://kestrelwp.com
1110
*
12-
* Intellectual Property rights, and copyright, reserved by Todd Lahman, LLC as allowed by law include,
13-
* but are not limited to, the working concept, function, and behavior of this library,
14-
* the logical code structure and expression as written.
11+
* Copyright: (c) 2023-2024 Kestrel [[email protected]]
1512
*
1613
* @package WooCommerce API Manager Library for plugin or theme
17-
* @author Todd Lahman LLC
14+
* @author Kestrel
1815
* @category Plugin/Theme/library
19-
* @copyright Copyright (c) Todd Lahman LLC
16+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
2017
*/
2118

2219
// Exit if accessed directly
@@ -29,7 +26,7 @@
2926
*/
3027

3128
// Load WC_AM_Client class if it exists.
32-
if ( ! class_exists( 'WC_AM_Client_2_9_1' ) ) {
29+
if ( ! class_exists( 'WC_AM_Client_2_9_3' ) ) {
3330
/*
3431
* |---------------------------------------------------------------------
3532
* | This must be exactly the same for both plugins and themes.
@@ -39,7 +36,7 @@
3936
}
4037

4138
// Instantiate WC_AM_Client class object if the WC_AM_Client class is loaded.
42-
if ( class_exists( 'WC_AM_Client_2_9_1' ) ) {
39+
if ( class_exists( 'WC_AM_Client_2_9_3' ) ) {
4340
/**
4441
* This file is only an example that includes a plugin header, and this code used to instantiate the client object. The variable $wcam_lib
4542
* can be used to access the public properties from the WC_AM_Client class, but $wcam_lib must have a unique name. To find data saved by
@@ -57,17 +54,17 @@
5754
* @param int $product_id (Optional, can be an empty string) Must match the Product ID number (integer) in the product if set.
5855
* @param string $software_version This product's current software version.
5956
* @param string $plugin_or_theme 'plugin' or 'theme'
60-
* @param string $api_url The URL to the site that is running the API Manager. Example: https://www.toddlahman.com/ Must be the root URL.
57+
* @param string $api_url The URL to the site that is running the API Manager. Example: https://kestrelwp.com/ Must be the root URL.
6158
* @param string $software_title The name, or title, of the product. The title is not sent to the API Manager APIs, but is used for menu titles.
6259
* @param string $text Text Domain.
6360
*
6461
* Example:
6562
*
66-
* $wcam_lib = new WC_AM_Client_2_9_1( $file, $product_id, $software_version, $plugin_or_theme, $api_url, $software_title );
63+
* $wcam_lib = new WC_AM_Client_2_9_3( $file, $product_id, $software_version, $plugin_or_theme, $api_url, $software_title );
6764
*/
6865

6966
// Default menu Theme example.
70-
//$wcam_lib = new WC_AM_Client_2_9_1( __FILE__, 234, '1.0', 'theme', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
67+
//$wcam_lib = new WC_AM_Client_2_9_3( __FILE__, 234, '1.0', 'theme', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
7168

7269
/*
7370
* Default Menu Plugin example.
@@ -83,13 +80,13 @@
8380
* with a different Product ID, then do not set the Product ID here.
8481
*/
8582

86-
//$wcam_lib = new WC_AM_Client_2_9_1( __FILE__, 32960, '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
87-
$wcam_lib = new WC_AM_Client_2_9_1( __FILE__, '', '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes', 'wc-am-text' );
83+
//$wcam_lib = new WC_AM_Client_2_9_3( __FILE__, 32960, '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
84+
$wcam_lib = new WC_AM_Client_2_9_3( __FILE__, '', '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes', 'wc-am-text' );
8885

8986
/**
9087
* Custom top level or top level submenu.
9188
*
92-
* Last argument to the WC_AM_Client_2_9_1 class is to prevent the not activated yet admin message from being displayed, which may not be necessary with a custom menu.
89+
* Last argument to the WC_AM_Client_2_9_3 class is to prevent the not activated yet admin message from being displayed, which may not be necessary with a custom menu.
9390
*
9491
* Example using add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null );
9592
*
@@ -108,5 +105,5 @@
108105

109106
// $wcam_lib_custom_menu = array( 'menu_type' => 'add_submenu_page', 'parent_slug' => 'my-plugin.php', 'page_title' => 'My Plugin License Activation', 'menu_title' => 'API Key' );
110107

111-
// $wcam_lib = new WC_AM_Client_2_9_1( __FILE__, 168804, '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes', 'wc-am-text', $wcam_lib_custom_menu, false );
108+
// $wcam_lib = new WC_AM_Client_2_9_3( __FILE__, 168804, '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes', 'wc-am-text', $wcam_lib_custom_menu, false );
112109
}

0 commit comments

Comments
 (0)