Plugin Directory

Changeset 3038667


Ignore:
Timestamp:
02/20/2024 04:27:53 PM (2 years ago)
Author:
frpet
Message:

Release 4.19

Location:
easytranslate
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • easytranslate/tags/4.19/README.txt

    r2983499 r3038667  
    55Requires at least: 4.7
    66Tested up to: 6.4
    7 Stable tag: 4.18
     7Stable tag: 4.19
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • easytranslate/tags/4.19/admin/class-easy-translate-api-service.php

    r2780745 r3038667  
    120120        $this->access_token = $body['access_token'];
    121121
    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        ];
    123149    }
    124150
     
    276302            'scope'         => self::SCOPE_DASHBOARD,
    277303        ];
     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        ]);
    278317    }
    279318
  • easytranslate/tags/4.19/easy-translate.php

    r2903708 r3038667  
    1515 * Plugin URI:        https://www.easytranslate.com/en/integrations/cms/wordpress-plugin/
    1616 * Description:       This is a short description of what the plugin does. It's displayed in the WordPress admin area.
    17  * Version:           1.10.3
     17 * Version:           1.10.4
    1818 * Author:            EasyTranslate
    1919 * Author URI:        https://easytranslate.com
     
    3434 * Rename this for your plugin and update it as you release new versions.
    3535 */
    36 define('EASY_TRANSLATE_VERSION', '1.10.3');
     36define('EASY_TRANSLATE_VERSION', '1.10.4');
    3737
    3838/**
  • easytranslate/trunk/README.txt

    r2983499 r3038667  
    55Requires at least: 4.7
    66Tested up to: 6.4
    7 Stable tag: 4.18
     7Stable tag: 4.19
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • easytranslate/trunk/admin/class-easy-translate-api-service.php

    r2780745 r3038667  
    120120        $this->access_token = $body['access_token'];
    121121
    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        ];
    123149    }
    124150
     
    276302            'scope'         => self::SCOPE_DASHBOARD,
    277303        ];
     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        ]);
    278317    }
    279318
  • easytranslate/trunk/easy-translate.php

    r2903708 r3038667  
    1515 * Plugin URI:        https://www.easytranslate.com/en/integrations/cms/wordpress-plugin/
    1616 * Description:       This is a short description of what the plugin does. It's displayed in the WordPress admin area.
    17  * Version:           1.10.3
     17 * Version:           1.10.4
    1818 * Author:            EasyTranslate
    1919 * Author URI:        https://easytranslate.com
     
    3434 * Rename this for your plugin and update it as you release new versions.
    3535 */
    36 define('EASY_TRANSLATE_VERSION', '1.10.3');
     36define('EASY_TRANSLATE_VERSION', '1.10.4');
    3737
    3838/**
Note: See TracChangeset for help on using the changeset viewer.