WPSEO_MyYoast_Api_Request::enrich_request_arguments()protectedYoast 1.0

Checks if MyYoast tokens are allowed and adds the token to the request body.

When tokens are disallowed it will add the url to the request body.

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

Хуков нет.

Возвращает

Массив. The enriched arguments.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->enrich_request_arguments( $request_arguments );
$request_arguments(массив) (обязательный)
The arguments to enrich.

Код WPSEO_MyYoast_Api_Request::enrich_request_arguments() Yoast 22.4

protected function enrich_request_arguments( array $request_arguments ) {
	$request_arguments     = wp_parse_args( $request_arguments, [ 'headers' => [] ] );
	$addon_version_headers = $this->get_installed_addon_versions();

	foreach ( $addon_version_headers as $addon => $version ) {
		$request_arguments['headers'][ $addon . '-version' ] = $version;
	}

	$request_body = $this->get_request_body();
	if ( $request_body !== [] ) {
		$request_arguments['body'] = $request_body;
	}

	return $request_arguments;
}