*/ if (!defined('PmWiki')) exit(); # # recurve/recurve.php # # PmWiki Recurve skin code # Copyright 2004-2006 Dominique Faure (dfaure@cpan.org) # With some ideas borrowed from some other PmWiki skins... # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # See http://www.pmwiki.org/wiki/Cookbook/RecurveSkin for info. # $RecipeInfo['RecurveSkin']['Version'] = '20061205'; # Skin Parts handling global $SkinPartFmt, $WikiTitle; SDVA($SkinPartFmt, array( 'wikititle' => "$WikiTitle > {\$Group} / {\$Title}", 'suptitle' => "[[{\$DefaultGroup}|$WikiTitle]] > [[{\$Group}/|{\$Groupspaced}]] /", 'title' => '{$Titlespaced}', 'footer' => ' * %item rel=nofollow% %navbox% [[▲ $[Top] ▲ -> {$FullName}#recurve_topofpage]] * %item rel=nofollow% [[$[Search] -> $[{$SiteGroup}/Search]]] * %item rel=nofollow% [[$[Recent Changes] -> $[{$Group}/RecentChanges]]] * %item rel=nofollow% [[$[All Recent Changes] -> $[{$SiteGroup}/AllRecentChanges]]] ', 'leftbardisabled' => false, 'tabsdisabled' => false, )); global $SkinPartStylesFmt; SDVA($SkinPartStylesFmt, array( 'leftbardisabled' => 'body { margin-left: 0; }', 'tabsdisabled' => '#tabpage { border-top: 1px #98AAB1 solid; }', )); # Ensure local CSS customization files are included *after* skin style global $HTMLHeaderFmt; $HTMLHeaderFmt[] = "\n"; function RenderPart($pagename, $part, $strip = '') { global $SkinPartFmt, $PCache; $n = "skin_$part"; if(!isset($PCache[$pagename][$n])) { $t = htmlspecialchars($SkinPartFmt[$part], ENT_NOQUOTES); $t = MarkupToHTML($pagename, "<:block>$t", array('escape' => 0)); $PCache[$pagename][$n] = $strip ? preg_replace($strip, '', $t) : $t; } print $PCache[$pagename][$n]; } function RenderTitle($pagename) { RenderPart($pagename, 'wikititle', "/(<[^>]+>|\r\n?|\n\r?)/"); } function RetrievePageMarkup($pagelist) { foreach($pagelist as $p) { if (PageExists($p)) { $page = RetrieveAuthPage($p, 'read', false, READPAGE_CURRENT); $text = $page['text']??''; break; } } return $text; } function RenderActions($pagename, $actionslist) { global $action, $SkinPartFmt; $pagelist = preg_split('/\s+/', $actionslist, -1, PREG_SPLIT_NO_EMPTY); $text = RetrievePageMarkup($pagelist); SDV($text, preg_replace("/(\r\n|\n?\r)/", "\n", $SkinPartFmt['pageactions']??'')); preg_match('/(<([uo])l>(?:.*)<\\/\\2l>)/si', MarkupToHTML($pagename, $text), $m); $ls = explode("", str_replace("\n", "", $m[1]??'')); $lRe = "/(.*?)(.*?)<\\/a>(.*)/i"; foreach($ls as $i => $l) { if(preg_match($lRe, $l, $l1)) { $laction = preg_match("/action=(.*)/i", $l1[2], $a) ? $a[1] : 'browse'; if($action == $laction) { $ls[$i] = $l1[1]; if($l1[4] && preg_match($lRe, $l1[4], $l2)) $ls[$i] .= "" . $l2[3] . ""; else $ls[$i] .= "

" . $l1[3] . "

"; } } } print implode("\n", $ls); } function RenderStyle($pagename, $params) { global $SkinPartFmt, $SkinPartStylesFmt; preg_match('/^\s*(!?)\s*(\S+)$/s', $params, $m); $bool = $SkinPartFmt[$m[2]]; $style = $SkinPartStylesFmt[$m[2]]; print ($m[1] ? ! $bool : $bool) ? "" : ''; } # Action-specific behaviors global $action; if ($action != 'browse') SetTmplDisplay('PagePrintFmt', 0); if ($action == 'print') { # Skin-specific print action. # Enabled from config.php with: $ActionSkin['print'] = ; global $LinkPageExistsFmt, $UrlLinkTextFmt, $GroupPrintHeaderFmt, $GroupPrintFooterFmt, $GroupHeaderFmt, $GroupFooterFmt; $LinkPageExistsFmt = "\$LinkText"; $UrlLinkTextFmt = "\$LinkText [\$Url]"; SDV($GroupPrintHeaderFmt,'(:include $Group.GroupPrintHeader:)(:nl:)'); SDV($GroupPrintFooterFmt,'(:nl:)(:include $Group.GroupPrintFooter:)'); $GroupHeaderFmt = $GroupPrintHeaderFmt; $GroupFooterFmt = $GroupPrintFooterFmt; LoadPageTemplate($pagename,"$SkinDir/print.tmpl"); return; } # $StopWatch handling global $EnableStopWatch, $FmtP; if(!$EnableStopWatch) $FmtP['/\\$StopWatch/'] = ''; # Markup extension # (:noleft:), (:nosidebar:) => remove sidebar # (:notabs:) => remove tabs above page content # (:notrailer:) => remove last modification information below page content # Markup('noleft', 'directives', '/\\(:noleft:\\)/i', "NoLeftBar"); Markup('nosidebar', 'directives', '/\\(:nosidebar:\\)/i', "NoLeftBar"); Markup('notabs', 'directives', '/\\(:notabs:\\)/i', "NoTabs"); Markup('notrailer', 'directives', '/\\(:notrailer:\\)/i', "mu_notrailer"); function mu_notrailer() { SetTmplDisplay('PageTabsTrailerFmt', 0); } global $NoLeftBarStartComment, $NoLeftBarEndComment, $NoTabsStartComment, $NoTabsEndComment; $NoLeftBarStartComment = $NoTabsStartComment = '/*'; $NoLeftBarEndComment = $NoTabsEndComment = '*/'; function NoLeftBar() { global $SkinPartFmt; $SkinPartFmt['leftbardisabled'] = true; SetTmplDisplay('PageLeftFmt', 0); } function NoTabs() { global $SkinPartFmt; $SkinPartFmt['tabsdisabled'] = true; SetTmplDisplay('PageTabsHeaderFmt', 0); }