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.9KB

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