Jetpack_Sitemap_Stylist

Builds the XSL files required by Jetpack_Sitemap_Manager.

Defined (1)

The class is defined in the following location(s).

/modules/sitemaps/sitemap-stylist.php  
  1. class Jetpack_Sitemap_Stylist { 
  2.  
  3. /** 
  4. * Convert named entities, strip all HTML except anchor tags,  
  5. * and interpolate with vsprintf. This is a helper function 
  6. * for all the internationalized UI strings in this class 
  7. * which have to include URLs. 
  8. * Note that $url_array should be indexed by integers like so: 
  9. * array( 
  10. * 1 => 'example.com',  
  11. * 2 => 'example.org',  
  12. * ); 
  13. * Then '%1$s' in the format string will substitute 'example.com' 
  14. * and '%2$s' will substitute 'example.org'. 
  15. * @access private 
  16. * @since 4.8.0 
  17. * @link http://php.net/manual/en/function.vsprintf.php Format string documentation. 
  18. * @param string $format A vsprintf-style format string to be sanitized. 
  19. * @param array $url_array The string substitution array to be passed to vsprintf. 
  20. * @return string The sanitized string. 
  21. */ 
  22. private static function sanitize_with_links( $format, $url_array ) { 
  23. return vsprintf( 
  24. wp_kses( 
  25. ent2ncr( $format ),  
  26. array( 
  27. 'a' => array( 
  28. 'href' => true,  
  29. 'title' => true,  
  30. ),  
  31. ),  
  32. $url_array 
  33. ); 
  34.  
  35. /** 
  36. * Returns the xsl of a sitemap xml file as a string. 
  37. * @access public 
  38. * @since 4.8.0 
  39. * @return string The contents of the xsl file. 
  40. */ 
  41. public static function sitemap_xsl() { 
  42. $title = esc_html( ent2ncr( __( 'XML Sitemap', 'jetpack' ) ) ); 
  43. $header_url = esc_html( ent2ncr( __( 'URL', 'jetpack' ) ) ); 
  44. $header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) ); 
  45.  
  46. $description = self::sanitize_with_links( 
  47. __( 
  48. 'This is an XML Sitemap generated by <a href="%1$s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%2$s" target="_blank">Google</a> or <a href="%3$s" target="_blank">Bing</a>.',  
  49. 'jetpack' 
  50. ),  
  51. array( 
  52. 1 => 'http://jetpack.com/',  
  53. 2 => 'https://www.google.com/',  
  54. 3 => 'https://www.bing.com/',  
  55. ); 
  56.  
  57. $more_info = self::sanitize_with_links( 
  58. __( 
  59. 'You can find more information on XML sitemaps at <a href="%1$s" target="_blank">sitemaps.org</a>',  
  60. 'jetpack' 
  61. ),  
  62. array( 
  63. 1 => 'http://sitemaps.org',  
  64. ); 
  65.  
  66. $generated_by = self::sanitize_with_links( 
  67. __( 
  68. 'Generated by <a href="%s" target="_blank">Jetpack for WordPress</a>',  
  69. 'jetpack' 
  70. ),  
  71. array( 
  72. 1 => 'https://jetpack.com',  
  73. ); 
  74.  
  75. $css = self::sitemap_xsl_css(); 
  76.  
  77. return <<<XSL 
  78. <?xml version='1.0' encoding='UTF-8'?> 
  79. <xsl:stylesheet version='2.0' 
  80. xmlns:html='http://www.w3.org/TR/REC-html40' 
  81. xmlns:sitemap='http://www.sitemaps.org/schemas/sitemap/0.9' 
  82. xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 
  83. <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> 
  84. <xsl:template match="/"> 
  85. <html xmlns="http://www.w3.org/1999/xhtml"> 
  86. <head> 
  87. <title>$title</title> 
  88. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> 
  89. <style type='text/css'> 
  90. $css 
  91. </style> 
  92. </head> 
  93. <body> 
  94. <div id='description'> 
  95. <h1>$title</h1> 
  96. <p>$description</p> 
  97. <p>$more_info</p> 
  98. </div> 
  99. <div id='content'> 
  100. <!-- <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> --> 
  101. <table> 
  102. <tr> 
  103. <th>#</th> 
  104. <th>$header_url</th> 
  105. <th>$header_lastmod</th> 
  106. </tr> 
  107. <xsl:for-each select="sitemap:urlset/sitemap:url"> 
  108. <tr> 
  109. <xsl:choose> 
  110. <xsl:when test='position() mod 2 != 1'> 
  111. <xsl:attribute name="class">odd</xsl:attribute> 
  112. </xsl:when> 
  113. </xsl:choose> 
  114. <td> 
  115. <xsl:value-of select = "position()" /> 
  116. </td> 
  117. <td> 
  118. <xsl:variable name='itemURL'> 
  119. <xsl:value-of select='sitemap:loc'/> 
  120. </xsl:variable> 
  121. <a href='{\$itemURL}'> 
  122. <xsl:value-of select='sitemap:loc'/> 
  123. </a> 
  124. </td> 
  125. <td> 
  126. <xsl:value-of select='sitemap:lastmod'/> 
  127. </td> 
  128. </tr> 
  129. </xsl:for-each> 
  130. </table> 
  131. </div> 
  132. <div id='footer'> 
  133. <p>$generated_by</p> 
  134. </div> 
  135. </body> 
  136. </html> 
  137. </xsl:template> 
  138. </xsl:stylesheet>\n 
  139. XSL; 
  140.  
  141. /** 
  142. * Returns the xsl of a sitemap index xml file as a string. 
  143. * @access public 
  144. * @since 4.8.0 
  145. * @return string The contents of the xsl file. 
  146. */ 
  147. public static function sitemap_index_xsl() { 
  148. $title = esc_html( ent2ncr( __( 'XML Sitemap Index', 'jetpack' ) ) ); 
  149. $header_url = esc_html( ent2ncr( __( 'Sitemap URL', 'jetpack' ) ) ); 
  150. $header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) ); 
  151.  
  152. $description = self::sanitize_with_links( 
  153. __( 
  154. 'This is an XML Sitemap Index generated by <a href="%1$s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%2$s" target="_blank">Google</a> or <a href="%3$s" target="_blank">Bing</a>.',  
  155. 'jetpack' 
  156. ),  
  157. array( 
  158. 1 => 'http://jetpack.com/',  
  159. 2 => 'https://www.google.com/',  
  160. 3 => 'https://www.bing.com/',  
  161. ); 
  162.  
  163. $more_info = self::sanitize_with_links( 
  164. __( 
  165. 'You can find more information on XML sitemaps at <a href="%1$s" target="_blank">sitemaps.org</a>',  
  166. 'jetpack' 
  167. ),  
  168. array( 
  169. 1 => 'http://sitemaps.org',  
  170. ); 
  171.  
  172. $generated_by = self::sanitize_with_links( 
  173. __( 
  174. 'Generated by <a href="%s" target="_blank">Jetpack for WordPress</a>',  
  175. 'jetpack' 
  176. ),  
  177. array( 
  178. 1 => 'https://jetpack.com',  
  179. ); 
  180.  
  181. $css = self::sitemap_xsl_css(); 
  182.  
  183. return <<<XSL 
  184. <?xml version='1.0' encoding='UTF-8'?> 
  185. <xsl:stylesheet version='2.0' 
  186. xmlns:html='http://www.w3.org/TR/REC-html40' 
  187. xmlns:sitemap='http://www.sitemaps.org/schemas/sitemap/0.9' 
  188. xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 
  189. <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> 
  190. <xsl:template match="/"> 
  191. <html xmlns="http://www.w3.org/1999/xhtml"> 
  192. <head> 
  193. <title>$title</title> 
  194. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> 
  195. <style type='text/css'> 
  196. $css 
  197. </style> 
  198. </head> 
  199. <body> 
  200. <div id='description'> 
  201. <h1>$title</h1> 
  202. <p>$description</p> 
  203. <p>$more_info</p> 
  204. </div> 
  205. <div id='content'> 
  206. <table> 
  207. <tr> 
  208. <th>#</th> 
  209. <th>$header_url</th> 
  210. <th>$header_lastmod</th> 
  211. </tr> 
  212. <xsl:for-each select='sitemap:sitemapindex/sitemap:sitemap'> 
  213. <tr> 
  214. <xsl:choose> 
  215. <xsl:when test='position() mod 2 != 1'> 
  216. <xsl:attribute name="class">odd</xsl:attribute> 
  217. </xsl:when> 
  218. </xsl:choose> 
  219. <td> 
  220. <xsl:value-of select = "position()" /> 
  221. </td> 
  222. <td> 
  223. <xsl:variable name='itemURL'> 
  224. <xsl:value-of select='sitemap:loc'/> 
  225. </xsl:variable> 
  226. <a href='{\$itemURL}'> 
  227. <xsl:value-of select='sitemap:loc'/> 
  228. </a> 
  229. </td> 
  230. <td> 
  231. <xsl:value-of select='sitemap:lastmod'/> 
  232. </td> 
  233. </tr> 
  234. </xsl:for-each> 
  235. </table> 
  236. </div> 
  237. <div id='footer'> 
  238. <p>$generated_by</p> 
  239. </div> 
  240. </body> 
  241. </html> 
  242. </xsl:template> 
  243. </xsl:stylesheet>\n 
  244. XSL; 
  245.  
  246. /** 
  247. * Returns the xsl of an image sitemap xml file as a string. 
  248. * @access public 
  249. * @since 4.8.0 
  250. * @return string The contents of the xsl file. 
  251. */ 
  252. public static function image_sitemap_xsl() { 
  253. $title = esc_html( ent2ncr( __( 'XML Image Sitemap', 'jetpack' ) ) ); 
  254. $header_url = esc_html( ent2ncr( __( 'Page URL', 'jetpack' ) ) ); 
  255. $header_image_url = esc_html( ent2ncr( __( 'Image URL', 'jetpack' ) ) ); 
  256. $header_thumbnail = esc_html( ent2ncr( __( 'Thumbnail', 'jetpack' ) ) ); 
  257. $header_title = esc_html( ent2ncr( __( 'Title', 'jetpack' ) ) ); 
  258. $header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) ); 
  259. $header_caption = esc_html( ent2ncr( __( 'Caption', 'jetpack' ) ) ); 
  260.  
  261. $description = self::sanitize_with_links( 
  262. __( 
  263. 'This is an XML Image Sitemap generated by <a href="%1$s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%2$s" target="_blank">Google</a> or <a href="%3$s" target="_blank">Bing</a>.',  
  264. 'jetpack' 
  265. ),  
  266. array( 
  267. 1 => 'http://jetpack.com/',  
  268. 2 => 'https://www.google.com/',  
  269. 3 => 'https://www.bing.com/',  
  270. ); 
  271.  
  272. $more_info = self::sanitize_with_links( 
  273. __( 
  274. 'You can find more information on XML sitemaps at <a href="%1$s" target="_blank">sitemaps.org</a>',  
  275. 'jetpack' 
  276. ),  
  277. array( 
  278. 1 => 'http://sitemaps.org',  
  279. ); 
  280.  
  281. $generated_by = self::sanitize_with_links( 
  282. __( 
  283. 'Generated by <a href="%s" target="_blank">Jetpack for WordPress</a>',  
  284. 'jetpack' 
  285. ),  
  286. array( 
  287. 1 => 'https://jetpack.com',  
  288. ); 
  289.  
  290. $css = self::sitemap_xsl_css(); 
  291.  
  292. return <<<XSL 
  293. <?xml version='1.0' encoding='UTF-8'?> 
  294. <xsl:stylesheet version='2.0' 
  295. xmlns:html='http://www.w3.org/TR/REC-html40' 
  296. xmlns:sitemap='http://www.sitemaps.org/schemas/sitemap/0.9' 
  297. xmlns:image='http://www.google.com/schemas/sitemap-image/1.1' 
  298. xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 
  299. <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> 
  300. <xsl:template match="/"> 
  301. <html xmlns="http://www.w3.org/1999/xhtml"> 
  302. <head> 
  303. <title>$title</title> 
  304. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> 
  305. <style type='text/css'> 
  306. $css 
  307. </style> 
  308. </head> 
  309. <body> 
  310. <div id='description'> 
  311. <h1>$title</h1> 
  312. <p>$description</p> 
  313. <p>$more_info</p> 
  314. </div> 
  315. <div id='content'> 
  316. <!-- <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> --> 
  317. <table> 
  318. <tr> 
  319. <th>#</th> 
  320. <th>$header_url</th> 
  321. <th>$header_image_url</th> 
  322. <th>$header_title</th> 
  323. <th>$header_caption</th> 
  324. <th>$header_lastmod</th> 
  325. <th>$header_thumbnail</th> 
  326. </tr> 
  327. <xsl:for-each select="sitemap:urlset/sitemap:url"> 
  328. <tr> 
  329. <xsl:choose> 
  330. <xsl:when test='position() mod 2 != 1'> 
  331. <xsl:attribute name="class">odd</xsl:attribute> 
  332. </xsl:when> 
  333. </xsl:choose> 
  334. <td> 
  335. <xsl:value-of select = "position()" /> 
  336. </td> 
  337. <td> 
  338. <xsl:variable name='pageURL'> 
  339. <xsl:value-of select='sitemap:loc'/> 
  340. </xsl:variable> 
  341. <a href='{\$pageURL}'> 
  342. <xsl:value-of select='sitemap:loc'/> 
  343. </a> 
  344. </td> 
  345. <xsl:variable name='itemURL'> 
  346. <xsl:value-of select='image:image/image:loc'/> 
  347. </xsl:variable> 
  348. <td> 
  349. <a href='{\$itemURL}'> 
  350. <xsl:value-of select='image:image/image:loc'/> 
  351. </a> 
  352. </td> 
  353. <td> 
  354. <xsl:value-of select='image:image/image:title'/> 
  355. </td> 
  356. <td> 
  357. <xsl:value-of select='image:image/image:caption'/> 
  358. </td> 
  359. <td> 
  360. <xsl:value-of select='sitemap:lastmod'/> 
  361. </td> 
  362. <td> 
  363. <a href='{\$itemURL}'> 
  364. <img class='thumbnail' src='{\$itemURL}'/> 
  365. </a> 
  366. </td> 
  367. </tr> 
  368. </xsl:for-each> 
  369. </table> 
  370. </div> 
  371. <div id='footer'> 
  372. <p>$generated_by</p> 
  373. </div> 
  374. </body> 
  375. </html> 
  376. </xsl:template> 
  377. </xsl:stylesheet>\n 
  378. XSL; 
  379.  
  380. /** 
  381. * Returns the xsl of a video sitemap xml file as a string. 
  382. * @access public 
  383. * @since 4.8.0 
  384. * @return string The contents of the xsl file. 
  385. */ 
  386. public static function video_sitemap_xsl() { 
  387. $title = esc_html( ent2ncr( __( 'XML Video Sitemap', 'jetpack' ) ) ); 
  388. $header_url = esc_html( ent2ncr( __( 'Page URL', 'jetpack' ) ) ); 
  389. $header_image_url = esc_html( ent2ncr( __( 'Video URL', 'jetpack' ) ) ); 
  390. $header_thumbnail = esc_html( ent2ncr( __( 'Thumbnail', 'jetpack' ) ) ); 
  391. $header_title = esc_html( ent2ncr( __( 'Title', 'jetpack' ) ) ); 
  392. $header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) ); 
  393. $header_description = esc_html( ent2ncr( __( 'Description', 'jetpack' ) ) ); 
  394.  
  395. $description = self::sanitize_with_links( 
  396. __( 
  397. 'This is an XML Video Sitemap generated by <a href="%1$s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%2$s" target="_blank">Google</a> or <a href="%3$s" target="_blank">Bing</a>.',  
  398. 'jetpack' 
  399. ),  
  400. array( 
  401. 1 => 'http://jetpack.com/',  
  402. 2 => 'https://www.google.com/',  
  403. 3 => 'https://www.bing.com/',  
  404. ); 
  405.  
  406. $more_info = self::sanitize_with_links( 
  407. __( 
  408. 'You can find more information on XML sitemaps at <a href="%1$s" target="_blank">sitemaps.org</a>',  
  409. 'jetpack' 
  410. ),  
  411. array( 
  412. 1 => 'http://sitemaps.org',  
  413. ); 
  414.  
  415. $generated_by = self::sanitize_with_links( 
  416. __( 
  417. 'Generated by <a href="%s" target="_blank">Jetpack for WordPress</a>',  
  418. 'jetpack' 
  419. ),  
  420. array( 
  421. 1 => 'https://jetpack.com',  
  422. ); 
  423.  
  424. $css = self::sitemap_xsl_css(); 
  425.  
  426. return <<<XSL 
  427. <?xml version='1.0' encoding='UTF-8'?> 
  428. <xsl:stylesheet version='2.0' 
  429. xmlns:html='http://www.w3.org/TR/REC-html40' 
  430. xmlns:sitemap='http://www.sitemaps.org/schemas/sitemap/0.9' 
  431. xmlns:video='http://www.google.com/schemas/sitemap-video/1.1' 
  432. xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 
  433. <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> 
  434. <xsl:template match="/"> 
  435. <html xmlns="http://www.w3.org/1999/xhtml"> 
  436. <head> 
  437. <title>$title</title> 
  438. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> 
  439. <style type='text/css'> 
  440. $css 
  441. </style> 
  442. </head> 
  443. <body> 
  444. <div id='description'> 
  445. <h1>$title</h1> 
  446. <p>$description</p> 
  447. <p>$more_info</p> 
  448. </div> 
  449. <div id='content'> 
  450. <!-- <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> --> 
  451. <table> 
  452. <tr> 
  453. <th>#</th> 
  454. <th>$header_url</th> 
  455. <th>$header_image_url</th> 
  456. <th>$header_title</th> 
  457. <th>$header_description</th> 
  458. <th>$header_lastmod</th> 
  459. <th>$header_thumbnail</th> 
  460. </tr> 
  461. <xsl:for-each select="sitemap:urlset/sitemap:url"> 
  462. <tr> 
  463. <xsl:choose> 
  464. <xsl:when test='position() mod 2 != 1'> 
  465. <xsl:attribute name="class">odd</xsl:attribute> 
  466. </xsl:when> 
  467. </xsl:choose> 
  468. <td> 
  469. <xsl:value-of select = "position()" /> 
  470. </td> 
  471. <td> 
  472. <xsl:variable name='pageURL'> 
  473. <xsl:value-of select='sitemap:loc'/> 
  474. </xsl:variable> 
  475. <a href='{\$pageURL}'> 
  476. <xsl:value-of select='sitemap:loc'/> 
  477. </a> 
  478. </td> 
  479. <xsl:variable name='itemURL'> 
  480. <xsl:value-of select='video:video/video:content_loc'/> 
  481. </xsl:variable> 
  482. <td> 
  483. <a href='{\$itemURL}'> 
  484. <xsl:value-of select='video:video/video:content_loc'/> 
  485. </a> 
  486. </td> 
  487. <td> 
  488. <xsl:value-of select='video:video/video:title'/> 
  489. </td> 
  490. <td> 
  491. <xsl:value-of select='video:video/video:description'/> 
  492. </td> 
  493. <td> 
  494. <xsl:value-of select='sitemap:lastmod'/> 
  495. </td> 
  496. <td> 
  497. <xsl:variable name='thumbURL'> 
  498. <xsl:value-of select='video:video/video:thumbnail_loc'/> 
  499. </xsl:variable> 
  500. <a href='{\$thumbURL}'> 
  501. <img class='thumbnail' src='{\$thumbURL}'/> 
  502. </a> 
  503. </td> 
  504. </tr> 
  505. </xsl:for-each> 
  506. </table> 
  507. </div> 
  508. <div id='footer'> 
  509. <p>$generated_by</p> 
  510. </div> 
  511. </body> 
  512. </html> 
  513. </xsl:template> 
  514. </xsl:stylesheet>\n 
  515. XSL; 
  516.  
  517. /** 
  518. * Returns the xsl of a news sitemap xml file as a string. 
  519. * @access public 
  520. * @since 4.8.0 
  521. * @return string The contents of the xsl file. 
  522. */ 
  523. public static function news_sitemap_xsl() { 
  524. $title = esc_html( ent2ncr( __( 'XML News Sitemap', 'jetpack' ) ) ); 
  525. $header_url = esc_html( ent2ncr( __( 'Page URL', 'jetpack' ) ) ); 
  526. $header_title = esc_html( ent2ncr( __( 'Title', 'jetpack' ) ) ); 
  527. $header_pubdate = esc_html( ent2ncr( __( 'Publication Date', 'jetpack' ) ) ); 
  528.  
  529. $description = self::sanitize_with_links( 
  530. __( 
  531. 'This is an XML News Sitemap generated by <a href="%1$s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%2$s" target="_blank">Google</a> or <a href="%3$s" target="_blank">Bing</a>.',  
  532. 'jetpack' 
  533. ),  
  534. array( 
  535. 1 => 'http://jetpack.com/',  
  536. 2 => 'https://www.google.com/',  
  537. 3 => 'https://www.bing.com/',  
  538. ); 
  539.  
  540. $more_info = self::sanitize_with_links( 
  541. __( 
  542. 'You can find more information on XML sitemaps at <a href="%1$s" target="_blank">sitemaps.org</a>',  
  543. 'jetpack' 
  544. ),  
  545. array( 
  546. 1 => 'http://sitemaps.org',  
  547. ); 
  548.  
  549. $generated_by = self::sanitize_with_links( 
  550. __( 
  551. 'Generated by <a href="%s" target="_blank">Jetpack for WordPress</a>',  
  552. 'jetpack' 
  553. ),  
  554. array( 
  555. 1 => 'https://jetpack.com',  
  556. ); 
  557.  
  558. $css = self::sitemap_xsl_css(); 
  559.  
  560. return <<<XSL 
  561. <?xml version='1.0' encoding='UTF-8'?> 
  562. <xsl:stylesheet version='2.0' 
  563. xmlns:html='http://www.w3.org/TR/REC-html40' 
  564. xmlns:sitemap='http://www.sitemaps.org/schemas/sitemap/0.9' 
  565. xmlns:news='http://www.google.com/schemas/sitemap-news/0.9' 
  566. xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 
  567. <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> 
  568. <xsl:template match="/"> 
  569. <html xmlns="http://www.w3.org/1999/xhtml"> 
  570. <head> 
  571. <title>$title</title> 
  572. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> 
  573. <style type='text/css'> 
  574. $css 
  575. </style> 
  576. </head> 
  577. <body> 
  578. <div id='description'> 
  579. <h1>$title</h1> 
  580. <p>$description</p> 
  581. <p>$more_info</p> 
  582. </div> 
  583. <div id='content'> 
  584. <!-- <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> --> 
  585. <table> 
  586. <tr> 
  587. <th>#</th> 
  588. <th>$header_url</th> 
  589. <th>$header_title</th> 
  590. <th>$header_pubdate</th> 
  591. </tr> 
  592. <xsl:for-each select="sitemap:urlset/sitemap:url"> 
  593. <tr> 
  594. <xsl:choose> 
  595. <xsl:when test='position() mod 2 != 1'> 
  596. <xsl:attribute name="class">odd</xsl:attribute> 
  597. </xsl:when> 
  598. </xsl:choose> 
  599. <td> 
  600. <xsl:value-of select = "position()" /> 
  601. </td> 
  602. <xsl:variable name='pageURL'> 
  603. <xsl:value-of select='sitemap:loc'/> 
  604. </xsl:variable> 
  605. <td> 
  606. <a href='{\$pageURL}'> 
  607. <xsl:value-of select='sitemap:loc'/> 
  608. </a> 
  609. </td> 
  610. <td> 
  611. <a href='{\$pageURL}'> 
  612. <xsl:value-of select='news:news/news:title'/> 
  613. </a> 
  614. </td> 
  615. <td> 
  616. <xsl:value-of select='news:news/news:publication_date'/> 
  617. </td> 
  618. </tr> 
  619. </xsl:for-each> 
  620. </table> 
  621. </div> 
  622. <div id='footer'> 
  623. <p>$generated_by</p> 
  624. </div> 
  625. </body> 
  626. </html> 
  627. </xsl:template> 
  628. </xsl:stylesheet>\n 
  629. XSL; 
  630.  
  631. /** 
  632. * The CSS to be included in sitemap xsl stylesheets; 
  633. * factored out for uniformity. 
  634. * @access public 
  635. * @since 4.8.0 
  636. * @return string The CSS. 
  637. */ 
  638. public static function sitemap_xsl_css() { 
  639. return <<<CSS 
  640. body { 
  641. font: 14px 'Open Sans', Helvetica, Arial, sans-serif; 
  642. margin: 0; 
  643.  
  644. a { 
  645. color: #3498db; 
  646. text-decoration: none; 
  647.  
  648. h1 { 
  649. margin: 0; 
  650.  
  651. #description { 
  652. background-color: #81a844; 
  653. color: #FFF; 
  654. padding: 30px 30px 20px; 
  655.  
  656. #description a { 
  657. color: #fff; 
  658.  
  659. #content { 
  660. padding: 10px 30px 30px; 
  661. background: #fff; 
  662.  
  663. a:hover { 
  664. border-bottom: 1px solid; 
  665.  
  666. th, td { 
  667. font-size: 12px; 
  668.  
  669. th { 
  670. text-align: left; 
  671. border-bottom: 1px solid #ccc; 
  672.  
  673. th, td { 
  674. padding: 10px 15px; 
  675.  
  676. .odd { 
  677. background-color: #E7F1D4; 
  678.  
  679. #footer { 
  680. margin: 20px 30px; 
  681. font-size: 12px; 
  682. color: #999; 
  683.  
  684. #footer a { 
  685. color: inherit; 
  686.  
  687. #description a, #footer a { 
  688. border-bottom: 1px solid; 
  689.  
  690. #description a:hover, #footer a:hover { 
  691. border-bottom: none; 
  692.  
  693. img.thumbnail { 
  694. max-height: 100px; 
  695. max-width: 100px; 
  696. CSS; 
  697.