|
@ -106,7 +106,7 @@ class Parser { |
|
|
'author' => ['h-entry' => ["u", "author", [], null, true]], |
|
|
'author' => ['h-entry' => ["u", "author", [], null, true]], |
|
|
]; |
|
|
]; |
|
|
/** @var array The list of (global) attributes which contain URLs and apply to any element */ |
|
|
/** @var array The list of (global) attributes which contain URLs and apply to any element */ |
|
|
protected const URL_ATTRS_GLOBAL= ["itemid", "itemprop", "itemtype"]; |
|
|
protected const URL_ATTRS_GLOBAL = ["itemid", "itemprop", "itemtype"]; |
|
|
/** @var array The list of (non-global) attributes which contain URLs and their host elements */ |
|
|
/** @var array The list of (non-global) attributes which contain URLs and their host elements */ |
|
|
protected const URL_ATTRS = [ |
|
|
protected const URL_ATTRS = [ |
|
|
'a' => ["href", "ping"], |
|
|
'a' => ["href", "ping"], |
|
@ -663,10 +663,9 @@ class Parser { |
|
|
} elseif (in_array($node->localName, ["img", "area"]) && $node->hasAttribute("alt")) { |
|
|
} elseif (in_array($node->localName, ["img", "area"]) && $node->hasAttribute("alt")) { |
|
|
# else if img.p-x[alt] or area.p-x[alt], then return the alt attribute |
|
|
# else if img.p-x[alt] or area.p-x[alt], then return the alt attribute |
|
|
return $node->getAttribute("alt"); |
|
|
return $node->getAttribute("alt"); |
|
|
} else { |
|
|
|
|
|
# else return the textContent of the element after [cleaning] |
|
|
|
|
|
return $this->getCleanText($node, $prefix); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
# else return the textContent of the element after [cleaning] |
|
|
|
|
|
return $this->getCleanText($node, $prefix); |
|
|
case "u": |
|
|
case "u": |
|
|
# To parse an element for a u-x property value (whether explicit u-* or backcompat equivalent): |
|
|
# To parse an element for a u-x property value (whether explicit u-* or backcompat equivalent): |
|
|
if (in_array($node->localName, ["a", "area", "link"]) && $node->hasAttribute("href")) { |
|
|
if (in_array($node->localName, ["a", "area", "link"]) && $node->hasAttribute("href")) { |
|
@ -745,7 +744,7 @@ class Parser { |
|
|
} |
|
|
} |
|
|
// return the result |
|
|
// return the result |
|
|
return [ |
|
|
return [ |
|
|
'html' => trim(Serializer::serializeInner($copy)), |
|
|
'html' => trim(Serializer::serializeInner($copy)), |
|
|
'value' => $this->getCleanText($node, $prefix), |
|
|
'value' => $this->getCleanText($node, $prefix), |
|
|
]; |
|
|
]; |
|
|
default: |
|
|
default: |
|
@ -870,7 +869,7 @@ class Parser { |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
foreach (self::ZONE_INPUT_FORMATS as $zf => $zp) { |
|
|
foreach (self::ZONE_INPUT_FORMATS as $zf => $zp) { |
|
|
if ($out = $this->testDate($input, "!$df $tf$zf", "!$df\T$tf$zf","!$df $tf $zf", "!$df\T$tf $zf")) { |
|
|
if ($out = $this->testDate($input, "!$df $tf$zf", "!$df\T$tf$zf", "!$df $tf $zf", "!$df\T$tf $zf")) { |
|
|
return [ |
|
|
return [ |
|
|
'date' => $out->format(self::DATE_OUTPUT_FORMATS[$dp]), |
|
|
'date' => $out->format(self::DATE_OUTPUT_FORMATS[$dp]), |
|
|
'time' => $out->format(self::DATE_OUTPUT_FORMATS[$tp]), |
|
|
'time' => $out->format(self::DATE_OUTPUT_FORMATS[$tp]), |
|
|