function SetSkin($pagename, $skin) { global $Skin, $SkinDir, $SkinDirUrl, $IsTemplateLoaded, $PubDirUrl, $FarmPubDirUrl, $FarmD; unset($Skin); foreach ((array) $skin as $s) { $sd = FmtPageName("pub/skins/{$s}", $pagename); if (is_dir($sd)) { $Skin = $s; $SkinDirUrl = "{$PubDirUrl}/skins/{$Skin}"; break; } $sd = FmtPageName("{$FarmD}/pub/skins/{$s}", $pagename); if (is_dir($sd)) { $Skin = $s; $SkinDirUrl = "{$FarmPubDirUrl}/skins/{$Skin}"; break; } } if (!is_dir($sd)) { Abort("?unable to find skin from list " . implode(' ', (array) $skin)); } $SkinDir = $sd; $IsTemplateLoaded = 0; if (file_exists("{$SkinDir}/{$Skin}.php")) { include_once "{$SkinDir}/{$Skin}.php"; } else { if (file_exists("{$SkinDir}/skin.php")) { include_once "{$SkinDir}/skin.php"; } } if ($IsTemplateLoaded) { return; } if (file_exists("{$SkinDir}/{$Skin}.tmpl")) { LoadPageTemplate($pagename, "{$SkinDir}/{$Skin}.tmpl"); } else { if (file_exists("{$SkinDir}/skin.tmpl")) { LoadPageTemplate($pagename, "{$SkinDir}/skin.tmpl"); } else { if ($dh = opendir($SkinDir)) { while (($fname = readdir($dh)) !== false) { if (substr($fname, -5) != '.tmpl') { continue; } if ($IsTemplateLoaded) { Abort("?unable to find unique template in {$SkinDir}"); } LoadPageTemplate($pagename, "{$SkinDir}/{$fname}"); } closedir($dh); } } } if (!$IsTemplateLoaded) { Abort("Unable to load {$Skin} template"); } }
function SetSkin($pagename, $skin) { global $Skin, $SkinLibDirs, $SkinDir, $SkinDirUrl, $IsTemplateLoaded, $PubDirUrl, $FarmPubDirUrl, $FarmD, $GCount; SDV($SkinLibDirs, array("./pub/skins/\$Skin" => "{$PubDirUrl}/skins/\$Skin", "{$FarmD}/pub/skins/\$Skin" => "{$FarmPubDirUrl}/skins/\$Skin")); foreach ((array) $skin as $sfmt) { $Skin = FmtPageName($sfmt, $pagename); $GCount = 0; foreach ($SkinLibDirs as $dirfmt => $urlfmt) { $SkinDir = FmtPageName($dirfmt, $pagename); if (is_dir($SkinDir)) { $SkinDirUrl = FmtPageName($urlfmt, $pagename); break 2; } } } if (!is_dir($SkinDir)) { unset($Skin); Abort("?unable to find skin from list " . implode(' ', (array) $skin)); } $IsTemplateLoaded = 0; if (file_exists("{$SkinDir}/{$Skin}.php")) { include_once "{$SkinDir}/{$Skin}.php"; } else { if (file_exists("{$SkinDir}/skin.php")) { include_once "{$SkinDir}/skin.php"; } } if ($IsTemplateLoaded) { return; } if (file_exists("{$SkinDir}/{$Skin}.tmpl")) { LoadPageTemplate($pagename, "{$SkinDir}/{$Skin}.tmpl"); } else { if (file_exists("{$SkinDir}/skin.tmpl")) { LoadPageTemplate($pagename, "{$SkinDir}/skin.tmpl"); } else { if ($dh = opendir($SkinDir)) { while (($fname = readdir($dh)) !== false) { if (substr($fname, -5) != '.tmpl') { continue; } if ($IsTemplateLoaded) { Abort("?unable to find unique template in {$SkinDir}"); } LoadPageTemplate($pagename, "{$SkinDir}/{$fname}"); } closedir($dh); } } } if (!$IsTemplateLoaded) { Abort("Unable to load {$Skin} template", 'skin'); } }
function loadTemplate($page) { global $SkinDir; if (shouldDisplayMain($page)) { // No need to include this stuff for every page load; include it here include_once 'cookbook/mainpage.php'; // Load and generate the HTML code for upcoming UPL events $GLOBALS['QuoteHtml'] = ''; // loadQuote(); // Temporarily disable the quote $GLOBALS['ProjectsHtml'] = generateProjectsHtml(loadProjects()); $GLOBALS['EventsHtml'] = generateEventsHtml(loadEvents()); $GLOBALS['PageContents'] = getIncludeContents("{$SkinDir}/mainpage.tmpl.php"); } else { $GLOBALS['PageContents'] = '</div>'; } LoadPageTemplate($page, "{$SkinDir}/upl.tmpl"); }
* http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ global $FmtPV; $FmtPV['$SkinName'] = '"Skidoo"'; $FmtPV['$SkinVersion'] = '"1.0.6"'; $FmtPV['$SkinDate'] = '"20100612"'; global $action; include_once "{$SkinDir}/cookbook/detect_mobile.php"; if ($action == 'print' || detect_mobile_device()) { # Enabled from config.php with: $ActionSkin['print'] = <skin_name>; global $SkinStyle, $LinkPageExistsFmt, $UrlLinkTextFmt; $SkinStyle = 'pda'; $LinkPageExistsFmt = "<a class='wikilink' href='\$PageUrl?action=print'>\$LinkText</a>"; $UrlLinkTextFmt = "<cite class='urllink'>\$LinkText</cite> [<a class='urllink' href='\$Url'>\$Url</a>]"; LoadPageTemplate($pagename, "{$SkinDir}/print/print.tmpl"); return; } ## Search a Group.Templates page as well as the Site templates global $FPLTemplatePageFmt; SDV($FPLTemplatePageFmt, array('{$FullName}', "Site.Skidoo-LocalTemplates", "Site.LocalTemplates", "Site.PageListTemplates")); ## Use internationalization template for alternative Section Edit text XLPage('en', "Site.Skidoo-XLPageLocal"); # Condition used in Header to determine whether to display "menu" in the header. global $Conditions; $Conditions['skinstyle'] = "\$GLOBALS['SkinStyle']==\$condparm"; ## Move any (:noleft:) or SetTmplDisplay('PageLeftFmt', 0); directives to variables for access in jScript. global $LeftColumn, $RightColumn; $FmtPV['$LeftColumn'] = "\$GLOBALS['TmplDisplay']['PageLeftFmt']"; $FmtPV['$RightColumn'] = "\$GLOBALS['TmplDisplay']['PageRightFmt']"; # ----------------------------------------
} else { if (file_exists("{$FarmD}/{$k}")) { SDV($PageTemplateFmt, "{$FarmD}/{$k}"); SDV($SkinDirUrl, FmtPageName("\$FarmPubDirUrl/skins/{$PageSkinFmt}", $pagename)); } } SDV($PageLogoUrl, "{$FarmPubDirUrl}/skins/pmwiki/pmwiki-32.gif"); SDV($PageLogoFmt, "<div id='wikilogo'><a href='{$ScriptUrl}'><img \n src='{$PageLogoUrl}' alt='{$WikiTitle}' border='0' /></a></div>"); SDV($PageCSSListFmt, array('pub/css/local.css' => '$PubDirUrl/css/local.css', 'pub/css/$Group.css' => '$PubDirUrl/css/$Group.css', 'pub/css/$FullName.css' => '$PubDirUrl/css/$FullName.css')); foreach ((array) $PageCSSListFmt as $k => $v) { if (file_exists(FmtPageName($k, $pagename))) { $HTMLHeaderFmt[] = "<link rel='stylesheet' type='text/css' href='{$v}' />\n"; } } if ($PageTemplateFmt) { LoadPageTemplate($pagename, $PageTemplateFmt); } function LoadPageTemplate($pagename, $tfilefmt) { global $PageStartFmt, $PageEndFmt, $BasicLayoutVars, $HTMLHeaderFmt; SDV($BasicLayoutVars, array('HeaderText', 'PageHeaderFmt', 'PageLeftFmt', 'PageTitleFmt', 'PageText', 'PageRightFmt', 'PageFooterFmt')); $k = implode('', file(FmtPageName($tfilefmt, $pagename))); $sect = preg_split('#[[<]!--(/?Page[A-Za-z]+Fmt|PageText|HeaderText)--[]>]#', $k, 0, PREG_SPLIT_DELIM_CAPTURE); $PageStartFmt = array_merge(array('headers:'), preg_split('/[[<]!--((?:wiki|file|function|markup):.*?)--[]>]/s', array_shift($sect), 0, PREG_SPLIT_DELIM_CAPTURE)); $PageEndFmt = array(); $ps = 'PageStartFmt'; while (count($sect) > 0) { $k = array_shift($sect); $v = preg_split('/[[<]!--((?:wiki|file|function|markup):.*?)--[]>]/', array_shift($sect), 0, PREG_SPLIT_DELIM_CAPTURE); if (substr($k, 0, 1) == '/') { $GLOBALS[$ps][] = "<!--{$k}-->";
*/ SDV($FarmPubDirUrl, $PubDirUrl); # $PageTemplateFmt is deprecated. Use $PageSkinFmt instead. SDV($PageSkinFmt, @$PageTemplateFmt ? $PageTemplateFmt : 'pmwiki'); SDV($PageLogoUrl, "{$FarmPubDirUrl}/skins/pmwiki/pmwiki-32.gif"); SDV($PageLogoFmt, "<div id='wikilogo'><a href='{$ScriptUrl}'><img \n src='{$PageLogoUrl}' alt='{$WikiTitle}' border='0' /></a></div>"); SDV($SkinTmplFmt, 'screen.tmpl'); # $SkinPathFmt determines where to look for skin files, and the # corresponding value to use for $SkinDirUrl if the template file is found. $SkinPathFmt = array($PageSkinFmt => '', "pub/skins/{$PageSkinFmt}/{$SkinTmplFmt}" => "{$PubDirUrl}/skins/{$PageSkinFmt}/{$SkinTmplFmt}", "pub/skins/{$PageSkinFmt}" => "{$PubDirUrl}/skins/{$PageSkinFmt}", "{$FarmD}/pub/skins/{$PageSkinFmt}/{$SkinTmplFmt}" => "{$FarmPubDirUrl}/skins/{$PageSkinFmt}/{$SkinTmplFmt}", "{$FarmD}/pub/skins/{$PageSkinFmt}" => "{$FarmPubDirUrl}/skins/{$PageSkinFmt}"); $f = 0; foreach ($SkinPathFmt as $k => $v) { $t = FmtPageName($k, $pagename); if (file_exists($t) && !is_dir($t)) { $SkinDirUrl = dirname(FmtPageName($v, $pagename)); LoadPageTemplate($pagename, $t); $f = 1; break; } } if ($PageSkinFmt && !@$f) { Abort("?unable to find skin: {$PageSkinFmt}"); } SDV($PageCSSListFmt, array('pub/css/local.css' => '$PubDirUrl/css/local.css', 'pub/css/$Group.css' => '$PubDirUrl/css/$Group.css', 'pub/css/$FullName.css' => '$PubDirUrl/css/$FullName.css')); foreach ((array) $PageCSSListFmt as $k => $v) { if (file_exists(FmtPageName($k, $pagename))) { $HTMLHeaderFmt[] = "<link rel='stylesheet' type='text/css' href='{$v}' />\n"; } } function LoadPageTemplate($pagename, $tfilefmt) {