PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.3.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.3.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / codeinwp / themeisle-sdk / src / Modules / Licenser.php

Licenser.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.3.0, at vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php

756 lines 21.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The main loader class for license handling.
4 *
5 * @package ThemeIsleSDK
6 * @subpackage Modules
7 * @copyright Copyright (c) 2017, Marius Cristea
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 1.0.0
10 */
11
12 namespace ThemeisleSDK\Modules;
13
14 // Exit if accessed directly.
15 use ThemeisleSDK\Common\Abstract_Module;
16 use ThemeisleSDK\Product;
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 /**
23 * Licenser module for ThemeIsle SDK.
24 */
25 class Licenser extends Abstract_Module {
26
27 /**
28 * Number of max failed checks before showing the license message.
29 *
30 * @var int $max_failed Maximum failed checks allowed before show the notice
31 */
32 private static $max_failed = 5;
33 /**
34 * License key string.
35 *
36 * @var string $license_key The license key string
37 */
38 public $license_key;
39 /**
40 * This ensures that the custom API request only runs on the second time that WP fires the update check.
41 *
42 * @var bool $do_check Flag for request.
43 */
44 private $do_check = false;
45 /**
46 * Number of failed checks to the api endpoint.
47 *
48 * @var bool $failed_checks
49 */
50 private $failed_checks = 0;
51 /**
52 * The product update response key.
53 *
54 * @var string $product_key Product key.
55 */
56 private $product_key;
57
58 /**
59 * Disable wporg updates for premium products.
60 *
61 * @param string $r Update payload.
62 * @param string $url The api url.
63 *
64 * @return mixed List of themes to check for update.
65 */
66 function disable_wporg_update( $r, $url ) {
67
68 if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/' ) ) {
69 return $r;
70 }
71
72 // Decode the JSON response.
73 $themes = json_decode( $r['body']['themes'] );
74
75 unset( $themes->themes->{$this->product->get_slug()} );
76
77 // Encode the updated JSON response.
78 $r['body']['themes'] = json_encode( $themes );
79
80 return $r;
81 }
82
83 /**
84 * Register the setting for the license of the product.
85 *
86 * @return bool
87 */
88 public function register_settings() {
89 if ( ! is_admin() ) {
90 return false;
91 }
92 add_settings_field(
93 $this->product->get_key() . '_license',
94 $this->product->get_name() . ' license',
95 array( $this, 'license_view' ),
96 'general'
97 );
98 }
99
100 /**
101 * The license view field.
102 */
103 public function license_view() {
104 $status = $this->get_license_status();
105 $value = $this->license_key;
106
107 $activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', 'Activate' );
108 $deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', 'Deactivate' );
109 $valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', 'Valid' );
110 $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
111 $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
112 ?>
113 <style type="text/css">
114 input.themeisle-sdk-text-input-valid {
115 border: 1px solid #7ad03a;
116 }
117
118 input.themeisle-sdk-license-input {
119 width: 300px;
120 padding: 5px;
121 }
122
123 .themeisle-sdk-license-deactivate-cta {
124 color: #fff;
125 background: #7ad03a;
126 display: inline-block;
127 text-decoration: none;
128 font-size: 13px;
129 line-height: 30px;
130 height: 26px;
131 margin-left: 5px;
132 padding: 0 10px 3px;
133 -webkit-border-radius: 3px;
134 border-radius: 3px;
135 }
136
137 .themeisle-sdk-license-activate-cta {
138 color: #fff;
139 background: #dd3d36;
140 display: inline-block;
141 text-decoration: none;
142 font-size: 13px;
143 line-height: 30px;
144 height: 26px;
145 margin-left: 5px;
146 padding: 0 10px 3px;
147 -webkit-border-radius: 3px;
148 border-radius: 3px;
149 }
150
151 button.button.themeisle-sdk-licenser-button-cta {
152 line-height: 26px;
153 height: 29px;
154 vertical-align: top;
155 }
156
157 </style>
158 <?php
159 echo sprintf(
160 '<p>%s<input class="themeisle-sdk-license-input %s" type="text" id="%s_license" name="%s_license" value="%s" /><a class="%s">%s</a>&nbsp;&nbsp;&nbsp;<button name="%s_btn_trigger" class="button button-primary themeisle-sdk-licenser-button-cta" value="yes" type="submit" >%s</button></p><p class="description">%s</p>',
161 ( ( 'valid' === $status ) ? sprintf( '<input type="hidden" value="%s" name="%s_license" />', $this->product->get_key(), $value ) : '' ),
162 ( ( 'valid' === $status ) ? 'themeisle-sdk-text-input-valid' : '' ),
163 $this->product->get_key(),
164 ( ( 'valid' === $status ) ? $this->product->get_key() . '_mask' : $this->product->get_key() ),
165 ( ( 'valid' === $status ) ? ( str_repeat( '*', 30 ) . substr( $value, - 5 ) ) : $value ),
166 ( 'valid' === $status ? 'themeisle-sdk-license-deactivate-cta' : 'themeisle-sdk-license-activate-cta' ),
167 ( 'valid' === $status ? $valid_string : $invalid_string ),
168 $this->product->get_key(),
169 ( 'valid' === $status ? $deactivate_string : $activate_string ),
170 sprintf( $license_message, '<a href="' . $this->get_api_url() . '">' . $this->get_distributor_name() . '</a> ', $this->product->get_type() )
171 );
172
173 }
174
175 /**
176 * Return the license status.
177 *
178 * @return string The License status.
179 */
180 public function get_license_status() {
181
182 $license_data = get_option( $this->product->get_key() . '_license_data', '' );
183
184 if ( '' === $license_data ) {
185 return get_option( $this->product->get_key() . '_license_status', 'not_active' );
186 }
187
188 return isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
189
190 }
191
192 /**
193 * Get remote api url.
194 *
195 * @return string Remote api url.
196 */
197 public function get_api_url() {
198 if ( $this->is_from_partner( $this->product ) ) {
199 return 'https://themeisle.com';
200 }
201
202 return $this->product->get_store_url();
203 }
204
205 /**
206 * Get remote api url.
207 *
208 * @return string Remote api url.
209 */
210 public function get_distributor_name() {
211 if ( $this->is_from_partner( $this->product ) ) {
212 return 'ThemeIsle';
213 }
214
215 return $this->product->get_store_name();
216 }
217
218 /**
219 * Show the admin notice regarding the license status.
220 *
221 * @return bool Should we show the notice ?
222 */
223 function show_notice() {
224 if ( ! is_admin() ) {
225 return false;
226 }
227 $status = $this->get_license_status();
228 $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No activations left for %s !!!. You need to upgrade your plan in order to use %s on more websites. Please ask the %s Staff for more details.' );
229 $no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
230
231 // No activations left for this license.
232 if ( 'valid' != $status && $this->check_activation() ) {
233 ?>
234 <div class="error">
235 <p><strong>
236 <?php
237 echo sprintf(
238 $no_activations_string,
239 $this->product->get_name(),
240 $this->product->get_name(),
241 '<a href="' . $this->get_api_url() . '" target="_blank">' . $this->get_distributor_name() . '</a>'
242 );
243 ?>
244 </strong>
245 </p>
246 </div>
247 <?php
248 return false;
249 }
250 // Invalid license key.
251 if ( 'valid' != $status ) {
252 ?>
253 <div class="error">
254 <p>
255 <strong><?php echo sprintf( $no_valid_string, $this->product->get_name() . ' ' . $this->product->get_type(), $this->get_api_url(), admin_url( 'options-general.php' ) . '#' . $this->product->get_key() . '_license' ); ?> </strong>
256 </p>
257 </div>
258 <?php
259
260 return false;
261 }
262
263 return true;
264 }
265
266 /**
267 * Check if the license is active or not.
268 *
269 * @return bool
270 */
271 public function check_activation() {
272 $license_data = get_option( $this->product->get_key() . '_license_data', '' );
273 if ( '' === $license_data ) {
274 return false;
275 }
276
277 return isset( $license_data->error ) ? ( 'no_activations_left' == $license_data->error ) : false;
278
279 }
280
281 /**
282 * Check if the license is about to expire in the next month.
283 *
284 * @return bool
285 */
286 function check_expiration() {
287 $license_data = get_option( $this->product->get_key() . '_license_data', '' );
288 if ( '' === $license_data ) {
289 return false;
290 }
291 if ( ! isset( $license_data->expires ) ) {
292 return false;
293 }
294 if ( strtotime( $license_data->expires ) - time() > 30 * 24 * 3600 ) {
295 return false;
296 }
297
298 return true;
299 }
300
301 /**
302 * Return the renew url from the store used.
303 *
304 * @return string The renew url.
305 */
306 function renew_url() {
307 $license_data = get_option( $this->product->get_key() . '_license_data', '' );
308 if ( '' === $license_data ) {
309 return $this->get_api_url();
310 }
311 if ( ! isset( $license_data->download_id ) || ! isset( $license_data->key ) ) {
312 return $this->get_api_url();
313 }
314
315 return $this->get_api_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
316 }
317
318 /**
319 * Run the license check call.
320 */
321 public function product_valid() {
322 if ( false !== ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) {
323 return;
324 }
325 $license = $this->check_license();
326 set_transient( $this->product->get_key() . '_license_data', $license, 12 * HOUR_IN_SECONDS );
327 update_option( $this->product->get_key() . '_license_data', $license );
328 }
329
330 /**
331 * Check the license status.
332 *
333 * @return object The license data.
334 */
335 public function check_license() {
336 $status = $this->get_license_status();
337 if ( 'not_active' == $status ) {
338 $license_data = new \stdClass();
339 $license_data->license = 'not_active';
340
341 return $license_data;
342 }
343 $license = trim( $this->license_key );
344 $api_params = array(
345 'edd_action' => 'check_license',
346 'license' => $license,
347 'item_name' => rawurlencode( $this->product->get_name() ),
348 'url' => rawurlencode( home_url() ),
349 );
350 // Call the custom API.
351 $response = wp_remote_get(
352 add_query_arg( $api_params, $this->get_api_url() ),
353 array(
354 'timeout' => 15,
355 'sslverify' => false,
356 )
357 );
358 if ( is_wp_error( $response ) ) {
359 $license_data = new \stdClass();
360 $license_data->license = 'valid';
361
362 } else {
363 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
364 if ( ! is_object( $license_data ) ) {
365 $license_data = new \stdClass();
366 $license_data->license = 'valid';
367 }
368 }
369 $license_old = get_option( $this->product->get_key() . '_license_data', '' );
370 if ( 'valid' == $license_old->license && ( $license_data->license != $license_old->license ) ) {
371 $this->increment_failed_checks();
372 } else {
373 $this->reset_failed_checks();
374 }
375
376 if ( $this->failed_checks <= self::$max_failed ) {
377 return $license_old;
378 }
379
380 if ( isset( $license_old->hide_valid ) ) {
381 $license_data->hide_valid = true;
382 }
383
384 if ( ! isset( $license_data->key ) ) {
385 $license_data->key = isset( $license_old->key ) ? $license_old->key : '';
386 }
387
388 if ( isset( $license_old->hide_expiration ) ) {
389 $license_data->hide_expiration = true;
390 }
391
392 if ( isset( $license_old->hide_activation ) ) {
393 $license_data->hide_activation = true;
394 }
395
396 return $license_data;
397
398 }
399
400 /**
401 * Increment the failed checks.
402 */
403 private function increment_failed_checks() {
404 $this->failed_checks ++;
405 update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
406 }
407
408 /**
409 * Reset the failed checks
410 */
411 private function reset_failed_checks() {
412 $this->failed_checks = 1;
413 update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
414 }
415
416 /**
417 * Activate the license remotely.
418 */
419 function activate_license() {
420 // listen for our activate button to be clicked.
421 if ( ! isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) {
422 return;
423 }
424 $status = $this->get_license_status();
425 // retrieve the license from the database.
426 $license = $_POST[ $this->product->get_key() . '_license' ];
427 $api_params = array(
428 'license' => $license,
429 'item_name' => rawurlencode( $this->product->get_name() ),
430 'url' => rawurlencode( home_url() ),
431 );
432 if ( 'valid' != $status ) {
433 // data to send in our API request.
434 $api_params['edd_action'] = 'activate_license';
435 } else {
436 $api_params['edd_action'] = 'deactivate_license';
437 }
438 // Call the custom API.
439 $response = wp_remote_get( add_query_arg( $api_params, $this->get_api_url() ) );
440 // make sure the response came back okay.
441 if ( is_wp_error( $response ) ) {
442 $license_data = new \stdClass();
443 $license_data->license = ( 'valid' != $status ) ? 'valid' : 'invalid';
444
445 } else {
446 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
447 if ( ! is_object( $license_data ) ) {
448 $license_data = new \stdClass();
449 $license_data->license = ( 'valid' != $status ) ? 'valid' : 'invalid';
450 }
451 if ( ! isset( $license_data->license ) ) {
452 $license_data->license = 'invalid';
453 }
454 }
455 if ( ! isset( $license_data->key ) ) {
456 $license_data->key = $license;
457 }
458 if ( 'valid' == $license_data->license ) {
459 $this->reset_failed_checks();
460 }
461
462 if ( isset( $license_data->plan ) ) {
463 update_option( $this->product->get_key() . '_license_plan', $license_data->plan );
464 }
465
466 update_option( $this->product->get_key() . '_license_data', $license_data );
467 set_transient( $this->product->get_key() . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
468
469 }
470
471 /**
472 * Load the Themes screen.
473 */
474 function load_themes_screen() {
475 add_thickbox();
476 add_action( 'admin_notices', array( &$this, 'update_nag' ) );
477 }
478
479 /**
480 * Alter the nag for themes update.
481 */
482 function update_nag() {
483 $theme = wp_get_theme( $this->product->get_slug() );
484 $api_response = get_transient( $this->product_key );
485 if ( false === $api_response || ! isset( $api_response->new_version ) ) {
486 return;
487 }
488 $update_url = wp_nonce_url( 'update.php?action=upgrade-theme&amp;theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
489 $update_message = apply_filters( 'themeisle_sdk_license_update_message', 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.' );
490 $update_onclick = ' onclick="if ( confirm(\'' . esc_js( $update_message ) . '\') ) {return true;}return false;"';
491 if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
492 echo '<div id="update-nag">';
493 printf(
494 '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
495 $theme->get( 'Name' ),
496 $api_response->new_version,
497 sprintf( '%s&TB_iframe=true&amp;width=1024&amp;height=800', $this->product->get_changelog() ),
498 $theme->get( 'Name' ),
499 $update_url,
500 $update_onclick
501 );
502 echo '</div>';
503 echo '<div id="' . $this->product->get_slug() . '_' . 'changelog" style="display:none;">';
504 echo wpautop( $api_response->sections['changelog'] );
505 echo '</div>';
506 }
507 }
508
509 /**
510 * Alter update transient.
511 *
512 * @param mixed $value The transient data.
513 *
514 * @return mixed
515 */
516 function theme_update_transient( $value ) {
517 $update_data = $this->check_for_update();
518 if ( $update_data ) {
519 $value->response[ $this->product->get_slug() ] = $update_data;
520 }
521
522 return $value;
523 }
524
525 /**
526 * Check for updates
527 *
528 * @return array|bool Either the update data or false in case of failure.
529 */
530 function check_for_update() {
531 $update_data = get_transient( $this->product_key );
532
533 if ( false === $update_data ) {
534 $failed = false;
535 $update_data = $this->get_version_data();
536 if ( empty( $update_data ) ) {
537 $failed = true;
538 }
539 // If the response failed, try again in 30 minutes.
540 if ( $failed ) {
541 $data = new \stdClass();
542 $data->new_version = $this->product->get_version();
543 set_transient( $this->product_key, $data, 30 * MINUTE_IN_SECONDS );
544
545 return false;
546 }
547 $update_data->sections = isset( $update_data->sections ) ? maybe_unserialize( $update_data->sections ) : null;
548
549 set_transient( $this->product_key, $update_data, 12 * HOUR_IN_SECONDS );
550 }
551 if ( ! isset( $update_data->new_version ) ) {
552 return false;
553 }
554 if ( version_compare( $this->product->get_version(), $update_data->new_version, '>=' ) ) {
555 return false;
556 }
557
558 return (array) $update_data;
559 }
560
561 /**
562 * Check remote api for latest version.
563 *
564 * @return bool|mixed Update api response.
565 */
566 private function get_version_data() {
567 $api_params = array(
568 'edd_action' => 'get_version',
569 'version' => $this->product->get_version(),
570 'license' => empty( $this->license_key ) ? 'free' : '',
571 'name' => rawurlencode( $this->product->get_name() ),
572 'slug' => $this->product->get_slug(),
573 'author' => rawurlencode( $this->get_distributor_name() ),
574 'url' => rawurlencode( home_url() ),
575 );
576 $response = wp_remote_get(
577 add_query_arg( $api_params, $this->get_api_url() ),
578 array(
579 'timeout' => 15,
580 'sslverify' => false,
581 )
582 );
583 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
584 return false;
585 }
586 $update_data = json_decode( wp_remote_retrieve_body( $response ) );
587 if ( ! is_object( $update_data ) ) {
588 return false;
589 }
590
591 return $update_data;
592 }
593
594 /**
595 * Delete the update transient
596 */
597 function delete_theme_update_transient() {
598 delete_transient( $this->product_key );
599 }
600
601 /**
602 * Check for Updates at the defined API endpoint and modify the update array.
603 *
604 * @param array $_transient_data Update array build by WordPress.
605 *
606 * @return mixed Modified update array with custom plugin data.
607 */
608 public function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
609 if ( empty( $_transient_data ) || ! $this->do_check ) {
610 $this->do_check = true;
611
612 return $_transient_data;
613 }
614 $api_response = $this->api_request();
615 if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
616 if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
617 $_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
618 }
619 }
620
621 return $_transient_data;
622 }
623
624 /**
625 * Calls the API and, if successfull, returns the object delivered by the API.
626 *
627 * @param string $_action The requested action.
628 * @param array $_data Parameters for the API action.
629 *
630 * @return false||object
631 */
632 private function api_request( $_action = '', $_data = '' ) {
633 $update_data = $this->get_version_data();
634 if ( empty( $update_data ) ) {
635 return false;
636 }
637 if ( $update_data && isset( $update_data->sections ) ) {
638 $update_data->sections = maybe_unserialize( $update_data->sections );
639 }
640
641 return $update_data;
642 }
643
644 /**
645 * Updates information on the "View version x.x details" page with custom data.
646 *
647 * @param mixed $_data Plugin data.
648 * @param string $_action Action to send.
649 * @param object $_args Arguments to use.
650 *
651 * @return object $_data
652 */
653 public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
654 if ( ( 'plugin_information' != $_action ) || ! isset( $_args->slug ) || ( $_args->slug != $this->product->get_slug() ) ) {
655 return $_data;
656 }
657 $api_response = $this->api_request();
658 if ( false !== $api_response ) {
659 $_data = $api_response;
660 }
661
662 return $_data;
663 }
664
665 /**
666 * Disable SSL verification in order to prevent download update failures.
667 *
668 * @param array $args Http args.
669 * @param string $url Url to check.
670 *
671 * @return array $array
672 */
673 function http_request_args( $args, $url ) {
674 // If it is an https request and we are performing a package download, disable ssl verification.
675 if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
676 $args['sslverify'] = false;
677 }
678
679 return $args;
680 }
681
682 /**
683 * Check if we should load the module for this product.
684 *
685 * @param Product $product Product data.
686 *
687 * @return bool Should we load the module?
688 */
689 public function can_load( $product ) {
690
691 if ( $product->is_wordpress_available() ) {
692 return false;
693 }
694
695 return ( apply_filters( $product->get_key() . '_enable_licenser', true ) === true );
696
697 }
698
699 /**
700 * Load module logic.
701 *
702 * @param Product $product Product to load the module for.
703 *
704 * @return Licenser Module object.
705 */
706 public function load( $product ) {
707 $this->product = $product;
708
709 $this->product_key = $this->product->get_key() . '-update-response';
710
711 $this->license_key = $this->product->get_license();
712 if ( $this->product->requires_license() ) {
713 $this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
714 $this->register_license_hooks();
715 }
716
717 if ( $this->product->is_plugin() ) {
718 add_filter(
719 'pre_set_site_transient_update_plugins',
720 [
721 $this,
722 'pre_set_site_transient_update_plugins_filter',
723 ]
724 );
725 add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
726 add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
727
728 return $this;
729 }
730 if ( $this->product->is_theme() ) {
731 add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
732 add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
733 add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
734 add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
735 add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
736 add_filter( 'http_request_args', array( $this, 'disable_wporg_update' ), 5, 2 );
737
738 return $this;
739
740 }
741
742 return $this;
743 }
744
745 /**
746 * Register license fields for the products.
747 */
748 public function register_license_hooks() {
749 add_action( 'admin_init', array( $this, 'register_settings' ) );
750 add_action( 'admin_init', array( $this, 'activate_license' ) );
751 add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
752 add_action( 'admin_notices', array( $this, 'show_notice' ) );
753 add_filter( $this->product->get_key() . '_license_status', array( $this, 'get_license_status' ) );
754 }
755 }
756