-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_skin.class.php
executable file
·309 lines (277 loc) · 9.3 KB
/
_skin.class.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?php
/**
* This file implements a class derived of the generic Skin class in order to provide custom code for
* the skin in this folder.
*
* This file is part of the b2evolution project - {@link http://b2evolution.net/}
*
* @package skins
* @subpackage bootstrap_blog
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
/**
* Specific code for this skin.
*
* ATTENTION: if you make a new skin you have to change the class name below accordingly
*/
class flat_Skin extends Skin
{
/**
* Skin version
* @var string
*/
var $version = '1.0.5';
/**
* Do we want to use style.min.css instead of style.css ?
*/
var $use_min_css = 'check'; // true|false|'check' Set this to true for better optimization
// Note: we leave this on "check" in the bootstrap_blog_skin so it's easier for beginners to just delete the .min.css file
// But for best performance, you should set it to true.
/**
* Get default name for the skin.
* Note: the admin can customize it.
*/
function get_default_name()
{
return 'Flat Blog';
}
/**
* Get default type for the skin.
*/
function get_default_type()
{
return 'normal';
}
/**
* What evoSkins API does has this skin been designed with?
*
* This determines where we get the fallback templates from (skins_fallback_v*)
* (allows to use new markup in new b2evolution versions)
*/
function get_api_version()
{
return 6;
}
/**
* What CSS framework does has this skin been designed with?
*
* This may impact default markup returned by Skin::get_template() for example
*/
function get_css_framework()
{
return 'bootstrap';
}
/**
* Get supported collection kinds.
*
* This should be overloaded in skins.
*
* For each kind the answer could be:
* - 'yes' : this skin does support that collection kind (the result will be was is expected)
* - 'partial' : this skin is not a primary choice for this collection kind (but still produces an output that makes sense)
* - 'maybe' : this skin has not been tested with this collection kind
* - 'no' : this skin does not support that collection kind (the result would not be what is expected)
* There may be more possible answers in the future...
*/
public function get_supported_coll_kinds()
{
$supported_kinds = array(
'main' => 'no',
'std' => 'yes', // Blog
'photo' => 'maybe',
'forum' => 'no',
'manual' => 'maybe',
'group' => 'no', // Tracker
// Any kind that is not listed should be considered as "maybe" supported
);
return $supported_kinds;
}
/**
* Get definitions for editable params
*
* @see Plugin::GetDefaultSettings()
* @param local params like 'for_editing' => true
* @return array
*/
function get_param_definitions( $params )
{
$r = array_merge( array(
'section_layout_start' => array(
'layout' => 'begin_fieldset',
'label' => T_('Layout Settings')
),
'layout' => array(
'label' => T_('Layout'),
'note' => '',
'defaultvalue' => 'right_sidebar',
'options' => array(
'single_column' => T_('Single Column'),
'left_sidebar' => T_('Left Sidebar'),
'right_sidebar' => T_('Right Sidebar'),
),
'type' => 'select',
),
'max_image_height' => array(
'label' => T_('Max image height'),
'note' => 'px',
'defaultvalue' => '',
'type' => 'integer',
'allow_empty' => true,
),
'section_layout_end' => array(
'layout' => 'end_fieldset',
),
'section_colorbox_start' => array(
'layout' => 'begin_fieldset',
'label' => T_('Colorbox Image Zoom')
),
'colorbox' => array(
'label' => T_('Colorbox Image Zoom'),
'note' => T_('Check to enable javascript zooming on images (using the colorbox script)'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_post' => array(
'label' => T_('Voting on Post Images'),
'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_post_numbers' => array(
'label' => T_('Display Votes'),
'note' => T_('Check to display number of likes and dislikes'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_comment' => array(
'label' => T_('Voting on Comment Images'),
'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_comment_numbers' => array(
'label' => T_('Display Votes'),
'note' => T_('Check to display number of likes and dislikes'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_user' => array(
'label' => T_('Voting on User Images'),
'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_user_numbers' => array(
'label' => T_('Display Votes'),
'note' => T_('Check to display number of likes and dislikes'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'section_colorbox_end' => array(
'layout' => 'end_fieldset',
),
'section_username_start' => array(
'layout' => 'begin_fieldset',
'label' => T_('Username options')
),
'gender_colored' => array(
'label' => T_('Display gender'),
'note' => T_('Use colored usernames to differentiate men & women.'),
'defaultvalue' => 0,
'type' => 'checkbox',
),
'bubbletip' => array(
'label' => T_('Username bubble tips'),
'note' => T_('Check to enable bubble tips on usernames'),
'defaultvalue' => 0,
'type' => 'checkbox',
),
'autocomplete_usernames' => array(
'label' => T_('Autocomplete usernames'),
'note' => T_('Check to enable auto-completion of usernames entered after a "@" sign in the comment forms'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'section_username_end' => array(
'layout' => 'end_fieldset',
),
'section_access_start' => array(
'layout' => 'begin_fieldset',
'label' => T_('When access is denied or requires login...')
),
'access_login_containers' => array(
'label' => T_('Display on login screen'),
'note' => '',
'type' => 'checklist',
'options' => array(
array( 'header', sprintf( T_('"%s" container'), NT_('Header') ), 1 ),
array( 'page_top', sprintf( T_('"%s" container'), NT_('Page Top') ), 1 ),
array( 'menu', sprintf( T_('"%s" container'), NT_('Menu') ), 0 ),
array( 'sidebar', sprintf( T_('"%s" container'), NT_('Sidebar') ), 0 ),
array( 'sidebar2', sprintf( T_('"%s" container'), NT_('Sidebar 2') ), 0 ),
array( 'footer', sprintf( T_('"%s" container'), NT_('Footer') ), 1 ) ),
),
'section_access_end' => array(
'layout' => 'end_fieldset',
),
), parent::get_param_definitions( $params ) );
return $r;
}
/**
* Get ready for displaying the skin.
*
* This may register some CSS or JS...
*/
function display_init()
{
global $Messages, $debug;
// Request some common features that the parent function (Skin::display_init()) knows how to provide:
parent::display_init( array(
'jquery', // Load jQuery
'font_awesome', // Load Font Awesome (and use its icons as a priority over the Bootstrap glyphicons)
'bootstrap', // Load Bootstrap (without 'bootstrap_theme_css')
'bootstrap_evo_css', // Load the b2evo_base styles for Bootstrap (instead of the old b2evo_base styles)
'bootstrap_messages', // Initialize $Messages Class to use Bootstrap styles
'style_css', // Load the style.css file of the current skin
'colorbox', // Load Colorbox (a lightweight Lightbox alternative + customizations for b2evo)
'bootstrap_init_tooltips', // Inline JS to init Bootstrap tooltips (E.g. on comment form for allowed file extensions)
'disp_auto', // Automatically include additional CSS and/or JS required by certain disps (replace with 'disp_off' to disable this)
) );
// Skin specific initializations:
// Limit images by max height:
$max_image_height = intval( $this->get_setting( 'max_image_height' ) );
if( $max_image_height > 0 )
{
add_css_headline( '.evo_image_block img { max-height: '.$max_image_height.'px; width: auto; }' );
}
// Add custom CSS:
$custom_css = '';
if( ! empty( $custom_css ) )
{ // Function for custom_css:
$custom_css = '<style type="text/css">
<!--
'.$custom_css.'
-->
</style>';
add_headline( $custom_css );
}
}
/**
* Check if we can display a widget container
*
* @param string Widget container key: 'header', 'page_top', 'menu', 'sidebar', 'sidebar2', 'footer'
* @return boolean TRUE to display
*/
function is_visible_container( $container_key )
{
global $Blog;
if( $Blog->has_access() )
{ // If current user has an access to this collection then don't restrict containers:
return true;
}
// Get what containers are available for this skin when access is denied or requires login:
$access = $this->get_setting( 'access_login_containers' );
return ( ! empty( $access ) && ! empty( $access[ $container_key ] ) );
}
}
?>