WP_Dependencies::get_etag()
Get etag header for cache validation.
Метод класса: WP_Dependencies{}
Хуков нет.
Возвращает
Строку
. Etag header.
Использование
$WP_Dependencies = new WP_Dependencies(); $WP_Dependencies->get_etag( $load );
- $load(string[]) (обязательный)
- Array of script or style handles to load.
Заметки
- Global. Строка. $wp_version The WordPress version string.
Список изменений
С версии 6.7.0 | Введена. |
Код WP_Dependencies::get_etag() WP Dependencies::get etag WP 6.7.1
public function get_etag( $load ) { /* * Note: wp_get_wp_version() is not used here, as this file can be included * via wp-admin/load-scripts.php or wp-admin/load-styles.php, in which case * wp-includes/functions.php is not loaded. */ global $wp_version; $etag = "WP:{$wp_version};"; foreach ( $load as $handle ) { if ( ! array_key_exists( $handle, $this->registered ) ) { continue; } $ver = $this->registered[ $handle ]->ver ?? $wp_version; $etag .= "{$handle}:{$ver};"; } /* * This is not intended to be cryptographically secure, just a fast way to get * a fixed length string based on the script versions. As this file does not * load the full WordPress environment, it is not possible to use the salted * wp_hash() function. */ return 'W/"' . md5( $etag ) . '"'; }