Plugin Directory

Changeset 2928979


Ignore:
Timestamp:
06/21/2023 06:54:59 AM (3 years ago)
Author:
webtemyk
Message:

Small fixes (1.0.1)

Location:
smart-captcha-yandex
Files:
30 added
4 edited

Legend:

Unmodified
Added
Removed
  • smart-captcha-yandex/trunk/admin/includes/base/class.page-base.php

    r2768162 r2928979  
    4949            $this,
    5050            'page_action',
    51         ], $this->page_menu_dashicon, $this->page_menu_position );
     51        ], $this->page_menu_position );
    5252    }
    5353
  • smart-captcha-yandex/trunk/includes/class.auth-form-captcha.php

    r2768162 r2928979  
    6262        }
    6363
     64        // Bail if a rest request.
     65        if ( $this->is_rest_request() ) {
     66            return $user;
     67        }
     68
     69        // Bail if a rest request.
     70        if ( str_contains( $_SERVER['REQUEST_URI'], 'xmlrpc.php' ) ) {
     71            return $user;
     72        }
     73
    6474        if ( isset( $_POST['smart-token'] ) ) {
    6575            if ( wysc_check_smart_captcha( $_POST['smart-token'] ) ) {
     
    7080        return new WP_Error( 'wysc_spam_check_failed', esc_html__( 'Ошибка авторизации. Введите капчу', 'smart-captcha-yandex' ) );
    7181    }
     82
     83    /**
     84     * Checks if the current authentication request is RESTy or a custom URL where it should not load.
     85     *
     86     * @return boolean - Was a rest request?
     87     */
     88    public function is_rest_request() {
     89        if ( defined( 'REST_REQUEST' ) && REST_REQUEST || isset( $_GET['rest_route'] ) && strpos( sanitize_text_field( wp_unslash( $_GET['rest_route'] ) ), '/', 0 ) === 0 ) {
     90            return true;
     91        }
     92
     93        global $wp_rewrite;
     94        if ( null === $wp_rewrite ) {
     95            $wp_rewrite = new \WP_Rewrite();
     96        }
     97
     98        $rest_url    = wp_parse_url( trailingslashit( rest_url() ) );
     99        $current_url = wp_parse_url( add_query_arg( [] ) );
     100        $is_rest     = strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
     101
     102        return $is_rest;
     103    }
    72104}
  • smart-captcha-yandex/trunk/readme.txt

    r2768173 r2928979  
    3737== Changelog ==
    3838
     39= 1.0.2 =
     40* Небольшие исправления
     41
    3942= 1.0.0 =
    4043* Первая версия с базовой интеграцией
  • smart-captcha-yandex/trunk/smart-captcha-yandex.php

    r2768162 r2928979  
    33 * Plugin Name: Smart Captcha Yandex
    44 * Description: WordPress integration for Yandex Smart Captcha
    5  * Version:     1.0.0
     5 * Version:     1.0.1
    66 * Author:      Webtemyk <[email protected]>
    77 * Author URI:  https://temyk.ru
Note: See TracChangeset for help on using the changeset viewer.