Changeset 2634590
- Timestamp:
- 11/24/2021 08:59:42 AM (4 years ago)
- Location:
- popup-builder/trunk
- Files:
-
- 1 added
- 1 deleted
- 5 edited
-
com/classes/Actions.php (modified) (3 diffs)
-
com/classes/Updates.php (modified) (5 diffs)
-
com/config/configPackage.php (modified) (1 diff)
-
com/libs/EDD_SL_Plugin_Updater.php (deleted)
-
com/libs/WOOSL_CodeAutoUpdate.php (added)
-
popup-builder.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
popup-builder/trunk/com/classes/Actions.php
r2584791 r2634590 4 4 use \SgpbPopupConfig; 5 5 use \SgpbDataConfig; 6 6 7 7 8 class Actions … … 70 71 71 72 private function checkIfLicenseIsActive($license, $itemId, $storeURL, $key) { 73 /* TODO change the domain to a valid domain name! from store url before the production */ 72 74 $transient = 'sgpb-license-key-'.$key.'-requested'; 73 75 if ( false !== ( $value = get_transient( $transient ) ) ) { 74 76 return; 75 77 } 76 $ apiParams = array(77 ' edd_action' => 'activate_license',78 'licen se'=> $license,79 ' item_id' => $itemId, // The ID of the item in EDD80 ' url'=> home_url()78 $params = array( 79 'woo_sl_action' => 'status-check', 80 'licence_key' => $license, 81 'product_unique_id' => $itemId, 82 'domain' => home_url() 81 83 ); 82 $response = wp_remote_post($storeURL, array('timeout' => 15, 'sslverify' => false, 'body' => $apiParams)); 84 $requestUri = 'https://popup-builder.com/index.php?'.http_build_query($params); 85 $response = wp_remote_get($requestUri); 83 86 if (!is_wp_error($response) || 200 == wp_remote_retrieve_response_code($response)) { 84 87 $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 88 $status = isset($licenseData[0]->licence_status) && $licenseData[0]->licence_status === 'active' ? 'valid' : $licenseData[0]->licence_status; 89 update_option('sgpb-license-status-'.$key, $status); 90 set_transient($transient, $licenseData[0]->status_code, WEEK_IN_SECONDS); 91 } 89 92 } 90 93 public function updatesInit() 91 94 { 92 if (!class_exists('sgpb\ EDD_SL_Plugin_Updater')) {95 if (!class_exists('sgpb\WOOSL_CodeAutoUpdate')) { 93 96 // load our custom updater if it doesn't already exist 94 require_once(SG_POPUP_LIBS_PATH .' EDD_SL_Plugin_Updater.php');97 require_once(SG_POPUP_LIBS_PATH .'WOOSL_CodeAutoUpdate.php'); 95 98 } 96 99 $licenses = (new License())->getLicenses(); 100 97 101 foreach ($licenses as $license) { 98 102 $key = @$license['key']; … … 139 143 continue; 140 144 } 141 $sgpbUpdater = new EDD_SL_Plugin_Updater($storeURL, $pluginMainFilePath, array(142 ' version' => $version, // current version number143 'license' => $licenseKey, // license key (used get_option above to retrieve from DB)144 'item_id' => $license['itemId'], // id of this plugin145 'author' => $license['autor'], // author of this plugin146 'beta' => false // set to true if you wish customers to receive update notifications of beta releases147 ) );145 $sgpbUpdater = new WOOSL_CodeAutoUpdate( 146 'https://popup-builder.com/index.php', 147 $pluginMainFilePath, 148 $itemId, 149 $licenseKey, 150 $version 151 ); 148 152 } 149 153 } -
popup-builder/trunk/com/classes/Updates.php
r2578665 r2634590 2 2 namespace sgpb; 3 3 4 /* TODO change the domain name before production */ 4 5 5 6 class Updates … … 61 62 } 62 63 64 private function activateLicense($license, $itemId) 65 { 66 $params = array( 67 'woo_sl_action' => 'activate', 68 'licence_key' => $license, 69 'product_unique_id' => $itemId, 70 'domain' => home_url() 71 ); 72 73 $requestUri = 'https://popup-builder.com/index.php?'.http_build_query($params); 74 75 return wp_remote_get($requestUri); 76 } 77 78 private function deactivateLicense($license, $itemId) 79 { 80 $params = array( 81 'woo_sl_action' => 'deactivate', 82 'licence_key' => $license, 83 'product_unique_id' => $itemId, 84 'domain' => home_url() 85 ); 86 87 $requestUri = 'https://popup-builder.com/index.php?'.http_build_query($params); 88 89 return wp_remote_get($requestUri); 90 } 91 63 92 public function sgpbActivateLicense() 64 93 { … … 68 97 $key = @$license['key']; 69 98 $itemId = @$license['itemId']; 70 $itemName = @$license['itemName'];71 $storeURL = @$license['storeURL'];72 99 $this->licenseKey = $key; 73 100 … … 84 111 // retrieve the license from the database 85 112 $license = trim(get_option('sgpb-license-key-'.$key)); 86 // data to send in our API request 87 $apiParams = array( 88 'edd_action' => 'activate_license', 89 'license' => $license, 90 'item_id' => $itemId, // The ID of the item in EDD 91 'url' => home_url() 92 ); 93 // Call the custom API. 94 $response = wp_remote_post($storeURL, array('timeout' => 15, 'sslverify' => false, 'body' => $apiParams)); 95 // make sure the response came back okay 96 if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) { 97 $errorMessage = $response->get_error_message(); 98 $message = (is_wp_error($response) && ! empty($errorMessage)) ? $errorMessage : __('An error occurred, please try again.', SG_POPUP_TEXT_DOMAIN); 99 } 100 else { 101 $licenseData = json_decode(wp_remote_retrieve_body($response)); 102 if (false === $licenseData->success) { 103 switch ($licenseData->error) { 104 case 'expired' : 105 $message = sprintf( 106 __('Your license key expired on %s.', SG_POPUP_TEXT_DOMAIN), 107 date_i18n(get_option('date_format'), strtotime($licenseData->expires, current_time('timestamp'))) 108 ); 109 break; 110 case 'revoked' : 111 $message = __('Your license key has been disabled.', SG_POPUP_TEXT_DOMAIN); 112 break; 113 case 'missing' : 114 $message = __('Invalid license.', SG_POPUP_TEXT_DOMAIN); 115 break; 116 case 'invalid' : 117 case 'site_inactive' : 118 $message = __('Your license is not active for this URL.',SG_POPUP_TEXT_DOMAIN); 119 break; 120 case 'item_name_mismatch' : 121 $message = sprintf(__('This appears to be an invalid license key for %s.', SG_POPUP_TEXT_DOMAIN), $itemName); 122 break; 123 case 'no_activations_left' : 124 $message = __('You\'ve already used the permitted number of this license key!', SG_POPUP_TEXT_DOMAIN); 125 break; 126 default : 127 $message = __('An error occurred, please try again.', SG_POPUP_TEXT_DOMAIN); 128 break; 113 $data = $this->activateLicense($license, $itemId); 114 if (!is_wp_error($data) && $data['response']['code'] == 200) { 115 $dataBody = json_decode($data['body']); 116 if (isset($dataBody[0]->status)) { 117 if ($dataBody[0]->status == 'success' && ($dataBody[0]->status_code == 's100' || $dataBody[0]->status_code == 's101')) { 118 update_option('sgpb-license-status-'.$key, 'valid'); 119 $hasInactiveExtensions = AdminHelper::hasInactiveExtensions(); 120 121 if (empty($hasInactiveExtensions)) { 122 delete_option('SGPB_INACTIVE_EXTENSIONS', 'inactive'); 123 } 124 125 wp_redirect(admin_url('edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SGPB_POPUP_LICENSE)); 126 exit(); 129 127 } 130 128 } 131 129 } 132 // Check if anything passed on a message constituting a failure 133 if (!empty($message)) { 134 $baseUrl = admin_url('edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SGPB_POPUP_LICENSE); 135 $redirect = add_query_arg(array('sl_activation' => 'false', 'message' => urlencode($message)), $baseUrl); 136 wp_redirect($redirect); 137 exit(); 138 } 139 // $licenseData->license will be either "valid" or "invalid" 140 update_option('sgpb-license-status-'.$key, $licenseData->license); 141 $hasInactiveExtensions = AdminHelper::hasInactiveExtensions(); 142 // all available extensions have active license status 143 if (empty($hasInactiveExtensions)) { 144 // and if we don't have inactive extensions, remove option, until new one activation 145 delete_option('SGPB_INACTIVE_EXTENSIONS', 'inactive'); 146 } 147 wp_redirect(admin_url('edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SGPB_POPUP_LICENSE)); 130 131 $message = __('An error occurred, please try again.', SG_POPUP_TEXT_DOMAIN); 132 $baseUrl = admin_url('edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SGPB_POPUP_LICENSE); 133 $redirect = add_query_arg(array('sl_activation' => 'false', 'message' => urlencode($message)), $baseUrl); 134 wp_redirect($redirect); 148 135 exit(); 149 136 } … … 152 139 $license = trim(get_option('sgpb-license-key-'.$key)); 153 140 // data to send in our API request 154 $apiParams = array( 155 'edd_action' => 'deactivate_license', 156 'license' => $license, 157 'item_id' => $itemId, // The ID of the item in EDD 158 'url' => home_url() 159 ); 160 $home = home_url(); 161 // Send the remote request 162 $response = wp_remote_post($storeURL, array('body' => $apiParams, 'timeout' => 15, 'sslverify' => false)); 141 $response = $this->deactivateLicense($license, $itemId); 163 142 if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) { 164 $errorMessage = $response->get_error_message(); 165 $message = (is_wp_error($response) && ! empty($errorMessage)) ? $errorMessage : __('An error occurred, please try again.', SG_POPUP_TEXT_DOMAIN); 143 $message = __('An error occurred, please try again.', SG_POPUP_TEXT_DOMAIN); 166 144 $baseUrl = admin_url('edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SGPB_POPUP_LICENSE); 167 145 $redirect = add_query_arg(array('message' => urlencode($message)), $baseUrl); -
popup-builder/trunk/com/config/configPackage.php
r2585890 r2634590 4 4 } 5 5 6 define('SG_POPUP_VERSION', '4.0. 4');6 define('SG_POPUP_VERSION', '4.0.5'); 7 7 define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE); 8 8 define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php'); -
popup-builder/trunk/popup-builder.php
r2585890 r2634590 4 4 * Plugin URI: https://popup-builder.com 5 5 * Description: The most complete popup plugin. Html, image, iframe, shortcode, video and many other popup types. Manage popup dimensions, effects, themes and more. 6 * Version: 4.0. 46 * Version: 4.0.5 7 7 * Author: Sygnoos 8 8 * Author URI: https://sygnoos.com -
popup-builder/trunk/readme.txt
r2585890 r2634590 9 9 Tested up to: 5.8 10 10 Requires PHP: 5.3.3 11 Stable tag: 4.0. 411 Stable tag: 4.0.5 12 12 License: GPLv2 or later 13 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 146 146 == Changelog == 147 147 148 = Version 4.0.5 = 149 * Bug fixes and improvements 150 148 151 = Version 4.0.4 = 149 152 * Bug fixed related to JS files that some 3rd party plugins minify on our side
Note: See TracChangeset
for help on using the changeset viewer.