Plugin Directory

Changeset 3293830


Ignore:
Timestamp:
05/15/2025 07:20:27 AM (11 months ago)
Author:
frpet
Message:

Release v2.0.3

Location:
easytranslate
Files:
4 edited
18 copied

Legend:

Unmodified
Added
Removed
  • easytranslate/tags/v5.4/README.txt

    r3281341 r3293830  
    55Requires at least: 4.7
    66Tested up to: 6.8
    7 Stable tag: 5.3
     7Stable tag: 5.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • easytranslate/tags/v5.4/admin/functions.php

    r2866487 r3293830  
    201201}
    202202
    203 /**
    204  * Verifies that a correct security nonce was used with time limit.
    205  *
    206  * @param     $nonce
    207  * @param int $action
    208  * @return bool|int
    209  */
    210 function wp_verify_nonce($nonce, $action = -1)
    211 {
    212 
    213     if ($action === 'icl_st_save_translation_nonce') {
    214         return 1;
     203if (!function_exists('wp_verify_nonce')) {
     204    /**
     205     * Verifies that a correct security nonce was used with time limit.
     206     *
     207     * @param     $nonce
     208     * @param int $action
     209     * @return bool|int
     210     */
     211    function wp_verify_nonce($nonce, $action = -1)
     212    {
     213
     214        if ($action === 'icl_st_save_translation_nonce') {
     215            return 1;
     216        }
     217
     218        $nonce = (string)$nonce;
     219        $user = wp_get_current_user();
     220        $uid = (int)$user->ID;
     221        if (!$uid) {
     222            /**
     223             * Filters whether the user who generated the nonce is logged out.
     224             *
     225             * @param int    $uid    ID of the nonce-owning user.
     226             * @param string $action The nonce action.
     227             * @since 3.5.0
     228             */
     229            $uid = apply_filters('nonce_user_logged_out', $uid, $action);
     230        }
     231
     232        if (empty($nonce)) {
     233            return false;
     234        }
     235
     236        $token = wp_get_session_token();
     237        $i = wp_nonce_tick();
     238
     239        // Nonce generated 0-12 hours ago.
     240        $expected = substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
     241        if (hash_equals($expected, $nonce)) {
     242            return 1;
     243        }
     244
     245        // Nonce generated 12-24 hours ago.
     246        $expected = substr(wp_hash(($i - 1) . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
     247        if (hash_equals($expected, $nonce)) {
     248            return 2;
     249        }
     250
     251        /**
     252         * Fires when nonce verification fails.
     253         *
     254         * @param string     $nonce  The invalid nonce.
     255         * @param string|int $action The nonce action.
     256         * @param WP_User    $user   The current user object.
     257         * @param string     $token  The user's session token.
     258         * @since 4.4.0
     259         */
     260        do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
     261
     262        // Invalid nonce.
     263        return false;
     264
    215265    }
    216 
    217     $nonce = (string)$nonce;
    218     $user = wp_get_current_user();
    219     $uid = (int)$user->ID;
    220     if (!$uid) {
    221         /**
    222          * Filters whether the user who generated the nonce is logged out.
    223          *
    224          * @param int    $uid    ID of the nonce-owning user.
    225          * @param string $action The nonce action.
    226          * @since 3.5.0
    227          */
    228         $uid = apply_filters('nonce_user_logged_out', $uid, $action);
    229     }
    230 
    231     if (empty($nonce)) {
    232         return false;
    233     }
    234 
    235     $token = wp_get_session_token();
    236     $i = wp_nonce_tick();
    237 
    238     // Nonce generated 0-12 hours ago.
    239     $expected = substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
    240     if (hash_equals($expected, $nonce)) {
    241         return 1;
    242     }
    243 
    244     // Nonce generated 12-24 hours ago.
    245     $expected = substr(wp_hash(($i - 1) . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
    246     if (hash_equals($expected, $nonce)) {
    247         return 2;
    248     }
    249 
    250     /**
    251      * Fires when nonce verification fails.
    252      *
    253      * @param string     $nonce  The invalid nonce.
    254      * @param string|int $action The nonce action.
    255      * @param WP_User    $user   The current user object.
    256      * @param string     $token  The user's session token.
    257      * @since 4.4.0
    258      */
    259     do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
    260 
    261     // Invalid nonce.
    262     return false;
    263 
    264 }
     266}
  • easytranslate/tags/v5.4/easy-translate.php

    r3281341 r3293830  
    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:           2.0.2
     17 * Version:           2.0.3
    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', '2.0.2');
     36define('EASY_TRANSLATE_VERSION', '2.0.3');
    3737
    3838/**
  • easytranslate/trunk/README.txt

    r3281341 r3293830  
    55Requires at least: 4.7
    66Tested up to: 6.8
    7 Stable tag: 5.3
     7Stable tag: 5.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • easytranslate/trunk/admin/functions.php

    r2866487 r3293830  
    201201}
    202202
    203 /**
    204  * Verifies that a correct security nonce was used with time limit.
    205  *
    206  * @param     $nonce
    207  * @param int $action
    208  * @return bool|int
    209  */
    210 function wp_verify_nonce($nonce, $action = -1)
    211 {
    212 
    213     if ($action === 'icl_st_save_translation_nonce') {
    214         return 1;
     203if (!function_exists('wp_verify_nonce')) {
     204    /**
     205     * Verifies that a correct security nonce was used with time limit.
     206     *
     207     * @param     $nonce
     208     * @param int $action
     209     * @return bool|int
     210     */
     211    function wp_verify_nonce($nonce, $action = -1)
     212    {
     213
     214        if ($action === 'icl_st_save_translation_nonce') {
     215            return 1;
     216        }
     217
     218        $nonce = (string)$nonce;
     219        $user = wp_get_current_user();
     220        $uid = (int)$user->ID;
     221        if (!$uid) {
     222            /**
     223             * Filters whether the user who generated the nonce is logged out.
     224             *
     225             * @param int    $uid    ID of the nonce-owning user.
     226             * @param string $action The nonce action.
     227             * @since 3.5.0
     228             */
     229            $uid = apply_filters('nonce_user_logged_out', $uid, $action);
     230        }
     231
     232        if (empty($nonce)) {
     233            return false;
     234        }
     235
     236        $token = wp_get_session_token();
     237        $i = wp_nonce_tick();
     238
     239        // Nonce generated 0-12 hours ago.
     240        $expected = substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
     241        if (hash_equals($expected, $nonce)) {
     242            return 1;
     243        }
     244
     245        // Nonce generated 12-24 hours ago.
     246        $expected = substr(wp_hash(($i - 1) . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
     247        if (hash_equals($expected, $nonce)) {
     248            return 2;
     249        }
     250
     251        /**
     252         * Fires when nonce verification fails.
     253         *
     254         * @param string     $nonce  The invalid nonce.
     255         * @param string|int $action The nonce action.
     256         * @param WP_User    $user   The current user object.
     257         * @param string     $token  The user's session token.
     258         * @since 4.4.0
     259         */
     260        do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
     261
     262        // Invalid nonce.
     263        return false;
     264
    215265    }
    216 
    217     $nonce = (string)$nonce;
    218     $user = wp_get_current_user();
    219     $uid = (int)$user->ID;
    220     if (!$uid) {
    221         /**
    222          * Filters whether the user who generated the nonce is logged out.
    223          *
    224          * @param int    $uid    ID of the nonce-owning user.
    225          * @param string $action The nonce action.
    226          * @since 3.5.0
    227          */
    228         $uid = apply_filters('nonce_user_logged_out', $uid, $action);
    229     }
    230 
    231     if (empty($nonce)) {
    232         return false;
    233     }
    234 
    235     $token = wp_get_session_token();
    236     $i = wp_nonce_tick();
    237 
    238     // Nonce generated 0-12 hours ago.
    239     $expected = substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
    240     if (hash_equals($expected, $nonce)) {
    241         return 1;
    242     }
    243 
    244     // Nonce generated 12-24 hours ago.
    245     $expected = substr(wp_hash(($i - 1) . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
    246     if (hash_equals($expected, $nonce)) {
    247         return 2;
    248     }
    249 
    250     /**
    251      * Fires when nonce verification fails.
    252      *
    253      * @param string     $nonce  The invalid nonce.
    254      * @param string|int $action The nonce action.
    255      * @param WP_User    $user   The current user object.
    256      * @param string     $token  The user's session token.
    257      * @since 4.4.0
    258      */
    259     do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
    260 
    261     // Invalid nonce.
    262     return false;
    263 
    264 }
     266}
  • easytranslate/trunk/easy-translate.php

    r3281341 r3293830  
    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:           2.0.2
     17 * Version:           2.0.3
    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', '2.0.2');
     36define('EASY_TRANSLATE_VERSION', '2.0.3');
    3737
    3838/**
Note: See TracChangeset for help on using the changeset viewer.