-
Notifications
You must be signed in to change notification settings - Fork 0
/
skin.php
82 lines (76 loc) · 4.01 KB
/
skin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php if (!defined('PmWiki')) exit();
/* PmWiki DropShadow skin
*
* Examples at: http://pmwiki.com/Cookbook/DropShadow and http://solidgone.org/Skins/
* Copyright (c)2016 David Gilbert
* This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.
* Please retain the links in the footer.
* http://creativecommons.org/licenses/by-sa/4.0/
*/
global $FmtPV;
$FmtPV['$SkinName'] = '"DropShadow"';
$FmtPV['$SkinVersion'] = '"2.2.4"';
global $PageLogoUrl, $PageLogoUrlHeight, $PageLogoUrlWidth, $HTMLStylesFmt;
if (!empty($PageLogoUrl)) {
dg_SetLogoHeightWidth(15);
$HTMLStylesFmt['dropshadow'] .=
'#siteheader .sitetitle a{height:' .$PageLogoUrlHeight .'; background: url(' .$PageLogoUrl .') left top no-repeat} '.
'#siteheader .sitetitle a, #siteheader .sitetag{padding-left: ' .$PageLogoUrlWidth .'} '.
'#siteheader .sitetag{margin-top: ' .(35-substr($PageLogoUrlHeight,0,-2)) .'px}';
}
$SkinColor = dg_SetSkinColor('blue', array('red','blue','orange','yellow','green'));
# ----------------------------------------
# - Standard Skin Setup
# ----------------------------------------
$FmtPV['$WikiTitle'] = '$GLOBALS["WikiTitle"]';
$FmtPV['$WikiTag'] = '$GLOBALS["WikiTag"]';
# Move any (:noleft:) or SetTmplDisplay('PageLeftFmt', 0); directives to variables for access in jScript.
$FmtPV['$LeftColumn'] = "\$GLOBALS['TmplDisplay']['PageLeftFmt']";
Markup_e('noleft', 'directives', '/\\(:noleft:\\)/i', "SetTmplDisplay('PageLeftFmt',0)");
$FmtPV['$RightColumn'] = "\$GLOBALS['TmplDisplay']['PageRightFmt']";
Markup_e('noright', 'directives', '/\\(:noright:\\)/i', "SetTmplDisplay('PageRightFmt',0)");
$FmtPV['$ActionBar'] = "\$GLOBALS['TmplDisplay']['PageActionFmt']";
Markup_e('noaction', 'directives', '/\\(:noaction:\\)/i', "SetTmplDisplay('PageActionFmt',0)");
$FmtPV['$TabsBar'] = "\$GLOBALS['TmplDisplay']['PageTabsFmt']";
Markup_e('notabs', 'directives', '/\\(:notabs:\\)/i', "SetTmplDisplay('PageTabsFmt',0)");
$FmtPV['$SearchBar'] = "\$GLOBALS['TmplDisplay']['PageSearchFmt']";
Markup_e('nosearch', 'directives', '/\\(:nosearch:\\)/i', "SetTmplDisplay('PageSearchFmt',0)");
$FmtPV['$TitleGroup'] = "\$GLOBALS['TmplDisplay']['PageTitleGroupFmt']";
Markup_e('notitlegroup', 'directives', '/\\(:notitlegroup:\\)/i', "SetTmplDisplay('PageTitleGroupFmt',0)");
Markup_e('notitle', 'directives', '/\\(:notitle:\\)/i', "SetTmplDisplay('PageTitleFmt',0); SetTmplDisplay('PageTitleGroupFmt',0)");
Markup('fieldset', 'inline', '/\\(:fieldset:\\)/i', "<fieldset>");
Markup('fieldsetend', 'inline', '/\\(:fieldsetend:\\)/i', "</fieldset>");
# Override pmwiki styles otherwise they will override styles declared in css
global $HTMLStylesFmt;
$HTMLStylesFmt['pmwiki'] = '';
# Add a custom page storage location
global $WikiLibDirs;
$PageStorePath = dirname(__FILE__)."/wikilib.d/{\$FullName}";
$where = count($WikiLibDirs);
if ($where>1) $where--;
array_splice($WikiLibDirs, $where, 0, array(new PageStore($PageStorePath)));
# ----------------------------------------
# - Standard Skin Functions
# ----------------------------------------
function dg_SetSkinColor($default, $valid_colors){
global $SkinColor, $ValidSkinColors, $_GET;
if ( !is_array($ValidSkinColors) ) $ValidSkinColors = array();
$ValidSkinColors = array_merge($ValidSkinColors, $valid_colors);
if ( isset($_GET['color']) && in_array($_GET['color'], $ValidSkinColors) )
$SkinColor = $_GET['color'];
elseif ( !in_array($SkinColor, $ValidSkinColors) )
$SkinColor = $default;
return $SkinColor;
}
function dg_PoweredBy(){
print ('<a href="http://pmwiki.com/'.($GLOBALS['bi_BlogIt_Enabled']?'Cookbook/BlogIt">BlogIt':'">PmWiki').'</a>');
}
# Determine logo height and width
function dg_SetLogoHeightWidth ($wPad, $hPad=0){
global $PageLogoUrl, $PageLogoUrlHeight, $PageLogoUrlWidth;
if (!isset($PageLogoUrlWidth) || !isset($PageLogoUrlHeight)){
$size = @getimagesize($PageLogoUrl);
if (!isset($PageLogoUrlWidth)) SDV($PageLogoUrlWidth, ($size ?$size[0]+$wPad :0) .'px');
if (!isset($PageLogoUrlHeight)) SDV($PageLogoUrlHeight, ($size ?$size[1]+$hPad :0) .'px');
}
}