Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Embed::detect_provider_from_domains
Detect provider from content by checking against known domains.
Метод класса: Embed{}
Хуков нет.
Возвращает
string. Provider name or empty string if not found.
Использование
// private - только в коде основоного (родительского) класса $result = $this->detect_provider_from_domains( $content ): string;
- $content(строка) (обязательный)
- Content to check for provider domains.
Код Embed::detect_provider_from_domains() Embed::detect provider from domains WC 11.2.2
private function detect_provider_from_domains( string $content ): string {
$all_providers = $this->get_all_provider_configs();
foreach ( $all_providers as $provider => $config ) {
foreach ( $config['domains'] as $domain ) {
if ( strpos( $content, $domain ) !== false ) {
return $provider;
}
}
}
return '';
}