wp/lib/blobfolio/wp/bm/svg/svg_dom.php
protected static function import($svg = '') {
		// Early bail.
		if (
			false === ($svg = static::load_svg($svg)) ||
			!class_exists('DOMDocument')
		) {
			return false;
		}

		try {
			// @codingStandardsIgnoreStart
			libxml_use_internal_errors(true);
			libxml_disable_entity_loader(true);
			$dom = new DOMDocument('1.0', 'UTF-8');
			$dom->formatOutput = false;
			$dom->preserveWhiteSpace = false;
			$dom->loadXML(static::get_doctype() . "\n{$svg}");

			// Make sure there are still SVG tags.
			$svgs = $dom->getElementsByTagName('svg');
			if (!$svgs->length) {
				return false;
			}

			return $dom;
			// @codingStandardsIgnoreEnd
		} catch (\Throwable $e) {
			error_log($e->getMessage());
			return false;
		} catch (\Exception $e) {
			return false;
		}

		return false;
	}
protected static function import($svg = '') {
		// Early bail.
		if (
			false === ($svg = static::load_svg($svg)) ||
			!class_exists('DOMDocument')
		) {
			return false;
		}

		try {
			// @codingStandardsIgnoreStart
			libxml_use_internal_errors(true);
			libxml_disable_entity_loader(true);
			$dom = new DOMDocument('1.0', 'UTF-8');
			$dom->formatOutput = false;
			$dom->preserveWhiteSpace = false;
			$dom->loadXML(static::get_doctype() . "\n{$svg}");

			// Make sure there are still SVG tags.
			$svgs = $dom->getElementsByTagName('svg');
			if (!$svgs->length) {
				return false;
			}

			return $dom;
			// @codingStandardsIgnoreEnd
		} catch (\Throwable $e) {
			error_log($e->getMessage());
			return false;
		} catch (\Exception $e) {
			return false;
		}

		return false;
	}
Import to DOMDocument object.

@param string $svg SVG code or path.
@return DOMDocument|bool XML object. False on failure.