wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
_wp_secrets_get_provider › WordPress Function
Seit7.2.0
Veraltetn/v
› _wp_secrets_get_provider ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Returns the active provider.
The provider is whatever is responsible for holding, protecting, and answering for this site's secrets. A secrets.php drop-in overrides it by setting $GLOBALS['wp_secrets_provider'] to an instance before this is first called. Absent that, the provider WordPress ships is assembled from the active store and keyring, which a drop-in can also replace individually, so wanting host-managed key custody with default storage needs no provider at all. No filter is applied here, or anywhere on the retrieval path. Substitution is by replacement, never by interception: a filter that can observe which provider answers is one step from a filter that can answer instead. Cached for the request. A failed drop-in fails closed, returning WP_Error from every operation, rather than silently reverting to the default, because a misconfigured credential backend must never look like a working one that happens to be empty.Ähnliche Funktionen: _wp_secrets_get_store, wp_secrets_provider_label, _wp_secrets_get, _wp_secrets_retire, _wp_secrets_set
Quellcode
function _wp_secrets_get_provider(): WP_Secrets_Provider {
static $provider = null;
if ( $provider instanceof WP_Secrets_Provider ) {
return $provider;
}
if ( ! empty( $GLOBALS['wp_secrets_dropin_broken'] ) ) {
$provider = new WP_Secrets_Broken_Provider();
return $provider;
}
if ( isset( $GLOBALS['wp_secrets_provider'] ) ) {
/*
* Set, but not a provider. Failing closed here rather than falling through to
* the default is the whole point: a platform drop-in that names its class
* wrongly would otherwise have every secret served from wp_options, where none
* of them exist, and a site whose credentials are held elsewhere would report
* them absent rather than unreachable.
*/
if ( ! ( $GLOBALS['wp_secrets_provider'] instanceof WP_Secrets_Provider ) ) {
$provider = new WP_Secrets_Broken_Provider();
return $provider;
}
$provider = $GLOBALS['wp_secrets_provider'];
return $provider;
}
$provider = new WP_Secrets_Libsodium_Provider(
_wp_secrets_get_store(),
_wp_secrets_get_key_manager()
);
return $provider;
}