WP_oEmbed::sanitize_provider
Sanitizes and normalizes a single oEmbed provider entry.
Validates that the match mask is a non-empty string and that the provider data is an array with a non-empty string endpoint URL at index 0. Normalizes the optional regex flag at index 1 to a boolean.
Метод класса: WP_oEmbed{}
Хуков нет.
Возвращает
array{ match_mask: non-empty-string, endpoint: non-empty-string, is_regex: bool }|null. Normalized provider array, or null if malformed.
Использование
// private - только в коде основоного (родительского) класса $result = $this->sanitize_provider( $match_mask, $data ): ?array;
- $match_mask(array-key) (обязательный)
- The URL pattern used to match against URLs.
- $data(разное) (обязательный)
- The raw provider data to sanitize.
Список изменений
| С версии 7.1.0 | Введена. |
Код WP_oEmbed::sanitize_provider() WP oEmbed::sanitize provider WP 7.1.3
private function sanitize_provider( $match_mask, $data ): ?array {
if (
is_string( $match_mask ) &&
'' !== $match_mask &&
is_array( $data ) &&
isset( $data[0] ) &&
is_string( $data[0] ) &&
'' !== $data[0]
) {
return array(
'match_mask' => $match_mask,
'endpoint' => $data[0],
'is_regex' => (bool) ( $data[1] ?? false ),
);
}
return null;
}