← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php
+48
-44
3.10.13
→
3.11.10
View file →
| @@ -138,9 +138,9 @@ | ||
| 138 | 138 | $status = $this->get_license_status(); |
| 139 | 139 | $value = $this->license_key; |
| 140 | 140 | |
| 141 | 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']['deactivateactivate'] ); | |
| 142 | + $deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', Loader::$labels['licenser']['deactivate'] ); | |
| 143 | 143 | $valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', Loader::$labels['licenser']['valid'] ); |
| 144 | 144 | $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', Loader::$labels['licenser']['invalid'] ); |
| 145 | 145 | $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', Loader::$labels['licenser']['notice'] ); |
| 146 | 146 | $error_message = $this->get_error(); |
| @@ -925,9 +925,9 @@ | ||
| 925 | 925 | * @return bool Should we load the module? |
| 926 | 926 | */ |
| 927 | 927 | public function can_load( $product ) { |
| 928 | 928 | |
| 929 | - if ( $product->is_wordpress_available() ) { | |
| 929 | + if ( ! $product->requires_license() ) { | |
| 930 | 930 | return false; |
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | return ( apply_filters( $product->get_key() . '_enable_licenser', true ) === true ); |
| @@ -974,57 +974,61 @@ | ||
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | add_action( 'admin_head', [ $this, 'auto_activate' ] ); |
| 977 | 977 | if ( $this->product->is_plugin() ) { |
| 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, | |
| 978 | + if ( ! $product->is_wordpress_available() ) { | |
| 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( //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args | |
| 990 | 988 | 'http_request_args', |
| 991 | - ), | |
| 992 | - 10, | |
| 993 | - 2 | |
| 994 | - ); | |
| 995 | - if ( ! self::is_valid( $product->get_basefile() ) ) { | |
| 996 | - add_filter( | |
| 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; | |
| 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; | |
| 1001 | 1007 | } |
| 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 | - } | |
| 1007 | - ); | |
| 1008 | + ); | |
| 1009 | + } | |
| 1008 | 1010 | } |
| 1009 | 1011 | |
| 1010 | 1012 | return $this; |
| 1011 | 1013 | } |
| 1012 | 1014 | if ( $this->product->is_theme() ) { |
| 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 | - ); | |
| 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 | + } | |
| 1027 | 1031 | |
| 1028 | 1032 | return $this; |
| 1029 | 1033 | |
| 1030 | 1034 | } |