54°F

Aaron Parecki

  • Articles
  • Notes
  • Photos
  • mediawiki-vector-customizations.php

    January 14, 2018
    1. <?php
    2. // This post documents the changes made to VectorTemplate.php for the IndieWeb wiki.
    3. // More details at https://indieweb.org/mediawiki-customization
    4.  
    5. // Some wiki pages have their own Microformats on the page, such as events. In these cases, we don't want to add the h-entry class.
    6.  
    7. // Pre-render the HTML for the page and check if there are embedded microformats already. Add the following after the line `$this->html( 'headelement' );`
    8.  
    9. ob_start();
    10. $this->html('bodycontent');
    11. $bodycontent = ob_get_clean();
    12. $has_microformats = false;
    13. try {
    14. // Check for HTML tags that contain a top-level microformat object
    15. $mf2 = Mf2\parse($bodycontent);
    16. if($mf2) {
    17. if(isset($mf2['items']) && count($mf2['items'])) {
    18. if(array_intersect($mf2['items'][]['type'], ['h-entry','h-event','h-x-app'])) {
    19. $has_microformats = true;
    20. }
    21. }
    22. }
    23. } catch(Exception $e) {
    24. }
    25. ?>
    26.  
    27. <!-- Change the `mw-body` element to the following to add `h-entry` when applicable: -->
    28. <div id="content" class="mw-body <?= $has_microformats ? '' : 'h-entry' ?>" role="main">
    29.  
    30. <!-- Just below that, add this line to set the `u-url` property to the page URL: -->
    31. <?= $has_microformats ? '' : '<a href="" class="u-url"></a>' ?>
    32.  
    33. <!-- Change the h1 header to add `p-name` -->
    34. <h1 id="firstHeading" class="firstHeading <?= $has_microformats ? '' : 'p-name' ?>" lang="<?php $this->text( 'pageLanguage' ); ?>">
    Portland, Oregon • 49°F
    Sun, Jan 14, 2018 7:25am -08:00
Posted in /code using quill.p3k.io

Hi, I'm Aaron Parecki, Director of Identity Standards at Okta, and co-founder of IndieWebCamp. I maintain oauth.net, write and consult about OAuth, and participate in the OAuth Working Group at the IETF. I also help people learn about video production and livestreaming. (detailed bio)

I've been tracking my location since 2008 and I wrote 100 songs in 100 days. I've spoken at conferences around the world about owning your data, OAuth, quantified self, and explained why R is a vowel. Read more.

  • Director of Identity Standards at Okta
  • IndieWebCamp Founder
  • OAuth WG Editor
  • OpenID Board Member

  • 🎥 YouTube Tutorials and Reviews
  • 🏠 We're building a triplex!
  • ⭐️ Life Stack
  • ⚙️ Home Automation
  • All
  • Articles
  • Bookmarks
  • Notes
  • Photos
  • Replies
  • Reviews
  • Trips
  • Videos
  • Contact
© 1999-2025 by Aaron Parecki. Powered by p3k. This site supports Webmention.
Except where otherwise noted, text content on this site is licensed under a Creative Commons Attribution 3.0 License.
IndieWebCamp Microformats Webmention W3C HTML5 Creative Commons
WeChat ID
aaronpk_tv