Yoast\WP\SEO\Helpers

Crawl_Cleanup_Helper::allowed_params()publicYoast 1.0

Gets the allowed query vars from the current URL.

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

Хуков нет.

Возвращает

Массив. is_allowed and allowed_query.

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

$Crawl_Cleanup_Helper = new Crawl_Cleanup_Helper();
$Crawl_Cleanup_Helper->allowed_params( $current_url );
$current_url(строка) (обязательный)
The current URL.

Код Crawl_Cleanup_Helper::allowed_params() Yoast 23.4

public function allowed_params( $current_url ) {
	// This is a Premium plugin-only function: Allows plugins to register their own variables not to clean.
	$allowed_extravars = $this->get_allowed_extravars();

	$allowed_query = [];

	$parsed_url = \wp_parse_url( $current_url, \PHP_URL_QUERY );

	$query = $this->url_helper->parse_str_params( $parsed_url );

	if ( ! empty( $allowed_extravars ) ) {
		foreach ( $allowed_extravars as $get ) {
			$get = \trim( $get );
			if ( isset( $query[ $get ] ) ) {
				$allowed_query[ $get ] = \rawurlencode_deep( $query[ $get ] );
				unset( $query[ $get ] );
			}
		}
	}
	return [
		'query'         => $query,
		'allowed_query' => $allowed_query,
	];
}