Version Description
- 2020/Dec/1 =
- TWEAK: Adds option to filter HTML Purify
- TWEAK: Updates Appsero dependency version
Download this release
Release Info
| Developer | metaslider |
| Plugin | |
| Version | 3.19.1 |
| Comparing to | |
| See all releases | |
Code changes from version 3.19.0 to 3.19.1
- inc/slide/metaslide.image.class.php +10 -2
- lib/appsero/readme.md +3 -0
- lib/appsero/src/Client.php +45 -3
- lib/appsero/src/License.php +197 -130
- lib/appsero/src/Updater.php +1 -2
- ml-slider.php +2 -2
- readme.txt +5 -1
inc/slide/metaslide.image.class.php
CHANGED
|
@@ -498,12 +498,20 @@ class MetaImageSlide extends MetaSlide
|
|
| 498 |
);
|
| 499 |
|
| 500 |
// Remove unsafe html but let users that rely on this to override
|
| 501 |
-
if (apply_filters('metaslider_filter_unsafe_html', true) && $slide['caption']) {
|
| 502 |
try {
|
| 503 |
if (!class_exists('HTMLPurifier')) {
|
| 504 |
require_once(METASLIDER_PATH . 'lib/htmlpurifier/library/HTMLPurifier.auto.php');
|
| 505 |
}
|
| 506 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
$slide['caption'] = $purifier->purify($slide['caption']);
|
| 508 |
} catch (Exception $e) {
|
| 509 |
// If something goes wrong then escape
|
| 498 |
);
|
| 499 |
|
| 500 |
// Remove unsafe html but let users that rely on this to override
|
| 501 |
+
if (apply_filters('metaslider_filter_unsafe_html', true, $slide, $this->slider->ID, $this->settings) && $slide['caption']) {
|
| 502 |
try {
|
| 503 |
if (!class_exists('HTMLPurifier')) {
|
| 504 |
require_once(METASLIDER_PATH . 'lib/htmlpurifier/library/HTMLPurifier.auto.php');
|
| 505 |
}
|
| 506 |
+
$config = HTMLPurifier_Config::createDefault();
|
| 507 |
+
// How to filter:
|
| 508 |
+
// add_filter('metaslider_html_purifier_config', function($config) {
|
| 509 |
+
// $config->set('HTML.Allowed', 'a[href|target]');
|
| 510 |
+
// $config->set('Attr.AllowedFrameTargets', array('_blank'));
|
| 511 |
+
// return $config;
|
| 512 |
+
// });
|
| 513 |
+
$config = apply_filters('metaslider_html_purifier_config', $config, $slide, $this->slider->ID, $this->settings);
|
| 514 |
+
$purifier = new HTMLPurifier($config);
|
| 515 |
$slide['caption'] = $purifier->purify($slide['caption']);
|
| 516 |
} catch (Exception $e) {
|
| 517 |
// If something goes wrong then escape
|
lib/appsero/readme.md
CHANGED
|
@@ -190,6 +190,9 @@ Or check by pricing plan title
|
|
| 190 |
if ( $twenty_twelve_license->is_valid_by( 'title', 'Business' ) ) {
|
| 191 |
// Your special code here
|
| 192 |
}
|
|
|
|
|
|
|
|
|
|
| 193 |
```
|
| 194 |
|
| 195 |
### Use your own license form
|
| 190 |
if ( $twenty_twelve_license->is_valid_by( 'title', 'Business' ) ) {
|
| 191 |
// Your special code here
|
| 192 |
}
|
| 193 |
+
|
| 194 |
+
// Set custom options key for storing the license info
|
| 195 |
+
$twenty_twelve_license->set_option_key( 'my_plugin_license' );
|
| 196 |
```
|
| 197 |
|
| 198 |
### Use your own license form
|
lib/appsero/src/Client.php
CHANGED
|
@@ -75,6 +75,27 @@ class Client
|
|
| 75 |
*/
|
| 76 |
public $textdomain;
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
/**
|
| 79 |
* Initialize the class
|
| 80 |
*
|
|
@@ -102,7 +123,14 @@ class Client
|
|
| 102 |
require_once __DIR__ . '/Insights.php';
|
| 103 |
}
|
| 104 |
|
| 105 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
/**
|
|
@@ -116,7 +144,14 @@ class Client
|
|
| 116 |
require_once __DIR__ . '/Updater.php';
|
| 117 |
}
|
| 118 |
|
| 119 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
}
|
| 121 |
|
| 122 |
/**
|
|
@@ -130,7 +165,14 @@ class Client
|
|
| 130 |
require_once __DIR__ . '/License.php';
|
| 131 |
}
|
| 132 |
|
| 133 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
|
| 136 |
/**
|
| 75 |
*/
|
| 76 |
public $textdomain;
|
| 77 |
|
| 78 |
+
/**
|
| 79 |
+
* The Object of Insights Class
|
| 80 |
+
*
|
| 81 |
+
* @var object
|
| 82 |
+
*/
|
| 83 |
+
private $insights;
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* The Object of Updater Class
|
| 87 |
+
*
|
| 88 |
+
* @var object
|
| 89 |
+
*/
|
| 90 |
+
private $updater;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* The Object of License Class
|
| 94 |
+
*
|
| 95 |
+
* @var object
|
| 96 |
+
*/
|
| 97 |
+
private $license;
|
| 98 |
+
|
| 99 |
/**
|
| 100 |
* Initialize the class
|
| 101 |
*
|
| 123 |
require_once __DIR__ . '/Insights.php';
|
| 124 |
}
|
| 125 |
|
| 126 |
+
// if already instantiated, return the cached one
|
| 127 |
+
if ($this->insights) {
|
| 128 |
+
return $this->insights;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
$this->insights = new Insights($this);
|
| 132 |
+
|
| 133 |
+
return $this->insights;
|
| 134 |
}
|
| 135 |
|
| 136 |
/**
|
| 144 |
require_once __DIR__ . '/Updater.php';
|
| 145 |
}
|
| 146 |
|
| 147 |
+
// if already instantiated, return the cached one
|
| 148 |
+
if ($this->updater) {
|
| 149 |
+
return $this->updater;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
$this->updater = new Updater($this);
|
| 153 |
+
|
| 154 |
+
return $this->updater;
|
| 155 |
}
|
| 156 |
|
| 157 |
/**
|
| 165 |
require_once __DIR__ . '/License.php';
|
| 166 |
}
|
| 167 |
|
| 168 |
+
// if already instantiated, return the cached one
|
| 169 |
+
if ($this->license) {
|
| 170 |
+
return $this->license;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
$this->license = new License($this);
|
| 174 |
+
|
| 175 |
+
return $this->license;
|
| 176 |
}
|
| 177 |
|
| 178 |
/**
|
lib/appsero/src/License.php
CHANGED
|
@@ -6,7 +6,8 @@ namespace MSAppsero;
|
|
| 6 |
*
|
| 7 |
* This class will check, active and deactive license
|
| 8 |
*/
|
| 9 |
-
class License
|
|
|
|
| 10 |
|
| 11 |
/**
|
| 12 |
* AppSero\Client
|
|
@@ -53,7 +54,7 @@ class License {
|
|
| 53 |
/**
|
| 54 |
* Set value for valid licnese
|
| 55 |
*
|
| 56 |
-
* @var
|
| 57 |
*/
|
| 58 |
private $is_valid_licnese = null;
|
| 59 |
|
|
@@ -62,51 +63,85 @@ class License {
|
|
| 62 |
*
|
| 63 |
* @param Appsero\Client
|
| 64 |
*/
|
| 65 |
-
public function __construct(
|
|
|
|
| 66 |
$this->client = $client;
|
| 67 |
|
| 68 |
-
$this->option_key = 'appsero_' . md5(
|
| 69 |
|
| 70 |
$this->schedule_hook = $this->client->slug . '_license_check_event';
|
| 71 |
|
| 72 |
// Run hook to check license status daily
|
| 73 |
-
add_action(
|
| 74 |
|
| 75 |
// Active/Deactive corn schedule
|
| 76 |
$this->run_schedule();
|
| 77 |
}
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
/**
|
| 80 |
* Check license
|
| 81 |
*
|
| 82 |
-
* @return
|
| 83 |
*/
|
| 84 |
-
public function check(
|
|
|
|
| 85 |
$route = 'public/license/' . $this->client->hash . '/check';
|
| 86 |
|
| 87 |
-
return $this->send_request(
|
| 88 |
}
|
| 89 |
|
| 90 |
/**
|
| 91 |
* Active a license
|
| 92 |
*
|
| 93 |
-
* @return
|
| 94 |
*/
|
| 95 |
-
public function activate(
|
|
|
|
| 96 |
$route = 'public/license/' . $this->client->hash . '/activate';
|
| 97 |
|
| 98 |
-
return $this->send_request(
|
| 99 |
}
|
| 100 |
|
| 101 |
/**
|
| 102 |
* Deactivate a license
|
| 103 |
*
|
| 104 |
-
* @return
|
| 105 |
*/
|
| 106 |
-
public function deactivate(
|
|
|
|
| 107 |
$route = 'public/license/' . $this->client->hash . '/deactivate';
|
| 108 |
|
| 109 |
-
return $this->send_request(
|
| 110 |
}
|
| 111 |
|
| 112 |
/**
|
|
@@ -117,32 +152,33 @@ class License {
|
|
| 117 |
*
|
| 118 |
* @return array
|
| 119 |
*/
|
| 120 |
-
protected function send_request(
|
|
|
|
| 121 |
$params = array(
|
| 122 |
'license_key' => $license_key,
|
| 123 |
-
'url' => esc_url(
|
| 124 |
'is_local' => $this->client->is_local_server(),
|
| 125 |
);
|
| 126 |
|
| 127 |
-
$response = $this->client->send_request(
|
| 128 |
|
| 129 |
-
if (
|
| 130 |
return array(
|
| 131 |
'success' => false,
|
| 132 |
'error' => $response->get_error_message()
|
| 133 |
);
|
| 134 |
}
|
| 135 |
|
| 136 |
-
$response = json_decode(
|
| 137 |
|
| 138 |
-
if (
|
| 139 |
return array(
|
| 140 |
'success' => false,
|
| 141 |
'error' => 'Unknown error occurred, Please try again.'
|
| 142 |
);
|
| 143 |
}
|
| 144 |
|
| 145 |
-
if (
|
| 146 |
$response = array(
|
| 147 |
'success' => false,
|
| 148 |
'error' => $response['errors']['license_key'][0]
|
|
@@ -159,7 +195,8 @@ class License {
|
|
| 159 |
*
|
| 160 |
* @return void
|
| 161 |
*/
|
| 162 |
-
public function add_settings_page(
|
|
|
|
| 163 |
$defaults = array(
|
| 164 |
'type' => 'menu', // Can be: menu, options, submenu
|
| 165 |
'page_title' => 'Manage License',
|
|
@@ -171,9 +208,9 @@ class License {
|
|
| 171 |
'parent_slug' => '',
|
| 172 |
);
|
| 173 |
|
| 174 |
-
$this->menu_args = wp_parse_args(
|
| 175 |
|
| 176 |
-
add_action(
|
| 177 |
}
|
| 178 |
|
| 179 |
/**
|
|
@@ -181,8 +218,9 @@ class License {
|
|
| 181 |
*
|
| 182 |
* @return void
|
| 183 |
*/
|
| 184 |
-
public function admin_menu()
|
| 185 |
-
|
|
|
|
| 186 |
case 'menu':
|
| 187 |
$this->create_menu_page();
|
| 188 |
break;
|
|
@@ -200,58 +238,57 @@ class License {
|
|
| 200 |
/**
|
| 201 |
* License menu output
|
| 202 |
*/
|
| 203 |
-
public function menu_output()
|
| 204 |
-
|
| 205 |
-
if (
|
| 206 |
-
$this->license_form_submit(
|
| 207 |
}
|
| 208 |
|
| 209 |
-
$license =
|
| 210 |
-
$action
|
| 211 |
-
$this->licenses_style();
|
| 212 |
-
?>
|
| 213 |
|
| 214 |
<div class="wrap appsero-license-settings-wrapper">
|
| 215 |
<h1>License Settings</h1>
|
| 216 |
|
| 217 |
<?php
|
| 218 |
$this->show_license_page_notices();
|
| 219 |
-
|
| 220 |
-
?>
|
| 221 |
|
| 222 |
<div class="appsero-license-settings appsero-license-section">
|
| 223 |
<?php $this->show_license_page_card_header(); ?>
|
| 224 |
|
| 225 |
<div class="appsero-license-details">
|
| 226 |
-
<p>
|
|
|
|
|
|
|
| 227 |
<form method="post" action="<?php $this->formActionUrl(); ?>" novalidate="novalidate" spellcheck="false">
|
| 228 |
<input type="hidden" name="_action" value="<?php echo $action; ?>">
|
| 229 |
-
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce(
|
| 230 |
<div class="license-input-fields">
|
| 231 |
<div class="license-input-key">
|
| 232 |
<svg enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
| 233 |
<path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
|
| 234 |
</svg>
|
| 235 |
-
<input type="text" value="<?php echo $this->get_input_license_value(
|
| 236 |
-
placeholder="Enter your license key to activate" name="license_key"
|
| 237 |
-
<?php echo (
|
| 238 |
/>
|
| 239 |
</div>
|
| 240 |
<button type="submit" name="submit" class="<?php echo 'deactive' == $action ? 'deactive-button' : ''; ?>">
|
| 241 |
-
<?php echo $action == 'active' ? 'Activate License' : 'Deactivate License'
|
| 242 |
</button>
|
| 243 |
</div>
|
| 244 |
</form>
|
| 245 |
|
| 246 |
<?php
|
| 247 |
-
if (
|
| 248 |
-
$this->show_active_license_info(
|
| 249 |
-
}
|
| 250 |
-
?>
|
| 251 |
</div>
|
| 252 |
</div> <!-- /.appsero-license-settings -->
|
| 253 |
|
| 254 |
-
<?php do_action(
|
| 255 |
</div>
|
| 256 |
<?php
|
| 257 |
}
|
|
@@ -259,24 +296,27 @@ class License {
|
|
| 259 |
/**
|
| 260 |
* License form submit
|
| 261 |
*/
|
| 262 |
-
public function license_form_submit(
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
| 265 |
return;
|
| 266 |
}
|
| 267 |
|
| 268 |
-
if (
|
| 269 |
$this->error = "You don't have permission to manage license.";
|
|
|
|
| 270 |
return;
|
| 271 |
}
|
| 272 |
|
| 273 |
-
switch (
|
| 274 |
case 'active':
|
| 275 |
-
$this->active_client_license(
|
| 276 |
break;
|
| 277 |
|
| 278 |
case 'deactive':
|
| 279 |
-
$this->deactive_client_license(
|
| 280 |
break;
|
| 281 |
}
|
| 282 |
}
|
|
@@ -284,13 +324,14 @@ class License {
|
|
| 284 |
/**
|
| 285 |
* Check license status on schedule
|
| 286 |
*/
|
| 287 |
-
public function check_license_status()
|
| 288 |
-
|
|
|
|
| 289 |
|
| 290 |
-
if (
|
| 291 |
-
$response = $this->check(
|
| 292 |
|
| 293 |
-
if (
|
| 294 |
$license['status'] = 'activate';
|
| 295 |
$license['remaining'] = $response['remaining'];
|
| 296 |
$license['activation_limit'] = $response['activation_limit'];
|
|
@@ -303,23 +344,25 @@ class License {
|
|
| 303 |
$license['expiry_days'] = 0;
|
| 304 |
}
|
| 305 |
|
| 306 |
-
update_option(
|
| 307 |
}
|
| 308 |
}
|
| 309 |
|
| 310 |
/**
|
| 311 |
* Check this is a valid license
|
| 312 |
*/
|
| 313 |
-
public function is_valid()
|
| 314 |
-
|
|
|
|
| 315 |
return $this->is_valid_licnese;
|
| 316 |
}
|
| 317 |
|
| 318 |
-
$license =
|
| 319 |
-
|
|
|
|
| 320 |
$this->is_valid_licnese = true;
|
| 321 |
} else {
|
| 322 |
-
|
| 323 |
}
|
| 324 |
|
| 325 |
return $this->is_valid_licnese;
|
|
@@ -328,11 +371,12 @@ class License {
|
|
| 328 |
/**
|
| 329 |
* Check this is a valid license
|
| 330 |
*/
|
| 331 |
-
public function is_valid_by(
|
| 332 |
-
|
|
|
|
| 333 |
|
| 334 |
-
if (
|
| 335 |
-
if (
|
| 336 |
return true;
|
| 337 |
}
|
| 338 |
}
|
|
@@ -343,7 +387,8 @@ class License {
|
|
| 343 |
/**
|
| 344 |
* Styles for licenses page
|
| 345 |
*/
|
| 346 |
-
private function licenses_style()
|
|
|
|
| 347 |
?>
|
| 348 |
<style type="text/css">
|
| 349 |
.appsero-license-section {
|
|
@@ -463,29 +508,29 @@ class License {
|
|
| 463 |
/**
|
| 464 |
* Show active license information
|
| 465 |
*/
|
| 466 |
-
private function show_active_license_info(
|
|
|
|
| 467 |
?>
|
| 468 |
<div class="active-license-info">
|
| 469 |
<div class="single-license-info">
|
| 470 |
-
<h3
|
| 471 |
-
<?php if (
|
| 472 |
-
<p
|
| 473 |
-
<?php else
|
| 474 |
<p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
|
| 475 |
-
<?php
|
| 476 |
</p>
|
| 477 |
-
<?php
|
| 478 |
</div>
|
| 479 |
<div class="single-license-info">
|
| 480 |
-
<h3
|
| 481 |
<?php
|
| 482 |
-
if (
|
| 483 |
-
$occupied = $license['expiry_days'] >
|
| 484 |
echo '<p class="' . $occupied . '">' . $license['expiry_days'] . ' days</p>';
|
| 485 |
} else {
|
| 486 |
-
echo '<p>Never</p>';
|
| 487 |
-
}
|
| 488 |
-
?>
|
| 489 |
</div>
|
| 490 |
</div>
|
| 491 |
<?php
|
|
@@ -494,28 +539,31 @@ class License {
|
|
| 494 |
/**
|
| 495 |
* Show license settings page notices
|
| 496 |
*/
|
| 497 |
-
private function show_license_page_notices()
|
| 498 |
-
|
| 499 |
-
|
|
|
|
| 500 |
<div class="notice notice-error is-dismissible appsero-license-section">
|
| 501 |
<p><?php echo $this->error; ?></p>
|
| 502 |
</div>
|
| 503 |
<?php
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
|
|
|
| 507 |
<div class="notice notice-success is-dismissible appsero-license-section">
|
| 508 |
<p><?php echo $this->success; ?></p>
|
| 509 |
</div>
|
| 510 |
<?php
|
| 511 |
-
|
| 512 |
-
|
| 513 |
}
|
| 514 |
|
| 515 |
/**
|
| 516 |
* Card header
|
| 517 |
*/
|
| 518 |
-
private function show_license_page_card_header()
|
|
|
|
| 519 |
?>
|
| 520 |
<div class="appsero-license-title">
|
| 521 |
<svg enable-background="new 0 0 299.995 299.995" version="1.1" viewBox="0 0 300 300" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -531,17 +579,20 @@ class License {
|
|
| 531 |
/**
|
| 532 |
* Active client license
|
| 533 |
*/
|
| 534 |
-
private function active_client_license(
|
| 535 |
-
|
|
|
|
| 536 |
$this->error = 'The license key field is required.';
|
|
|
|
| 537 |
return;
|
| 538 |
}
|
| 539 |
|
| 540 |
-
$license_key = sanitize_text_field(
|
| 541 |
-
$response
|
| 542 |
|
| 543 |
-
if (
|
| 544 |
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
|
|
|
|
| 545 |
return;
|
| 546 |
}
|
| 547 |
|
|
@@ -556,7 +607,7 @@ class License {
|
|
| 556 |
'recurring' => $response['recurring'],
|
| 557 |
);
|
| 558 |
|
| 559 |
-
update_option(
|
| 560 |
|
| 561 |
$this->success = 'License activated successfully.';
|
| 562 |
}
|
|
@@ -564,25 +615,28 @@ class License {
|
|
| 564 |
/**
|
| 565 |
* Deactive client license
|
| 566 |
*/
|
| 567 |
-
private function deactive_client_license(
|
| 568 |
-
|
|
|
|
| 569 |
|
| 570 |
-
if (
|
| 571 |
$this->error = 'License key not found.';
|
|
|
|
| 572 |
return;
|
| 573 |
}
|
| 574 |
|
| 575 |
-
$response = $this->deactivate(
|
| 576 |
|
| 577 |
$data = array(
|
| 578 |
'key' => '',
|
| 579 |
'status' => 'deactivate',
|
| 580 |
);
|
| 581 |
|
| 582 |
-
update_option(
|
| 583 |
|
| 584 |
-
if (
|
| 585 |
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
|
|
|
|
| 586 |
return;
|
| 587 |
}
|
| 588 |
|
|
@@ -592,7 +646,8 @@ class License {
|
|
| 592 |
/**
|
| 593 |
* Add license menu page
|
| 594 |
*/
|
| 595 |
-
private function create_menu_page()
|
|
|
|
| 596 |
call_user_func(
|
| 597 |
'add_' . 'menu' . '_page',
|
| 598 |
$this->menu_args['page_title'],
|
|
@@ -608,7 +663,8 @@ class License {
|
|
| 608 |
/**
|
| 609 |
* Add submenu page
|
| 610 |
*/
|
| 611 |
-
private function create_submenu_page()
|
|
|
|
| 612 |
call_user_func(
|
| 613 |
'add_' . 'submenu' . '_page',
|
| 614 |
$this->menu_args['parent_slug'],
|
|
@@ -624,7 +680,8 @@ class License {
|
|
| 624 |
/**
|
| 625 |
* Add submenu page
|
| 626 |
*/
|
| 627 |
-
private function create_options_page()
|
|
|
|
| 628 |
call_user_func(
|
| 629 |
'add_' . 'options' . '_page',
|
| 630 |
$this->menu_args['page_title'],
|
|
@@ -639,34 +696,37 @@ class License {
|
|
| 639 |
/**
|
| 640 |
* Schedule daily sicense checker event
|
| 641 |
*/
|
| 642 |
-
public function schedule_cron_event()
|
| 643 |
-
|
| 644 |
-
|
|
|
|
| 645 |
|
| 646 |
-
wp_schedule_single_event(
|
| 647 |
}
|
| 648 |
}
|
| 649 |
|
| 650 |
/**
|
| 651 |
* Clear any scheduled hook
|
| 652 |
*/
|
| 653 |
-
public function clear_scheduler()
|
| 654 |
-
|
|
|
|
| 655 |
}
|
| 656 |
|
| 657 |
/**
|
| 658 |
* Enable/Disable schedule
|
| 659 |
*/
|
| 660 |
-
private function run_schedule()
|
| 661 |
-
|
|
|
|
| 662 |
case 'plugin':
|
| 663 |
-
register_activation_hook(
|
| 664 |
-
register_deactivation_hook(
|
| 665 |
break;
|
| 666 |
|
| 667 |
case 'theme':
|
| 668 |
-
add_action(
|
| 669 |
-
add_action(
|
| 670 |
break;
|
| 671 |
}
|
| 672 |
}
|
|
@@ -674,32 +734,39 @@ class License {
|
|
| 674 |
/**
|
| 675 |
* Form action URL
|
| 676 |
*/
|
| 677 |
-
private function formActionUrl()
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
|
|
|
| 681 |
);
|
|
|
|
|
|
|
| 682 |
}
|
| 683 |
|
| 684 |
/**
|
| 685 |
* Get input license key
|
|
|
|
| 686 |
* @param $action
|
|
|
|
| 687 |
* @return $license
|
| 688 |
*/
|
| 689 |
-
private function get_input_license_value(
|
| 690 |
-
|
| 691 |
-
|
|
|
|
| 692 |
}
|
| 693 |
|
| 694 |
-
if (
|
| 695 |
-
$key_length = strlen(
|
| 696 |
|
| 697 |
return str_pad(
|
| 698 |
-
substr(
|
|
|
|
|
|
|
| 699 |
);
|
| 700 |
}
|
| 701 |
|
| 702 |
return '';
|
| 703 |
}
|
| 704 |
-
|
| 705 |
}
|
| 6 |
*
|
| 7 |
* This class will check, active and deactive license
|
| 8 |
*/
|
| 9 |
+
class License
|
| 10 |
+
{
|
| 11 |
|
| 12 |
/**
|
| 13 |
* AppSero\Client
|
| 54 |
/**
|
| 55 |
* Set value for valid licnese
|
| 56 |
*
|
| 57 |
+
* @var bool
|
| 58 |
*/
|
| 59 |
private $is_valid_licnese = null;
|
| 60 |
|
| 63 |
*
|
| 64 |
* @param Appsero\Client
|
| 65 |
*/
|
| 66 |
+
public function __construct(Client $client)
|
| 67 |
+
{
|
| 68 |
$this->client = $client;
|
| 69 |
|
| 70 |
+
$this->option_key = 'appsero_' . md5($this->client->slug) . '_manage_license';
|
| 71 |
|
| 72 |
$this->schedule_hook = $this->client->slug . '_license_check_event';
|
| 73 |
|
| 74 |
// Run hook to check license status daily
|
| 75 |
+
add_action($this->schedule_hook, array( $this, 'check_license_status' ));
|
| 76 |
|
| 77 |
// Active/Deactive corn schedule
|
| 78 |
$this->run_schedule();
|
| 79 |
}
|
| 80 |
|
| 81 |
+
/**
|
| 82 |
+
* Set the license option key.
|
| 83 |
+
*
|
| 84 |
+
* If someone wants to override the default generated key.
|
| 85 |
+
*
|
| 86 |
+
* @param string $key
|
| 87 |
+
*
|
| 88 |
+
* @since 1.3.0
|
| 89 |
+
*
|
| 90 |
+
* @return License
|
| 91 |
+
*/
|
| 92 |
+
public function set_option_key($key)
|
| 93 |
+
{
|
| 94 |
+
$this->option_key = $key;
|
| 95 |
+
|
| 96 |
+
return $this;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Get the license key
|
| 101 |
+
*
|
| 102 |
+
* @since 1.3.0
|
| 103 |
+
*
|
| 104 |
+
* @return string|null
|
| 105 |
+
*/
|
| 106 |
+
public function get_license()
|
| 107 |
+
{
|
| 108 |
+
return get_option($this->option_key, null);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
/**
|
| 112 |
* Check license
|
| 113 |
*
|
| 114 |
+
* @return bool
|
| 115 |
*/
|
| 116 |
+
public function check($license_key)
|
| 117 |
+
{
|
| 118 |
$route = 'public/license/' . $this->client->hash . '/check';
|
| 119 |
|
| 120 |
+
return $this->send_request($license_key, $route);
|
| 121 |
}
|
| 122 |
|
| 123 |
/**
|
| 124 |
* Active a license
|
| 125 |
*
|
| 126 |
+
* @return bool
|
| 127 |
*/
|
| 128 |
+
public function activate($license_key)
|
| 129 |
+
{
|
| 130 |
$route = 'public/license/' . $this->client->hash . '/activate';
|
| 131 |
|
| 132 |
+
return $this->send_request($license_key, $route);
|
| 133 |
}
|
| 134 |
|
| 135 |
/**
|
| 136 |
* Deactivate a license
|
| 137 |
*
|
| 138 |
+
* @return bool
|
| 139 |
*/
|
| 140 |
+
public function deactivate($license_key)
|
| 141 |
+
{
|
| 142 |
$route = 'public/license/' . $this->client->hash . '/deactivate';
|
| 143 |
|
| 144 |
+
return $this->send_request($license_key, $route);
|
| 145 |
}
|
| 146 |
|
| 147 |
/**
|
| 152 |
*
|
| 153 |
* @return array
|
| 154 |
*/
|
| 155 |
+
protected function send_request($license_key, $route)
|
| 156 |
+
{
|
| 157 |
$params = array(
|
| 158 |
'license_key' => $license_key,
|
| 159 |
+
'url' => esc_url(home_url()),
|
| 160 |
'is_local' => $this->client->is_local_server(),
|
| 161 |
);
|
| 162 |
|
| 163 |
+
$response = $this->client->send_request($params, $route, true);
|
| 164 |
|
| 165 |
+
if (is_wp_error($response)) {
|
| 166 |
return array(
|
| 167 |
'success' => false,
|
| 168 |
'error' => $response->get_error_message()
|
| 169 |
);
|
| 170 |
}
|
| 171 |
|
| 172 |
+
$response = json_decode(wp_remote_retrieve_body($response), true);
|
| 173 |
|
| 174 |
+
if (empty($response) || isset($response['exception'])) {
|
| 175 |
return array(
|
| 176 |
'success' => false,
|
| 177 |
'error' => 'Unknown error occurred, Please try again.'
|
| 178 |
);
|
| 179 |
}
|
| 180 |
|
| 181 |
+
if (isset($response['errors']) && isset($response['errors']['license_key'])) {
|
| 182 |
$response = array(
|
| 183 |
'success' => false,
|
| 184 |
'error' => $response['errors']['license_key'][0]
|
| 195 |
*
|
| 196 |
* @return void
|
| 197 |
*/
|
| 198 |
+
public function add_settings_page($args = array())
|
| 199 |
+
{
|
| 200 |
$defaults = array(
|
| 201 |
'type' => 'menu', // Can be: menu, options, submenu
|
| 202 |
'page_title' => 'Manage License',
|
| 208 |
'parent_slug' => '',
|
| 209 |
);
|
| 210 |
|
| 211 |
+
$this->menu_args = wp_parse_args($args, $defaults);
|
| 212 |
|
| 213 |
+
add_action('admin_menu', array( $this, 'admin_menu' ), 99);
|
| 214 |
}
|
| 215 |
|
| 216 |
/**
|
| 218 |
*
|
| 219 |
* @return void
|
| 220 |
*/
|
| 221 |
+
public function admin_menu()
|
| 222 |
+
{
|
| 223 |
+
switch ($this->menu_args['type']) {
|
| 224 |
case 'menu':
|
| 225 |
$this->create_menu_page();
|
| 226 |
break;
|
| 238 |
/**
|
| 239 |
* License menu output
|
| 240 |
*/
|
| 241 |
+
public function menu_output()
|
| 242 |
+
{
|
| 243 |
+
if (isset($_POST['submit'])) {
|
| 244 |
+
$this->license_form_submit($_POST);
|
| 245 |
}
|
| 246 |
|
| 247 |
+
$license = $this->get_license();
|
| 248 |
+
$action = ($license && isset($license['status']) && 'activate' == $license['status']) ? 'deactive' : 'active';
|
| 249 |
+
$this->licenses_style(); ?>
|
|
|
|
| 250 |
|
| 251 |
<div class="wrap appsero-license-settings-wrapper">
|
| 252 |
<h1>License Settings</h1>
|
| 253 |
|
| 254 |
<?php
|
| 255 |
$this->show_license_page_notices();
|
| 256 |
+
do_action('before_appsero_license_section'); ?>
|
|
|
|
| 257 |
|
| 258 |
<div class="appsero-license-settings appsero-license-section">
|
| 259 |
<?php $this->show_license_page_card_header(); ?>
|
| 260 |
|
| 261 |
<div class="appsero-license-details">
|
| 262 |
+
<p>
|
| 263 |
+
<?php printf($this->client->__trans('Activate <strong>%s</strong> by your license key to get professional support and automatic update from your WordPress dashboard.'), $this->client->name); ?>
|
| 264 |
+
</p>
|
| 265 |
<form method="post" action="<?php $this->formActionUrl(); ?>" novalidate="novalidate" spellcheck="false">
|
| 266 |
<input type="hidden" name="_action" value="<?php echo $action; ?>">
|
| 267 |
+
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce($this->client->name); ?>">
|
| 268 |
<div class="license-input-fields">
|
| 269 |
<div class="license-input-key">
|
| 270 |
<svg enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
| 271 |
<path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
|
| 272 |
</svg>
|
| 273 |
+
<input type="text" value="<?php echo $this->get_input_license_value($action, $license); ?>"
|
| 274 |
+
placeholder="<?php echo esc_attr($this->client->__trans('Enter your license key to activate')); ?>" name="license_key"
|
| 275 |
+
<?php echo ('deactive' == $action) ? 'readonly="readonly"' : ''; ?>
|
| 276 |
/>
|
| 277 |
</div>
|
| 278 |
<button type="submit" name="submit" class="<?php echo 'deactive' == $action ? 'deactive-button' : ''; ?>">
|
| 279 |
+
<?php echo $action == 'active' ? $this->client->__trans('Activate License') : $this->client->__trans('Deactivate License'); ?>
|
| 280 |
</button>
|
| 281 |
</div>
|
| 282 |
</form>
|
| 283 |
|
| 284 |
<?php
|
| 285 |
+
if ('deactive' == $action && isset($license['remaining'])) {
|
| 286 |
+
$this->show_active_license_info($license);
|
| 287 |
+
} ?>
|
|
|
|
| 288 |
</div>
|
| 289 |
</div> <!-- /.appsero-license-settings -->
|
| 290 |
|
| 291 |
+
<?php do_action('after_appsero_license_section'); ?>
|
| 292 |
</div>
|
| 293 |
<?php
|
| 294 |
}
|
| 296 |
/**
|
| 297 |
* License form submit
|
| 298 |
*/
|
| 299 |
+
public function license_form_submit($form)
|
| 300 |
+
{
|
| 301 |
+
if (! isset($form['_nonce'], $form['_action'])) {
|
| 302 |
+
$this->error = 'Please add all information';
|
| 303 |
+
|
| 304 |
return;
|
| 305 |
}
|
| 306 |
|
| 307 |
+
if (! wp_verify_nonce($form['_nonce'], $this->client->name)) {
|
| 308 |
$this->error = "You don't have permission to manage license.";
|
| 309 |
+
|
| 310 |
return;
|
| 311 |
}
|
| 312 |
|
| 313 |
+
switch ($form['_action']) {
|
| 314 |
case 'active':
|
| 315 |
+
$this->active_client_license($form);
|
| 316 |
break;
|
| 317 |
|
| 318 |
case 'deactive':
|
| 319 |
+
$this->deactive_client_license($form);
|
| 320 |
break;
|
| 321 |
}
|
| 322 |
}
|
| 324 |
/**
|
| 325 |
* Check license status on schedule
|
| 326 |
*/
|
| 327 |
+
public function check_license_status()
|
| 328 |
+
{
|
| 329 |
+
$license = $this->get_license();
|
| 330 |
|
| 331 |
+
if (isset($license['key']) && ! empty($license['key'])) {
|
| 332 |
+
$response = $this->check($license['key']);
|
| 333 |
|
| 334 |
+
if (isset($response['success']) && $response['success']) {
|
| 335 |
$license['status'] = 'activate';
|
| 336 |
$license['remaining'] = $response['remaining'];
|
| 337 |
$license['activation_limit'] = $response['activation_limit'];
|
| 344 |
$license['expiry_days'] = 0;
|
| 345 |
}
|
| 346 |
|
| 347 |
+
update_option($this->option_key, $license, false);
|
| 348 |
}
|
| 349 |
}
|
| 350 |
|
| 351 |
/**
|
| 352 |
* Check this is a valid license
|
| 353 |
*/
|
| 354 |
+
public function is_valid()
|
| 355 |
+
{
|
| 356 |
+
if (null !== $this->is_valid_licnese) {
|
| 357 |
return $this->is_valid_licnese;
|
| 358 |
}
|
| 359 |
|
| 360 |
+
$license = $this->get_license();
|
| 361 |
+
|
| 362 |
+
if (! empty($license['key']) && isset($license['status']) && $license['status'] == 'activate') {
|
| 363 |
$this->is_valid_licnese = true;
|
| 364 |
} else {
|
| 365 |
+
$this->is_valid_licnese = false;
|
| 366 |
}
|
| 367 |
|
| 368 |
return $this->is_valid_licnese;
|
| 371 |
/**
|
| 372 |
* Check this is a valid license
|
| 373 |
*/
|
| 374 |
+
public function is_valid_by($option, $value)
|
| 375 |
+
{
|
| 376 |
+
$license = $this->get_license();
|
| 377 |
|
| 378 |
+
if (! empty($license['key']) && isset($license['status']) && $license['status'] == 'activate') {
|
| 379 |
+
if (isset($license[ $option ]) && $license[ $option ] == $value) {
|
| 380 |
return true;
|
| 381 |
}
|
| 382 |
}
|
| 387 |
/**
|
| 388 |
* Styles for licenses page
|
| 389 |
*/
|
| 390 |
+
private function licenses_style()
|
| 391 |
+
{
|
| 392 |
?>
|
| 393 |
<style type="text/css">
|
| 394 |
.appsero-license-section {
|
| 508 |
/**
|
| 509 |
* Show active license information
|
| 510 |
*/
|
| 511 |
+
private function show_active_license_info($license)
|
| 512 |
+
{
|
| 513 |
?>
|
| 514 |
<div class="active-license-info">
|
| 515 |
<div class="single-license-info">
|
| 516 |
+
<h3><?php $this->client->_etrans('Activations Remaining'); ?></h3>
|
| 517 |
+
<?php if (empty($license['activation_limit'])) { ?>
|
| 518 |
+
<p><?php $this->client->_etrans('Unlimited'); ?></p>
|
| 519 |
+
<?php } else { ?>
|
| 520 |
<p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
|
| 521 |
+
<?php printf($this->client->__trans('%1$d out of %2$d'), $license['remaining'], $license['activation_limit']); ?>
|
| 522 |
</p>
|
| 523 |
+
<?php } ?>
|
| 524 |
</div>
|
| 525 |
<div class="single-license-info">
|
| 526 |
+
<h3><?php $this->client->_etrans('Expires in'); ?></h3>
|
| 527 |
<?php
|
| 528 |
+
if (false !== $license['expiry_days']) {
|
| 529 |
+
$occupied = $license['expiry_days'] > 21 ? '' : 'occupied';
|
| 530 |
echo '<p class="' . $occupied . '">' . $license['expiry_days'] . ' days</p>';
|
| 531 |
} else {
|
| 532 |
+
echo '<p>' . $this->client->__trans('Never') . '</p>';
|
| 533 |
+
} ?>
|
|
|
|
| 534 |
</div>
|
| 535 |
</div>
|
| 536 |
<?php
|
| 539 |
/**
|
| 540 |
* Show license settings page notices
|
| 541 |
*/
|
| 542 |
+
private function show_license_page_notices()
|
| 543 |
+
{
|
| 544 |
+
if (! empty($this->error)) {
|
| 545 |
+
?>
|
| 546 |
<div class="notice notice-error is-dismissible appsero-license-section">
|
| 547 |
<p><?php echo $this->error; ?></p>
|
| 548 |
</div>
|
| 549 |
<?php
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
if (! empty($this->success)) {
|
| 553 |
+
?>
|
| 554 |
<div class="notice notice-success is-dismissible appsero-license-section">
|
| 555 |
<p><?php echo $this->success; ?></p>
|
| 556 |
</div>
|
| 557 |
<?php
|
| 558 |
+
}
|
| 559 |
+
echo '<br />';
|
| 560 |
}
|
| 561 |
|
| 562 |
/**
|
| 563 |
* Card header
|
| 564 |
*/
|
| 565 |
+
private function show_license_page_card_header()
|
| 566 |
+
{
|
| 567 |
?>
|
| 568 |
<div class="appsero-license-title">
|
| 569 |
<svg enable-background="new 0 0 299.995 299.995" version="1.1" viewBox="0 0 300 300" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
| 579 |
/**
|
| 580 |
* Active client license
|
| 581 |
*/
|
| 582 |
+
private function active_client_license($form)
|
| 583 |
+
{
|
| 584 |
+
if (empty($form['license_key'])) {
|
| 585 |
$this->error = 'The license key field is required.';
|
| 586 |
+
|
| 587 |
return;
|
| 588 |
}
|
| 589 |
|
| 590 |
+
$license_key = sanitize_text_field($form['license_key']);
|
| 591 |
+
$response = $this->activate($license_key);
|
| 592 |
|
| 593 |
+
if (! $response['success']) {
|
| 594 |
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
|
| 595 |
+
|
| 596 |
return;
|
| 597 |
}
|
| 598 |
|
| 607 |
'recurring' => $response['recurring'],
|
| 608 |
);
|
| 609 |
|
| 610 |
+
update_option($this->option_key, $data, false);
|
| 611 |
|
| 612 |
$this->success = 'License activated successfully.';
|
| 613 |
}
|
| 615 |
/**
|
| 616 |
* Deactive client license
|
| 617 |
*/
|
| 618 |
+
private function deactive_client_license($form)
|
| 619 |
+
{
|
| 620 |
+
$license = $this->get_license();
|
| 621 |
|
| 622 |
+
if (empty($license['key'])) {
|
| 623 |
$this->error = 'License key not found.';
|
| 624 |
+
|
| 625 |
return;
|
| 626 |
}
|
| 627 |
|
| 628 |
+
$response = $this->deactivate($license['key']);
|
| 629 |
|
| 630 |
$data = array(
|
| 631 |
'key' => '',
|
| 632 |
'status' => 'deactivate',
|
| 633 |
);
|
| 634 |
|
| 635 |
+
update_option($this->option_key, $data, false);
|
| 636 |
|
| 637 |
+
if (! $response['success']) {
|
| 638 |
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
|
| 639 |
+
|
| 640 |
return;
|
| 641 |
}
|
| 642 |
|
| 646 |
/**
|
| 647 |
* Add license menu page
|
| 648 |
*/
|
| 649 |
+
private function create_menu_page()
|
| 650 |
+
{
|
| 651 |
call_user_func(
|
| 652 |
'add_' . 'menu' . '_page',
|
| 653 |
$this->menu_args['page_title'],
|
| 663 |
/**
|
| 664 |
* Add submenu page
|
| 665 |
*/
|
| 666 |
+
private function create_submenu_page()
|
| 667 |
+
{
|
| 668 |
call_user_func(
|
| 669 |
'add_' . 'submenu' . '_page',
|
| 670 |
$this->menu_args['parent_slug'],
|
| 680 |
/**
|
| 681 |
* Add submenu page
|
| 682 |
*/
|
| 683 |
+
private function create_options_page()
|
| 684 |
+
{
|
| 685 |
call_user_func(
|
| 686 |
'add_' . 'options' . '_page',
|
| 687 |
$this->menu_args['page_title'],
|
| 696 |
/**
|
| 697 |
* Schedule daily sicense checker event
|
| 698 |
*/
|
| 699 |
+
public function schedule_cron_event()
|
| 700 |
+
{
|
| 701 |
+
if (! wp_next_scheduled($this->schedule_hook)) {
|
| 702 |
+
wp_schedule_event(time(), 'daily', $this->schedule_hook);
|
| 703 |
|
| 704 |
+
wp_schedule_single_event(time() + 20, $this->schedule_hook);
|
| 705 |
}
|
| 706 |
}
|
| 707 |
|
| 708 |
/**
|
| 709 |
* Clear any scheduled hook
|
| 710 |
*/
|
| 711 |
+
public function clear_scheduler()
|
| 712 |
+
{
|
| 713 |
+
wp_clear_scheduled_hook($this->schedule_hook);
|
| 714 |
}
|
| 715 |
|
| 716 |
/**
|
| 717 |
* Enable/Disable schedule
|
| 718 |
*/
|
| 719 |
+
private function run_schedule()
|
| 720 |
+
{
|
| 721 |
+
switch ($this->client->type) {
|
| 722 |
case 'plugin':
|
| 723 |
+
register_activation_hook($this->client->file, array( $this, 'schedule_cron_event' ));
|
| 724 |
+
register_deactivation_hook($this->client->file, array( $this, 'clear_scheduler' ));
|
| 725 |
break;
|
| 726 |
|
| 727 |
case 'theme':
|
| 728 |
+
add_action('after_switch_theme', array( $this, 'schedule_cron_event' ));
|
| 729 |
+
add_action('switch_theme', array( $this, 'clear_scheduler' ));
|
| 730 |
break;
|
| 731 |
}
|
| 732 |
}
|
| 734 |
/**
|
| 735 |
* Form action URL
|
| 736 |
*/
|
| 737 |
+
private function formActionUrl()
|
| 738 |
+
{
|
| 739 |
+
$url = add_query_arg(
|
| 740 |
+
$_GET,
|
| 741 |
+
admin_url(basename($_SERVER['SCRIPT_NAME']))
|
| 742 |
);
|
| 743 |
+
|
| 744 |
+
echo apply_filters('appsero_client_license_form_action', $url);
|
| 745 |
}
|
| 746 |
|
| 747 |
/**
|
| 748 |
* Get input license key
|
| 749 |
+
*
|
| 750 |
* @param $action
|
| 751 |
+
*
|
| 752 |
* @return $license
|
| 753 |
*/
|
| 754 |
+
private function get_input_license_value($action, $license)
|
| 755 |
+
{
|
| 756 |
+
if ('active' == $action) {
|
| 757 |
+
return isset($license['key']) ? $license['key'] : '';
|
| 758 |
}
|
| 759 |
|
| 760 |
+
if ('deactive' == $action) {
|
| 761 |
+
$key_length = strlen($license['key']);
|
| 762 |
|
| 763 |
return str_pad(
|
| 764 |
+
substr($license['key'], 0, $key_length / 2),
|
| 765 |
+
$key_length,
|
| 766 |
+
'*'
|
| 767 |
);
|
| 768 |
}
|
| 769 |
|
| 770 |
return '';
|
| 771 |
}
|
|
|
|
| 772 |
}
|
lib/appsero/src/Updater.php
CHANGED
|
@@ -148,8 +148,7 @@ class Updater
|
|
| 148 |
*/
|
| 149 |
private function get_project_latest_version()
|
| 150 |
{
|
| 151 |
-
$
|
| 152 |
-
$license = get_option($license_option_key, null);
|
| 153 |
|
| 154 |
$params = array(
|
| 155 |
'version' => $this->client->project_version,
|
| 148 |
*/
|
| 149 |
private function get_project_latest_version()
|
| 150 |
{
|
| 151 |
+
$license = $this->client->license()->get_license();
|
|
|
|
| 152 |
|
| 153 |
$params = array(
|
| 154 |
'version' => $this->client->project_version,
|
ml-slider.php
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
* Plugin Name: MetaSlider
|
| 7 |
* Plugin URI: https://www.metaslider.com
|
| 8 |
* Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
|
| 9 |
-
* Version: 3.19.
|
| 10 |
* Author: MetaSlider
|
| 11 |
* Author URI: https://www.metaslider.com
|
| 12 |
* License: GPL-2.0+
|
|
@@ -35,7 +35,7 @@ class MetaSliderPlugin
|
|
| 35 |
*
|
| 36 |
* @var string
|
| 37 |
*/
|
| 38 |
-
public $version = '3.19.
|
| 39 |
|
| 40 |
/**
|
| 41 |
* Pro installed version number
|
| 6 |
* Plugin Name: MetaSlider
|
| 7 |
* Plugin URI: https://www.metaslider.com
|
| 8 |
* Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
|
| 9 |
+
* Version: 3.19.1
|
| 10 |
* Author: MetaSlider
|
| 11 |
* Author URI: https://www.metaslider.com
|
| 12 |
* License: GPL-2.0+
|
| 35 |
*
|
| 36 |
* @var string
|
| 37 |
*/
|
| 38 |
+
public $version = '3.19.1';
|
| 39 |
|
| 40 |
/**
|
| 41 |
* Pro installed version number
|
readme.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
Contributors: matchalabs, DavidAnderson, dnutbourne, kbat82
|
| 3 |
Tags: slideshow, slider, image slider, carousel, gallery, flexslider, wordpress slider, nivoslider, rotating banner, responsive slideshow, seo slideshow, unsplash
|
| 4 |
Requires at least: 3.5
|
| 5 |
-
Stable tag: 3.19.
|
| 6 |
Requires PHP: 5.2
|
| 7 |
Tested up to: 5.6
|
| 8 |
License: GPLv2 or later
|
|
@@ -173,6 +173,10 @@ See https://www.metaslider.com/documentation/image-cropping/
|
|
| 173 |
|
| 174 |
== Changelog ==
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
= 3.19.0 - 2020/Nov/12 =
|
| 177 |
|
| 178 |
* ACCESSIBILITY: Fixes typo on svg button in Simply Dark
|
| 2 |
Contributors: matchalabs, DavidAnderson, dnutbourne, kbat82
|
| 3 |
Tags: slideshow, slider, image slider, carousel, gallery, flexslider, wordpress slider, nivoslider, rotating banner, responsive slideshow, seo slideshow, unsplash
|
| 4 |
Requires at least: 3.5
|
| 5 |
+
Stable tag: 3.19.1
|
| 6 |
Requires PHP: 5.2
|
| 7 |
Tested up to: 5.6
|
| 8 |
License: GPLv2 or later
|
| 173 |
|
| 174 |
== Changelog ==
|
| 175 |
|
| 176 |
+
= 3.19.1 - 2020/Dec/1 =
|
| 177 |
+
* TWEAK: Adds option to filter HTML Purify
|
| 178 |
+
* TWEAK: Updates Appsero dependency version
|
| 179 |
+
|
| 180 |
= 3.19.0 - 2020/Nov/12 =
|
| 181 |
|
| 182 |
* ACCESSIBILITY: Fixes typo on svg button in Simply Dark
|
