Plugin Directory


Ignore:
Timestamp:
11/08/2026 10:31:05 AM (12 hours ago)
Author:
degird
Message:

Release 1.2.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cliedesk/trunk/src/Rest/RestServer.php

    r3788907 r3790823  
    7676                add_action( 'rest_api_init', array( $this, 'register' ) );
    7777                add_action( 'application_password_did_authenticate', array( $this, 'mark_app_password' ) );
     78                add_filter( 'rest_pre_dispatch', array( $this, 'complete_routes' ), 0, 3 );
    7879                add_filter( 'rest_pre_dispatch', array( $this, 'guard' ), 10, 3 );
    7980                add_filter( 'rest_post_dispatch', array( $this, 'headers' ), 10, 3 );
    … …  
    9394                }
    9495                $this->routes->register();
     96        }
     97
     98        /**
     99         * `rest_pre_dispatch` (P4, row 91): a request for a path whose routes were left out of this REST request's server
     100         * (an internal rest_do_request, an embed) registers them before WordPress matches it.
     101         *
     102         * @param mixed            $result  Pre-dispatch result.
     103         * @param \WP_REST_Server  $server  Server.
     104         * @param \WP_REST_Request $request Request.
     105         * @return mixed
     106         */
     107        public function complete_routes( $result, $server, $request ) {
     108                if ( $request instanceof \WP_REST_Request ) {
     109                        $this->routes->complete( (string) $request->get_route(), (string) $request->get_method() );
     110                }
     111                return $result;
    95112        }
    96113
Note: See TracChangeset for help on using the changeset viewer.