PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.14
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.14
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 +74 -53 3.10.113.11.14 View file →
@@ -137,13 +137,13 @@
137 137 public function license_view() {
138 138 $status = $this->get_license_status();
139 139 $value = $this->license_key;
140 140
141 - $activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', 'Activate' );
142 - $deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', 'Deactivate' );
143 - $valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', 'Valid' );
144 - $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
145 - $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
141 + $activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', Loader::$labels['licenser']['activate'] );
142 + $deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', Loader::$labels['licenser']['deactivate'] );
143 + $valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', Loader::$labels['licenser']['valid'] );
144 + $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', Loader::$labels['licenser']['invalid'] );
145 + $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', Loader::$labels['licenser']['notice'] );
146 146 $error_message = $this->get_error();
147 147 ?>
148 148 <style type="text/css">
149 149 input.themeisle-sdk-text-input-valid {
@@ -265,11 +265,11 @@
265 265 }
266 266
267 267 /**
268 268 * Get license hash.
269 - *
269 + *
270 270 * @param string $key Product key.
271 - *
271 + *
272 272 * @return bool|string
273 273 */
274 274 public static function create_license_hash( $key ) {
275 275 $data = self::get_license_data( $key );
@@ -377,11 +377,11 @@
377 377 return false;
378 378 }
379 379
380 380 $status = $this->get_license_status( true );
381 - $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No more activations left for %s. You need to upgrade your plan in order to use %s on more websites. If you need assistance, please get in touch with %s staff.' );
382 - $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>. ' );
383 - $expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_string', 'Your %s\'s License Key has expired. In order to continue receiving support and software updates you must <a href="%s" target="_blank">renew</a> your license key.' );
381 + $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', Loader::$labels['licenser']['no_activations'] );
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_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">
@@ -542,17 +542,17 @@
542 542 * @return bool|\WP_Error
543 543 */
544 544 public function do_license_process( $license, $action = 'toggle' ) {
545 545 if ( strlen( $license ) < 10 ) {
546 - return new \WP_Error( 'themeisle-license-invalid-format', 'Invalid license.' );
546 + return new \WP_Error( 'themeisle-license-invalid-format', Loader::$labels['licenser']['invalid_msg'] );
547 547 }
548 548 $status = $this->get_license_status();
549 549
550 550 if ( 'valid' === $status && 'activate' === $action ) {
551 - return new \WP_Error( 'themeisle-license-already-active', 'License is already active.' );
551 + return new \WP_Error( 'themeisle-license-already-active', Loader::$labels['licenser']['already_active'] );
552 552 }
553 553 if ( 'valid' !== $status && 'deactivate' === $action ) {
554 - return new \WP_Error( 'themeisle-license-already-deactivate', 'License not active.' );
554 + return new \WP_Error( 'themeisle-license-already-deactivate', Loader::$labels['licenser']['not_active'] );
555 555 }
556 556
557 557 if ( 'toggle' === $action ) {
558 558 $action = ( 'valid' !== $status ? ( 'activate' ) : ( 'deactivate' ) );
@@ -578,15 +578,15 @@
578 578 }
579 579
580 580 // make sure the response came back okay.
581 581 if ( is_wp_error( $response ) ) {
582 - return new \WP_Error( 'themeisle-license-500', sprintf( 'ERROR: Failed to connect to the license service. Please try again later. Reason: %s', $response->get_error_message() ) );
582 + return new \WP_Error( 'themeisle-license-500', sprintf( Loader::$labels['licenser']['error_notice'], $response->get_error_message() ) );
583 583 }
584 584
585 585 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
586 586
587 587 if ( ! is_object( $license_data ) ) {
588 - return new \WP_Error( 'themeisle-license-404', 'ERROR: Failed to validate license. Please try again in one minute.' );
588 + return new \WP_Error( 'themeisle-license-404', Loader::$labels['licenser']['error_notice2'] );
589 589 }
590 590 if ( 'check' === $action ) {
591 591 return $license_data;
592 592 }
@@ -617,9 +617,9 @@
617 617 }
618 618 update_option( $this->product->get_key() . '_license_data', $license_data );
619 619 set_transient( $this->product->get_key() . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
620 620 if ( 'activate' === $action && 'valid' !== $license_data->license ) {
621 - return new \WP_Error( 'themeisle-license-invalid', 'ERROR: Invalid license provided.' );
621 + return new \WP_Error( 'themeisle-license-invalid', Loader::$labels['licenser']['error_invalid'] );
622 622 }
623 623
624 624 // Remove the versions transient upon activation so that newer version for rollback can be acquired.
625 625 $versions_cache = $this->product->get_cache_key();
@@ -652,9 +652,9 @@
652 652 if ( ! isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) {
653 653 return;
654 654 }
655 655 if ( ! isset( $_POST[ $this->product->get_key() . 'nonce_field' ] )
656 - || ! wp_verify_nonce( $_POST[ $this->product->get_key() . 'nonce_field' ], $this->product->get_key() . 'nonce' ) //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
656 + || ! wp_verify_nonce( $_POST[ $this->product->get_key() . 'nonce_field' ], $this->product->get_key() . 'nonce' ) //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
657 657 ) {
658 658 return;
659 659 }
660 660 if ( ! current_user_can( 'manage_options' ) ) {
@@ -702,20 +702,18 @@
702 702 if ( false === $api_response || ! isset( $api_response->new_version ) ) {
703 703 return;
704 704 }
705 705 $update_url = wp_nonce_url( 'update.php?action=upgrade-theme&amp;theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
706 - $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.' );
706 + $update_message = apply_filters( 'themeisle_sdk_license_update_message', Loader::$labels['licenser']['update_license'] );
707 707 $update_onclick = ' onclick="if ( confirm(\'' . esc_js( $update_message ) . '\') ) {return true;}return false;"';
708 708 if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
709 709 echo '<div id="update-nag">';
710 710 printf(
711 - '<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>.',
712 - esc_attr( $theme->get( 'Name' ) ),
713 - esc_attr( $api_response->new_version ),
714 - esc_url( sprintf( '%s&TB_iframe=true&amp;width=1024&amp;height=800', $this->product->get_changelog() ) ),
715 - esc_attr( $theme->get( 'Name' ) ),
716 - esc_url( $update_url ),
717 - $update_onclick // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Already escaped.
711 + esc_html( Loader::$labels['licenser']['notice_update'] ),
712 + '<strong>' . esc_attr( $theme->get( 'Name' ) ) . ' ' . esc_attr( $api_response->new_version ) . '</strong>',
713 + '<a href="' . esc_url( sprintf( '%s&TB_iframe=true&amp;width=1024&amp;height=800', $this->product->get_changelog() ) ) . '" class="thickbox" title="' . esc_attr( $theme->get( 'Name' ) ) . '">',
714 + '</a>',
715 + '<a href="' . esc_url( $update_url ) . '" ' . $update_onclick . '>' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Already escaped.
718 716 );
719 717 echo '</div>';
720 718 echo '<div id="' . esc_attr( $this->product->get_slug() ) . '_changelog" style="display:none;">';
721 719 echo wp_kses_data( wpautop( $api_response->sections['changelog'] ) );
@@ -744,8 +742,9 @@
744 742 return $value;
745 743 }
746 744
747 745 $value->response[ $this->product->get_slug() ] = $update_data;
746 +
748 747 return $value;
749 748 }
750 749
751 750 /**
@@ -926,9 +925,9 @@
926 925 * @return bool Should we load the module?
927 926 */
928 927 public function can_load( $product ) {
929 928
930 - if ( $product->is_wordpress_available() ) {
929 + if ( ! $product->requires_license() ) {
931 930 return false;
932 931 }
933 932
934 933 return ( apply_filters( $product->get_key() . '_enable_licenser', true ) === true );
@@ -975,41 +974,61 @@
975 974 }
976 975
977 976 add_action( 'admin_head', [ $this, 'auto_activate' ] );
978 977 if ( $this->product->is_plugin() ) {
979 - add_filter(
980 - 'pre_set_site_transient_update_plugins',
981 - [
982 - $this,
983 - 'pre_set_site_transient_update_plugins_filter',
984 - ]
985 - );
986 - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
987 - add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
988 - if ( ! self::is_valid( $product->get_basefile() ) ) {
978 + if ( ! $product->is_wordpress_available() ) {
989 979 add_filter(
990 - 'plugin_action_links_' . plugin_basename( $product->get_basefile() ),
991 - function ( $actions ) {
992 - if ( $this->get_license_status( true ) !== self::STATUS_ACTIVE_EXPIRED ) {
993 - return $actions;
980 + 'pre_set_site_transient_update_plugins',
981 + [
982 + $this,
983 + 'pre_set_site_transient_update_plugins_filter',
984 + ]
985 + );
986 + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
987 + add_filter( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
988 + 'http_request_args',
989 + array(
990 + $this,
991 + 'http_request_args',
992 + ),
993 + 10,
994 + 2
995 + );
996 + if ( ! self::is_valid( $product->get_basefile() ) ) {
997 + add_filter(
998 + 'plugin_action_links_' . plugin_basename( $product->get_basefile() ),
999 + function ( $actions ) {
1000 + if ( $this->get_license_status( true ) !== self::STATUS_ACTIVE_EXPIRED ) {
1001 + return $actions;
1002 + }
1003 + $new_actions['deactivate'] = $actions['deactivate'];
1004 + $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>';
1005 +
1006 + return $new_actions;
994 1007 }
995 - $new_actions['deactivate'] = $actions['deactivate'];
996 - $new_actions['renew_link'] = '<a style="color:#d63638" href="' . esc_url( $this->renew_url() ) . '" target="_blank" rel="external noopener noreferrer">Renew license to update</a>';
997 -
998 - return $new_actions;
999 - }
1000 - );
1008 + );
1009 + }
1001 1010 }
1002 1011
1003 1012 return $this;
1004 1013 }
1005 1014 if ( $this->product->is_theme() ) {
1006 - add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
1007 - add_action( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
1008 - add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
1009 - add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
1010 - add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
1011 - add_filter( 'http_request_args', array( $this, 'disable_wporg_update' ), 5, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
1015 + if ( ! $product->is_wordpress_available() ) {
1016 + add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
1017 + add_action( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
1018 + add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
1019 + add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
1020 + add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
1021 + add_filter( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
1022 + 'http_request_args',
1023 + array(
1024 + $this,
1025 + 'disable_wporg_update',
1026 + ),
1027 + 5,
1028 + 2
1029 + );
1030 + }
1012 1031
1013 1032 return $this;
1014 1033
1015 1034 }
@@ -1050,10 +1069,12 @@
1050 1069 }
1051 1070 if ( ! isset( $content->key ) ) {
1052 1071 return false;
1053 1072 }
1073 +
1054 1074 return $content->key;
1055 1075 }
1076 +
1056 1077 /**
1057 1078 * Run license activation on plugin activate.
1058 1079 */
1059 1080 public function auto_activate() {
@@ -1101,9 +1122,9 @@
1101 1122 */
1102 1123 public function autoactivate_notice() {
1103 1124 ?>
1104 1125 <div class="notice notice-success is-dismissible">
1105 - <p><?php echo sprintf( '<strong>%s</strong> has been successfully activated using <strong>%s</strong> license !', esc_attr( $this->product->get_name() ), esc_attr( str_repeat( '*', 20 ) . substr( $this->license_local, - 10 ) ) ); ?></p>
1126 + <p><?php echo sprintf( esc_html( Loader::$labels['licenser']['autoactivate_notice'] ), '<strong>' . esc_attr( $this->product->get_name() ) . '</strong>', '<strong>' . esc_attr( str_repeat( '*', 20 ) . substr( $this->license_local, - 10 ) ) . '</strong>' ); ?></p>
1106 1127 </div>
1107 1128 <?php
1108 1129 }
1109 1130