-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_public.php
More file actions
131 lines (117 loc) · 4.44 KB
/
_public.php
File metadata and controls
131 lines (117 loc) · 4.44 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
# This file is part of Freshy2, a theme for Dotclear.
# Original WP Theme from Julien de Luca
# (http://www.jide.fr/francais/)
#
# Copyright (c) 2008-2018
# Bruno Hondelatte [email protected]
# Pierre Van Glabeke [email protected]
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return;
}
dcCore::app()->tpl->addValue('Freshy2StyleSheet', ['tplFreshy2Theme','FreshyStyleSheet']);
dcCore::app()->tpl->addValue('Freshy2LayoutClass', ['tplFreshy2Theme','FreshyLayoutClass']);
dcCore::app()->tpl->addBlock('Freshy2IfHasSidebar', ['tplFreshy2Theme','FreshyIfHasSidebar']);
dcCore::app()->tpl->addBlock('Freshy2IfHasSidebarContent', ['tplFreshy2Theme','FreshyIfHasSidebarContent']);
dcCore::app()->tpl->addBlock('Freshy2MenuIf', ['tplFreshy2Theme','FreshyMenuIf']);
dcCore::app()->addBehavior('publicHeadContent', ['tplFreshy2Theme','publicHeadContent']);
l10n::set(__DIR__ . '/locales/' . dcCore::app()->lang . '/public');
require __DIR__ . '/lib/class.freshy2.config.php';
class tplFreshy2Theme
{
public static $config;
public static $syssettings;
public static function initSettings()
{
self::$config = new freshy2Config();
self::$syssettings = dcCore::app()->blog->settings->system;
}
public static function FreshyStyleSheet($attr)
{
return 'style.css';
}
public static function FreshyMenuIf($attr, $content)
{
if (isset($attr['name']) && $attr['name'] == 'freshymenu') {
$menu = 'freshymenu';
} else {
$menu = 'simplemenu';
}
return '<?php if (tplFreshy2Theme::$config->menu == "' . $menu . '"): ?>' . "\n" .
$content . "\n" .
'<?php endif; ?>' . "\n";
}
public static function FreshyLayoutClass($attr)
{
$p = '<?php ' . "\n";
$p .= 'if (tplFreshy2Theme::$config->right_sidebar != "none")' . "\n";
$p .= ' echo "sidebar_right ";' . "\n";
$p .= 'if (tplFreshy2Theme::$config->left_sidebar != "none")' . "\n";
$p .= ' echo "sidebar_left";' . "\n";
$p .= '?>' . "\n";
return $p;
}
public static function FreshyIfHasSidebar($attr, $content)
{
if (isset($attr['pos'])) {
$pos = trim(strtolower($attr['pos']));
} else {
$pos = 'right';
}
if ($pos == 'both') {
return '<?php if ((tplFreshy2Theme::$config->left_sidebar != "none") ' .
'&& (tplFreshy2Theme::$config->right_sidebar != "none")): ?>' . "\n" .
$content . "\n" .
'<?php endif; ?>' . "\n";
}
$setting = $pos . '_sidebar';
return '<?php if (tplFreshy2Theme::$config->' . $setting . ' != "none"): ?>' . "\n" .
$content . "\n" .
'<?php endif; ?>' . "\n";
}
public static function FreshyIfHasSidebarContent($attr, $content)
{
if (isset($attr['pos'])) {
$pos = trim(strtolower($attr['pos']));
} else {
$pos = 'right';
}
$setting = $pos . '_sidebar';
if (isset($attr['value'])) {
$value = trim(strtolower($attr['value']));
} else {
$value = 'nav';
}
return '<?php if (tplFreshy2Theme::$config->' . $setting . ' == "' . $value . '"): ?>' . "\n" .
$content . "\n" .
'<?php endif; ?>' . "\n";
}
public static function publicHeadContent()
{
$cust = self::$config->custom_theme;
$topimg = self::$config->top_image;
$theme_url = self::$syssettings->themes_url . '/' . self::$syssettings->theme;
$css_content = '';
if (empty($cust) === false && $cust !== 'default') {
$css_content .= '@import url(' .
$theme_url . '/' . $cust . ");\n";
}
if ($topimg !== null && $topimg !== 'default') {
$css_content .= "#header_image {\n" .
'background-image:url(' . $theme_url . '/images/headers/' . $topimg . ");\n" .
"}\n";
}
if ($css_content != '') {
echo '<style type="text/css" media="screen">' . "\n" .
$css_content .
"</style>\n";
}
}
}
tplFreshy2Theme::initSettings();