WPSEO_Sitemaps_Cache_Validator::create_validator()public staticYoast 3.2

Refresh the cache validator value.

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

Хуков нет.

Возвращает

true|false. True if validator key has been saved as option.

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

$result = WPSEO_Sitemaps_Cache_Validator::create_validator( $type );
$type(строка)
Provide a type for a specific type validator, empty for global validator.
По умолчанию: ''

Список изменений

С версии 3.2 Введена.

Код WPSEO_Sitemaps_Cache_Validator::create_validator() Yoast 22.4

public static function create_validator( $type = '' ) {

	$key = self::get_validator_key( $type );

	// Generate new validator.
	$microtime = microtime();

	// Remove space.
	list( $milliseconds, $seconds ) = explode( ' ', $microtime );

	// Transients are purged every 24h.
	$seconds      = ( $seconds % DAY_IN_SECONDS );
	$milliseconds = intval( substr( $milliseconds, 2, 3 ), 10 );

	// Combine seconds and milliseconds and convert to integer.
	$validator = intval( $seconds . '' . $milliseconds, 10 );

	// Apply base 61 encoding.
	$compressed = self::convert_base10_to_base61( $validator );

	return update_option( $key, $compressed, false );
}