WPSEO_Sitemaps_Cache_Validator::convert_base10_to_base61()
Encode to base61 format.
This is base64 (numeric + alpha + alpha upper case) without the 0.
Метод класса: WPSEO_Sitemaps_Cache_Validator{}
Хуков нет.
Возвращает
Строку
. Base 61 converted string.
Использование
$result = WPSEO_Sitemaps_Cache_Validator::convert_base10_to_base61( $base10 );
- $base10(int) (обязательный)
- The number that has to be converted to base 61.
Список изменений
С версии 3.2 | Введена. |
Код WPSEO_Sitemaps_Cache_Validator::convert_base10_to_base61() WPSEO Sitemaps Cache Validator::convert base10 to base61 Yoast 24.9
public static function convert_base10_to_base61( $base10 ) { if ( ! is_int( $base10 ) ) { throw new InvalidArgumentException( __( 'Expected an integer as input.', 'wordpress-seo' ) ); } // Characters that will be used in the conversion. $characters = '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $length = strlen( $characters ); $remainder = $base10; $output = ''; do { // Building from right to left in the result. $index = ( $remainder % $length ); // Prepend the character to the output. $output = $characters[ $index ] . $output; // Determine the remainder after removing the applied number. $remainder = floor( $remainder / $length ); // Keep doing it until we have no remainder left. } while ( $remainder ); return $output; }