Plugin Directory

Changeset 2578886


Ignore:
Timestamp:
08/05/2021 04:28:36 PM (4 years ago)
Author:
Sygnoos
Message:

Minor fixes.

Location:
popup-builder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • popup-builder/tags/4.0/com/classes/Actions.php

    r2578675 r2578886  
    6969    }
    7070
     71    private function checkIfLicenseIsActive($license, $itemId, $storeURL, $key) {
     72        $transient = 'sgpb-license-key-'.$key.'-requested';
     73        if ( false !== ( $value = get_transient( $transient ) ) ) {
     74            return;
     75        }
     76        $apiParams = array(
     77            'edd_action' => 'activate_license',
     78            'license'    => $license,
     79            'item_id'    => $itemId, // The ID of the item in EDD
     80            'url'        => home_url()
     81        );
     82        $response = wp_remote_post($storeURL, array('timeout' => 15, 'sslverify' => false, 'body' => $apiParams));
     83        if (!is_wp_error($response) || 200 == wp_remote_retrieve_response_code($response)) {
     84            $licenseData = json_decode(wp_remote_retrieve_body($response));
     85            update_option('sgpb-license-status-'.$key, $licenseData->license);
     86            set_transient($transient, $licenseData->item_name, WEEK_IN_SECONDS);
     87        }
     88
     89    }
    7190    public function updatesInit()
    7291    {
     
    7998            $key = @$license['key'];
    8099            $storeURL = @$license['storeURL'];
     100            $itemId = @$license['itemId'];
    81101            $pluginMainFilePath = @$license['file'];
    82102            $pluginMainFilePath = SG_POPUP_PLUGIN_PATH.$pluginMainFilePath;
     
    88108                continue;
    89109            }
    90 
     110            $this->checkIfLicenseIsActive($licenseKey, $itemId, $storeURL, $key);
    91111            $version = @constant('SG_VERSION_'.$key);
    92112
  • popup-builder/tags/4.0/public/js/sgpbDetect.js

    r2578740 r2578886  
    101101    css += '.sgpb.sgpb-modal-detection .sgpb-modal-body a, .sgpb.sgpb-modal-detection .sgpb-modal-body .sgpb-plugins-list .sgpb-update-plugin {font-weight: normal; font-size: 17px; color: #2873EB;}';
    102102    css += '.sgpb.sgpb-modal-detection .sgpb-modal-body p{font-size: 20px;margin: 0;}';
    103     css += '.sgpb.sgpb-modal-detection .sgpb-plugins-list-auto-update {max-width: 70%; margin: 0 auto;}';
     103    css += '.sgpb.sgpb-modal-detection .sgpb-plugins-list-auto-update {max-width: 73%; margin: 0 auto;}';
    104104    css += '.sgpb.sgpb-modal-detection .sgpb-modal-body p.sgpb-modal-footer-message{font-size: 15px;}';
    105105    css += '.sgpb-plugins-list {display: flex; flex-direction: column;} .sgpb-update-plugin { display: inline-flex;justify-content: space-between;color: #2873eb} .sgpb-update-plugin:after { content: "";font: normal 20px/1 dashicons;display: block;}.sgpb-update-plugin-success{color:#00ae5d}.sgpb-update-plugin-success:after { content: "\\f147";}.sgpb-update-plugin-failed{color:#c00}.sgpb-update-plugin-failed:after { content: "\\f534";}.sgpb-update-plugin-progress:after { content: "\\f463";}.sgpb-update-plugin-progress.updating:after{animation: sgpbRotation 2s infinite linear;}@keyframes sgpbRotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(359deg);}}';
  • popup-builder/trunk/com/classes/Actions.php

    r2578665 r2578886  
    6969    }
    7070
     71    private function checkIfLicenseIsActive($license, $itemId, $storeURL, $key) {
     72        $transient = 'sgpb-license-key-'.$key.'-requested';
     73        if ( false !== ( $value = get_transient( $transient ) ) ) {
     74            return;
     75        }
     76        $apiParams = array(
     77            'edd_action' => 'activate_license',
     78            'license'    => $license,
     79            'item_id'    => $itemId, // The ID of the item in EDD
     80            'url'        => home_url()
     81        );
     82        $response = wp_remote_post($storeURL, array('timeout' => 15, 'sslverify' => false, 'body' => $apiParams));
     83        if (!is_wp_error($response) || 200 == wp_remote_retrieve_response_code($response)) {
     84            $licenseData = json_decode(wp_remote_retrieve_body($response));
     85            update_option('sgpb-license-status-'.$key, $licenseData->license);
     86            set_transient($transient, $licenseData->item_name, WEEK_IN_SECONDS);
     87        }
     88
     89    }
    7190    public function updatesInit()
    7291    {
     
    7998            $key = @$license['key'];
    8099            $storeURL = @$license['storeURL'];
     100            $itemId = @$license['itemId'];
    81101            $pluginMainFilePath = @$license['file'];
    82102            $pluginMainFilePath = SG_POPUP_PLUGIN_PATH.$pluginMainFilePath;
     
    88108                continue;
    89109            }
    90 
     110            $this->checkIfLicenseIsActive($licenseKey, $itemId, $storeURL, $key);
    91111            $version = @constant('SG_VERSION_'.$key);
    92112
  • popup-builder/trunk/public/js/sgpbDetect.js

    r2578740 r2578886  
    101101    css += '.sgpb.sgpb-modal-detection .sgpb-modal-body a, .sgpb.sgpb-modal-detection .sgpb-modal-body .sgpb-plugins-list .sgpb-update-plugin {font-weight: normal; font-size: 17px; color: #2873EB;}';
    102102    css += '.sgpb.sgpb-modal-detection .sgpb-modal-body p{font-size: 20px;margin: 0;}';
    103     css += '.sgpb.sgpb-modal-detection .sgpb-plugins-list-auto-update {max-width: 70%; margin: 0 auto;}';
     103    css += '.sgpb.sgpb-modal-detection .sgpb-plugins-list-auto-update {max-width: 73%; margin: 0 auto;}';
    104104    css += '.sgpb.sgpb-modal-detection .sgpb-modal-body p.sgpb-modal-footer-message{font-size: 15px;}';
    105105    css += '.sgpb-plugins-list {display: flex; flex-direction: column;} .sgpb-update-plugin { display: inline-flex;justify-content: space-between;color: #2873eb} .sgpb-update-plugin:after { content: "";font: normal 20px/1 dashicons;display: block;}.sgpb-update-plugin-success{color:#00ae5d}.sgpb-update-plugin-success:after { content: "\\f147";}.sgpb-update-plugin-failed{color:#c00}.sgpb-update-plugin-failed:after { content: "\\f534";}.sgpb-update-plugin-progress:after { content: "\\f463";}.sgpb-update-plugin-progress.updating:after{animation: sgpbRotation 2s infinite linear;}@keyframes sgpbRotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(359deg);}}';
Note: See TracChangeset for help on using the changeset viewer.