Git Product home page Git Product logo

edd-license-handler's People

Contributors

chriscct7 avatar cklosowski avatar jordymeow avatar pippinsplugins avatar sunnyratilal avatar x-raym avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edd-license-handler's Issues

Add composer.json support

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

Pass current version number

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.

wp_remote_post = Bad Idea

We need to stop using wp_remote_post. It will not work for sites with curl disabled.

We should use wp_remote_get instead.

Make `class EDD_License` extendable

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
                )
            );
        }
}

sslverify false?

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 file in this repo the latest one?

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.

Indicate when the license key is valid, but the domain isn't registered for the license key

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:

image

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".

Uncaught Error: Cannot use object of type stdClass as array in wp-admin\includes\plugin-install.php:500

On clicking "View version xx details" the second time this error is produced.

Steps to produce an error.

  1. Click on "View version xx details." it will work fine.
  2. Click on "View version xx details." again and this error will come.

Reason.

  1. The first time it fetches the data on which the "sections" property of object consists arrays. Like this

["sections"]=> array(2) { ["description"]=> "***" ["changelog"]=> "***" }

Then returning data encoded in JSON and stored in options table.

  1. On the second click stored data get fetched and decoded back to the object and here is a problem the "sections" property also convert into an object and Fatal Error come.

["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.

Plugins update conflict due to "last_checked = current_time( 'timestamp' );"

Hi @pippinsplugins

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,

EDD_SL_Plugin_Updater.php coding standards fail

FILE: ...ntent/plugins/testimonials-widget-premium/lib/EDD_SL_Plugin_Updater.php

FOUND 5 ERROR(S) AND 2 WARNING(S) AFFECTING 6 LINE(S)

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

| | (WordPress.WhiteSpace.ControlStructureSpacing)

Need to check if $_data->sections is null before foreach in EDD_SL_Plugin_Updater

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

  • include EDD_SL_Plugin_Updater on admin_init hook
  • woocommerce installed,
  • a theme with obsolete WC template pages,
    then go to WC status system page and the errors shows.

(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.

Repository Out of Date

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?

Update

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:

  1. Maintain an up-to-date reflection of the code.
  2. Add package info compatible with Composer/Packagist, including license.
  3. Publish the package on Packagist.

Undefined property issue

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

Why override 'pre_set_site_transient_update_plugins' array param with object?

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

https://github.com/easydigitaldownloads/EDD-License-handler/blob/master/EDD_SL_Plugin_Updater.php#L138

Filter $api_params or add 'locale' => get_locale() to support multilang version details in EDD_SL_Plugin_Updater.php

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,

An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration.

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 :)

EDD_License_Handler.php coding standards fail

FILE: ...content/plugins/testimonials-widget-premium/lib/EDD_License_Handler.php

FOUND 14 ERROR(S) AFFECTING 13 LINE(S)

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

| | (WordPress.WhiteSpace.ControlStructureSpacing)

Auto Updates in the Background

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?

Plugin index not set for $_transient_data array

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' : '';

cURL error 56: Problem (2) in the Chunked-Encoded data

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.