Papyrus skin for PmWiki.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

papyrus.php 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php if (!defined('PmWiki')) exit();
  2. /* Papyrus skin for PmWiki
  3. Copyright 2017-2022 Said Achmiz
  4. https://www.pmwiki.org/wiki/Skins/Papyrus
  5. */
  6. global $FmtPV;
  7. $FmtPV['$SkinName'] = '"Papyrus"';
  8. $FmtPV['$SkinVersion'] = '"2022-03-04"';
  9. ## Append the modification time to the URL as a GET parameter; this should be ignored
  10. ## by the web server, but is seen as part of the unique URL of the remote resource by
  11. ## the browser; when it changes (because the attachment has been modified), the
  12. ## browser will see that it doesn’t have a cached version of the resource under the
  13. ## new URL, and will retrieve the updated version.
  14. $filepath = "$SkinDir/papyrus.css";
  15. $path = "$SkinDirUrl/papyrus.css";
  16. $versioned_path = $path . "?v=" . filemtime($filepath);
  17. global $VersionedAssetsReattachFileExtension;
  18. if ($VersionedAssetsReattachFileExtension == true) {
  19. ## Re-attach the file extension.
  20. preg_match("/\\.[^\\.]+$/", $path, $matches);
  21. $versioned_path .= $matches[0];
  22. }
  23. global $HTMLHeaderFmt;
  24. $HTMLHeaderFmt[] = "<link rel='stylesheet' type='text/css' href='$versioned_path' />\n";
  25. ## Define a custom PageStore for bundled pages.
  26. class PapyrusPageStore extends PageStore {
  27. function pagefile($pagename) {
  28. global $FarmD;
  29. $dfmt = $this->dirfmt;
  30. if ($pagename > '') {
  31. $pagename = str_replace('/', '.', $pagename);
  32. if ($dfmt == dirname(__FILE__).'/wikilib.d/{$FullName}')
  33. return $this->PFE(dirname(__FILE__)."/wikilib.d/$pagename");
  34. if ($dfmt == '$FarmD/pub/skins/papyrus/wikilib.d/{$FullName}')
  35. return $this->PFE("$FarmD/pub/skins/papyrus/wikilib.d/$pagename");
  36. }
  37. return $this->PFE(FmtPageName($dfmt, $pagename));
  38. }
  39. }
  40. global $WikiLibDirs, $RecipeInfo;
  41. $PageStorePath = dirname(__FILE__).'/wikilib.d/{$FullName}';
  42. $where = count($WikiLibDirs);
  43. if ($where > 1) $where--;
  44. if ($RecipeInfo['Sisterly']['Version'] != '') $where--; // If Sisterly is enabled, then the last PageStore is the SisterStore, not the PmWiki stuff. So we have to insert at an index 1 less.
  45. array_splice($WikiLibDirs, $where, 0, array(new PapyrusPageStore($PageStorePath)));
  46. ## Label the body element with a class indicating the current page action.
  47. global $HTMLFooterFmt, $action;
  48. $HTMLFooterFmt[] = "<script type='text/javascript'>document.querySelector('body').classList.add('action-{$action}');</script>";
  49. ## Enable the (:notitlegroup:) and (:titlegroup:) directives.
  50. Markup('notitlegroup', 'directives', '/\(:notitlegroup:\)/i', function ($m) {
  51. global $HTMLStylesFmt;
  52. $HTMLStylesFmt['papyrus-title-group'] = "#pageTitle .title-group { display: none; }";
  53. });
  54. Markup('titlegroup', 'directives', '/\(:titlegroup:\)/i', function ($m) {
  55. global $HTMLStylesFmt;
  56. $HTMLStylesFmt['papyrus-title-group'] = "";
  57. });