Yoast_Notification::normalize_options()privateYoast 1.0

Make sure we only have values that we can work with.

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

Хуков нет.

Возвращает

Массив.

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

// private - только в коде основоного (родительского) класса
$result = $this->normalize_options( $options );
$options(массив) (обязательный)
Options to normalize.

Код Yoast_Notification::normalize_options() Yoast 22.4

private function normalize_options( $options ) {
	$options = wp_parse_args( $options, $this->defaults );

	// Should not exceed 0 or 1.
	$options['priority'] = min( 1, max( 0, $options['priority'] ) );

	// Set default capabilities when not supplied.
	if ( empty( $options['capabilities'] ) || $options['capabilities'] === [] ) {
		$options['capabilities'] = [ 'wpseo_manage_options' ];
	}

	// Set to the id of the current user if not supplied.
	if ( $options['user_id'] === null ) {
		$options['user_id'] = get_current_user_id();
	}

	return $options;
}