| @@ -8,62 +8,10 @@ | ||
| 8 | 8 | * |
| 9 | 9 | * @since 1.9 |
| 10 | 10 | */ |
| 11 | 11 | class PLL_License { |
| 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 | - */ | |
| 12 | + public $id, $name, $license_key, $license_data; | |
| 13 | + private $file, $version, $author; | |
| 66 | 14 | private $api_url = 'https://polylang.pro'; |
| 67 | 15 | |
| 68 | 16 | /** |
| 69 | 17 | * Constructor |
| @@ -108,10 +56,8 @@ | ||
| 108 | 56 | /** |
| 109 | 57 | * Auto updater |
| 110 | 58 | * |
| 111 | 59 | * @since 1.9 |
| 112 | - * | |
| 113 | - * @return void | |
| 114 | 60 | */ |
| 115 | 61 | public function auto_updater() { |
| 116 | 62 | $args = array( |
| 117 | 63 | 'version' => $this->version, |
| @@ -185,9 +131,8 @@ | ||
| 185 | 131 | * |
| 186 | 132 | * @since 1.9 |
| 187 | 133 | * |
| 188 | 134 | * @param string $request check_license | activate_license | deactivate_license |
| 189 | - * @return void | |
| 190 | 135 | */ |
| 191 | 136 | private function api_request( $request ) { |
| 192 | 137 | $licenses = get_option( 'polylang_licenses' ); |
| 193 | 138 | |
| @@ -245,14 +190,13 @@ | ||
| 245 | 190 | if ( ! empty( $this->license_data ) ) { |
| 246 | 191 | $license = $this->license_data; |
| 247 | 192 | } |
| 248 | 193 | |
| 249 | - $class = 'license-null'; | |
| 250 | - $message = ''; | |
| 194 | + $class = 'license-null'; | |
| 251 | 195 | |
| 252 | 196 | $out = sprintf( |
| 253 | 197 | '<td><label for="pll-licenses[%1$s]">%2$s</label></td>' . |
| 254 | - '<td><input name="licenses[%1$s]" id="pll-licenses[%1$s]" type="password" value="%3$s" class="regular-text code" />', | |
| 198 | + '<td><input name="licenses[%1$s]" id="pll-licenses[%1$s]" type="text" value="%3$s" class="regular-text code" />', | |
| 255 | 199 | esc_attr( $this->id ), |
| 256 | 200 | esc_attr( $this->name ), |
| 257 | 201 | esc_html( $this->license_key ) |
| 258 | 202 | ); |
| @@ -275,9 +219,9 @@ | ||
| 275 | 219 | $message = sprintf( |
| 276 | 220 | /* translators: %1$s is a date, %2$s is link start tag, %3$s is link end tag. */ |
| 277 | 221 | esc_html__( 'Your license key expired on %1$s. Please %2$srenew your license key%3$s.', 'polylang' ), |
| 278 | 222 | esc_html( date_i18n( get_option( 'date_format' ), $expiration ) ), |
| 279 | - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ), | |
| 223 | + sprintf( '<a href="%s" target="_blank">', esc_url( 'https://polylang.pro/checkout/?edd_license_key=' . $this->license_key ) ), | |
| 280 | 224 | '</a>' |
| 281 | 225 | ); |
| 282 | 226 | break; |
| 283 | 227 | |
| @@ -289,9 +233,9 @@ | ||
| 289 | 233 | case 'missing': |
| 290 | 234 | $message = sprintf( |
| 291 | 235 | /* translators: %1$s is link start tag, %2$s is link end tag. */ |
| 292 | 236 | esc_html__( 'Invalid license. Please %1$svisit your account page%2$s and verify it.', 'polylang' ), |
| 293 | - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ), | |
| 237 | + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account' ), | |
| 294 | 238 | '</a>' |
| 295 | 239 | ); |
| 296 | 240 | break; |
| 297 | 241 | |
| @@ -300,9 +244,9 @@ | ||
| 300 | 244 | $message = sprintf( |
| 301 | 245 | /* translators: %1$s is a product name, %2$s is link start tag, %3$s is link end tag. */ |
| 302 | 246 | 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' ), |
| 303 | 247 | esc_html( $this->name ), |
| 304 | - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ), | |
| 248 | + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account' ), | |
| 305 | 249 | '</a>' |
| 306 | 250 | ); |
| 307 | 251 | break; |
| 308 | 252 | |
| @@ -314,9 +258,9 @@ | ||
| 314 | 258 | case 'no_activations_left': |
| 315 | 259 | $message = sprintf( |
| 316 | 260 | /* translators: %1$s is link start tag, %2$s is link end tag */ |
| 317 | 261 | esc_html__( 'Your license key has reached its activation limit. %1$sView possible upgrades%2$s now.', 'polylang' ), |
| 318 | - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ), | |
| 262 | + sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account' ), | |
| 319 | 263 | '</a>' |
| 320 | 264 | ); |
| 321 | 265 | break; |
| 322 | 266 | } |
| @@ -332,9 +276,9 @@ | ||
| 332 | 276 | $message = sprintf( |
| 333 | 277 | /* translators: %1$s is a date, %2$s is link start tag, %3$s is link end tag. */ |
| 334 | 278 | esc_html__( 'Your license key will expire soon! Precisely, it will expire on %1$s. %2$sRenew your license key today!%3$s.', 'polylang' ), |
| 335 | 279 | esc_html( date_i18n( get_option( 'date_format' ), $expiration ) ), |
| 336 | - sprintf( '<a href="%s" target="_blank">', 'https://polylang.pro/account/' ), | |
| 280 | + sprintf( '<a href="%s" target="_blank">', esc_url( 'https://polylang.pro/checkout/?edd_license_key=' . $this->license_key ) ), | |
| 337 | 281 | '</a>' |
| 338 | 282 | ); |
| 339 | 283 | } else { |
| 340 | 284 | $message = sprintf( |