PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.8
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
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php +47 -137 4.0.73.11.8 View file →
@@ -379,9 +379,9 @@
379 379
380 380 $status = $this->get_license_status( true );
381 381 $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', Loader::$labels['licenser']['no_activations'] );
382 382 $no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', sprintf( Loader::$labels['licenser']['inactive'], '%s', '<a href="%s" target="_blank">', '</a>', '<a href="%s">', '</a>' ) );
383 - $expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_heading_string', Loader::$labels['licenser']['expired'] );
383 + $expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_string', sprintf( Loader::$labels['licenser']['expired'], '%s', '<a href="%s" target="_blank">', '</a>' ) );
384 384 // No activations left for this license.
385 385 if ( 'valid' != $status && $this->check_activation() ) {
386 386 ?>
387 387 <div class="error">
@@ -402,74 +402,14 @@
402 402 }
403 403
404 404 // Invalid license key.
405 405 if ( 'active_expired' === $status ) {
406 - // Check if the notice was dismissed.
407 - $dismiss_option_key = $this->product->get_key() . '_expired_notice_dismissed';
408 - if ( get_option( $dismiss_option_key, false ) ) {
409 - return false;
410 - }
411 -
412 - $license_data = get_option( $this->product->get_key() . '_license_data', '' );
413 - $expiration_date = '';
414 - if ( is_object( $license_data ) && isset( $license_data->expires ) ) {
415 - $timestamp = strtotime( (string) $license_data->expires );
416 - if ( false !== $timestamp ) {
417 - $expiration_date = gmdate( 'F j, Y', $timestamp );
418 - }
419 - }
420 -
421 - $discount_config = apply_filters( $this->product->get_key() . '_lc_renew_discount', false );
422 -
423 - if ( is_array( $discount_config ) && isset( $discount_config['url'] ) && isset( $discount_config['renew_button'] ) ) {
424 - $renew_url = $discount_config['url'];
425 - $renew_button = $discount_config['renew_button'];
426 - } else {
427 - $renew_url = apply_filters( $this->product->get_key() . '_lc_renew_url', $this->renew_url() );
428 - $renew_button = apply_filters( $this->product->get_key() . '_lc_renew_button_string', Loader::$labels['licenser']['renew_license'] );
429 - }
430 -
431 - $learn_more_url = apply_filters( $this->product->get_key() . '_lc_learn_more_url', $this->get_api_url() );
432 - $learn_more_button = apply_filters( $this->product->get_key() . '_lc_learn_more_button_string', Loader::$labels['licenser']['learn_more'] );
433 - $notice_message = apply_filters( $this->product->get_key() . '_lc_expired_notice_message', Loader::$labels['licenser']['expired_notice'] );
434 -
435 - $expired_date_string = apply_filters( $this->product->get_key() . '_lc_expired_date_string', sprintf( Loader::$labels['licenser']['expired_date'], esc_html( $expiration_date ) ) );
436 - $heading = apply_filters( $this->product->get_key() . '_lc_expired_heading_string', sprintf( Loader::$labels['licenser']['expired'], $this->product->get_name() ) );
437 - $notice_id = $this->product->get_key() . '_expired_notice';
438 406 ?>
439 - <div class="notice notice-warning notice-alt is-dismissible themeisle-sdk-license-notice" id="<?php echo esc_attr( $notice_id ); ?>" data-notice-id="<?php echo esc_attr( $notice_id ); ?>" style="position: relative; border-left: 4px solid #d63638; padding: 12px; background-color: #fff;">
440 - <p style="margin: 0.5em 0; font-size: 13px;">
441 - <strong><?php echo wp_kses_post( $heading ); ?></strong>
442 - · <?php echo esc_html( $expired_date_string ); ?>
407 + <div class="error">
408 + <p>
409 + <strong><?php echo sprintf( wp_kses_data( $expired_license_string ), esc_attr( $this->product->get_name() . ' ' . $this->product->get_type() ), esc_url( $this->get_api_url() . '?license=' . $this->license_key ) ); ?> </strong>
443 410 </p>
444 - <p style="margin: 0.5em 0 1em 0; font-size: 13px;">
445 - <?php echo esc_html( $notice_message ); ?>
446 - </p>
447 - <p style="margin: 0.5em 0;">
448 - <a href="<?php echo esc_url( $renew_url ); ?>" class="button button-primary" target="_blank" rel="noopener noreferrer">
449 - <?php echo esc_html( $renew_button ); ?>
450 - </a>
451 - <a href="<?php echo esc_url( $learn_more_url ); ?>" class="button" target="_blank" rel="noopener noreferrer" style="border: none; background-color: transparent;">
452 - <?php echo esc_html( $learn_more_button ); ?>
453 - </a>
454 - </p>
455 411 </div>
456 - <script type="text/javascript">
457 - jQuery(document).ready(function($) {
458 - $('#<?php echo esc_js( $notice_id ); ?>').on('click', '.notice-dismiss', function(e) {
459 - const noticeId = '<?php echo esc_js( $notice_id ); ?>';
460 - $.ajax({
461 - url: ajaxurl,
462 - type: 'POST',
463 - data: {
464 - action: 'themeisle_sdk_dismiss_license_notice',
465 - notice_id: noticeId,
466 - nonce: '<?php echo esc_js( wp_create_nonce( 'themeisle_sdk_dismiss_license_notice' ) ); ?>'
467 - }
468 - });
469 - });
470 - });
471 - </script>
472 412 <?php
473 413
474 414 return false;
475 415 }
@@ -985,9 +925,9 @@
985 925 * @return bool Should we load the module?
986 926 */
987 927 public function can_load( $product ) {
988 928
989 - if ( ! $product->requires_license() ) {
929 + if ( $product->is_wordpress_available() ) {
990 930 return false;
991 931 }
992 932
993 933 return ( apply_filters( $product->get_key() . '_enable_licenser', true ) === true );
@@ -1034,61 +974,57 @@
1034 974 }
1035 975
1036 976 add_action( 'admin_head', [ $this, 'auto_activate' ] );
1037 977 if ( $this->product->is_plugin() ) {
1038 - if ( ! $product->is_wordpress_available() ) {
978 + add_filter(
979 + 'pre_set_site_transient_update_plugins',
980 + [
981 + $this,
982 + 'pre_set_site_transient_update_plugins_filter',
983 + ]
984 + );
985 + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
986 + add_filter( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
987 + 'http_request_args',
988 + array(
989 + $this,
990 + 'http_request_args',
991 + ),
992 + 10,
993 + 2
994 + );
995 + if ( ! self::is_valid( $product->get_basefile() ) ) {
1039 996 add_filter(
1040 - 'pre_set_site_transient_update_plugins',
1041 - [
1042 - $this,
1043 - 'pre_set_site_transient_update_plugins_filter',
1044 - ]
997 + 'plugin_action_links_' . plugin_basename( $product->get_basefile() ),
998 + function ( $actions ) {
999 + if ( $this->get_license_status( true ) !== self::STATUS_ACTIVE_EXPIRED ) {
1000 + return $actions;
1001 + }
1002 + $new_actions['deactivate'] = $actions['deactivate'];
1003 + $new_actions['renew_link'] = '<a style="color:#d63638" href="' . esc_url( $this->renew_url() ) . '" target="_blank" rel="external noopener noreferrer">' . esc_html( Loader::$labels['licenser']['renew_cta'] ) . '</a>';
1004 +
1005 + return $new_actions;
1006 + }
1045 1007 );
1046 - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
1047 - add_filter( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
1048 - 'http_request_args',
1049 - array(
1050 - $this,
1051 - 'http_request_args',
1052 - ),
1053 - 10,
1054 - 2
1055 - );
1056 - if ( ! self::is_valid( $product->get_basefile() ) ) {
1057 - add_filter(
1058 - 'plugin_action_links_' . plugin_basename( $product->get_basefile() ),
1059 - function ( $actions ) {
1060 - if ( $this->get_license_status( true ) !== self::STATUS_ACTIVE_EXPIRED ) {
1061 - return $actions;
1062 - }
1063 - $new_actions['deactivate'] = $actions['deactivate'];
1064 - $new_actions['renew_link'] = '<a style="color:#d63638" href="' . esc_url( $this->renew_url() ) . '" target="_blank" rel="external noopener noreferrer">' . esc_html( Loader::$labels['licenser']['renew_cta'] ) . '</a>';
1065 -
1066 - return $new_actions;
1067 - }
1068 - );
1069 - }
1070 1008 }
1071 1009
1072 1010 return $this;
1073 1011 }
1074 1012 if ( $this->product->is_theme() ) {
1075 - if ( ! $product->is_wordpress_available() ) {
1076 - add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
1077 - add_action( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
1078 - add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
1079 - add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
1080 - add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
1081 - add_filter( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
1082 - 'http_request_args',
1083 - array(
1084 - $this,
1085 - 'disable_wporg_update',
1086 - ),
1087 - 5,
1088 - 2
1089 - );
1090 - }
1013 + add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
1014 + add_action( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
1015 + add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
1016 + add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
1017 + add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
1018 + add_filter( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
1019 + 'http_request_args',
1020 + array(
1021 + $this,
1022 + 'disable_wporg_update',
1023 + ),
1024 + 5,
1025 + 2
1026 + );
1091 1027
1092 1028 return $this;
1093 1029
1094 1030 }
@@ -1104,34 +1040,8 @@
1104 1040 add_action( 'admin_init', array( $this, 'process_license' ) );
1105 1041 add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
1106 1042 add_action( 'admin_notices', array( $this, 'show_notice' ) );
1107 1043 add_filter( $this->product->get_key() . '_license_status', array( $this, 'get_license_status' ) );
1108 - add_action( 'wp_ajax_themeisle_sdk_dismiss_license_notice', array( $this, 'dismiss_license_notice' ) );
1109 - }
1110 -
1111 - /**
1112 - * Handle AJAX request to dismiss the license notice.
1113 - */
1114 - public function dismiss_license_notice() {
1115 - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['nonce'] ), 'themeisle_sdk_dismiss_license_notice' ) ) {
1116 - wp_send_json_error( 'Invalid nonce' );
1117 - }
1118 -
1119 - if ( ! current_user_can( 'manage_options' ) ) {
1120 - wp_send_json_error( 'Insufficient permissions' );
1121 - }
1122 -
1123 - $notice_id = isset( $_POST['notice_id'] ) ? sanitize_text_field( $_POST['notice_id'] ) : '';
1124 -
1125 - if ( empty( $notice_id ) ) {
1126 - wp_send_json_error( 'Missing notice ID' );
1127 - }
1128 -
1129 - // Save the dismissal option.
1130 - $dismiss_option_key = $notice_id . '_dismissed';
1131 - update_option( $dismiss_option_key, true );
1132 -
1133 - wp_send_json_success();
1134 1044 }
1135 1045
1136 1046 /**
1137 1047 * Check license on filesystem.