get_var( $wpdb->prepare( "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s", $option ) ); if ( ! is_string( $value ) || '' === $value ) { $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO {$wpdb->options} (option_name, option_value, autoload) VALUES (%s, %s, 'yes')", $option, bin2hex( random_bytes( 32 ) ) ) ); wp_cache_delete( $option, 'options' ); wp_cache_delete( 'notoptions', 'options' ); wp_cache_delete( 'alloptions', 'options' ); $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s", $option ) ); } // phpcs:enable if ( ! is_string( $value ) || '' === $value ) { // Database refused the write: fall back to the salts rather than an empty key. $value = wp_salt( 'auth' ) . $name; } self::$memo[ $name ] = $value; return $value; } /** * @param string $name Secret. * @param string $data Data. * @return string Hex HMAC-SHA256. */ public static function hmac( $name, $data ) { return hash_hmac( 'sha256', (string) $data, self::get( $name ) ); } }