PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/license.php +68 -9 2.7.23.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * A class to easily manage licenses for Polylang Pro and addons
5 8 *
@@ -5,10 +8,62 @@
5 8 *
6 9 * @since 1.9
7 10 */
8 11 class PLL_License {
9 - public $id, $name, $license_key, $license_data;
10 - private $file, $version, $author;
12 + /**
13 + * Sanitized plugin name.
14 + *
15 + * @var string
16 + */
17 + public $id;
18 +
19 + /**
20 + * Plugin name.
21 + *
22 + * @var string
23 + */
24 + public $name;
25 +
26 + /**
27 + * License key.
28 + *
29 + * @var string
30 + */
31 + public $license_key;
32 +
33 + /**
34 + * License data, obtained from the API request.
35 + *
36 + * @var stdClass
37 + */
38 + public $license_data;
39 +
40 + /**
41 + * Main plugin file.
42 + *
43 + * @var string
44 + */
45 + private $file;
46 +
47 + /**
48 + * Current plugin version.
49 + *
50 + * @var string
51 + */
52 + private $version;
53 +
54 + /**
55 + * Plugin author.
56 + *
57 + * @var string
58 + */
59 + private $author;
60 +
61 + /**
62 + * API url.
63 + *
64 + * @var string.
65 + */
11 66 private $api_url = 'https://polylang.pro';
12 67
13 68 /**
14 69 * Constructor
@@ -53,8 +108,10 @@
53 108 /**
54 109 * Auto updater
55 110 *
56 111 * @since 1.9
112 + *
113 + * @return void
57 114 */
58 115 public function auto_updater() {
59 116 $args = array(
60 117 'version' => $this->version,
@@ -128,8 +185,9 @@
128 185 *
129 186 * @since 1.9
130 187 *
131 188 * @param string $request check_license | activate_license | deactivate_license
189 + * @return void
132 190 */
133 191 private function api_request( $request ) {
134 192 $licenses = get_option( 'polylang_licenses' );
135 193
@@ -187,13 +245,14 @@
187 245 if ( ! empty( $this->license_data ) ) {
188 246 $license = $this->license_data;
189 247 }
190 248
191 - $class = 'license-null';
249 + $class = 'license-null';
250 + $message = '';
192 251
193 252 $out = sprintf(
194 253 '<td><label for="pll-licenses[%1$s]">%2$s</label></td>' .
195 - '<td><input name="licenses[%1$s]" id="pll-licenses[%1$s]" type="text" value="%3$s" class="regular-text code" />',
254 + '<td><input name="licenses[%1$s]" id="pll-licenses[%1$s]" type="password" value="%3$s" class="regular-text code" />',
196 255 esc_attr( $this->id ),
197 256 esc_attr( $this->name ),
198 257 esc_html( $this->license_key )
199 258 );
@@ -216,9 +275,9 @@
216 275 $message = sprintf(
217 276 /* translators: %1$s is a date, %2$s is link start tag, %3$s is link end tag. */
218 277 esc_html__( 'Your license key expired on %1$s. Please %2$srenew your license key%3$s.', 'polylang' ),
219 278 esc_html( date_i18n( get_option( 'date_format' ), $expiration ) ),
220 - sprintf( '<a href="%s" target="_blank">', esc_url( 'https://polylang.pro/checkout/?edd_license_key=' . $this->license_key ) ),
279 + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ),
221 280 '</a>'
222 281 );
223 282 break;
224 283
@@ -230,9 +289,9 @@
230 289 case 'missing':
231 290 $message = sprintf(
232 291 /* translators: %1$s is link start tag, %2$s is link end tag. */
233 292 esc_html__( 'Invalid license. Please %1$svisit your account page%2$s and verify it.', 'polylang' ),
234 - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account' ),
293 + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ),
235 294 '</a>'
236 295 );
237 296 break;
238 297
@@ -241,9 +300,9 @@
241 300 $message = sprintf(
242 301 /* translators: %1$s is a product name, %2$s is link start tag, %3$s is link end tag. */
243 302 esc_html__( 'Your %1$s license key is not active for this URL. Please %2$svisit your account page%3$s to manage your license key URLs.', 'polylang' ),
244 303 esc_html( $this->name ),
245 - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account' ),
304 + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ),
246 305 '</a>'
247 306 );
248 307 break;
249 308
@@ -255,9 +314,9 @@
255 314 case 'no_activations_left':
256 315 $message = sprintf(
257 316 /* translators: %1$s is link start tag, %2$s is link end tag */
258 317 esc_html__( 'Your license key has reached its activation limit. %1$sView possible upgrades%2$s now.', 'polylang' ),
259 - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account' ),
318 + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ),
260 319 '</a>'
261 320 );
262 321 break;
263 322 }
@@ -273,9 +332,9 @@
273 332 $message = sprintf(
274 333 /* translators: %1$s is a date, %2$s is link start tag, %3$s is link end tag. */
275 334 esc_html__( 'Your license key will expire soon! Precisely, it will expire on %1$s. %2$sRenew your license key today!%3$s.', 'polylang' ),
276 335 esc_html( date_i18n( get_option( 'date_format' ), $expiration ) ),
277 - sprintf( '<a href="%s" target="_blank">', esc_url( 'https://polylang.pro/checkout/?edd_license_key=' . $this->license_key ) ),
336 + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ),
278 337 '</a>'
279 338 );
280 339 } else {
281 340 $message = sprintf(