Yoast\WP\SEO\Routes

Wincher_Route::register_routes()publicYoast 1.0

Registers routes with WordPress.

Метод класса: Wincher_Route{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$Wincher_Route = new Wincher_Route();
$Wincher_Route->register_routes();

Код Wincher_Route::register_routes() Yoast 19.11

public function register_routes() {
	$authorize_route_args = [
		'methods'             => 'GET',
		'callback'            => [ $this, 'get_authorization_url' ],
		'permission_callback' => [ $this, 'can_use_wincher' ],
	];
	\register_rest_route( Main::API_V1_NAMESPACE, self::AUTHORIZATION_URL_ROUTE, $authorize_route_args );

	$authentication_route_args = [
		'methods'             => 'POST',
		'callback'            => [ $this, 'authenticate' ],
		'permission_callback' => [ $this, 'can_use_wincher' ],
		'args'                => [
			'code' => [
				'validate_callback' => [ $this, 'has_valid_code' ],
				'required'          => true,
			],
			'websiteId' => [
				'validate_callback' => [ $this, 'has_valid_website_id' ],
				'required'          => true,
			],
		],
	];

	\register_rest_route( Main::API_V1_NAMESPACE, self::AUTHENTICATION_ROUTE, $authentication_route_args );

	$track_keyphrases_route_args = [
		'methods'             => 'POST',
		'callback'            => [ $this, 'track_keyphrases' ],
		'permission_callback' => [ $this, 'can_use_wincher' ],
		'args'                => [
			'keyphrases' => [
				'required'          => true,
			],
		],
	];

	\register_rest_route( Main::API_V1_NAMESPACE, self::KEYPHRASES_TRACK_ROUTE, $track_keyphrases_route_args );

	$get_keyphrases_route_args = [
		'methods'             => 'POST',
		'callback'            => [ $this, 'get_tracked_keyphrases' ],
		'permission_callback' => [ $this, 'can_use_wincher' ],
		'args'                => [
			'keyphrases' => [
				'required' => false,
			],
			'permalink' => [
				'required' => false,
			],
		],
	];

	\register_rest_route( Main::API_V1_NAMESPACE, self::TRACKED_KEYPHRASES_ROUTE, $get_keyphrases_route_args );

	$delete_keyphrase_route_args = [
		'methods'             => 'DELETE',
		'callback'            => [ $this, 'untrack_keyphrase' ],
		'permission_callback' => [ $this, 'can_use_wincher' ],
	];

	\register_rest_route( Main::API_V1_NAMESPACE, self::UNTRACK_KEYPHRASE_ROUTE, $delete_keyphrase_route_args );
}