• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/urlpreview/htmldocument.php
  • Класс: BitrixMainUrlPreviewHtmlDocument
  • Вызов: HtmlDocument::extractElementAttributes
public function extractElementAttributes($tagName)
{
	$results = array();
	preg_match_all("/<$tagName.+?>/mis", $this->html, $elements);

	foreach($elements[0] as $element)
	{
		preg_match_all('/(?:([w-_]+)=(['"])(.*?)g{-2}s*)/mis', $element, $matches);

		$elementAttributes = array();
		foreach($matches[1] as $k => $attributeName)
		{
			$attributeName = mb_strtolower($attributeName);
			$attributeValue = $matches[3][$k];
			$elementAttributes[$attributeName] = $attributeValue;
		}

		$results[] = $elementAttributes;
	}

	return $results;
}