Changeset 3038667
- Timestamp:
- 02/20/2024 04:27:53 PM (2 years ago)
- Location:
- easytranslate
- Files:
-
- 6 edited
- 1 copied
-
tags/4.19 (copied) (copied from easytranslate/trunk)
-
tags/4.19/README.txt (modified) (1 diff)
-
tags/4.19/admin/class-easy-translate-api-service.php (modified) (2 diffs)
-
tags/4.19/easy-translate.php (modified) (2 diffs)
-
trunk/README.txt (modified) (1 diff)
-
trunk/admin/class-easy-translate-api-service.php (modified) (2 diffs)
-
trunk/easy-translate.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easytranslate/tags/4.19/README.txt
r2983499 r3038667 5 5 Requires at least: 4.7 6 6 Tested up to: 6.4 7 Stable tag: 4.1 87 Stable tag: 4.19 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
easytranslate/tags/4.19/admin/class-easy-translate-api-service.php
r2780745 r3038667 120 120 $this->access_token = $body['access_token']; 121 121 122 return $body; 122 $pat = $this->wp_remote_post( 123 '/oauth/personal-access-tokens', 124 [ 125 'body' => $this->personal_access_token_payload(), 126 'headers' => ['Content-Type' => 'application/json'], 127 ] 128 ); 129 $patCode = wp_remote_retrieve_response_code($pat); 130 $patBody = $this->decode_body($pat); 131 132 if ($patCode != 200) { 133 return [ 134 'error' => (isset($body['message']) && $body['message']) ? $body['message'] : __('Error', 135 EASY_TRANSLATE), 136 'hint' => (isset($body['hint']) && $body['hint']) ? $body['hint'] : __( 137 'Please verify your credentials', 138 EASY_TRANSLATE 139 ), 140 ]; 141 } 142 $this->access_token = $patBody['data']['attributes']['access_token']; 143 144 return [ 145 'access_token' => $this->access_token, 146 'refresh_token' => null, 147 'expires_in' => (60 * 60 * 24 * 354), // 1 year 148 ]; 123 149 } 124 150 … … 276 302 'scope' => self::SCOPE_DASHBOARD, 277 303 ]; 304 } 305 306 private function personal_access_token_payload(): string 307 { 308 return wp_json_encode([ 309 'data' => [ 310 'type' => 'personal_access_tokens', 311 'attributes' => [ 312 'name' => 'Wordpress Access Token', 313 'expires_in' => ['key' => 'year', 'value' => 1], 314 ], 315 ], 316 ]); 278 317 } 279 318 -
easytranslate/tags/4.19/easy-translate.php
r2903708 r3038667 15 15 * Plugin URI: https://www.easytranslate.com/en/integrations/cms/wordpress-plugin/ 16 16 * Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area. 17 * Version: 1.10. 317 * Version: 1.10.4 18 18 * Author: EasyTranslate 19 19 * Author URI: https://easytranslate.com … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define('EASY_TRANSLATE_VERSION', '1.10. 3');36 define('EASY_TRANSLATE_VERSION', '1.10.4'); 37 37 38 38 /** -
easytranslate/trunk/README.txt
r2983499 r3038667 5 5 Requires at least: 4.7 6 6 Tested up to: 6.4 7 Stable tag: 4.1 87 Stable tag: 4.19 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
easytranslate/trunk/admin/class-easy-translate-api-service.php
r2780745 r3038667 120 120 $this->access_token = $body['access_token']; 121 121 122 return $body; 122 $pat = $this->wp_remote_post( 123 '/oauth/personal-access-tokens', 124 [ 125 'body' => $this->personal_access_token_payload(), 126 'headers' => ['Content-Type' => 'application/json'], 127 ] 128 ); 129 $patCode = wp_remote_retrieve_response_code($pat); 130 $patBody = $this->decode_body($pat); 131 132 if ($patCode != 200) { 133 return [ 134 'error' => (isset($body['message']) && $body['message']) ? $body['message'] : __('Error', 135 EASY_TRANSLATE), 136 'hint' => (isset($body['hint']) && $body['hint']) ? $body['hint'] : __( 137 'Please verify your credentials', 138 EASY_TRANSLATE 139 ), 140 ]; 141 } 142 $this->access_token = $patBody['data']['attributes']['access_token']; 143 144 return [ 145 'access_token' => $this->access_token, 146 'refresh_token' => null, 147 'expires_in' => (60 * 60 * 24 * 354), // 1 year 148 ]; 123 149 } 124 150 … … 276 302 'scope' => self::SCOPE_DASHBOARD, 277 303 ]; 304 } 305 306 private function personal_access_token_payload(): string 307 { 308 return wp_json_encode([ 309 'data' => [ 310 'type' => 'personal_access_tokens', 311 'attributes' => [ 312 'name' => 'Wordpress Access Token', 313 'expires_in' => ['key' => 'year', 'value' => 1], 314 ], 315 ], 316 ]); 278 317 } 279 318 -
easytranslate/trunk/easy-translate.php
r2903708 r3038667 15 15 * Plugin URI: https://www.easytranslate.com/en/integrations/cms/wordpress-plugin/ 16 16 * Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area. 17 * Version: 1.10. 317 * Version: 1.10.4 18 18 * Author: EasyTranslate 19 19 * Author URI: https://easytranslate.com … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define('EASY_TRANSLATE_VERSION', '1.10. 3');36 define('EASY_TRANSLATE_VERSION', '1.10.4'); 37 37 38 38 /**
Note: See TracChangeset
for help on using the changeset viewer.