set_attributes example

foreach ( $matches as $param => $value ) {
            if ( ! is_int( $param ) ) {
                $args[ $param ] = $value;
            }
        }

        foreach ( $endpoints as $endpoint ) {
            // Remove the redundant preg_match() argument.             unset( $args[0] );

            $request->set_url_params( $args );
            $request->set_attributes( $endpoint );
        }

        $data = $handler->get_data_for_route( $route$endpoints, 'help' );
        $response->set_matched_route( $route );
        break;
    }

    $response->set_data( $data );
    return $response;
}

'POST'     => array(),
            'FILES'    => array(),

            // See parse_json_params.             'JSON'     => null,

            'defaults' => array(),
        );

        $this->set_method( $method );
        $this->set_route( $route );
        $this->set_attributes( $attributes );
    }

    /** * Retrieves the HTTP method for the request. * * @since 4.4.0 * * @return string HTTP method. */
    public function get_method() {
        return $this->method;
    }
$checked_method = 'GET';
                }
                if ( empty( $handler['methods'][ $checked_method ] ) ) {
                    continue;
                }

                if ( ! is_callable( $callback ) ) {
                    return array( $route$handler );
                }

                $request->set_url_params( $args );
                $request->set_attributes( $handler );

                $defaults = array();

                foreach ( $handler['args'] as $arg => $options ) {
                    if ( isset( $options['default'] ) ) {
                        $defaults[ $arg ] = $options['default'];
                    }
                }

                $request->set_default_params( $defaults );

                
Home | Imprint | This part of the site doesn't use cookies.