awesomemotive / edd-license-handler Goto Github PK
View Code? Open in Web Editor NEWLicense / updater handler for Easy Digital Downloads extensions
License / updater handler for Easy Digital Downloads extensions
I'm new to EDD but I understood that this code (the updater) is presumed in add ons using the EDD-SL system.
Wouldn't it be easier to include this code in a third party add-on/plugin if you supported composer?
In this way I can keep your EDD_License separate from my code, include it using composer autoloader and if you update it, I don't need cut & paste over and over again - of course if one is not using composer can still include the code by copy/paste
All you need to do is add a composer.json and add this to packagist.org
hi @pippinsplugins
Please pass current version number when activate or check plugin and add a feature in your software licensing plugin where can capture this version. That way we can see which website using which version of our premium plugin. That can be shown for every license also in license table in wp admin. This will be very useful for keeping our premium plugin fresh. we will know which older version users are using, so that we can remove some code also.
Right now this Repo could be packaged with a Plugin to sell on an EDD Store to ensure the necessary Classes exist, but not a Theme. Having the Theme Updater class here could be convenient.
We need to stop using wp_remote_post. It will not work for sites with curl disabled.
We should use wp_remote_get instead.
I'd like to see the class EDD_License
made more reusable so that we can easily adjust the method auto_updater
update URL with our own. Then in turn, integrating EDD Software Licensing becomes really a quick affair.
To make class EDD_License
extensible, I think simply changing private function auto_updater
to protected function auto_updater
will suffice. Then we can create simple extensions class with our own update URL.
Therefore, in then in my plugin I do…
include_once dirname( __FILE__ ) . '/lib/TWP_License_Handler.php';
$eddsr_license = new TWP_License( __FILE__, 'Testimonials Widget Premium', Testimonials_Widget_Premium::VERSION, 'Michael Cannon' );
File TWP_License_Handler.php
looks like…
class TWP_License extends EDD_License {
protected function auto_updater() {
// Setup the updater
$edd_updater = new EDD_SL_Plugin_Updater( 'https://example.com', $this->file, array(
'version' => $this->version,
'license' => $this->license,
'item_name' => $this->item_name,
'author' => $this->author
)
);
}
}
Hi,
I'm getting this error on WooCommerce 3 System Status Page.
Warning: Invalid argument supplied for foreach() in \wp-content\plugins\my-plugin\lib\EDD_SL_Plugin_Updater.php on line 282
What's the reason behind setting sslverify
to false when activating and deactivating a license?
Ideally sslverify
should never be set to false because it does not verify the remote server's SSL certificate. If there are server compatibility reasons for doing this, I'd love to hear them!
Is the EDD_SL_Plugin_Updater.php
present in this repo the latest one or the one present inside the edd-sample-plugin.zip that is part of Software Licensing addon the latest one?
I see that there are some changes that are in the file that is present in this repo that are not available in the one that is part of the sample plugin. But the version number of the class in the sample plugin is 1.6.2 while the version of the file present in this repo is just 1.6
It will be really nice if the latest version of EDD_SL_Plugin_Updater.php
is available in a github repo so that we can easily pull the latest version as part of our plugin's build process.
When a user has provided a valid license key, they'll see a prompt to update the plugin when there's a new version available.
However, if the domain isn't registered to the license key, they'll see this cryptic error when they try to update:
It would be better to intercept the user earlier so they don't try the update process and end up in this state.
Similarly, "Download Failed: Unauthorized" would be better as "Download Failed: License key expired or not activated for URL".
On clicking "View version xx details" the second time this error is produced.
Steps to produce an error.
Reason.
["sections"]=> array(2) { ["description"]=> "***" ["changelog"]=> "***" }
Then returning data encoded in JSON and stored in options table.
["sections"]=> object(stdClass)#771 (2) { ["description"]=>"**" ["changelog"]=>"**" }
Temporary Solution:
if we pass 3 parameters of json_decode() that, is depth to 1 than it didn't convert the nested arrays into an object
json_decode( $cache['value'], false, 1 )
Problem After this
Plugins stop showing the update notices.
I have this Repo set as a Submodule so I can just pull in the latest version, but I noticed that this repo actually doesn't hold the latest version.
Edit: It is only a little bit out-of-date. I thought I saw it hadn't been updated in a year when I first opened the Issue.
I am using EDD_SL_Plugin_Updater class in my plugins but It is being conflicted with Elegant Themes and Plugins.
After a deep debugging with EDD and Elegant themes, I found this code below
$_transient_data->last_checked = current_time( 'timestamp' );
works if I change the current_time( 'timestamp' ); to time();
time() is being used in wp_update_plugins() as well.
So, I think time() should be used instead of current_time( 'timestamp' ); at all places.
Looking forward,
See this screenshot:
To replicate:
1 | ERROR | The PHP open tag does not have a corresponding PHP close tag
| | (Generic.PHP.ClosingPHPTag.NotFound)
1 | ERROR | Filename "EDD_SL_Plugin_Updater.php" with underscores found;
| | use EDD-SL-Plugin-Updater.php instead
| | (WordPress.Files.FileName)
36 | ERROR | No space before closing parenthesis of function definition
| | prohibited (WordPress.Functions.FunctionCallSignature)
102 | WARNING | Equals sign not aligned with surrounding assignments; expected
| | 25 spaces but found 1 space
| | (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)
134 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
136 | WARNING | Equals sign not aligned with surrounding assignments; expected
| | 4 spaces but found 1 space
| | (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)
143 | ERROR | Space after opening control structure is required
Hello,
In EDD_SL_Plugin_Updater, line 282, please add a check before the foreach because if $_data->sections is null it causes an error.
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
$new_sections = array();
if( $_data->sections ) {
foreach ( $_data->sections as $key => $value ) {
$new_sections[ $key ] = $value;
}
}
$_data->sections = $new_sections;
}
You can display the error if you have
(WP 4.7.3, WC 3.0.3, EDD_SL_Plugin_Updater 1.6.11, theme: accesspress-store 2.1.7)
But I guess this error can happen with other configurations since 'plugin_api' filter can return false.
Hi,
I am developing a plugin module that uses EDD for licensing. In particular, I use the EDD_License
class. In order to be able to write tests for the module, I need to depend on a package that contains this class. This package seems to be the official package for that and other related classes. However, it is severely out of date. Would it be possible to please update this package to reflect the latest code?
So, to summarize what I would need in order to be able to write correct code that depends on the EDD Licensing API "SDK", if I may call it that:
I have used this lib in one of the EDD add-on. I found following errors in error log with WP_DEBUG on. Basically this notice arise when admin clicks on to check new version details (View version x.x details).
PHP Notice: Undefined property: stdClass::$last_updated in .../wp-admin/includes/plugin-install.php on line 460
PHP Stack trace:
PHP 1. {main}() .../wp-admin/plugin-install.php:0
PHP 2. do_action() .../wp-admin/plugin-install.php:67
PHP 3. call_user_func_array:{.../wp-includes/plugin.php:503}() .../wp-includes/plugin.php:503
PHP 4. install_plugin_information() .../wp-includes/plugin.php:503
Hi @pippinsplugins,
I'd like to know why it checks for object arguments when this filter pre_set_site_transient_update_plugins
returns array?
http://hookr.io/filters/pre_set_site_transient_update_plugins/#usage
I found an issue where it swaps the existing passed array with an object that's why it always lookup for an update on every load of the /plugin.php page and disrespects the last_time
expiration when checking in transient?
https://github.com/easydigitaldownloads/EDD-License-handler/blob/master/EDD_SL_Plugin_Updater.php#L83
this looks wrong to me
https://gist.github.com/pdewouters/779dad36a13ddd5c9239
You can see that it returns too much data
also it has "version" and "new_version" unlike other plugins. Also, my local version is 1.6.0
That being said, I do see the update notice in the admin.
If two plugins both use this class and both include the file without checking for this class, a fatal error will occur due to trying to redeclare the class.
Hi,
I am using a multilang server site (where Software Licensing is installed).
As a result, when an update is available on a client site (where EDD_SL_Plugin_Updater.php is used), it always retrieves my plugin version details in the default language.
All I need is to pass the client locale in $api_params before sending wp_remote_post().
Is it possible to apply a filter on $api_request array or add the 'locale' => get_locale() element (lines 342 and 406 on EDD_SL_Plugin_Updater.php v1.6.10)?
Thanks,
That happens every time there is an update with EDD, or with any plugin using EDD License Handler.
An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.
Is there a way to avoid it? Or maybe by fixing this code? Sorry, I didn't look into it but I think somebody knows the solution already :)
1 | ERROR | The PHP open tag does not have a corresponding PHP close tag
| | (Generic.PHP.ClosingPHPTag.NotFound)
1 | ERROR | Filename "EDD_License_Handler.php" with underscores found; use
| | EDD-License-Handler.php instead (WordPress.Files.FileName)
15 | ERROR | Blank line found at start of control structure
| | (WordPress.WhiteSpace.ControlStructureSpacing)
114 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
135 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
136 | ERROR | Comma required after last value in array declaration
| | (WordPress.Arrays.ArrayDeclaration)
165 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
174 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
212 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
220 | ERROR | Each line in an array declaration must end in a comma
| | (WordPress.Arrays.ArrayDeclaration)
239 | ERROR | Blank line found at end of control structure
| | (WordPress.WhiteSpace.ControlStructureSpacing)
264 | ERROR | Expected 1 space after comma in function call; 2 found
| | (Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma)
269 | ERROR | Expected next thing to be a escaping function, not '$html'
| | (WordPress.XSS.EscapeOutput)
272 | ERROR | Blank line found at end of control structure
How can I implement my plugins to support auto-upgrade? I mean auto-upgrading in the background without any intervention from the user.
Is this something can be done? Or even recommended?
Given how critical a piece of software the upgrader class is, it would be ideal to have integration test coverage for it.
I'm getting the following warning on plugin screen:
Warning: Invalid argument supplied for foreach() in /wp-content/plugins/myplugin/EDD_SL_Plugin_Updater.php on line 371
Adding this in the condition removes the warning:
if( ! empty( $request ) && is_array( $request ) ) {
in https://github.com/easydigitaldownloads/EDD-License-handler/blob/master/EDD_SL_Plugin_Updater.php#L370
in your check_update function on line 84 there should be this line added
$version_info->plugin=$this->name;
otherwise you get an undefined index notice
as wordpress checks for this key in line 282 of wp-admin/includes/update.php
$active_class = ( is_plugin_active( $plugin_data['plugin'] ) ) ? ' active' : '';
Hi! I think you should update this github repo and gist in http://docs.easydigitaldownloads.com/article/383-automatic-upgrades-for-wordpress-plugins or remove it. Because it's really an old version and many people could get it wrong
Hi
On clicking "view version detail" link always return this message "Warning: An unexpected error occurred. Something may be wrong with WordPress.org". When i dig in code found that
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
in
function api_request( $_action, $_data ){ }
always return curl error. cURL error 56: Problem (2) in the Chunked-Encoded data
.
My PHP version is 5.323
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.