*/ 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] .= "