PluginProbe ʕ •ᴥ•ʔ
پارسی دیت – Parsi Date / trunk
پارسی دیت – Parsi Date vtrunk
6.2.1 6.2 6.1 5.1.6 5.1.7 5.1.8 5.1.8.2 6.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.0.0-alpha 2.1 2.1.1 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0.1 2.3.0.2 2.3.1 2.3.2 2.3.3 2.3.4 3.0.1 3.0.2 3.0.3 4.0.0 4.0.1 4.0.2 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5
wp-parsidate / vendor / enshrined / svg-sanitize / src / Helper.php
wp-parsidate / vendor / enshrined / svg-sanitize / src Last commit date
ElementReference 1 month ago Exceptions 1 month ago data 1 month ago Helper.php 1 month ago Sanitizer.php 1 month ago svg-scanner.php 1 month ago
Helper.php
54 lines
1 <?php
2 namespace enshrined\svgSanitize;
3
4 class Helper
5 {
6 /**
7 * @param \DOMElement $element
8 * @return string|null
9 */
10 public static function getElementHref(\DOMElement $element)
11 {
12 if ($element->hasAttribute('href')) {
13 return $element->getAttribute('href');
14 }
15 if ($element->hasAttributeNS('http://www.w3.org/1999/xlink', 'href')) {
16 return $element->getAttributeNS('http://www.w3.org/1999/xlink', 'href');
17 }
18 return null;
19 }
20
21 /**
22 * @param string $href
23 * @return string|null
24 */
25 public static function extractIdReferenceFromHref($href)
26 {
27 if (!is_string($href) || strpos($href, '#') !== 0) {
28 return null;
29 }
30 return substr($href, 1);
31 }
32
33 /**
34 * @param \DOMElement $needle
35 * @param \DOMElement $haystack
36 * @return bool
37 */
38 public static function isElementContainedIn(\DOMElement $needle, \DOMElement $haystack)
39 {
40 if ($needle === $haystack) {
41 return true;
42 }
43 foreach ($haystack->childNodes as $childNode) {
44 if (!$childNode instanceof \DOMElement) {
45 continue;
46 }
47 if (self::isElementContainedIn($needle, $childNode)) {
48 return true;
49 }
50 }
51 return false;
52 }
53 }
54