@@ -1573,6 +1573,38 @@ public function backcompat(DOMElement $el, $context = '', $isParentMf2 = false)
15731573 }
15741574 break ;
15751575
1576+ case 'hfeed ' :
1577+ $ this ->upgradeRelTagToCategory ($ el );
1578+ break ;
1579+
1580+ case 'hproduct ' :
1581+ $ review_and_hreview_aggregate = $ this ->xpath ->query ('.//*[contains(concat(" ", normalize-space(@class), " "), " review ") and contains(concat(" ", normalize-space(@class), " "), " hreview-aggregate ")] ' , $ el );
1582+
1583+ if ( $ review_and_hreview_aggregate ->length ) {
1584+ foreach ( $ review_and_hreview_aggregate as $ tempEl ) {
1585+ if ( !$ this ->hasRootMf2 ($ tempEl ) ) {
1586+ $ this ->backcompat ($ tempEl , 'hreview-aggregate ' );
1587+ $ this ->addMfClasses ($ tempEl , 'p-review h-review-aggregate ' );
1588+ $ this ->addUpgraded ($ tempEl , array ('review hreview-aggregate ' ));
1589+ }
1590+ }
1591+ }
1592+
1593+ $ review_and_hreview = $ this ->xpath ->query ('.//*[contains(concat(" ", normalize-space(@class), " "), " review ") and contains(concat(" ", normalize-space(@class), " "), " hreview ")] ' , $ el );
1594+
1595+ if ( $ review_and_hreview ->length ) {
1596+ foreach ( $ review_and_hreview as $ tempEl ) {
1597+ if ( !$ this ->hasRootMf2 ($ tempEl ) ) {
1598+ $ this ->backcompat ($ tempEl , 'hreview ' );
1599+ $ this ->addMfClasses ($ tempEl , 'p-review h-review ' );
1600+ $ this ->addUpgraded ($ tempEl , array ('review hreview ' ));
1601+ }
1602+ }
1603+ }
1604+
1605+ break ;
1606+
1607+ case 'hreview-aggregate ' :
15761608 case 'hreview ' :
15771609 $ item_and_vcard = $ this ->xpath ->query ('.//*[contains(concat(" ", normalize-space(@class), " "), " item ") and contains(concat(" ", normalize-space(@class), " "), " vcard ")] ' , $ el );
15781610
@@ -1614,12 +1646,12 @@ public function backcompat(DOMElement $el, $context = '', $isParentMf2 = false)
16141646 break ;
16151647
16161648 case 'vevent ' :
1617- $ location = $ this ->xpath ->query ('.//*[contains(concat(" ", normalize-space(@class), " "), " location ")] ' , $ el );
1649+ $ location_and_vcard = $ this ->xpath ->query ('.//*[contains(concat(" ", normalize-space(@class), " "), " location ") and contains(concat(" ", normalize-space(@class), " "), " vcard ")] ' , $ el );
16181650
1619- if ( $ location ->length ) {
1620- foreach ( $ location as $ tempEl ) {
1651+ if ( $ location_and_vcard ->length ) {
1652+ foreach ( $ location_and_vcard as $ tempEl ) {
16211653 if ( !$ this ->hasRootMf2 ($ tempEl ) ) {
1622- $ this ->addMfClasses ($ tempEl , 'h-card ' );
1654+ $ this ->addMfClasses ($ tempEl , 'p-location h-card ' );
16231655 $ this ->backcompat ($ tempEl , 'vcard ' );
16241656 }
16251657 }
@@ -1761,8 +1793,10 @@ public function query($expression, $context = null) {
17611793 'hresume ' => 'h-resume ' ,
17621794 'vevent ' => 'h-event ' ,
17631795 'hreview ' => 'h-review ' ,
1796+ 'hreview-aggregate ' => 'h-review-aggregate ' ,
17641797 'hproduct ' => 'h-product ' ,
17651798 'adr ' => 'h-adr ' ,
1799+ 'geo ' => 'h-geo '
17661800 );
17671801
17681802 /**
@@ -1879,7 +1913,19 @@ public function query($expression, $context = null) {
18791913 ),
18801914 ),
18811915 'hfeed ' => array (
1882- # nothing currently
1916+ 'author ' => array (
1917+ 'replace ' => 'p-author h-card ' ,
1918+ 'context ' => 'vcard '
1919+ ),
1920+ 'url ' => array (
1921+ 'replace ' => 'u-url '
1922+ ),
1923+ 'photo ' => array (
1924+ 'replace ' => 'u-photo '
1925+ ),
1926+ 'category ' => array (
1927+ 'replace ' => 'p-category '
1928+ ),
18831929 ),
18841930 'hentry ' => array (
18851931 'entry-title ' => array (
@@ -1989,12 +2035,15 @@ public function query($expression, $context = null) {
19892035 'replace ' => 'p-category '
19902036 ),
19912037 'location ' => array (
1992- 'replace ' => 'h-card ' ,
1993- 'context ' => 'vcard '
2038+ 'replace ' => 'p-location ' ,
19942039 ),
19952040 'geo ' => array (
19962041 'replace ' => 'p-location h-geo '
19972042 ),
2043+ 'attendee ' => array (
2044+ 'replace ' => 'p-attendee h-card ' ,
2045+ 'context ' => 'vcard '
2046+ )
19982047 ),
19992048 'hreview ' => array (
20002049 'summary ' => array (
@@ -2030,6 +2079,36 @@ public function query($expression, $context = null) {
20302079 'replace ' => 'p-category '
20312080 ),
20322081 ),
2082+ 'hreview-aggregate ' => array (
2083+ 'summary ' => array (
2084+ 'replace ' => 'p-name '
2085+ ),
2086+ # fn: see item.fn below
2087+ # photo: see item.photo below
2088+ # url: see item.url below
2089+ 'item ' => array (
2090+ 'replace ' => 'p-item h-item ' ,
2091+ 'context ' => 'item '
2092+ ),
2093+ 'rating ' => array (
2094+ 'replace ' => 'p-rating '
2095+ ),
2096+ 'best ' => array (
2097+ 'replace ' => 'p-best '
2098+ ),
2099+ 'worst ' => array (
2100+ 'replace ' => 'p-worst '
2101+ ),
2102+ 'average ' => array (
2103+ 'replace ' => 'p-average '
2104+ ),
2105+ 'count ' => array (
2106+ 'replace ' => 'p-count '
2107+ ),
2108+ 'votes ' => array (
2109+ 'replace ' => 'p-votes '
2110+ ),
2111+ ),
20332112 'hproduct ' => array (
20342113 'fn ' => array (
20352114 'replace ' => 'p-name ' ,
@@ -2052,9 +2131,7 @@ public function query($expression, $context = null) {
20522131 'url ' => array (
20532132 'replace ' => 'u-url ' ,
20542133 ),
2055- 'review ' => array (
2056- 'replace ' => 'p-review h-review ' ,
2057- ),
2134+ // review is handled in the special processing section to allow for 'review hreview-aggregate'
20582135 'price ' => array (
20592136 'replace ' => 'p-price '
20602137 ),
0 commit comments